Skip to content

Commit 5cf7cd8

Browse files
Use offset parameter when creating broadcasted version of rhs array for copy
Closes gh-1503
1 parent 12cd523 commit 5cf7cd8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

dpctl/tensor/_copy_utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,22 @@ def _copy_from_usm_ndarray_to_usm_ndarray(dst, src):
300300
src.shape, src.strides, len(common_shape)
301301
)
302302
src_same_shape = dpt.usm_ndarray(
303-
common_shape, dtype=src.dtype, buffer=src, strides=new_src_strides
303+
common_shape,
304+
dtype=src.dtype,
305+
buffer=src,
306+
strides=new_src_strides,
307+
offset=src._element_offset,
304308
)
305309
elif src.ndim == len(common_shape):
306310
new_src_strides = _broadcast_strides(
307311
src.shape, src.strides, len(common_shape)
308312
)
309313
src_same_shape = dpt.usm_ndarray(
310-
common_shape, dtype=src.dtype, buffer=src, strides=new_src_strides
314+
common_shape,
315+
dtype=src.dtype,
316+
buffer=src,
317+
strides=new_src_strides,
318+
offset=src._element_offset,
311319
)
312320
else:
313321
# since broadcasting succeeded, src.ndim is greater because of

0 commit comments

Comments
 (0)