Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.round

Contents

jax.numpy.round#

jax.numpy.round(a,decimals=0,out=None)[source]#

Round input evenly to the given number of decimals.

JAX implementation ofnumpy.round().

Parameters:
  • a (ArrayLike) – input array or scalar.

  • decimals (int) – int, default=0. Number of decimal points to which the input needsto be rounded. It must be specified statically. Not implemented fordecimals<0.

  • out (None) – Unused by JAX.

Returns:

An array containing the rounded values to the specifieddecimals withsame shape and dtype asa.

Return type:

Array

Note

jnp.round rounds to the nearest even integer for the values exactly halfwaybetween rounded decimal values.

See also

Examples

>>>x=jnp.array([1.532,3.267,6.149])>>>jnp.round(x)Array([2., 3., 6.], dtype=float32)>>>jnp.round(x,decimals=2)Array([1.53, 3.27, 6.15], dtype=float32)

For values exactly halfway between rounded values:

>>>x1=jnp.array([10.5,21.5,12.5,31.5])>>>jnp.round(x1)Array([10., 22., 12., 32.], dtype=float32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp