Skip to content

Return tuple in meshgrid - #4229

Merged
zcbenz merged 2 commits into
ml-explore:mainfrom
JasonHonKL:issue/4034
Aug 13, 2026
Merged

Return tuple in meshgrid#4229
zcbenz merged 2 commits into
ml-explore:mainfrom
JasonHonKL:issue/4034

Conversation

@JasonHonKL

Copy link
Copy Markdown
Contributor

Proposed changes

Fix #4034

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)

Comment thread python/src/ops.cpp
std::vector<mx::array> arrays =
nb::cast<std::vector<mx::array>>(arrays_);
return mx::meshgrid(arrays, sparse, indexing, s);
return nb::tuple(nb::cast(mx::meshgrid(arrays, sparse, indexing, s)));

@zcbenz zcbenz Aug 13, 2026

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.

would nb::cast<nb::tuple>() work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so.

error: no matching function for call to 'cast'
note: candidate not viable: no known conversion from 'std::vector<array>' to 'nb::tuple'

@JasonHonKL
JasonHonKL requested a review from zcbenz August 13, 2026 16:55

@zcbenz zcbenz 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!

@zcbenz zcbenz changed the title Fix Issue 4034 return as a tuple Return tuple in meshgrid Aug 13, 2026
@zcbenz
zcbenz merged commit 9b6575c into ml-explore:main Aug 13, 2026
28 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.

Returning a tuple instead of list for meshgrid to make it compliant with Array API

2 participants