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

Method _to_backend

dali/python/nvidia/dali/data_node.py:116–130  ·  view source on GitHub ↗
(self, backend)

Source from the content-addressed store, hash-verified

114 # of a tensor, we keep the source argument the same so that
115 # the pipeline can backtrack through the user-defined graph
116 def _to_backend(self, backend) -> DataNode:
117 if self.device == backend:
118 return self
119
120 from nvidia.dali import _conditionals
121
122 if _conditionals.conditionals_enabled():
123 # Treat it the same way as regular operator would behave
124 [self_split], _ = _conditionals.apply_conditional_split_to_args([self], {})
125 transferred_node = DataNode(
126 self_split.name, backend, self_split.source, self_split.index
127 )
128 _conditionals.register_data_nodes(transferred_node, [self])
129 return transferred_node
130 return DataNode(self.name, backend, self.source, self.index)
131
132 def __add__(self, other) -> DataNode:
133 return _arithm_op("add", self, other)

Callers 3

gpuMethod · 0.95
cpuMethod · 0.95

Calls 2

register_data_nodesMethod · 0.80
DataNodeClass · 0.70

Tested by 1