oneflow.cumprod

oneflow.cumprod(input, dim)Tensor

This operator computes the cumulative product of input elements in the given dimension.

The equation is:

$$ y_{i}=x_{0}*x_{1}*…*x_{i} $$

Parameters
  • input (Tensor) – the input tensor.

  • dim (int) – the dimension to do cumsum whose valid range is [-N, N-1), and the N is tensor’s dimensions

Returns

The result tensor with cumprod result.

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> input=flow.tensor([1, 2, 3])
>>> flow.cumprod(input, dim=0)
tensor([1, 2, 6], dtype=oneflow.int64)