You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
corrected use of src_offset in copy_from_numpy_into_usm_ndarray
When figuring out the bytes-boundary of numpy array to form
the sycl::buffer we use simplified strides and shapes, and hence
must start with src_offset, not with zero.
Now, both of these copy calls correctly populate the destination
usm_ndarray.
```
In [2]: n, m = 10**2, 10**3
In [3]: a = np.hstack((np.arange(n, dtype=np.int32),) * m)
In [4]: b = np.flipud(a)
In [5]:
In [5]: c = dpt.asarray(b, device='cpu')
In [6]: c
Out[6]: usm_ndarray([99, 98, 97, ..., 2, 1, 0], dtype=int32)
In [7]: import dpctl.tensor._tensor_impl as ti
In [8]: c = dpt.empty(b.shape, dtype=b.dtype)[::-1]
In [9]: ti._copy_numpy_ndarray_into_usm_ndarray(src=b, dst=c, sycl_queue=c.sycl_queue)
In [10]: c
Out[10]: usm_ndarray([99, 98, 97, ..., 2, 1, 0], dtype=int32)
In [11]: c = dpt.empty(b.shape, dtype=b.dtype)
In [12]: ti._copy_numpy_ndarray_into_usm_ndarray(src=b, dst=c, sycl_queue=c.sycl_queue)
In [13]: c
Out[13]: usm_ndarray([99, 98, 97, ..., 2, 1, 0], dtype=int32)
```
0 commit comments