CumsumOperation
Applicable Products
|
Hardware Model |
Supported |
|---|---|
|
Atlas 350 accelerator cards |
x |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Description
Returns the cumulative sum along the given axes.
Input:
- Array: The input of cumsum can be a multidimensional array.
- Axis: You can select an axis (dimension) along which the cumulative sum operation is performed. By default, for a one-dimensional array, the cumulative sum is calculated backwards from the first element (including the element itself by default). For a multi-dimensional array, specify the axis along which the cumulative sum is performed.
Output:
- Result of cumulative sum: The shape of the output is the same as that of the input. For each element, the sum includes the element and all previous elements.
Formula
If the input is a one-dimensional tensor of size N, the output is also a one-dimensional tensor of size N, where the values of the elements are:

Definition
1 2 3 4 5 6 |
struct CumsumParam { SVector<int64_t> axes; bool exclusive = false; bool reverse = false; uint8_t rsv[14] = {0}; }; |
Parameters
|
Member |
Type |
Default Value |
Description |
|---|---|---|---|
|
axes |
SVector<int64_t> |
- |
Calculates the accumulated sum along a specified axis (dimension). Only one axis index can be included. The value of axes must be less than the number of dimensions of the input x. |
|
exclusive |
bool |
false |
Sequence number of the element from which the accumulation on an axis starts. The default value is false.
|
|
reverse |
bool |
false |
Forward accumulation or reverse accumulation. The default value is false.
|
|
rsv[14] |
uint8_t |
{0} |
Reserved |
Input
|
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
|
x |
[dim_0, dim_1, ..., dim_n] |
float16/bf16 |
ND |
Input tensor |
Output
|
Parameter |
Dimension |
Data Type |
Format |
Description |
|---|---|---|---|---|
|
y |
[dim_0, dim_1, ..., dim_n] |
float16/bf16 |
ND |
Output tensor. |
Constraints
- The size of the axes array must be 1.
- The value of reverse must be false.
- The value of exclusive must be false.