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

Method preprocess_input

dali/python/nvidia/dali/_conditionals.py:293–310  ·  view source on GitHub ↗

Process the DataNode that is an input to an operator call. Detect if the DataNode was produced on the same nesting level. If not, split accordingly to the stack of the previous conditions. Caches the previously processed DataNodes to not do repeated splitting.

(self, data_node)

Source from the content-addressed store, hash-verified

291 return produced_data_node
292
293 def preprocess_input(self, data_node):
294 """Process the DataNode that is an input to an operator call. Detect if the DataNode was
295 produced on the same nesting level. If not, split accordingly to the stack of the previous
296 conditions. Caches the previously processed DataNodes to not do repeated splitting.
297 """
298 stack_level = self._find_closest(data_node)
299 logging.log(
300 8,
301 (
302 f"{self._indent()}[IF/Input] {data_node} accessed at level"
303 f" {self.stack_depth() - 1} found at {stack_level}."
304 ),
305 )
306 # We already have it cached or produced in this scope.
307 if stack_level == self.stack_depth() - 1:
308 return self.top().get(data_node)
309 # otherwise, we need to fill in the splits.
310 return self._realize_split(data_node, stack_level)
311
312 def register_data_nodes(self, data_nodes, global_scope=False):
313 """Register the data nodes as produced in current scope, otherwise if `global_scope` is True

Callers 4

push_predicateMethod · 0.95
apply_conditional_splitFunction · 0.80
test_condition_stackFunction · 0.80

Calls 7

_find_closestMethod · 0.95
_indentMethod · 0.95
stack_depthMethod · 0.95
topMethod · 0.95
_realize_splitMethod · 0.95
logMethod · 0.45
getMethod · 0.45

Tested by 1

test_condition_stackFunction · 0.64