-
Notifications
You must be signed in to change notification settings - Fork 16
ENH: new function union1d
#495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Relevant upstream context from data-apis/array-api#25 @kgryte :
Given @paddyroddy's analysis in gh-491, it looks like absence from PyTorch might still be a blocker for inclusion in the standard? If so, probably fine to proceed with this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @OmarManzoor, looks good!
| xp_assert_equal(res, expected) | ||
|
|
||
|
|
||
| @pytest.mark.skip_xp_backend(Backend.SPARSE, reason="unique_values returns arrays") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the problem here?
| expected = xp.asarray([-2, -1, 0, 1, 2]) | ||
| res = union1d(a, b) | ||
| xp_assert_equal(res, expected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to be checking that the array is sorted? Or would it be sufficient to check that xp.sort(res) matches expected here?
Fixes #491
union1dfunction.