Skip to content

Commit d294fb6

Browse files
Added tests based on example found by @npolina4
1 parent 2a90321 commit d294fb6

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

dpctl/tests/test_tensor_asarray.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,31 @@ def __init__(self, obj, iface):
293293
assert x.shape == (2, 0)
294294
assert x.usm_type == o.usm_type
295295
assert x.sycl_queue == o.sycl_queue
296+
297+
298+
def test_asarray_seq_of_suai_different_queue():
299+
q = get_queue_or_skip()
300+
301+
class Dummy:
302+
def __init__(self, obj, iface):
303+
self.obj = obj
304+
self.__sycl_usm_array_interface__ = iface
305+
306+
@property
307+
def shape(self):
308+
return self.__sycl_usm_array_interface__["shape"]
309+
310+
q2 = dpctl.SyclQueue()
311+
assert q != q2
312+
o = dpt.empty((2, 2), usm_type="shared", sycl_queue=q2)
313+
d = Dummy(o, o.__sycl_usm_array_interface__)
314+
315+
x = dpt.asarray(d, sycl_queue=q)
316+
assert x.sycl_queue == q
317+
assert x.shape == d.shape
318+
x = dpt.asarray([d], sycl_queue=q)
319+
assert x.sycl_queue == q
320+
assert x.shape == (1,) + d.shape
321+
x = dpt.asarray([d, d], sycl_queue=q)
322+
assert x.sycl_queue == q
323+
assert x.shape == (2,) + d.shape

0 commit comments

Comments
 (0)