[BUG] `mx.expand_dims` docs: the Args section names `axes`, but the parameter is `axis`
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- documentation, machine-learning
Research direction
The issue points to the mx.expand_dims docstring in python/src/ops.cpp:260 and its binding at line 249. Read those entries and check how nearby operation docstrings name arguments. Update the Args entry to match the axis parameter, then confirm the generated docstring uses that name.
Written by the indexing model from the issue text.
Description
☑️ I understand it is strictly prohibited to use AI to write issues.
Describe the bug
In the docstring of mx.expand_dims, the signature line uses axis, but the Args section documents axes (int or tuple(int)): The index of the inserted dimensions. Passing axes= raises TypeError.
To Reproduce
Include code snippet
import mlx.core as mx
doc = mx.expand_dims.__doc__
print(doc.splitlines()[0]) # signature line uses `axis`
print([l.strip()[:45] for l in doc.splitlines() if l.strip().startswith(("a (", "axes", "axis"))])
a = mx.zeros((2,))
print(mx.expand_dims(a, axis=0).shape)
mx.expand_dims(a, axes=0) # name taken from the Args section
Output:
expand_dims(a: array, /, axis: int | Sequence[int], *, stream: StreamOrDevice = None) -> array
['a (array): Input array.', 'axes (int or tuple(int)): The index of the in']
(1, 2)
TypeError: expand_dims(): incompatible function arguments. The following argument types are supported:
1. expand_dims(a: array, /, axis: int | Sequence[int], *, stream: StreamOrDevice = None) -> array
Invoked with types: mlx.core.array, kwargs = { axes: int }
Expected behavior
The Args entry is named axis, matching the signature and the binding.
Desktop (please complete the following information):
- OS Version: macOS 26.6.2 (arm64)
- Version: mlx 0.32.4
Additional context
Args entry: python/src/ops.cpp:260; binding argument "axis"_a: python/src/ops.cpp:249.
- Dominant language
- C++
- Stars
- 29.1k
- Forks
- 2.4k
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 103
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ml-explore/mlx
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ml-explore/mlx#4832 · 1 comment ·
Maintainers usually reply within 3 days
-
[BUG] `mx.qqmm` docs: the Args section names `global_scale`, but the parameter is `global_scale_x`Possibly taken @XXXXRT666 claimed this 5 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
ml-explore/mlx#4815 ·
Maintainers usually reply within 3 days
-
[BUG] FP4 quantization on CPU rounds ties toward zero while Metal rounds to evenMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ml-explore/mlx#4753 ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 43/100
ml-explore/mlx#4843 ·
Maintainers usually reply within 3 days
-
Metal cache admission can exceed the configured cache limitPossibly taken @tijs claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
ml-explore/mlx#4841 ·
Maintainers usually reply within 3 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
arvidn/libtorrent#9126 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Sunrisepeak/mcpp-language-server#80 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
xiaoyifang/goldendict-ng#3148 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
triton-inference-server/server#9069 ·
Maintainers usually reply within 1 day