Skip to content

Commit

Permalink
Use nan_to_num instead of _replace_nan in nansum and nanprod
Browse files Browse the repository at this point in the history
  • Loading branch information
ndgrigorian committed Feb 28, 2025
1 parent 2bb1e8b commit 4c0908b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dpnp/dpnp_iface_nanfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def nanprod(
"""

a, _ = _replace_nan(a, 1)
a = dpnp.nan_to_num(a, nan=1.0, posinf=dpnp.inf, neginf=-dpnp.inf)
return dpnp.prod(
a,
axis=axis,
Expand Down Expand Up @@ -988,7 +988,7 @@ def nansum(
"""

a, _ = _replace_nan(a, 0)
a = dpnp.nan_to_num(a, nan=0.0, posinf=dpnp.inf, neginf=-dpnp.inf)
return dpnp.sum(
a,
axis=axis,
Expand Down

0 comments on commit 4c0908b

Please sign in to comment.