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

Function test_data_ptr_tensor_gpu

dali/test/python/test_backend_impl_gpu.py:57–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55
56
57def test_data_ptr_tensor_gpu():
58 arr = np.random.rand(3, 5, 6)
59 pipe = ExternalSourcePipe(arr.shape[0], arr)
60 tensor = pipe.run()[0][0]
61 from_tensor = py_buffer_from_address(
62 tensor.data_ptr(), tensor.shape(), types.to_numpy_type(tensor.dtype), gpu=True
63 )
64 # from_tensor is cupy array, convert arr to cupy as well
65 assert cp.allclose(arr[0], from_tensor)
66
67
68def test_data_ptr_tensor_list_gpu():

Callers

nothing calls this directly

Calls 4

py_buffer_from_addressFunction · 0.90
ExternalSourcePipeClass · 0.85
runMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected