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

Method select

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

Selects a range of samples. The result of this function is either a :class:`Batch` (if `sample_range` is a `slice` or a `list`) or a :class:`Tensor` if `sample_range` is a number.

(self, sample_range)

Source from the content-addressed store, hash-verified

647 return iter(self.tensors)
648
649 def select(self, sample_range) -> "Batch | Tensor":
650 """
651 Selects a range of samples.
652
653 The result of this function is either a :class:`Batch` (if `sample_range` is a `slice` or a
654 `list`) or a :class:`Tensor` if `sample_range` is a number.
655 """
656 r = sample_range
657 if r is ...:
658 return self
659 if isinstance(r, slice):
660 return Batch(self.tensors[r])
661 elif isinstance(r, list):
662 return Batch(self.tensors[r])
663 else:
664 return self._get_tensor(r)
665
666 def _get_tensor(self, i) -> Tensor:
667 if self._tensors is None:

Callers 2

selectMethod · 0.45
_define_pipelineMethod · 0.45

Calls 2

_get_tensorMethod · 0.95
BatchClass · 0.70

Tested by

no test coverage detected