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

Function _get_shape

dali/python/nvidia/dali/external_source.py:30–38  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

28
29
30def _get_shape(data):
31 if hasattr(data, "shape"):
32 return data.shape() if callable(data.shape) else data.shape
33 elif hasattr(data, "__array_interface__"):
34 return data.__array_interface__["shape"]
35 elif hasattr(data, "__cuda_array_interface__"):
36 return data.__cuda_array_interface__["shape"]
37 else:
38 raise RuntimeError(f"Don't know how to extract the shape out of {type(data)}")
39
40
41def _get_batch_shape(data):

Callers 1

_get_batch_shapeFunction · 0.85

Calls 2

typeFunction · 0.50
shapeMethod · 0.45

Tested by

no test coverage detected