jax.numpy.isnan

jax.numpy.isnan(x)[source]

Test element-wise for NaN and return result as a boolean array.

LAX-backend implementation of isnan(). Original docstring below.

isnan(x, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, subok=True[, signature, extobj])

Parameters

x (array_like) – Input array.

Returns

y – True where x is NaN, false otherwise. This is a scalar if x is a scalar.

Return type

ndarray or bool

See also

isinf(), isneginf(), isposinf(), isfinite(), isnat()

Notes

NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic (IEEE 754). This means that Not a Number is not equivalent to infinity.

Examples

>>> np.isnan(np.nan)
True
>>> np.isnan(np.inf)
False
>>> np.isnan([np.log(-1.),1.,np.log(0)])
array([ True, False, False])