Fix incorrect examples and outputs in the usage docs - #3956
Merged
Conversation
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 things in the usage docs do not match what the code actually does. I ran every example below on current main to check.
compile.rstIndentationError: unexpected indent. Aligned the trailing lines with the rest of the block.indexing.rstarr[:, :, 0]block had a strayarray(3, dtype=int32)line that does not belong to either expression, and both outputs were missing their closing paren. Actual result for both isarray([[0, 2], [4, 6]], dtype=int32).arr.shapewas shown as[8]andarr[None].shapeas[1, 8].shapeis a tuple, so these print as(8,)and(1, 8).array([5.0, 2.0, 6.0], ...)andarray([[1.0, 0.0, 1.0], ...]), but MLX drops the trailing.0for whole valued floats, so they print asarray([5, 2, 6], dtype=float32)andarray([[1, 0, 1], [0, 0, 1]], dtype=float32).quick_start.rsta.shapeshown as[4], actually(4,).Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes(docs only; every example above was executed against current main and the new outputs are copied from the actual results)
small note on how i work: i'm a freshman contributor and i use Claude Code to help me spot this kind of drift, but for this one i pulled each code block out into a scratch file, ran it, and pasted back what it really printed. if any of these outputs look different on your machine i would like to know, since that would be more interesting than the typo.