|
10 | 10 |
|
11 | 11 | from .. import ones, arange, reshape, asarray, result_type, all, equal, stack |
12 | 12 | from .._array_object import Array |
13 | | -from .._devices import CPU_DEVICE, Device, DLDeviceType |
| 13 | +from .._devices import CPU_DEVICE, Device |
14 | 14 | from .._dtypes import ( |
15 | 15 | _all_dtypes, |
16 | 16 | _boolean_dtypes, |
@@ -758,39 +758,6 @@ def test_dlpack_2023_12(api_version): |
758 | 758 | a.__dlpack__(copy=True) |
759 | 759 | a.__dlpack__(copy=None) |
760 | 760 |
|
761 | | -@pytest.mark.parametrize( |
762 | | - ("device", "expected"), |
763 | | - [ |
764 | | - (CPU_DEVICE, (DLDeviceType.kDLCPU, 0)), |
765 | | - (Device("device1"), (DLDeviceType.kDLCUDA, 0)), |
766 | | - (Device("device2"), (DLDeviceType.kDLCUDA, 1)), |
767 | | - ], |
768 | | -) |
769 | | -def test_dlpack_device_numbers(device, expected): |
770 | | - a = asarray([1, 2, 3], device=device) |
771 | | - assert a.__dlpack_device__() == expected |
772 | | - |
773 | | - |
774 | | -@pytest.mark.parametrize("device", [CPU_DEVICE, Device("device1"), Device("device2")]) |
775 | | -def test_dlpack_export_with_matching_dl_device(device): |
776 | | - if np.lib.NumpyVersion(np.__version__) < "2.1.0": |
777 | | - pytest.skip("dl_device argument requires NumPy >= 2.1.0") |
778 | | - set_array_api_strict_flags(api_version="2023.12") |
779 | | - |
780 | | - a = asarray([1, 2, 3], device=device) |
781 | | - a.__dlpack__(dl_device=a.__dlpack_device__()) |
782 | | - |
783 | | - |
784 | | -@pytest.mark.parametrize("device", [Device("device1"), Device("device2")]) |
785 | | -def test_dlpack_cross_device_export_buffer_error(device): |
786 | | - if np.lib.NumpyVersion(np.__version__) < "2.1.0": |
787 | | - pytest.skip("dl_device argument requires NumPy >= 2.1.0") |
788 | | - set_array_api_strict_flags(api_version="2023.12") |
789 | | - |
790 | | - a = asarray([1, 2, 3], device=device) |
791 | | - with pytest.raises(BufferError): |
792 | | - a.__dlpack__(dl_device=(DLDeviceType.kDLCPU, 0), copy=False) |
793 | | - |
794 | 761 |
|
795 | 762 | def test_pickle(): |
796 | 763 | """Check that arrays are pickleable (despite raising on `__new__`)""" |
|
0 commit comments