Skip to content

Fix incorrect examples and outputs in the usage docs - #3956

Merged
angeloskath merged 1 commit into
ml-explore:mainfrom
ayaangazali:fix-usage-docs-examples
Jul 31, 2026
Merged

Fix incorrect examples and outputs in the usage docs#3956
angeloskath merged 1 commit into
ml-explore:mainfrom
ayaangazali:fix-usage-docs-examples

Conversation

@ayaangazali

Copy link
Copy Markdown
Contributor

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.rst

  • The implicit-state example mixes 3 and 4 space indentation, so copying it into a file gives IndentationError: unexpected indent. Aligned the trailing lines with the rest of the block.
  • Typo: "Firt call compiles the function".

indexing.rst

  • The arr[:, :, 0] block had a stray array(3, dtype=int32) line that does not belong to either expression, and both outputs were missing their closing paren. Actual result for both is array([[0, 2], [4, 6]], dtype=int32).
  • arr.shape was shown as [8] and arr[None].shape as [1, 8]. shape is a tuple, so these print as (8,) and (1, 8).
  • The two boolean-mask assignment examples showed array([5.0, 2.0, 6.0], ...) and array([[1.0, 0.0, 1.0], ...]), but MLX drops the trailing .0 for whole valued floats, so they print as array([5, 2, 6], dtype=float32) and array([[1, 0, 1], [0, 0, 1]], dtype=float32).

quick_start.rst

  • Same shape issue: a.shape shown as [4], actually (4,).

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

(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.

@angeloskath angeloskath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@angeloskath
angeloskath merged commit fb5133e into ml-explore:main Jul 31, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants