jax.numpy.cumprod — JAX documentation (original) (raw)

jax.numpy.cumprod#

jax.numpy.cumprod(a, axis=None, dtype=None, out=None)[source]#

Cumulative product of elements along an axis.

JAX implementation of numpy.cumprod().

Parameters:

Returns:

An array containing the accumulated product along the given axis.

Return type:

Array

See also

Examples

x = jnp.array([[1, 2, 3], ... [4, 5, 6]]) jnp.cumprod(x) # flattened cumulative product Array([ 1, 2, 6, 24, 120, 720], dtype=int32) jnp.cumprod(x, axis=1) # cumulative product along axis 1 Array([[ 1, 2, 6], [ 4, 20, 120]], dtype=int32)