Skip to content

[Bug]: add default none value to axis parameter of the take_along_axis - #4357

Merged
nastya236 merged 3 commits into
ml-explore:mainfrom
aaishwarymishra:fix-bug
Aug 19, 2026
Merged

[Bug]: add default none value to axis parameter of the take_along_axis#4357
nastya236 merged 3 commits into
ml-explore:mainfrom
aaishwarymishra:fix-bug

Conversation

@aaishwarymishra

@aaishwarymishra aaishwarymishra commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

Please include a description of the problem or feature this PR is addressing. If there is a corresponding issue, include the issue #.

fixes data-apis/array-api-compat#466

where take_along_axis needed axis to be passed even though docs says its default value was set to the None, nb signature didn't set a default value thus failing in cases where no axis was provided.

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

@aaishwarymishra

Copy link
Copy Markdown
Contributor Author

sorry for the extra whitespace removal, my editor removed it automatically :(
I can restore it if you want

@nastya236

Copy link
Copy Markdown
Collaborator

THanks for looking into this! Could you please share a test case for this failure?

@nastya236 nastya236 self-assigned this Aug 19, 2026
@nastya236 nastya236 added bug low priority await response This pull request is waiting for response from the author. labels Aug 19, 2026
@nastya236 nastya236 removed their assignment Aug 19, 2026
@nastya236
nastya236 self-requested a review August 19, 2026 15:47
@aaishwarymishra

Copy link
Copy Markdown
Contributor Author

done :)

@nastya236

Copy link
Copy Markdown
Collaborator

Sorry I meant: give me a command that does not work :) Thanks for the contribution!

@nastya236
nastya236 merged commit 3a98589 into ml-explore:main Aug 19, 2026
24 of 28 checks passed
@aaishwarymishra

Copy link
Copy Markdown
Contributor Author

oh, my bad
Sorry for the trouble :)

@aaishwarymishra

aaishwarymishra commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@nastya236 Hi, I just wanted to ask if it's ok to change the default value of the axis parameter to -1. It will make it comply with the array api spec https://data-apis.org/array-api/draft/API_specification/generated/array_api.take_along_axis.html#take-along-axis

JAX and Numpy does the same.

It's a backward breaking change but I don't think anyone will be affected as because of this bug, I think everyone had to explicitly pass an axis anyways so every old code would have an explict axis already defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

await response This pull request is waiting for response from the author. bug low priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLX compatibility: indexing functions

2 participants