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

Method __call__

dali/python/nvidia/dali/ops/__init__.py:634–677  ·  view source on GitHub ↗
(self, *inputs, **kwargs)

Source from the content-addressed store, hash-verified

632 return self._preserve
633
634 def __call__(self, *inputs, **kwargs):
635 inputs = _preprocess_inputs(inputs, self._operator_name(), self._device, self._schema)
636 input_sets = _build_input_sets(inputs, self._operator_name())
637
638 args, arg_inputs = _separate_kwargs(kwargs)
639
640 # Due to the fact that we already handled *some* args in init, we need to keep only
641 # the new ones.
642 args = _resolve_double_definitions(args, self._init_args, keep_old=False)
643 if self._name is not None:
644 args = _resolve_double_definitions(args, {"name": self._name}) # restore the name
645
646 if _dali_trace.is_tracing_enabled() and self._definition_frame_end is None:
647 self._definition_frame_end = _dali_trace.get_stack_depth() - 1
648
649 self._preserve = (
650 self._preserve or args.get("preserve", False) or self._schema.IsNoPrune()
651 )
652
653 # Adding argument inputs is fully delayed into call, so we just do the check
654 arg_inputs = _resolve_double_definitions(arg_inputs, self._call_args)
655
656 # Create OperatorInstance for every input set.
657 # OperatorInstance handles the creation of OpSpec and generation of output DataNodes
658 op_instances = []
659 for input_set in input_sets:
660 op_instances.append(
661 _OperatorInstance(input_set, arg_inputs, args, self._init_args, self)
662 )
663
664 # Tie the instances together
665 relation_id = op_instances[0].relation_id
666 for op in op_instances:
667 op.relation_id = relation_id
668
669 # If we don't have multiple input sets, flatten the result
670 if len(op_instances) == 1:
671 result = op_instances[0].unwrapped_outputs
672 else:
673 outputs = []
674 for op in op_instances:
675 outputs.append(op.outputs)
676 result = _repack_output_sets(outputs)
677 return result
678
679 def _operator_name(self):
680 """

Callers

nothing calls this directly

Calls 10

_operator_nameMethod · 0.95
_build_input_setsFunction · 0.90
_repack_output_setsFunction · 0.90
_preprocess_inputsFunction · 0.85
_separate_kwargsFunction · 0.85
_OperatorInstanceClass · 0.85
IsNoPruneMethod · 0.80
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected