MCPcopy Create free account
hub / github.com/apache/arrow / check_dlpack_export

Function check_dlpack_export

python/pyarrow/tests/test_dlpack.py:36–43  ·  view source on GitHub ↗
(arr, expected_arr)

Source from the content-addressed store, hash-verified

34
35
36def check_dlpack_export(arr, expected_arr):
37 DLTensor = arr.__dlpack__()
38 assert PyCapsule_IsValid(DLTensor, b"dltensor") is True
39
40 result = np.from_dlpack(arr)
41 np.testing.assert_array_equal(result, expected_arr, strict=True)
42
43 assert arr.__dlpack_device__() == (1, 0)
44
45
46def check_bytes_allocated(f):

Callers 2

test_dlpackFunction · 0.85
test_tensor_dlpackFunction · 0.85

Calls 3

__dlpack__Method · 0.80
__dlpack_device__Method · 0.80
PyCapsule_IsValidFunction · 0.70

Tested by

no test coverage detected