| Files | Last commit | Last update |
|---|---|---|
| 27 days ago | ||
| 2 months ago | ||
| 16 days ago | ||
| 16 days ago | ||
| 16 days ago | ||
| 21 days ago | ||
| 13 days ago | ||
| 14 days ago |
SquareSumAll
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: computes the sum of squares of all elements of the two input tensors
x1andx2that have the same shape, and outputs two scalarsy1andy2. -
Computation formula:
y1=∑i=0N−1x1,i2,y2=∑i=0N−1x2,i2y_1=\sum_{i=0}^{N-1}x_{1,i}^{2},\qquad y_2=\sum_{i=0}^{N-1}x_{2,i}^{2}
Here, NN is the total number of elements in the input tensor.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x1 | Input | Denotes the first tensor for which the sum of squares is to be computed, corresponding to x1 in the formula. | FLOAT | FRACTAL_Z, C1HWNCoC0, NC1HWC0, ND, NCHW, NHWC |
| x2 | Input | Denotes the second tensor for which the sum of squares is to be computed, corresponding to x2 in the formula. | FLOAT | FRACTAL_Z, C1HWNCoC0, NC1HWC0, ND, NCHW, NHWC |
| y1 | Output |
|
FLOAT | FRACTAL_Z, C1HWNCoC0, NC1HWC0, ND |
| y2 | Output |
|
FLOAT | FRACTAL_Z, C1HWNCoC0, NC1HWC0, ND |
Product Difference Description
The "input format → output format" combinations in the following table apply to both x1→y1 and x2→y2, and the two input paths must use the same data format.
| Product | Static shape format combinations | Dynamic shape format combinations | Rank restrictions |
|---|---|---|---|
| Ascend 950PR&950DT products | ND→ND, NCHW→ND, NHWC→ND | ND→ND, NCHW→ND, NHWC→ND | The rank of ND inputs ranges from [0, 8]; the rank of NCHW and NHWC inputs must be 4. |
| Atlas A3 products Atlas A2 products Atlas 200I/500 A2 inference products Atlas inference products Atlas training products |
FRACTAL_Z→FRACTAL_Z, C1HWNCoC0→C1HWNCoC0, NC1HWC0→NC1HWC0, ND→ND | ND→ND | The rank of inputs ranges from [0, 8]. |
Constraint Description
-
During graph compilation,
-1denotes an unknown dimension and[-2]denotes an unknown rank; the two outputs are always rank-0 scalars. During execution, the input shape must be parsed first, and then the following non-empty, same-shape, and format constraints must be met. -
Empty tensors are not supported for x1 or x2. A rank of 0 indicates a scalar input with one element. If the rank is greater than 0, the length of each dimension must be greater than 0.
-
The execution-time rank and the length of each dimension of x1 and x2 must be exactly the same, and broadcasting is not supported. The shapes
[2, 3]and[6]are invalid even if the number of elements is the same. -
All four parameters of the operator node must use the FLOAT type, and the data formats must meet the valid combinations in the product difference description.
-
NaN, Inf, and overflow of the square of finite values propagate naturally according to FLOAT semantics. The two accumulators and the two outputs do not pollute each other; a non-finite value in
x1does not affecty2, and vice versa. -
This operator provides only GE graph-mode registration, with the build configuration set to
aclnn_exclude, and does not provide aclnn APIs.
Invocation Description
| Invocation Method | Invocation Sample | Description |
|---|---|---|
| Graph-mode invocation | test_geir_square_sum_all | Invokes the SquareSumAll operator by building a graph through the operator IR. |