FilesLast commitLast update
17 days ago
1 month ago
20 days ago
20 days ago
20 days ago
20 days ago
9 days ago
6 days ago
5 months ago
20 days ago
10 days ago
README

AccumulateNV2

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: returns the sum of each input tensor in the input tensors list by adding them in sequence. AccumulateNv2 performs the same computation as AddN, but does not wait for all inputs to be ready before starting the summation, which saves memory when inputs become ready at different times.

  • Computation formula:

y=∑i=0N−1xiy = \sum_{i=0}^{N-1} x_i

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input The list of input tensors to be summed, which is x_i in the formula. In graph-mode direct connection, the shapes of all inputs must be exactly the same (the operator itself does not support broadcast). When the operator is invoked through the aclnnSum API, the shapes of tensors can be different, and the API layer completes the alignment. FLOAT16, FLOAT, INT8, INT32, UINT8 ND
y Output The summation result tensor, which is y in the formula. FLOAT16, FLOAT, INT8, INT32, UINT8 ND
N Attribute The size of the input tensor list. N must be greater than or equal to 1 and must be consistent with the actual number of input tensors. If they are inconsistent, an error is reported during graph compilation. INT -

Constraint Description

  • When the operator is invoked through the aclnnSum API, the shapes of tensors in the input tensors list must satisfy the broadcast relationship, and the implementation layer completes the alignment. In graph-mode (GE/GEIR) direct connection, the shapes of all inputs must be exactly the same as each other and as the output y (the operator itself does not support broadcast). If the shapes are inconsistent, an error is reported during graph compilation.
  • The data types of the input tensors and the output must be the same, and the data types of tensors in the tensors list must be consistent. If they are inconsistent, an error is reported during graph compilation.
  • The number of input dimensions cannot exceed 8: the first-stage validation of the aclnnSum API intercepts the violation (ACLNN_ERR_PARAM_INVALID 161002), and in graph-mode direct connection, the tiling stage intercepts it.
  • In graph-mode (GE/GEIR) direct connection, the number of inputs must be within the range [1, 40] (intercepted at the tiling stage, and an error is reported when the limit is exceeded). The aclnnSum API internally groups and accumulates tensors in groups of 16, and is not subject to this limit.

Invocation Description

Invocation Method Invocation Sample Description
aclnn invocation test_aclnn_sum Invokes the AccumulateNV2 operator through the aclnnSum API.
Graph-mode (GEIR) accumulate_nv2_proto.h Invoked in a GE graph through the AccumulateNV2 operator IR definition (the shapes of all inputs must be exactly the same).