Skip to content

Commit

Permalink
Replace np.empty_like(usm_ndarray_inst) with np.empty(shape, dtype=dt)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Jan 15, 2025
1 parent 6f02ec3 commit 1feee2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dpctl/tests/elementwise/test_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def test_add_errors():

ar1 = dpt.ones(2, dtype="float32")
ar2 = dpt.ones_like(ar1, dtype="int32")
y = np.empty_like(ar1)
y = np.empty(ar1.shape, dtype=ar1.dtype)
with pytest.raises(TypeError) as excinfo:
dpt.add(ar1, ar2, out=y)
assert "output array must be of usm_ndarray type" in str(excinfo.value)
Expand Down
2 changes: 1 addition & 1 deletion dpctl/tests/test_tensor_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def test_clip_errors():
ar1 = dpt.ones(2, dtype="i4")
ar2 = dpt.ones_like(ar1, dtype="i4")
ar3 = dpt.ones_like(ar1, dtype="i4")
ar4 = np.empty_like(ar1)
ar4 = np.empty(ar1.shape, dtype=ar1.dtype)
assert_raises_regex(
TypeError,
"output array must be of usm_ndarray type",
Expand Down

0 comments on commit 1feee2f

Please sign in to comment.