mindspore.numpy.cumprod

mindspore.numpy.cumprod(a, axis=None, dtype=None)[源代码]

Returns the cumulative product of elements along a given axis.

说明

Numpy argument out is not supported.

参数
  • a (Union[int, float, bool, list, tuple, Tensor]) – Input tensor.

  • axis (int, optional) – Axis along which the cumulative product is computed. By default the input is flattened. Default: None.

  • dtype (mindspore.dtype, optional) – Default: None. Overrides the dtype of the output Tensor.

返回

Tensor.

异常
  • TypeError – If the input can not be converted to tensor or axis is not integer.

  • ValueError – If axis is out of range.

Supported Platforms:

Ascend GPU

样例

>>> import mindspore.numpy as np
>>> x = np.array([1, 2, 3])
>>> print(np.cumprod(x))
[1 2 6]