MCPcopy Create free account
hub / github.com/NVIDIA/DALI / select

Method select

dali/python/nvidia/dali/experimental/dynamic/_batch.py:130–144  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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]

Callers 1

__getitem__Method · 0.95

Calls 3

sliceFunction · 0.85
_TensorListClass · 0.85
selectMethod · 0.45

Tested by

no test coverage detected