-
Notifications
You must be signed in to change notification settings - Fork 89
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: indexing into RegularArray
with typetracer
#2227
Conversation
@lgray would you mind confirming that this fixes your workflow? |
Yes this fixes the repro and the more complex actual use case. Thanks! |
Codecov Report
Additional details and impacted files
|
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.
More loosening of assumptions about lengths is a good thing; just be careful about slices with negative step
, as noted below.
src/awkward/contents/regulararray.py
Outdated
# Handle unknown sizes | ||
if self._size is None: | ||
nextsize = None | ||
start = 0 | ||
step = 1 if head.step is None else head.step |
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.
If step
is negative, should start
be 0
?
Slices are completely different when the step
is negative; be sure there is a test case for it.
c50fb18
to
81bb5b8
Compare
TL;DR
This PR
RegularArray
for_getitem_at
.DR
This latter point (regularisation of indices) is infectious; if a length is not known, or the index is unknown, the result is unknown.
This PR is taking a step towards allowing
int
as indices alongside the scalar arrays belong tobackend.index_nplike
. We need this if we want concrete slices (array[2:4]
) to preserve more information than unknown slices (array[x:y]
).