jax.numpy.isinf#

jax.numpy.isinf(x, /)[source]#

Return a boolean array indicating whether each element of input is infinite.

JAX implementation of numpy.isinf.

Parameters:

x (ArrayLike) – input array or scalar.

Returns:

A boolean array of same shape as x containing True where x is inf or -inf, and False otherwise.

Return type:

Array

See also

  • jax.numpy.isposinf(): Returns a boolean array indicating whether each element of input is positive infinity.

  • jax.numpy.isneginf(): Returns a boolean array indicating whether each element of input is negative infinity.

  • jax.numpy.isfinite(): Returns a boolean array indicating whether each element of input is finite.

  • jax.numpy.isnan(): Returns a boolean array indicating whether each element of input is not a number (NaN).

Examples

>>> jnp.isinf(jnp.inf)
Array(True, dtype=bool)
>>> x = jnp.array([2+3j, -jnp.inf, 6, jnp.inf, jnp.nan])
>>> jnp.isinf(x)
Array([False,  True, False,  True, False], dtype=bool)