jax.numpy.ceil#

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

Round input to the nearest integer upwards.

JAX implementation of numpy.ceil.

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 greater than or equal to the value itself.

Return type:

Array

See also

Examples

>>> key = jax.random.key(1)
>>> x = jax.random.uniform(key, (3, 3), minval=-5, maxval=5)
>>> with jnp.printoptions(precision=2, suppress=True):
...     print(x)
[[ 2.55 -1.87 -3.76]
 [ 0.48  3.85 -1.94]
 [ 3.2   4.56 -1.43]]
>>> jnp.ceil(x)
Array([[ 3., -1., -3.],
       [ 1.,  4., -1.],
       [ 4.,  5., -1.]], dtype=float32)