Skip to content

Accept NumPy arrays in advanced indexing #2128

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ndgrigorian
Copy link
Collaborator

This PR proposes allowing NumPy arrays when indexing usm_ndarray

This can be useful where attempting to use usm_ndarray in a library which generates indices with NumPy, and which expects to only handle devices implicitly through tensor operations (i.e., a library which can take an arbitrary tensor input, but generates indices with numpy.random and expects these indices to work on the input tensor)

Both boolean and integer advanced indices can accept NumPy arrays with these changes

Closes #2053

  • 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

Copy link

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

@coveralls
Copy link
Collaborator

coveralls commented Jul 24, 2025

Coverage Status

coverage: 85.886% (+0.004%) from 85.882%
when pulling b90fc90 on allow-numpy-arrays-indexing
into 0dbd495 on master.

@ndgrigorian ndgrigorian marked this pull request as ready for review July 25, 2025 03:50
Copy link

Array API standard conformance tests for dpctl=0.21.0dev0=py310h93fe807_81 ran successfully.
Passed: 1115
Failed: 6
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.

Request: subsetting with numpy arrays/masks
2 participants