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

Support multiple skip axes in iter_indices and broadcast_shapes #155

Merged
merged 39 commits into from
Feb 1, 2024

Conversation

asmeurer
Copy link
Member

The old syntax is still allowed but you can also specify a separate set of skip_axes for each shape.

… of skip_axes

This changes the way the strategy is generated to construct skip_axes and a
result shape first, then generate shapes that match those skip axes and
broadcast to the result shape. It doesn't attempt to directly use
mutually_broadcastable_shapes. This is unfortunate, and it does require a
little bit of filtering, but it is the only way that I could figure out how to
generate the full range of possible examples. skip_axes_st is now always
generated in conjunction with this strategy, as 1) generating the skip axes
first and then the shapes doesn't seem to work, and 2) the two strategies are
always used together anyway.

This doesn't yet update all the tests that use this (nor are the functions
themselves updated), but test_mutually_broadcastable_shapes_with_skip_axes()
passes.
…th skip_axes

This is impossible to do in general if we allow both negative and nonnegative
skip_axes, and it's also too complex to check the result shape skip axes to
make sure they are consistent.

Unfortunately, this is a backwards compatibility break, but hopefully no one
is actually using this function yet.
This also changes the definition of the internal associated_axis() function.
The testing strategy is changed a little bit. We just test against the
broadcasted arrays with the skip axes removed, since the number of skip axes
is not necessarily uniform across the shapes anymore.
Only generate slices for completely skipped shapes once.
It is (hopefully) actually correct now with the new definition for skip_axes.
@asmeurer asmeurer marked this pull request as ready for review August 2, 2023 04:26
@asmeurer asmeurer merged commit 2fb49e9 into Quansight-Labs:master Feb 1, 2024
17 checks passed
asmeurer added a commit to asmeurer/array-api-tests that referenced this pull request Feb 3, 2024
cr313 added a commit to cr313/test-array-api that referenced this pull request Apr 19, 2024
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

Successfully merging this pull request may close these issues.

1 participant