mindspore.ops.cumprod
- mindspore.ops.cumprod(input, dim, dtype=None)[源代码]
返回tensor在指定维度上累积的元素乘积。
- 参数:
input (Tensor) - 输入tensor。
dim (int) - 指定计算维度。
dtype (
mindspore.dtype
, 可选) - 返回的数据类型。默认None
。
- 返回:
Tensor
- 支持平台:
Ascend
GPU
CPU
样例:
>>> import mindspore >>> input = mindspore.tensor([[1, 2, 3], ... [4, 5, 6]]) >>> mindspore.ops.cumprod(input, dim=0) Tensor(shape=[2, 3], dtype=Int64, value= [[ 1, 2, 3], [ 4, 10, 18]]) >>> mindspore.ops.cumprod(input, dim=1) Tensor(shape=[2, 3], dtype=Int64, value= [[ 1, 2, 6], [ 4, 20, 120]])