-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Labels
33 - QuestionQuestion about NumPy usage or developmentQuestion about NumPy usage or development
Description
Describe the issue:
I get warnings when summing Inf
and -Inf
(which is NaN
), but not when summing 5
and NaN
(which is NaN
) nor when summing Inf
and Inf
.
I would prefer not seeing a warning in any of these cases.
Reproduce the code example:
# Warning:
python -c "import numpy as np; print(np.sum([np.Inf, -np.Inf]))"
# No warning:
python -c "import numpy as np; print(np.sum([5, np.nan]))"
python -c "import numpy as np; print(np.sum([np.Inf, np.Inf]))"
Error message:
site-packages\numpy\core\fromnumeric.py:86: RuntimeWarning: invalid value encountered in reduce
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
NumPy/Python version information:
1.23.4 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
Context for the issue:
Metadata
Metadata
Assignees
Labels
33 - QuestionQuestion about NumPy usage or developmentQuestion about NumPy usage or development