Skip to content

Commit 0fe8333

Browse files
added test based on example from #583
1 parent 7666803 commit 0fe8333

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
import pytest
2222

2323
import dpctl
24-
25-
# import dpctl.memory as dpmem
24+
import dpctl.memory as dpm
2625
import dpctl.tensor as dpt
2726
from dpctl.tensor._usmarray import Device
2827

@@ -224,3 +223,14 @@ def test_slice_constructor_3d():
224223
assert np.array_equal(
225224
_to_numpy(Xusm[ind]), Xh[ind]
226225
), "Failed for {}".format(ind)
226+
227+
228+
@pytest.mark.parametrize("usm_type", ["device", "shared", "host"])
229+
def test_slice_suai(usm_type):
230+
Xh = np.arange(0, 10, dtype="u1")
231+
default_device = dpctl.select_default_device()
232+
Xusm = _from_numpy(Xh, device=default_device, usm_type=usm_type)
233+
for ind in [slice(2, 3, None), slice(5, 7, None), slice(3, 9, None)]:
234+
assert np.array_equal(
235+
dpm.as_usm_memory(Xusm[ind]).copy_to_host(), Xh[ind]
236+
), "Failed for {}".format(ind)

0 commit comments

Comments
 (0)