Commit bd60be8
committed
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)
```1 parent eb97326 commit bd60be8
File tree
1 file changed
+2
-2
lines changed- dpctl/tensor/libtensor/source
1 file changed
+2
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
215 | | - | |
| 214 | + | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
0 commit comments