jax.numpy.floor#

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

Round input to the nearest integer downwards.

JAX implementation of numpy.floor.

Parameters:

x (ArrayLike) – input array or scalar. Must not have complex dtype.

Returns:

An array with same shape and dtype as x containing the values rounded to the nearest integer that is less than or equal to the value itself.

Return type:

Array

See also

Examples

>>> key = jax.random.key(42)
>>> x = jax.random.uniform(key, (3, 3), minval=-5, maxval=5)
>>> with jnp.printoptions(precision=2, suppress=True):
...     print(x)
[[ 1.44 -1.77 -3.07]
 [ 3.86  2.25 -3.08]
 [-1.55 -2.48  1.32]]
>>> jnp.floor(x)
Array([[ 1., -2., -4.],
       [ 3.,  2., -4.],
       [-2., -3.,  1.]], dtype=float32)