FilesLast commitLast update
9 days ago
2 months ago
3 months ago
2 months ago
10 months ago
6 days ago
9 days ago
2 months ago
9 days ago
6 days ago
1 month ago
13 days ago
README

Cumsum

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products √
Atlas inference products √
Atlas training products √

Function Description

  • Operator function: accumulates the elements of the input tensor self in sequence along the specified dimension dim and saves the result to the output tensor out.
  • Computation formula: x_ix\_{i} is an element in the input tensor self from the perspective of dimension dim (the subscripts of other dimensions remain unchanged, and only the subscript of the dim dimension increases in sequence), y_iy\_{i} is the element at the corresponding position in the output tensor out, then:

yi=x1+x2+x3+......+xiy_{i} = x_{1} + x_{2} + x_{3} + ...... + x_{i}

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input Tensor. INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, UINT64
FLOAT16, FLOAT, DOUBLE, COMPLEX64, COMPLEX128
ND
axis Input The dimension along which elements are accumulated in sequence. INT32, INT64 ND
exclusive Attribute The default value is false, indicating an inclusive cumsum, where the first output element is the same as the first input element;
true indicates an exclusive cumsum, where the first output element is 0 and subsequent elements are the prefix sums of the input.
BOOL -
reverse Attribute The default value is false, indicating that the cumulative sum is computed from the beginning to the end of the tensor (forward computation);
true indicates that the cumulative sum is computed from the end to the beginning of the tensor (backward computation).
BOOL -
y Output The output Tensor after accumulation along the specified dimension. Same as input Tensor x ND

Constraint Description

  • None.

Invocation Description

Invocation Method Sample Code Description
aclnn invocation test_aclnn_cumsum_v2 Invokes the cumsum operator through the aclnnCumsumV2 API.
Graph-mode invocation test_geir_cumsum Invokes the cumsum operator by building a graph through the operator IR.