jax.numpy.less#

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

Return element-wise truth value of x < y.

JAX implementation of numpy.less.

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

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

Returns:

An array containing boolean values. True if the elements of x < y, and False otherwise.

Return type:

Array

See also

Examples

Scalar inputs:

>>> jnp.less(3, 7)
Array(True, dtype=bool, weak_type=True)

Inputs with same shape:

>>> x = jnp.array([5, 9, -3])
>>> y = jnp.array([1, 6, 4])
>>> jnp.less(x, y)
Array([False, False,  True], dtype=bool)

Inputs with broadcast compatibility:

>>> x1 = jnp.array([[2, -4, 6, -8],
...                 [-1, 5, -3, 7]])
>>> y1 = jnp.array([0, 3, -5, 9])
>>> jnp.less(x1, y1)
Array([[False,  True, False,  True],
       [ True, False, False,  True]], dtype=bool)