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

Method classify_array_kwarg

dali/python/nvidia/dali/_debug_utils.py:80–94  ·  view source on GitHub ↗
(arr)

Source from the content-addressed store, hash-verified

78 return False, device, arr
79
80 def classify_array_kwarg(arr):
81 if _types._is_torch_tensor(arr):
82 if arr.is_cuda:
83 arr = arr.cpu().numpy()
84 elif _types._is_mxnet_array(arr):
85 import mxnet as mx
86
87 if "gpu" in str(arr.context):
88 arr = arr.copyto(mx.cpu())
89 elif not _types._is_numpy_array(arr):
90 raise RuntimeError(f"Unsupported array type '{type(arr)}'.")
91
92 arr = _types._preprocess_constant_array_type(arr)
93 arr = _tensors.TensorListCPU([_tensors.TensorCPU(arr)] * arg_constant_len)
94 return True, "cpu", arr
95
96 if isinstance(data, list):
97 if len(data) == 0 or any([is_primitive_type(d) for d in data]):

Callers

nothing calls this directly

Calls 2

typeFunction · 0.50
cpuMethod · 0.45

Tested by

no test coverage detected