You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mlx's axis=None value actually works as -1 , i.e. works along the last axis, or
what you added is not spec-compliant.
If the former, then there's no need to do anything, it is spec-compliant after your PR.
If the latter, then it's best to quickly make it spec compliant in MLX, until a release freezes the default via backwards compatibility.
Ok so the axis=None in MLX behaves differently then the axis=-1, so for it to work we need to explicitly set axis=-1 .
I proposed them to add axis=-1, as default value but it would have been backward breaking but in this case as we had to previously supply the axis explicitly so all the old code written already had an explicit axis parameter anyways.
Activity
aaishwarymishra commentedon Aug 20, 2026
I think we need to add wrapper for indexing to use -1 axis default ml-explore/mlx#4357 or maybe explicitly use -1 axis value in the tests.
ev-br commentedon Aug 20, 2026
No, why?
Let's see:
So either
If the former, then there's no need to do anything, it is spec-compliant after your PR.
If the latter, then it's best to quickly make it spec compliant in MLX, until a release freezes the default via backwards compatibility.
So which one is it?
aaishwarymishra commentedon Aug 20, 2026
Ok so the axis=None in MLX behaves differently then the axis=-1, so for it to work we need to explicitly set axis=-1 .
I proposed them to add axis=-1, as default value but it would have been backward breaking but in this case as we had to previously supply the axis explicitly so all the old code written already had an explicit axis parameter anyways.
I proposed them to make axis=-1, but this is the response I got ml-explore/mlx#4357 (comment)
Maybe I wasn't able to explain them effectively :(
ev-br commentedon Aug 20, 2026
Looking at https://ml-explore.github.io/mlx/build/html/python/_autosummary/mlx.core.take_along_axis.html,
"
axis=Nonemeans flatten" is a typical numpy look-alike, and it's neither array API compatible, nor is numpy's default.Here's the numpy behavior (and a recent numpy is Array API compatible):
Trying the same in MLX 0.32.1 (i.e., before your PR):
Therefore, I indeed think the best course of action is to send a follow-up PR changing to axis=-1 default, and explain that
take_along_axisArray API compatible.aaishwarymishra commentedon Aug 21, 2026
sure I will make a follow up :)
prady0t commentedon Aug 29, 2026
PR for setting -1 as the default value was merged: ml-explore/mlx#4368; we can close this issue.
ev-br commentedon Aug 29, 2026
Gladly, thank you @prady0t @aaishwarymishra