jax.numpy.modf — JAX documentation (original) (raw)
jax.numpy.modf#
jax.numpy.modf(x, /, out=None)[source]#
Return element-wise fractional and integral parts of the input array.
JAX implementation of numpy.modf.
Parameters:
- x (ArrayLike) – input array or scalar.
- out – Not used by JAX.
Returns:
An array containing the fractional and integral parts of the elements of x, promoting dtypes inexact.
Return type:
See also
- jax.numpy.divmod(): Calculates the integer quotient and remainder of
x1byx2element-wise.
Examples
jnp.modf(4.8) (Array(0.8000002, dtype=float32, weak_type=True), Array(4., dtype=float32, weak_type=True)) x = jnp.array([-3.4, -5.7, 0.6, 1.5, 2.3]) jnp.modf(x) (Array([-0.4000001 , -0.6999998 , 0.6 , 0.5 , 0.29999995], dtype=float32), Array([-3., -5., 0., 1., 2.], dtype=float32))