Skip to content

BUG: Return correctly shaped inverse indices in array_api set functions#20819

Merged
charris merged 2 commits intonumpy:maintenance/1.22.xfrom
charris:backport-20791
Jan 13, 2022
Merged

BUG: Return correctly shaped inverse indices in array_api set functions#20819
charris merged 2 commits intonumpy:maintenance/1.22.xfrom
charris:backport-20791

Conversation

@charris
Copy link
Copy Markdown
Member

@charris charris commented Jan 13, 2022

Backport of #20791.

As inverse indices from np.unique() are flattened when axis=None (the default), the related array_api set functions (xp.unique_inverse/xp.unique_all) don't return shape-sharing indices as the Array API specifies. This PR fixes this by internally reshaping the inverse indices.

Tested in array-api-tests , specifically https://github.com/data-apis/array-api-tests/blob/master/array_api_tests/test_set_functions.py. Note these tests will fail due to unrelated NaN-uniqueness issues.

Related #20638

@charris charris added this to the 1.22.1 release milestone Jan 13, 2022
@charris charris changed the base branch from main to maintenance/1.22.x January 13, 2022 19:01
@charris charris closed this Jan 13, 2022
@charris charris reopened this Jan 13, 2022
@charris charris merged commit 914b11f into numpy:maintenance/1.22.x Jan 13, 2022
@charris charris deleted the backport-20791 branch January 13, 2022 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants