jax.numpy.fix#
- jax.numpy.fix(x, out=None)[source]#
Round input to the nearest integer towards zero.
JAX implementation of
numpy.fix()
.- Parameters:
x (ArrayLike) – input array.
out (None) – unused by JAX.
- Returns:
An array with same shape and dtype as
x
containing the rounded values.- Return type:
See also
jax.numpy.trunc()
: Rounds the input to nearest integer towards zero.jax.numpy.ceil()
: Rounds the input up to the nearest integer.jax.numpy.floor()
: Rounds the input down to the nearest integer.
Examples
>>> key = jax.random.key(0) >>> x = jax.random.uniform(key, (3, 3), minval=-5, maxval=5) >>> with jnp.printoptions(precision=2, suppress=True): ... print(x) [[ 4.48 4.79 -1.68] [-0.31 0.7 -3.34] [-1.9 1.89 2.47]] >>> jnp.fix(x) Array([[ 4., 4., -1.], [-0., 0., -3.], [-1., 1., 2.]], dtype=float32)