(np_type)
| 111 | np.int8, np.int16, np.int32, np.int64, |
| 112 | np.float16, np.float32, np.float64,]) |
| 113 | def 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 | |
| 129 | def test_dlpack_not_supported(): |
nothing calls this directly
no test coverage detected