Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.fmod

Contents

jax.numpy.fmod#

jax.numpy.fmod(x1,x2,/)[source]#

Calculate element-wise floating-point modulo operation.

JAX implementation ofnumpy.fmod.

Parameters:
  • x1 (ArrayLike) – scalar or array. Specifies the dividend.

  • x2 (ArrayLike) – scalar or array. Specifies the divisor.x1 andx2 should eitherhave same shape or be broadcast compatible.

Returns:

An array containing the result of the element-wise floating-point modulooperation ofx1 andx2 with same sign as the elements ofx1.

Return type:

Array

Note

The result ofjnp.fmod is equivalent tox1-x2*jnp.fix(x1/x2).

See also

Examples

>>>x1=jnp.array([[3,-1,4],...[8,5,-2]])>>>x2=jnp.array([2,3,-5])>>>jnp.fmod(x1,x2)Array([[ 1, -1,  4],       [ 0,  2, -2]], dtype=int32)>>>x1-x2*jnp.fix(x1/x2)Array([[ 1., -1.,  4.],       [ 0.,  2., -2.]], dtype=float32)
Contents

[8]ページ先頭

©2009-2025 Movatter.jp