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

Function _process_inputs

dali/python/nvidia/dali/ops/__init__.py:307–328  ·  view source on GitHub ↗

Process inputs: validate, add to spec and return the list of DataNodes that need to be kept alive for the graph to exist. Returns ------- List the list of DataNodes representing inputs (there may be conversions)

(schema, spec, inputs, operator_name)

Source from the content-addressed store, hash-verified

305
306
307def _process_inputs(schema, spec, inputs, operator_name):
308 """Process inputs: validate, add to spec and return the list of DataNodes that need to be kept
309 alive for the graph to exist.
310
311 Returns
312 -------
313 List
314 the list of DataNodes representing inputs (there may be conversions)
315 """
316 if len(inputs) < schema.MinNumInput() or len(inputs) > schema.MaxNumInput():
317 raise ValueError(
318 f"Operator {operator_name} expects "
319 f"from {schema.MinNumInput()} to {schema.MaxNumInput()} inputs, "
320 f"but received {len(inputs)}."
321 )
322 if not inputs:
323 return []
324 for inp in inputs:
325 if not isinstance(inp, _DataNode):
326 raise TypeError(f"Expected inputs of type 'DataNode'. Received input of type '{inp}'.")
327 spec.AddInput(inp.name, inp.device, inp.ndim, inp.dtype, inp.layout)
328 return list(inputs)
329
330
331def _add_spec_args(schema, spec, kwargs):

Callers 1

__init__Method · 0.85

Calls 2

MinNumInputMethod · 0.80
MaxNumInputMethod · 0.80

Tested by

no test coverage detected