WIP: add axis tuple support to torch.expand_dims#385
Draft
ev-br wants to merge 1 commit intodata-apis:mainfrom
Draft
WIP: add axis tuple support to torch.expand_dims#385ev-br wants to merge 1 commit intodata-apis:mainfrom
ev-br wants to merge 1 commit intodata-apis:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for tuple values in the axis parameter of torch.expand_dims, allowing multiple dimensions to be expanded at once. This aligns with the Array API 2024.12 standard.
Changes:
- Extended
expand_dimsfunction signature to acceptaxis: int | tuple[int, ...]instead of justaxis: int - Added implementation logic to handle tuple axes by computing the expected output shape and using
torch.reshape - Added validation for duplicate axes and out-of-range axis values
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1f34958 to
35b631f
Compare
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.
TODO check the defaults for other wrappers (numpy,cupy,dask)seems fineDraft until 2025.12 is a thing and includes data-apis/array-api#988