Evaluate the chain of indices, and return a single index tensor.
(self)
| 32 | return _LazyIndex(self._indices + [index]) |
| 33 | |
| 34 | def flatten(self): |
| 35 | """Evaluate the chain of indices, and return a single index tensor.""" |
| 36 | flat_index = self._indices[0] |
| 37 | # here we actually need to resolve it |
| 38 | for index in self._indices[1:]: |
| 39 | if F.context(index) != F.context(flat_index): |
| 40 | index = F.copy_to(index, F.context(flat_index)) |
| 41 | flat_index = F.gather_row(flat_index, index) |
| 42 | return flat_index |
| 43 | |
| 44 | def record_stream(self, stream): |
| 45 | """Record stream for index. |