fix: typetracer nplike's all function leads to infinite recursion for axis=None#3765
Conversation
|
@pfackeldey just a small typo looks like that I found when looking for something else. |
|
This now works while on main it gives |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
|
The documentation preview is ready to be viewed at http://preview.awkward-array.org.s3-website.us-east-1.amazonaws.com/PR3765 |
pfackeldey
left a comment
There was a problem hiding this comment.
Thanks @ikrommyd!
Yes, this is correct. The .reshape(x, (-1,)) completely flattens the typetracer array. Once it is flat we can safely call .all with axis=0, otherwise this path infinitely recurses. This solution also solves this bug for .any as it uses .all under-the-hood.
I suppose this hasn't been observed in user code so far because ak.all normalizes the axis into an int always (afaik) which then avoids the axis=None case. We should anyway fix it like you suggest.
Please add a simple test (e.g. your reproducer and a .any-case), and then it's ready for merge 👍
|
Tests added @pfackeldey. This should be good to go from my side so if you agree just merge it. |
pfackeldey
left a comment
There was a problem hiding this comment.
Thanks @ikrommyd, LGTM!
The typetracer nplike's
allfunction withaxis=Nonecalls itself again withaxis=Noneleading into an infinite recursion naturally. This appears to be a typo. I think the point was when this was implemented to flatten the input with theself.reshape(x, (-1,)and then call it on the only existing axis which would be 0.