diff options
-rw-r--r-- | numpy/lib/function_base.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8a0c0b37d..caef5c709 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -585,8 +585,7 @@ def asarray_chkfinite(a, dtype=None, order=None): """ a = asarray(a, dtype=dtype, order=order) - if (a.dtype.char in typecodes['AllFloat']) \ - and (_nx.isnan(a).any() or _nx.isinf(a).any()): + if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all(): raise ValueError( "array must not contain infs or NaNs") return a |