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

24 lines
1020 B
ReStructuredText
Raw Normal View History

2022-10-17 09:52:55 +08:00
mindspore.ops.cumsum
====================
.. py:function:: mindspore.ops.cumsum(x, axis, dtype=None)
2022-11-01 19:52:13 +08:00
计算输入Tensor `x` 沿轴 `axis` 的累积和。
2022-10-17 09:52:55 +08:00
.. math::
y_i = x_1 + x_2 + x_3 + ... + x_i
.. note::
目前Ascend平台上对于静态shape的场景 `x` 的数据类型暂仅支持int8、uint8、int32float32和float16对于动态shape的场景 `x` 的数据类型暂仅支持int32、float32和float16。
参数:
- **x** (Tensor) - 输入要累积和的Tensor。
2022-11-01 19:52:13 +08:00
- **axis** (int) - 累积和计算的轴。
2022-10-17 09:52:55 +08:00
- **dtype** (:class:`mindspore.dtype`, optional) - 输出数据类型。如果不为None则输入会转化为 `dtype`。这有利于防止数值溢出。如果为None则输出和输入的数据类型一致。默认值None。
返回:
2022-11-01 19:52:13 +08:00
Tensor和输入Tensor的shape相同。
2022-10-17 09:52:55 +08:00
异常:
- **TypeError** - 如果 `x` 不是Tensor。
- **ValueError** - 如果 `axis` 超出范围。