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
{{ message }}
Repository navigation
Returning a tuple instead of list for meshgrid to make it compliant with Array API #4034
Hi, currently mlx.core.meshgrid returns a list. I am proposing to make it return tuple for making it compliant with Array API, and how numpy, and cupy do it.
Impact
Low risk of breaking real-world code. Common workflows are fully compatible with tuples:
Unpacking: X, Y = mx.meshgrid(x, y)
Indexing & Iteration: grids[0], for g in grids:
Direct passing: mx.stack(mx.meshgrid(...))
Only rare cases relying on isinstance(..., list) or container mutation (.append()) would be affected.
To expand on the numpy/array API history a bit: historically, numpy returned a list (and other array libraries followed, more or less). In NumPy 2.0, it was changed into returning a tuple. CuPy follows suit, and so does JAX (one reason for the backwards-incompatible change was I believe tuples are preferable in lazy/hit scenarios).
Finally, Array API standard itself changed it in its 2025.12 revision.
Activity
JasonHonKL commentedon Aug 6, 2026
@aaishwarymishra mind if I fix this later ?
aaishwarymishra commentedon Aug 6, 2026
@JasonHonKL Hi, this issue is a proposal I wont get started until a maintainer first approves it as workable :)
JasonHonKL commentedon Aug 6, 2026
sure no problem hahaha just having some spare time while searching for jobs lollll. But sure !
ev-br commentedon Aug 7, 2026
To expand on the numpy/array API history a bit: historically, numpy returned a list (and other array libraries followed, more or less). In NumPy 2.0, it was changed into returning a tuple. CuPy follows suit, and so does JAX (one reason for the backwards-incompatible change was I believe tuples are preferable in lazy/hit scenarios).
Finally, Array API standard itself changed it in its 2025.12 revision.
aaishwarymishra commentedon Aug 7, 2026
Jax themselves recently merged it jax-ml/jax#39779 :)
zcbenz commentedon Aug 11, 2026
Looks a nice change without hurting any existing code.
aaishwarymishra commentedon Aug 11, 2026
@JasonHonKL are you still interested to work on this ?
JasonHonKL commentedon Aug 11, 2026
@aaishwarymishra yeah sure. A bit busy today gonna work on it tomorrow.