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

Function check_dlpack_export

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

Source from the content-addressed store, hash-verified

41
42
43def check_dlpack_export(arr, expected_arr):
44 with pytest.warns(DeprecationWarning, match="unversioned DLPack capsule"):
45 DLTensor = arr.__dlpack__()
46 assert PyCapsule_IsValid(DLTensor, b"dltensor") is True
47
48 result = np.from_dlpack(arr)
49 np.testing.assert_array_equal(result, expected_arr, strict=True)
50
51 assert arr.__dlpack_device__() == (1, 0)
52
53
54class DLPackForwarder:

Callers 2

test_dlpackFunction · 0.85
test_tensor_dlpackFunction · 0.85

Calls 3

PyCapsule_IsValidFunction · 0.70
__dlpack__Method · 0.45
__dlpack_device__Method · 0.45

Tested by

no test coverage detected