mindspore/docs/api/api_python/ops/mindspore.ops.CumProd.rst

28 lines
1.0 KiB
ReStructuredText
Raw Normal View History

2022-05-25 15:45:10 +08:00
mindspore.ops.CumProd
=====================
.. py:class:: mindspore.ops.CumProd(exclusive=False, reverse=False)
计算 `x` 沿着指定axis的元素累计积。
2022-06-16 17:12:08 +08:00
2022-05-25 15:45:10 +08:00
例如如果输入是长度为N的vector则输出也是长度为N的vector。其中的每一个元素为
.. math::
y_i = x_1 * x_2 * x_3 * ... * x_i
2022-07-22 14:07:38 +08:00
参数:
2022-07-25 15:09:45 +08:00
- **exclusive** (bool) - 如果为True则排除末尾元素计算元素累计积见示例。默认值False。
- **reverse** (bool) - 如果为True则沿 `axis` 反转结果。默认值False。
2022-05-25 15:45:10 +08:00
2022-07-22 14:07:38 +08:00
输入:
- **x** (Tensor[Number]) - 输入Tensorshape: :math:`(N,*)` ,其中 :math:`*` 表示任何数量的附加维度。其秩应小于8。
- **axis** (int) - 沿此方向计算累计积。仅支持常量值。
2022-05-25 15:45:10 +08:00
2022-07-22 14:07:38 +08:00
输出:
Tensorshape和数据类型与 `x` 相同。
2022-05-25 15:45:10 +08:00
2022-07-22 14:07:38 +08:00
异常:
- **TypeError** - `exclusive``reverse` 不是bool类型。
- **TypeError** - `axis` 不是int。
- **ValueError** - `axis` 不是None。