jax.numpy.not_equal#

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

Returns element-wise truth value of x != y.

JAX implementation of numpy.not_equal. This function provides the implementation of the != operator for JAX arrays.

Parameters:
  • x (ArrayLike) – input array or scalar.

  • y (ArrayLike) – input array or scalar. x and y should either have same shape or be broadcast compatible.

Returns:

A boolean array containing True where the elements of x != y and False otherwise.

Return type:

Array

See also

Examples

>>> jnp.not_equal(0., -0.)
Array(False, dtype=bool, weak_type=True)
>>> jnp.not_equal(-2, 2)
Array(True, dtype=bool, weak_type=True)
>>> jnp.not_equal(1, 1.)
Array(False, dtype=bool, weak_type=True)
>>> jnp.not_equal(5, jnp.array(5))
Array(False, dtype=bool, weak_type=True)
>>> x = jnp.array([[1, 2, 3],
...                [4, 5, 6],
...                [7, 8, 9]])
>>> y = jnp.array([1, 5, 9])
>>> jnp.not_equal(x, y)
Array([[False,  True,  True],
       [ True, False,  True],
       [ True,  True, False]], dtype=bool)
>>> x != y
Array([[False,  True,  True],
       [ True, False,  True],
       [ True,  True, False]], dtype=bool)