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

Function to_numpy

dali/python/nvidia/dali/external_source.py:73–81  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

71
72def _prep_data_for_feed_input(data, batch_size, layout, device_id=None):
73 def to_numpy(x):
74 import numpy as np
75
76 if _types._is_mxnet_array(x):
77 return x.asnumpy()
78 elif _types._is_torch_tensor(x):
79 return x.numpy()
80 else:
81 return np.asarray(x)
82
83 # __cuda_array_interface__ doesn't provide any way to pass the information about the device
84 # where the memory is located. It is assumed that the current device is the one that

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected