Skip to content

Commit 5997cf3

Browse files
committed
Use nan_to_num instead of _replace_nan in nansum and nanprod
1 parent 77702b3 commit 5997cf3

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
@@ -844,7 +844,7 @@ def nanprod(
844844
845845
"""
846846

847-
a, _ = _replace_nan(a, 1)
847+
a = dpnp.nan_to_num(a, nan=1.0, posinf=dpnp.inf, neginf=-dpnp.inf)
848848
return dpnp.prod(
849849
a,
850850
axis=axis,
@@ -944,7 +944,7 @@ def nansum(
944944
945945
"""
946946

947-
a, _ = _replace_nan(a, 0)
947+
a = dpnp.nan_to_num(a, nan=0.0, posinf=dpnp.inf, neginf=-dpnp.inf)
948948
return dpnp.sum(
949949
a,
950950
axis=axis,

0 commit comments

Comments
 (0)