From 59ba0423ed68ae51a942b7a363e74339fbfe42e8 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 18 Jun 2026 15:26:26 +0200 Subject: [PATCH 1/2] Use reshape method when working with 0D numpy.ndarray --- dpnp/tensor/_usmarray.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpnp/tensor/_usmarray.pyx b/dpnp/tensor/_usmarray.pyx index 3344f757cf1..c050703eb77 100644 --- a/dpnp/tensor/_usmarray.pyx +++ b/dpnp/tensor/_usmarray.pyx @@ -171,7 +171,7 @@ cdef object _as_zero_dim_ndarray(object usm_ary): usm_ary.sycl_queue.wait() host_buf = mem_view.copy_to_host() view = host_buf.view(usm_ary.dtype) - view.shape = tuple() + view = view.reshape(()) return view From 411bee77c8f31116710aeec229c3e0b40e1b33d4 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 18 Jun 2026 19:07:23 +0200 Subject: [PATCH 2/2] Update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5162e4fcdfb..8009ce5849c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ This release is compatible with NumPy 2.5. * Fixed tests which expected lists from `dpctl` functions which now return tuples (i.e., `dpctl.SyclDevice.create_sub_devices`) [#2945](https://github.com/IntelPython/dpnp/pull/2945) * Fixed `PytestRemovedIn10Warning` raised by `pytest` 9.1.0 by converting class-scoped fixtures to class methods [#2952](https://github.com/IntelPython/dpnp/pull/2952) * 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) ### Security