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
{{ message }}
Repository navigation
Incorrect behavior of order parameter for order="K" #1326
As has been picked up by the array API test suite, the order="K" parameter does not work in some cases:
In [1]: import dpctl.tensor._usmarray as ua, dpctl.tensor as dpt
In [2]: x = dpt.usm_ndarray((1, 1, 2, 1, 1), dpt.bool, (0, 0, 1, 0, 0))
In [3]: dpt.astype(x, dpt.bool, order="K")
this raises ValueError: buffer='<SYCL(TM) USM-device allocation of 2 bytes at 0xffffb80200010200>' can not accomodate the requested array.
because the logic calculating the strides is incorrect in this case.
dpt.copy raises the same error for the same array
The internal function _empty_like_orderK does better
In [3]: x = dpt.usm_ndarray((1, 1, 2, 1, 1), dpt.bool, (0, 0, 1, 0, 0))
In [4]: _empty_like_orderK(x, dpt.bool)
Out[4]:
usm_ndarray([[[[[False]],
[[False]]]]])
but it's worth noting that the output of the strides are (1, 1, 1, 1, 1) where for Numpy they are (2, 2, 1, 1, 1).
This behavior should be implemented identically everywhere order="K" appears in dpctl.
Activity
oleksandr-pavlyk commentedon Aug 9, 2023
This is being fixed in gh-1324
ndgrigorian commentedon Aug 9, 2023
Resolved by #1324