mindspore.mint.cumprod

View Source On Gitee
mindspore.mint.cumprod(input, dim, dtype=None)[source]

Return the cumulative product along the given dimension of the tensor.

yi=x1x2x3...xi
Parameters
  • input (Tensor) – The input tensor.

  • dim (int) – Specify the dimension for computation.

  • dtype (mindspore.dtype, optional) – The data type returned. Default None .

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> input = mindspore.tensor([[1, 2, 3],
...                           [4, 5, 6]])
>>> mindspore.mint.cumprod(input, dim=0)
Tensor(shape=[2, 3], dtype=Int64, value=
[[ 1,  2,  3],
 [ 4, 10, 18]])
>>> mindspore.mint.cumprod(input, dim=1)
Tensor(shape=[2, 3], dtype=Int64, value=
[[  1,   2,   6],
 [  4,  20, 120]])