Skip to content

Extend nan_to_num with broadcast support of nan, posinf, and neginf#2754

Merged
antonwolfy merged 4 commits intomasterfrom
nan-to-num-broadcasting
Feb 9, 2026
Merged

Extend nan_to_num with broadcast support of nan, posinf, and neginf#2754
antonwolfy merged 4 commits intomasterfrom
nan-to-num-broadcasting

Conversation

@antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Feb 3, 2026

The PR extends implementation of dpnp.nan_to_num function to align with NumPy and CuPy which supports nan, posinf, and neginf keywords as any array through broadcasting.

This PR adds handling for a common path where at least one of the keywords has non-scalar value.
The path does not assume a dedicated SYCL kernel, instead proposes to rely on implementation through existing python functions. That can be improved in the future if required.

  • 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?

@antonwolfy antonwolfy added this to the 0.20.0 release milestone Feb 3, 2026
@antonwolfy antonwolfy self-assigned this Feb 3, 2026
@antonwolfy antonwolfy changed the title Extend nan_to_num implementation with broadcast support of nan, posinf, and neginf Extend nan_to_num with broadcast support of nan, posinf, and neginf Feb 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Array API standard conformance tests for dpnp=0.20.0dev2=py313h509198e_19 ran successfully.
Passed: 1355
Failed: 2
Skipped: 7

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

View rendered docs @ https://intelpython.github.io/dpnp/index.html

@coveralls
Copy link
Collaborator

coveralls commented Feb 3, 2026

Coverage Status

coverage: 81.117% (+0.01%) from 81.105%
when pulling 1b72e9c on nan-to-num-broadcasting
into 2f796e0 on master.

@antonwolfy antonwolfy marked this pull request as ready for review February 3, 2026 19:02
Copy link
Contributor

@vlad-perevezentsev vlad-perevezentsev left a comment

Choose a reason for hiding this comment

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

LGTM
Than you @antonwolfy !

@antonwolfy antonwolfy force-pushed the nan-to-num-broadcasting branch from 32c1e07 to 1b72e9c Compare February 9, 2026 13:07
@antonwolfy antonwolfy merged commit 06a74cd into master Feb 9, 2026
50 of 69 checks passed
@antonwolfy antonwolfy deleted the nan-to-num-broadcasting branch February 9, 2026 15:37
github-actions bot added a commit that referenced this pull request Feb 9, 2026
…eginf` (#2754)

The PR extends implementation of `dpnp.nan_to_num` function to align
with NumPy and CuPy which supports `nan`, `posinf`, and `neginf`
keywords as any array through broadcasting.

This PR adds handling for a common path where at least one of the
keywords has non-scalar value.
The path does not assume a dedicated SYCL kernel, instead proposes to
rely on implementation through existing python functions. That can be
improved in the future if required. 06a74cd
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.

3 participants