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
andy
must either have same shape or be broadcast compatible.
- Returns:
An array containing boolean values.
True
if the elements ofx < y
, andFalse
otherwise.- Return type:
See also
jax.numpy.greater()
: Returns element-wise truth value ofx > y
.jax.numpy.greater_equal()
: Returns element-wise truth value ofx >= y
.jax.numpy.less_equal()
: Returns element-wise truth value ofx <= y
.
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)