Skip to content

Commit 50268dd

Browse files
Condition test exercising fp16 support on availability of HW support
1 parent ea19360 commit 50268dd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,11 @@ def test_astype():
825825
X[:] = np.full((5, 5), 7, dtype="i4")
826826
Y = dpt.astype(X, "c8", order="C")
827827
assert np.allclose(dpt.to_numpy(Y), np.full((5, 5), 7, dtype="c8"))
828-
Y = dpt.astype(X[::2, ::-1], "f2", order="K")
829-
assert np.allclose(dpt.to_numpy(Y), np.full(Y.shape, 7, dtype="f2"))
828+
if Y.sycl_device.has_aspect_fp16:
829+
Y = dpt.astype(X[::2, ::-1], "f2", order="K")
830+
assert np.allclose(dpt.to_numpy(Y), np.full(Y.shape, 7, dtype="f2"))
831+
Y = dpt.astype(X[::2, ::-1], "f4", order="K")
832+
assert np.allclose(dpt.to_numpy(Y), np.full(Y.shape, 7, dtype="f4"))
830833
Y = dpt.astype(X[::2, ::-1], "i4", order="K", copy=False)
831834
assert Y.usm_data is X.usm_data
832835

0 commit comments

Comments
 (0)