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

Merged
merged 5 commits into from
Aug 1, 2025

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

github-actions bot commented Jul 24, 2025

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

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.894% (+0.01%) from 85.882%
when pulling 532c11e 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

@ndgrigorian ndgrigorian requested a review from antonwolfy July 31, 2025 22:48
Copy link

Array API standard conformance tests for dpctl=0.21.0dev0=py310h93fe807_83 ran successfully.
Passed: 1113
Failed: 8
Skipped: 119

Copy link
Collaborator

@antonwolfy antonwolfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ndgrigorian , no more comments from me.
I run the dpnp tests with that change and they passed.

@ndgrigorian ndgrigorian merged commit 3381d14 into master Aug 1, 2025
67 of 86 checks passed
@ndgrigorian ndgrigorian deleted the allow-numpy-arrays-indexing branch August 1, 2025 17:52
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
3 participants