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

Method __call__

dali/python/nvidia/dali/external_source.py:700–971  ·  view source on GitHub ↗
(
        self,
        *,
        source=None,
        cycle=None,
        name=None,
        layout=None,
        dtype=None,
        ndim=None,
        cuda_stream=None,
        use_copy_kernel=None,
        batch=None,
        parallel=None,
        no_copy=None,
        prefetch_queue_depth=None,
        bytes_per_sample_hint=None,
        batch_info=None,
        repeat_last=False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

698 return False
699
700 def __call__(
701 self,
702 *,
703 source=None,
704 cycle=None,
705 name=None,
706 layout=None,
707 dtype=None,
708 ndim=None,
709 cuda_stream=None,
710 use_copy_kernel=None,
711 batch=None,
712 parallel=None,
713 no_copy=None,
714 prefetch_queue_depth=None,
715 bytes_per_sample_hint=None,
716 batch_info=None,
717 repeat_last=False,
718 **kwargs,
719 ):
720 """"""
721 from nvidia.dali.ops import _OperatorInstance, _separate_kwargs
722
723 if batch_info is None:
724 batch_info = self._batch_info or False
725 elif self._batch_info is not None:
726 raise ValueError("The argument ``batch_info`` already specified in constructor.")
727
728 if source is None:
729 if cycle is not None:
730 if self._callback:
731 raise ValueError(
732 "The argument ``cycle`` can only be specified if ``source`` is an"
733 "iterable object or a generator function specified in this call. "
734 "To cycle through an iterable specified in "
735 "``__init__``, set ``cycle`` there."
736 )
737 else:
738 raise ValueError(
739 "The argument ``cycle`` can only be specified if ``source`` is a "
740 "reusable iterable or a generator function."
741 )
742 callback = self._callback
743 source_desc = self._source_desc
744 else:
745 if self._callback is not None:
746 raise RuntimeError("``source`` already specified in constructor.")
747 callback, source_desc = _get_callback_from_source(source, cycle, self._batch_info)
748
749 # Keep the metadata for Pipeline inspection
750 self._source_desc = source_desc
751
752 if callback is not None and repeat_last:
753 raise ValueError(
754 f"``repeat_last`` must not be set when using the ``source`` argument "
755 f"It's usable only with manually fed `{self._operator_name()}`."
756 )
757

Callers

nothing calls this directly

Calls 5

_operator_nameMethod · 0.95
_separate_kwargsFunction · 0.90
_OperatorInstanceClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected