Fix bug in basic slicing of empty arrays#1680
Merged
oleksandr-pavlyk merged 1 commit intomasterfrom May 16, 2024
Merged
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. 🤞 |
Collaborator
|
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. |
oleksandr-pavlyk
added a commit
that referenced
this pull request
May 16, 2024
ndgrigorian
approved these changes
May 16, 2024
Collaborator
There was a problem hiding this comment.
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...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.