Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This release is compatible with NumPy 2.5.
* Fixed `dpnp.linalg.svd(..., hermitian=True)` returning a non-unitary `vh` for singular input arrays due to a zero sign appearing [#2954](https://github.com/IntelPython/dpnp/pull/2954)
* Fixed scalar conversion of size-one `dpnp.tensor.usm_ndarray` (e.g. `int()`, `float()`, indexing) which failed with NumPy 2.5 after the in-place `ndarray.shape` assignment was deprecated [#2958](https://github.com/IntelPython/dpnp/pull/2958)
* Fixed `dpnp.mgrid` and `dpnp.ogrid` to return consistent results between single-slice and tuple-of-slices syntax when the step is a complex number with a non-integer magnitude (e.g. `2.5j`) [#2971](https://github.com/IntelPython/dpnp/pull/2971)
* Fixed `__array_namespace_info__().devices()` and `.default_device()` to return Python array API compatible device objects [#2979](https://github.com/IntelPython/dpnp/pull/2979)

### Security

Expand Down
8 changes: 4 additions & 4 deletions dpnp/tensor/_array_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ def default_device(self):
"""
default_device()

Returns the default SYCL device.
Returns the default device.
"""
return dpctl.select_default_device()
return dpt.Device.create_device(dpctl.select_default_device())

def default_dtypes(self, *, device=None):
"""
Expand Down Expand Up @@ -239,9 +239,9 @@ def devices(self):
"""
devices()

Returns a list of supported devices.
Returns a tuple of supported devices.
"""
return dpctl.get_devices()
return tuple(dpt.Device.create_device(d) for d in dpctl.get_devices())


def __array_namespace_info__():
Expand Down
8 changes: 4 additions & 4 deletions dpnp/tests/tensor/test_tensor_array_api_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_array_api_inspection_default_device():
dev = dpctl.select_default_device()
except dpctl.SyclDeviceCreationError:
pytest.skip("No default device available")
assert dpt.__array_namespace_info__().default_device() == dev
assert dpt.__array_namespace_info__().default_device().sycl_device == dev


def test_array_api_inspection_devices():
Expand All @@ -79,7 +79,7 @@ def test_array_api_inspection_devices():
pytest.skip("No default device available")
devices1 = dpt.__array_namespace_info__().devices()
assert len(devices1) == len(devices2)
assert devices1 == devices2
assert tuple(dev.sycl_device for dev in devices1) == devices2


def test_array_api_inspection_capabilities():
Expand Down Expand Up @@ -142,7 +142,7 @@ def test_array_api_inspection_device_dtypes():
except dpctl.SyclDeviceCreationError:
pytest.skip("No default device available")
dtypes = _dtypes_no_fp16_fp64.copy()
if dev.has_aspect_fp64:
if dev.sycl_device.has_aspect_fp64:
dtypes["float64"] = dpt.float64
dtypes["complex128"] = dpt.complex128

Expand Down Expand Up @@ -210,7 +210,7 @@ def test_array_api_inspection_dtype_kind_errors():
def test_array_api_inspection_device_types():
info = dpt.__array_namespace_info__()
try:
dev = info.default_device()
dev = info.default_device().sycl_device
except dpctl.SyclDeviceCreationError:
pytest.skip("No default device available")

Expand Down
6 changes: 4 additions & 2 deletions dpnp/tests/test_array_api_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_capabilities():


def test_default_device():
assert info.default_device() == default_device
assert info.default_device().sycl_device == default_device


def test_default_dtypes():
Expand Down Expand Up @@ -130,4 +130,6 @@ def test_dtypes_invalid_device():


def test_devices():
assert info.devices() == get_devices()
devices = info.devices()
assert isinstance(devices, tuple)
assert tuple(dev.sycl_device for dev in devices) == get_devices()
Loading