Skip to content

Commit 80a1652

Browse files
added a test for dpctl.tensor.arange
1 parent 2445d7e commit 80a1652

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

dpctl/tests/test_usm_ndarray_manipulation.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,37 @@ def test_roll_2d(data):
725725
Y = dpt.roll(X, sh, ax)
726726
Ynp = np.roll(Xnp, sh, ax)
727727
assert_array_equal(Ynp, dpt.asnumpy(Y))
728+
729+
730+
@pytest.mark.parametrize(
731+
"dt",
732+
[
733+
"u1",
734+
"i1",
735+
"u2",
736+
"i2",
737+
"u4",
738+
"i4",
739+
"u8",
740+
"i8",
741+
"f2",
742+
"f4",
743+
"f8",
744+
"c8",
745+
"c16",
746+
],
747+
)
748+
def test_arange(dt):
749+
try:
750+
q = dpctl.SyclQueue()
751+
except dpctl.SyclQueueCreationError:
752+
pytest.skip("Queue could not be created")
753+
754+
X = dpt.arange(0, 123, dtype=dt, sycl_queue=q)
755+
dt = np.dtype(dt)
756+
if np.issubdtype(dt, np.integer):
757+
assert int(X[47]) == 47
758+
elif np.issubdtype(dt, np.floating):
759+
assert float(X[47]) == 47.0
760+
elif np.issubdtype(dt, np.complexfloating):
761+
assert complex(X[47]) == 47.0 + 0.0j

0 commit comments

Comments
 (0)