added eye(0) support and tests - #3952
Open
aaishwarymishra wants to merge 1 commit into
Open
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
This pull request improves the behavior of the
eyefunction to correctly handle cases where the number of rows or columns is zero, and adds corresponding tests to ensure this behavior is correct.Bug fix and behavior improvement:
eyefunction inmlx/ops.cppto return an empty array when either the number of rows or columns is zero, instead of throwing an error or producing invalid output.Testing enhancements:
python/tests/test_ops.pyformx.eyeto verify correct handling of zero rows and/or columns.tests/ops_tests.cppto check thateye(0, 0)returns an empty array with the correct shape, size, and data type.Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changesHi, this was part of the data-apis/array-api-compat#452 where we were trying to add support of MLX in
array-api-compatwhere we found some of the issues when running tests.