Skip to content

Implement tensor.isin #2098

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

ndgrigorian
Copy link
Collaborator

This PR proposes an implementation for isin, a function likely coming to a future array API specification, which leverages a similar kernel to the implementation of searchsorted

This implementation uses the searchsorted kernel to check if the value has a position in the array. If that position is the number of elements in the array, it is not a member. Otherwise, if arr[pos] == val for some array arr being searched for value val, then val is a member.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

Copy link

github-actions bot commented Jun 6, 2025

Copy link

github-actions bot commented Jun 6, 2025

Array API standard conformance tests for dpctl=0.21.0dev0=py310h93fe807_8 ran successfully.
Passed: 1115
Failed: 6
Skipped: 119

@coveralls
Copy link
Collaborator

coveralls commented Jun 6, 2025

Coverage Status

coverage: 84.756% (-0.2%) from 84.972%
when pulling 5355fb8 on feature/searchsorted-based-isin
into 907a64e on master.

isin leverages kernel very similar to searchsorted, but after the search, the position is checked, and if the position is equal to the number of elements in the searched array, existence is considered false
@ndgrigorian ndgrigorian force-pushed the feature/searchsorted-based-isin branch from 1805102 to 5355fb8 Compare June 6, 2025 22:41
Copy link

github-actions bot commented Jun 6, 2025

Array API standard conformance tests for dpctl=0.21.0dev0=py310h93fe807_10 ran successfully.
Passed: 1114
Failed: 7
Skipped: 119

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.

2 participants