Skip to content

Commit 4c0908b

Browse files
committed
Use nan_to_num instead of _replace_nan in nansum and nanprod
1 parent 2bb1e8b commit 4c0908b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dpnp/dpnp_iface_nanfunctions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ def nanprod(
884884
885885
"""
886886

887-
a, _ = _replace_nan(a, 1)
887+
a = dpnp.nan_to_num(a, nan=1.0, posinf=dpnp.inf, neginf=-dpnp.inf)
888888
return dpnp.prod(
889889
a,
890890
axis=axis,
@@ -988,7 +988,7 @@ def nansum(
988988
989989
"""
990990

991-
a, _ = _replace_nan(a, 0)
991+
a = dpnp.nan_to_num(a, nan=0.0, posinf=dpnp.inf, neginf=-dpnp.inf)
992992
return dpnp.sum(
993993
a,
994994
axis=axis,

0 commit comments

Comments
 (0)