jax.numpy.logical_not
Contents
jax.numpy.logical_not#
- jax.numpy.logical_not(x,/)[source]#
Compute NOT bool(x) element-wise.
JAX implementation of
numpy.logical_not().- Parameters:
x (ArrayLike) – input array of any dtype.
- Returns:
A boolean array that computes NOT bool(x) element-wise
- Return type:
See also
jax.numpy.invert()orjax.numpy.bitwise_invert(): bitwise NOT operation
Examples
Compute NOT x element-wise on a boolean array:
>>>x=jnp.array([True,False,True])>>>jnp.logical_not(x)Array([False, True, False], dtype=bool)
For boolean input, this is equivalent to
invert(), which implementsthe unary~operator:>>>~xArray([False, True, False], dtype=bool)
For non-boolean input, the input of
logical_not()is implicitly cast to boolean:>>>x=jnp.array([-1,0,1])>>>jnp.logical_not(x)Array([False, True, False], dtype=bool)
Contents
