Create a new _LazyIndex object sliced by the given index tensor.
(self, index)
| 22 | return len(self._indices[-1]) |
| 23 | |
| 24 | def slice(self, index): |
| 25 | """Create a new _LazyIndex object sliced by the given index tensor.""" |
| 26 | # if our indices are in the same context, lets just slice now and free |
| 27 | # memory, otherwise do nothing until we have to |
| 28 | if F.context(self._indices[-1]) == F.context(index): |
| 29 | return _LazyIndex( |
| 30 | self._indices[:-1] + [F.gather_row(self._indices[-1], index)] |
| 31 | ) |
| 32 | return _LazyIndex(self._indices + [index]) |
| 33 | |
| 34 | def flatten(self): |
| 35 | """Evaluate the chain of indices, and return a single index tensor.""" |
no test coverage detected