Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.trunc

Contents

jax.numpy.trunc#

jax.numpy.trunc(x)[source]#

Round input to the nearest integer towards zero.

JAX implementation ofnumpy.trunc().

Parameters:

x (ArrayLike) – input array or scalar.

Returns:

An array with same shape and dtype asx containing the rounded values.

Return type:

Array

See also

Examples

>>>key=jax.random.key(42)>>>x=jax.random.uniform(key,(3,3),minval=-10,maxval=10)>>>withjnp.printoptions(precision=2,suppress=True):...print(x)[[-0.23  3.6   2.33] [ 1.22 -0.99  1.72] [-8.5   5.5   3.98]]>>>jnp.trunc(x)Array([[-0.,  3.,  2.],       [ 1., -0.,  1.],       [-8.,  5.,  3.]], dtype=float32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp