def slice(self, index):
        """Create a new _LazyIndex object sliced by the given index tensor."""
        # if our indices are in the same context, lets just slice now and free
        # memory, otherwise do nothing until we have to
        if F.context(self._indices[-1]) == F.context(index):
            return _LazyIndex(
                self._indices[:-1] + [F.gather_row(self._indices[-1], index)]
            )
        return _LazyIndex(self._indices + [index])
Create a new _LazyIndex object sliced by the given index tensor.
python/dgl/frame.py