Skip to content
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

RFC: add isin for elementwise set inclusion test #854

Open
lucascolley opened this issue Nov 21, 2024 · 2 comments
Open

RFC: add isin for elementwise set inclusion test #854

lucascolley opened this issue Nov 21, 2024 · 2 comments
Labels
API extension Adds new functions or objects to the API. RFC Request for comments. Feature requests and proposed changes.

Comments

@lucascolley
Copy link
Contributor

lucascolley commented Nov 21, 2024

Prior art

Motivation

This function is used in scikit-learn. They've implemented it in terms of the standard, and that implementation could find a home in array-api-extra: data-apis/array-api-extra#34. @asmeurer suggested there that we should also consider adding this to the standard.

@asmeurer
Copy link
Member

Another potential reason for adding it is that it uses a nontrivial implementation which depends on some heuristics based on the input size.

@rgommers
Copy link
Member

Thanks @lucascolley. I've added ndonnx (which has it) and MLX (which doesn't) to the issue description.

This seems like a very reasonable proposal to me. Implementing isin in terms of other primitives in the standard is a little complex indeed.

The return type should always be a boolean array. The NumPy docs say it can be a bool for a single input element, but that's actually a bug in the docs. I checked NumPy, JAX, and PyTorch and all return a 0-D array.

@rgommers rgommers added the API extension Adds new functions or objects to the API. label Nov 22, 2024
@kgryte kgryte added the RFC Request for comments. Feature requests and proposed changes. label Nov 22, 2024
@kgryte kgryte added this to Proposals Nov 22, 2024
@kgryte kgryte moved this to Stage 0 in Proposals Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API. RFC Request for comments. Feature requests and proposed changes.
Projects
Status: Stage 0
Development

No branches or pull requests

4 participants