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

Function test_tensor_dlpack

python/pyarrow/tests/test_dlpack.py:113–126  ·  view source on GitHub ↗
(np_type)

Source from the content-addressed store, hash-verified

111 np.int8, np.int16, np.int32, np.int64,
112 np.float16, np.float32, np.float64,])
113def test_tensor_dlpack(np_type):
114 if Version(np.__version__) < Version("1.24.0"):
115 pytest.skip("No dlpack support in numpy versions older than 1.22.0, "
116 "strict keyword in assert_array_equal added in numpy version "
117 "1.24.0")
118
119 arr = np.array([1, 2, 3, 4, 5, 6, 1, 1])
120 expected = np.array(arr, dtype=np_type).reshape((2, 2, 2), order='C')
121 t = pa.Tensor.from_numpy(expected)
122 check_dlpack_export(t, expected)
123
124 expected = np.array(arr, dtype=np_type).reshape((2, 2, 2), order='F')
125 t = pa.Tensor.from_numpy(expected)
126 check_dlpack_export(t, expected)
127
128
129def test_dlpack_not_supported():

Callers

nothing calls this directly

Calls 3

VersionClass · 0.90
check_dlpack_exportFunction · 0.85
arrayMethod · 0.45

Tested by

no test coverage detected