Skip to content

Commit 5cd7ba2

Browse files
Added test based on reproducing example from gh-1503
1 parent 5cf7cd8 commit 5cd7ba2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

+11
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ def test_setitem_same_dtype(dtype, src_usm_type, dst_usm_type):
10351035

10361036

10371037
def test_setitem_broadcasting():
1038+
"See gh-1503"
10381039
get_queue_or_skip()
10391040
dst = dpt.ones((2, 3, 4), dtype="u4")
10401041
src = dpt.zeros((3, 1), dtype=dst.dtype)
@@ -1043,6 +1044,16 @@ def test_setitem_broadcasting():
10431044
assert np.array_equal(dpt.asnumpy(dst), expected)
10441045

10451046

1047+
def test_setitem_broadcasting_offset():
1048+
get_queue_or_skip()
1049+
dt = dpt.int32
1050+
x = dpt.asarray([[1, 2, 3], [6, 7, 8]], dtype=dt)
1051+
y = dpt.asarray([4, 5], dtype=dt)
1052+
x[0] = y[1]
1053+
expected = dpt.asarray([[5, 5, 5], [6, 7, 8]], dtype=dt)
1054+
assert dpt.all(x == expected)
1055+
1056+
10461057
def test_setitem_broadcasting_empty_dst_validation():
10471058
"Broadcasting rules apply, except exception"
10481059
get_queue_or_skip()

0 commit comments

Comments
 (0)