Skip to content

Commit a653eb3

Browse files
Avoid calling int/float/complex/operator.index on 1d ndarray
This is to address NumPy 1.25 deprecation warnings.
1 parent 29fd9e5 commit a653eb3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ def test_copy_scalar_with_func(func, shape, dtype):
239239
X = dpt.usm_ndarray(shape, dtype=dtype)
240240
except dpctl.SyclDeviceCreationError:
241241
pytest.skip("No SYCL devices available")
242-
Y = np.arange(1, X.size + 1, dtype=dtype).reshape(shape)
243-
X.usm_data.copy_from_host(Y.reshape(-1).view("|u1"))
242+
Y = np.arange(1, X.size + 1, dtype=dtype)
243+
X.usm_data.copy_from_host(Y.view("|u1"))
244+
Y.shape = tuple()
244245
assert func(X) == func(Y)
245246

246247

@@ -254,8 +255,9 @@ def test_copy_scalar_with_method(method, shape, dtype):
254255
X = dpt.usm_ndarray(shape, dtype=dtype)
255256
except dpctl.SyclDeviceCreationError:
256257
pytest.skip("No SYCL devices available")
257-
Y = np.arange(1, X.size + 1, dtype=dtype).reshape(shape)
258-
X.usm_data.copy_from_host(Y.reshape(-1).view("|u1"))
258+
Y = np.arange(1, X.size + 1, dtype=dtype)
259+
X.usm_data.copy_from_host(Y.view("|u1"))
260+
Y.shape = tuple()
259261
assert getattr(X, method)() == getattr(Y, method)()
260262

261263

0 commit comments

Comments
 (0)