Selects a range of samples. The result of this function is either a :class:`_TensorList` (if `selection` is a `slice` or a `list`) or a :class:`Tensor` if `selection` is a number.
(self, selection)
| 128 | return len(self._indices) |
| 129 | |
| 130 | def select(self, selection): |
| 131 | """ |
| 132 | Selects a range of samples. |
| 133 | |
| 134 | The result of this function is either a :class:`_TensorList` (if `selection` is a `slice` or |
| 135 | a `list`) or a :class:`Tensor` if `selection` is a number. |
| 136 | """ |
| 137 | if selection == slice(None, None, None): |
| 138 | return self |
| 139 | if isinstance(selection, slice): |
| 140 | return _TensorList(self._batch, self._indices[selection]) |
| 141 | elif isinstance(selection, list): |
| 142 | return _TensorList(self._batch, [self._indices[i] for i in selection]) |
| 143 | else: |
| 144 | return self._batch.select(selection) |
| 145 | |
| 146 | def tolist(self): |
| 147 | return [self._batch._get_tensor(i) for i in self._indices] |
no test coverage detected