jax.numpy.less_equal#
- jax.numpy.less_equal(x, y, /)[source]#
Return element-wise truth value of
x <= y
.JAX implementation of
numpy.less_equal
.- Parameters:
x (ArrayLike) – input array or scalar.
y (ArrayLike) – input array or scalar.
x
andy
must have either same shape or be broadcast compatible.
- Returns:
An array containing the boolean values.
True
if the elements ofx <= y
, andFalse
otherwise.- Return type:
See also
jax.numpy.greater_equal()
: Returns element-wise truth value ofx >= y
.jax.numpy.greater()
: Returns element-wise truth value ofx > y
.jax.numpy.less()
: Returns element-wise truth value ofx < y
.
Examples
Scalar inputs:
>>> jnp.less_equal(6, -2) Array(False, dtype=bool, weak_type=True)
Inputs with same shape:
>>> x = jnp.array([-4, 1, 7]) >>> y = jnp.array([2, -3, 8]) >>> jnp.less_equal(x, y) Array([ True, False, True], dtype=bool)
Inputs with broadcast compatibility:
>>> x1 = jnp.array([2, -5, 9]) >>> y1 = jnp.array([[1, -6, 5], ... [-2, 4, -6]]) >>> jnp.less_equal(x1, y1) Array([[False, False, False], [False, True, False]], dtype=bool)