Fix unresolved mx.array docstring references - #3990
Merged
Merged
Conversation
zcbenz
approved these changes
Aug 5, 2026
zcbenz
force-pushed
the
fix-cosine-loss-array-refs
branch
from
August 5, 2026 02:07
43bbecc to
e3b74d1
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.
Proposed changes
A few docstrings write the array type as
mx.array, which Sphinx cannot resolve, so those types render as dead links. Building with-nreports four of them:The rest of the codebase writes plain
arrayin docstrings, which resolves.losses.pyis a good example of the inconsistency: 29 places write(array)and onlycosine_similarity_losswrites(mx.array), in both itsArgsand itsReturns.Changed to
arrayin:nn/losses.py,cosine_similarity_loss(x1,x2, and the return type)nn/layers/base.py,Module.load_weights(file_or_weights)optimizers.py,init_singleandapply_single(parameter,gradient)After the change a clean
-nbuild reports zero unresolvedmx.arrayreferences, down from four.Note the type annotations in the signatures still say
mx.array, which is correct Python since that is how the module is imported. This only touches the docstring text that Sphinx tries to turn into a link.Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes(docstring text only, no behavior change;
test_optimizers.pypasses and the docs build is clean of these warnings)process note, same as always: freshman contributor and Claude Code helps me hunt, but i found these by building the docs in nitpick mode, then chased the count from four down to zero one file at a time to make sure i had actually got all of them rather than assuming.