Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behavior of order parameter for order="K" #1326

Closed
ndgrigorian opened this issue Aug 4, 2023 · 2 comments
Closed

Incorrect behavior of order parameter for order="K" #1326

ndgrigorian opened this issue Aug 4, 2023 · 2 comments

Comments

@ndgrigorian
Copy link
Collaborator

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.

@oleksandr-pavlyk
Copy link
Collaborator

This is being fixed in gh-1324

@ndgrigorian
Copy link
Collaborator Author

Resolved by #1324

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants