-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix bug in basic slicing of empty arrays #1680
Conversation
Reproducer provided by @ndgrigorian: ``` import dpctl.tensor as dpt x = dpt.ones((0, 10)) y = dpt.moveaxis(x, 1, 0) y[1] # raises ValueError ``` Now this returns empty 1d array like `y[0]` does. A test is added for both integral basic indexing, and for simple slice.
d221a81
to
9fa1aec
Compare
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_353 ran successfully. |
Array API standard conformance tests for dpctl=0.17.0dev0=py310h15de555_353 ran successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This resolves the array API test failure. I've also tested it out in some edge cases and it seems to work as intended.
In [1]: import dpctl.tensor as dpt, dpctl, numpy as np
In [2]: x = dpt.arange(100, dtype="f4")
In [3]: x1 = dpt.reshape(x[2:], (7, 14))
In [4]: x1[-1:0, :].mT[2]
Out[4]: usm_ndarray([], dtype=float32)
In [5]: _.shape
Out[5]: (0,)
In [6]: test = x1[-1:0, :]
In [7]: test.shape
Out[7]: (0, 14)
In [8]: test.shape = (0, 100)
In [9]: test.mT[2]
Out[9]: usm_ndarray([], dtype=float32)
In [10]: test[:, 2]
Out[10]: usm_ndarray([], dtype=float32)
Windows CI break is unrelated...
Reproducer provided by @ndgrigorian:
Now this returns empty 1d array like
y[0]
does.A test is added for both integral basic indexing,
and for simple slice.