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

Method _update_classification

dali/python/nvidia/dali/_debug_mode.py:595–615  ·  view source on GitHub ↗

Keeps the data classification up to date in case of running the conditional mode or split and merge operations producing empty batches. Otherwise it is no-op. Parameters ---------- old_collection : list or dict The old classification - list of inp

(self, old_collection, position, new_classification)

Source from the content-addressed store, hash-verified

593 return _build_input_sets(inputs, self._op_name)
594
595 def _update_classification(self, old_collection, position, new_classification):
596 """Keeps the data classification up to date in case of running the conditional mode or
597 split and merge operations producing empty batches.
598 Otherwise it is no-op.
599
600 Parameters
601 ----------
602 old_collection : list or dict
603 The old classification - list of input classification or dictionary of kwarg
604 classification
605 position : int or str
606 The lookup to the currently examined element in the `old_collection`
607 new_classification : _Classification
608 New classification of the input/kwarg
609 """
610 # If the old classification was empty, it may be invalid due to the pass-through
611 # behavior on empty batches, so we need to update it with the new one
612 if old_collection[position].is_batch and len(old_collection[position].data) == 0:
613 old_collection[position] = new_classification
614 return new_classification
615 return old_collection[position]
616
617 def run(self, inputs, kwargs):
618 """Checks correctness of inputs and kwargs and runs the backend operator."""

Callers 1

runMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected