Merged
fix(foreach): 8个issue批量修复——错误码表对齐161002、out shape约束、列表长度错误码、资料修正、UT补齐 #13610
fix(foreach): 8个issue批量修复——错误码表对齐161002、out shape约束、列表长度错误码、资料修正、UT补齐 #13610
Merged
Tian_1122Add on 18 days ago
Total: 25 files changed+321-102
@@ -118,7 +118,7 @@ aclnnStatus aclnnForeachAddList(
118 <td>out(aclTensorList*)</td>118 <td>out(aclTensorList*)</td>
119 <td>输出</td>119 <td>输出</td>
120 <td>表示加法运算的输出张量列表。对应公式中的`y`。</td>120 <td>表示加法运算的输出张量列表。对应公式中的`y`。</td>
121- <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型和数据格式与入参`x1`的数据类型和数据格式一致,shape size大于等于入参`x1`的shape size。</li></ul></td>121+ <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型和数据格式与入参`x1`的数据类型和数据格式一致,shape与入参`x1`一致。</li></ul></td>
122 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>122 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>
123 <td>ND</td>123 <td>ND</td>
124 <td>0-8</td>124 <td>0-8</td>
@@ -172,16 +172,14 @@ aclnnStatus aclnnForeachAddList(
172 <td>传入的x1、x2、alpha、out是空指针。</td>172 <td>传入的x1、x2、alpha、out是空指针。</td>
173 </tr>173 </tr>
174 <tr>174 <tr>
175- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>175+ <td rowspan="5">ACLNN_ERR_PARAM_INVALID</td>
176- <td rowspan="2">161002</td>176+ <td rowspan="5">161002</td>
177 <td>x1、x2、alpha、out的数据类型不在支持的范围之内。</td>177 <td>x1、x2、alpha、out的数据类型不在支持的范围之内。</td>
178 </tr>178 </tr>
179 <tr>179 <tr>
180 <td>x1、x2、out的数据类型不一致。</td>180 <td>x1、x2、out的数据类型不一致。</td>
181 </tr>181 </tr>
182 <tr>182 <tr>
183- <td rowspan="4">ACLNN_ERR_INNER_TILING_ERROR</td>
184- <td rowspan="4">561002</td>
185 <td>x1、x2、out的shape不满足约束。</td>183 <td>x1、x2、out的shape不满足约束。</td>
186 </tr>184 </tr>
187 <tr>185 <tr>
@@ -191,6 +189,8 @@ aclnnStatus aclnnForeachAddList(
191 <td>x1、x2或out中的Tensor维度超过8维。</td>189 <td>x1、x2或out中的Tensor维度超过8维。</td>
192 </tr>190 </tr>
193 <tr>191 <tr>
192+ <td>ACLNN_ERR_INNER_TILING_ERROR</td>
193+ <td>561002</td>
194 <td>alpha元素个数不为1。</td>194 <td>alpha元素个数不为1。</td>
195 </tr>195 </tr>
196 </tbody></table>196 </tbody></table>
@@ -87,7 +87,7 @@ aclnnStatus aclnnForeachAddListV2(
87 <td>x1(aclTensorList*)</td>87 <td>x1(aclTensorList*)</td>
88 <td>输入</td>88 <td>输入</td>
89 <td>表示加法运算的第一个输入张量列表。公式中的`x1`。</td>89 <td>表示加法运算的第一个输入张量列表。公式中的`x1`。</td>
90- <td><ul><li>不支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li></ul></td>90+ <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li></ul></td>
91 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>91 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>
92 <td>ND</td>92 <td>ND</td>
93 <td>0-8</td>93 <td>0-8</td>
@@ -97,7 +97,7 @@ aclnnStatus aclnnForeachAddListV2(
97 <td>x2(aclTensorList*)</td>97 <td>x2(aclTensorList*)</td>
98 <td>输入</td>98 <td>输入</td>
99 <td>表示加法运算的第二个输入张量列表。对应公式中的`x2`。</td>99 <td>表示加法运算的第二个输入张量列表。对应公式中的`x2`。</td>
100- <td><ul><li>不支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型、数据格式和shape与入参`x1`一致。</li></ul></td>100+ <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型、数据格式和shape与入参`x1`一致。</li></ul></td>
101 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>101 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>
102 <td>ND</td>102 <td>ND</td>
103 <td>0-8</td>103 <td>0-8</td>
@@ -117,7 +117,7 @@ aclnnStatus aclnnForeachAddListV2(
117 <td>out(aclTensorList*)</td>117 <td>out(aclTensorList*)</td>
118 <td>输出</td>118 <td>输出</td>
119 <td>表示加法运算的输出张量列表。对应公式中的`y`。</td>119 <td>表示加法运算的输出张量列表。对应公式中的`y`。</td>
120- <td><ul><li>不支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型和数据格式与入参`x1`的数据类型和数据格式一致,shape size大于等于入参`x1`的shape size。</li></ul></td>120+ <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型和数据格式与入参`x1`的数据类型和数据格式一致,shape与入参`x1`一致。</li></ul></td>
121 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>121 <td>FLOAT32、FLOAT16、BFLOAT16、INT32、INT16、INT8、UINT8</td>
122 <td>ND</td>122 <td>ND</td>
123 <td>0-8</td>123 <td>0-8</td>
@@ -89,7 +89,7 @@ aclnnStatus aclnnForeachAddListV2(
89 <td>x1 (aclTensorList*)</td>89 <td>x1 (aclTensorList*)</td>
90 <td>Input</td>90 <td>Input</td>
91 <td>Indicates the first input tensor list of the addition operation. `x1` in the formula.</td>91 <td>Indicates the first input tensor list of the addition operation. `x1` in the formula.</td>
92- <td><ul><li>Does not support empty tensors.</li><li>All tensors in this parameter must have the same data type.</li></ul></td>92+ <td><ul><li>Supports empty tensors.</li><li>All tensors in this parameter must have the same data type.</li></ul></td>
93 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>93 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>
94 <td>ND</td>94 <td>ND</td>
95 <td>0-8</td>95 <td>0-8</td>
@@ -99,7 +99,7 @@ aclnnStatus aclnnForeachAddListV2(
99 <td>x2 (aclTensorList*)</td>99 <td>x2 (aclTensorList*)</td>
100 <td>Input</td>100 <td>Input</td>
101 <td>Indicates the second input tensor list of the addition operation. `x2` in the corresponding formula.</td>101 <td>Indicates the second input tensor list of the addition operation. `x2` in the corresponding formula.</td>
102- <td><ul><li>Does not support empty tensors.</li><li>All tensors in this parameter must have the same data type.</li><li>The data type, data format, and shape are the same as those of input `x1`.</li></ul></td>102+ <td><ul><li>Supports empty tensors.</li><li>All tensors in this parameter must have the same data type.</li><li>The data type, data format, and shape are the same as those of input `x1`.</li></ul></td>
103 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>103 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>
104 <td>ND</td>104 <td>ND</td>
105 <td>0-8</td>105 <td>0-8</td>
@@ -119,7 +119,7 @@ aclnnStatus aclnnForeachAddListV2(
119 <td>out (aclTensorList*)</td>119 <td>out (aclTensorList*)</td>
120 <td>Output</td>120 <td>Output</td>
121 <td>Output tensor list that represents addition. Corresponds to `y` in the corresponding formula.</td>121 <td>Output tensor list that represents addition. Corresponds to `y` in the corresponding formula.</td>
122- <td><ul><li>Does not support empty tensors.</li><li>All tensors in this parameter have the same data type.</li><li>The data type and data format must be the same as those of input `x1`, and the shape size must be greater than or equal to that of input `x1`.</li></ul></td>122+ <td><ul><li>Supports empty tensors.</li><li>All tensors in this parameter have the same data type.</li><li>The data type and data format must be the same as those of input `x1`, and the shape is the same as that of input `x1`.</li></ul></td>
123 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>123 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>
124 <td>ND</td>124 <td>ND</td>
125 <td>0-8</td>125 <td>0-8</td>
@@ -120,7 +120,7 @@ aclnnStatus aclnnForeachAddList(
120 <td>out (aclTensorList*)</td>120 <td>out (aclTensorList*)</td>
121 <td>Output</td>121 <td>Output</td>
122 <td>Output tensor list that represents the addition operation. It corresponds to `y` in the formula.</td>122 <td>Output tensor list that represents the addition operation. It corresponds to `y` in the formula.</td>
123- <td><ul><li>Supports empty tensors.</li><li>All tensors in this parameter have the same data type.</li><li>The data type and data format are the same as those of input parameter `x1`, and the shape size is greater than or equal to that of input parameter `x1`.</li></ul></td>123+ <td><ul><li>Supports empty tensors.</li><li>All tensors in this parameter have the same data type.</li><li>The data type and data format are the same as those of input parameter `x1`, and the shape is the same as that of input parameter `x1`.</li></ul></td>
124 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>124 <td>FLOAT32, FLOAT16, BFLOAT16, INT32, INT16, INT8, UINT8</td>
125 <td>ND</td>125 <td>ND</td>
126 <td>0-8</td>126 <td>0-8</td>
@@ -174,16 +174,14 @@ aclnnStatus aclnnForeachAddList(
174 <td>x1, x2, alpha, or out is a null pointer.</td>174 <td>x1, x2, alpha, or out is a null pointer.</td>
175 </tr>175 </tr>
176 <tr>176 <tr>
177- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>177+ <td rowspan="5">ACLNN_ERR_PARAM_INVALID</td>
178- <td rowspan="2">161002</td>178+ <td rowspan="5">161002</td>
179 <td>The data type of x1, x2, alpha, or out is not supported.</td>179 <td>The data type of x1, x2, alpha, or out is not supported.</td>
180 </tr>180 </tr>
181 <tr>181 <tr>
182 <td>The data types of x1, x2, and out are inconsistent.</td>182 <td>The data types of x1, x2, and out are inconsistent.</td>
183 </tr>183 </tr>
184 <tr>184 <tr>
185- <td rowspan="4">ACLNN_ERR_INNER_TILING_ERROR</td>
186- <td rowspan="4">561002</td>
187 <td>The shapes of x1, x2, and out do not meet the constraints.</td>185 <td>The shapes of x1, x2, and out do not meet the constraints.</td>
188 </tr>186 </tr>
189 <tr>187 <tr>
@@ -193,6 +191,8 @@ aclnnStatus aclnnForeachAddList(
193 <td>The dimensions of Tensors in x1, x2, or out exceed 8.</td>191 <td>The dimensions of Tensors in x1, x2, or out exceed 8.</td>
194 </tr>192 </tr>
195 <tr>193 <tr>
194+ <td>ACLNN_ERR_INNER_TILING_ERROR</td>
195+ <td>561002</td>
196 <td>The number of alpha elements is not 1.</td>196 <td>The number of alpha elements is not 1.</td>
197 </tr>197 </tr>
198 </tbody></table>198 </tbody></table>
@@ -31,13 +31,13 @@ extern "C" {
31 * @domain aclnnop_math31 * @domain aclnnop_math
32 * 参数描述:32 * 参数描述:
33 * @param [in] x133 * @param [in] x1
34- * 输入Tensor,数据类型支持FLOAT,FLOAT16,BFLOAT16,INT32。数据格式支持ND。34+ * 输入Tensor,数据类型支持FLOAT,FLOAT16,BFLOAT16,INT32,INT16,INT8,UINT8。数据格式支持ND。
35 * @param [in] x235 * @param [in] x2
36- * 输入Tensor,数据类型支持FLOAT,FLOAT16,BFLOAT16,INT32。数据格式支持ND。36+ * 输入Tensor,数据类型支持FLOAT,FLOAT16,BFLOAT16,INT32,INT16,INT8,UINT8。数据格式支持ND。
37 * @param [in] alpha37 * @param [in] alpha
38- * 输入Scalar,数据类型支持FLOAT、FLOAT16和INT32。数据格式支持ND。38+ * 输入Scalar,数据类型支持FLOAT、FLOAT16、INT32、DOUBLE、INT64。数据格式支持ND。
39 * @param [in] out39 * @param [in] out
40- * 输出Tensor,数据类型支持FLOAT,FLOAT16,BFLOAT16,INT32。数据格式支持ND。40+ * 输出Tensor,数据类型支持FLOAT,FLOAT16,BFLOAT16,INT32,INT16,INT8,UINT8。数据格式支持ND。
41 * @param [out] workspaceSize 返回用户需要在npu device侧申请的workspace大小。41 * @param [out] workspaceSize 返回用户需要在npu device侧申请的workspace大小。
42 * @param [out] executor 返回op执行器,包含了算子计算流程。42 * @param [out] executor 返回op执行器,包含了算子计算流程。
43 * @return aclnnStatus 返回状态码43 * @return aclnnStatus 返回状态码
@@ -213,3 +213,37 @@ TEST_F(l2_foreach_add_list_v2_test, ascend910B2_foreach_add_list_v2_test_non_con
213 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);213 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
214 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);214 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
215}215}
216+ 
217+// out 元素数大于 x1:实现要求严格同 shape,应拒绝
218+TEST_F(l2_foreach_add_list_v2_test, ascend910B2_foreach_add_list_v2_test_out_shape_larger_numel)
219+{
220+ auto alpha = ScalarDesc(1.0);
221+ auto x1 = TensorDesc({2, 3}, ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
222+ auto x2 = TensorDesc({2, 3}, ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
223+ auto out = TensorDesc({2, 4}, ACL_FLOAT, ACL_FORMAT_ND).Precision(0.001, 0.001);
224+ auto x1List = TensorListDesc({x1});
225+ auto x2List = TensorListDesc({x2});
226+ auto outList = TensorListDesc({out});
227+ 
228+ auto ut = OP_API_UT(aclnnForeachAddListV2, INPUT(x1List, x2List, alpha), OUTPUT(outList));
229+ uint64_t workspaceSize = 0;
230+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
231+ EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);
232+}
233+ 
234+// 空 Tensor:实现不拦截空 Tensor,应放行
235+TEST_F(l2_foreach_add_list_v2_test, ascend910B2_foreach_add_list_v2_test_empty_tensor)
236+{
237+ auto alpha = ScalarDesc(1.0);
238+ auto x1 = TensorDesc({0}, ACL_FLOAT, ACL_FORMAT_ND);
239+ auto x2 = TensorDesc({0}, ACL_FLOAT, ACL_FORMAT_ND);
240+ auto out = TensorDesc({0}, ACL_FLOAT, ACL_FORMAT_ND);
241+ auto x1List = TensorListDesc({x1});
242+ auto x2List = TensorListDesc({x2});
243+ auto outList = TensorListDesc({out});
244+ 
245+ auto ut = OP_API_UT(aclnnForeachAddListV2, INPUT(x1List, x2List, alpha), OUTPUT(outList));
246+ uint64_t workspaceSize = 0;
247+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
248+ EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
249+}
@@ -179,13 +179,16 @@ aclnnStatus aclnnForeachAddScalar(
179 <td>传入的x、scalar、out是空指针。</td>179 <td>传入的x、scalar、out是空指针。</td>
180 </tr>180 </tr>
181 <tr>181 <tr>
182- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>182+ <td rowspan="3">ACLNN_ERR_PARAM_INVALID</td>
183- <td rowspan="2">161002</td>183+ <td rowspan="3">161002</td>
184 <td>x、scalar、out的数据类型不在支持的范围之内。</td>184 <td>x、scalar、out的数据类型不在支持的范围之内。</td>
185 </tr>185 </tr>
186 <tr>186 <tr>
187 <td>x和out的数据类型不一致。</td>187 <td>x和out的数据类型不一致。</td>
188 </tr>188 </tr>
189+ <tr>
190+ <td>x与out的tensorList长度(包含的Tensor个数)不一致。</td>
191+ </tr>
189 <tr>192 <tr>
190 <td rowspan="4">ACLNN_ERR_INNER_TILING_ERROR</td>193 <td rowspan="4">ACLNN_ERR_INNER_TILING_ERROR</td>
191 <td rowspan="4">561002</td>194 <td rowspan="4">561002</td>
@@ -181,8 +181,6 @@ aclnnStatus aclnnForeachAddScalarV2(
181 <tr>181 <tr>
182 <td rowspan="6">ACLNN_ERR_PARAM_INVALID</td>182 <td rowspan="6">ACLNN_ERR_PARAM_INVALID</td>
183 <td rowspan="6">161002</td>183 <td rowspan="6">161002</td>
184- </tr>
185- <tr>
186 <td>x、scalar和out的数据类型不在支持的范围之内。</td>184 <td>x、scalar和out的数据类型不在支持的范围之内。</td>
187 </tr>185 </tr>
188 <tr>186 <tr>
@@ -190,12 +188,15 @@ aclnnStatus aclnnForeachAddScalarV2(
190 </tr>188 </tr>
191 <tr>189 <tr>
192 <td>x与out的shape不满足约束。</td>190 <td>x与out的shape不满足约束。</td>
191+ </tr>
193 <tr>192 <tr>
194 <td>x或out中的Tensor的数据类型不一致。</td>193 <td>x或out中的Tensor的数据类型不一致。</td>
195 </tr>194 </tr>
196 <tr>195 <tr>
197 <td>x或out中的Tensor维度超过8维。</td>196 <td>x或out中的Tensor维度超过8维。</td>
198 </tr>197 </tr>
198+ <tr>
199+ <td>x与out的tensorList长度(包含的Tensor个数)不一致。</td>
199 </tr>200 </tr>
200 </tbody></table>201 </tbody></table>
201 202 
@@ -52,7 +52,6 @@ static inline bool ForeachAddScalarCheckNotNull(const aclTensorList* self, const
52 OP_CHECK_NULL(self, return false);52 OP_CHECK_NULL(self, return false);
53 OP_CHECK_NULL(scalar, return false);53 OP_CHECK_NULL(scalar, return false);
54 OP_CHECK_NULL(out, return false);54 OP_CHECK_NULL(out, return false);
55- OP_CHECK_TENSORLIST_SIZE_EQUAL(self, out, return false);
56 return true;55 return true;
57}56}
58 57 
@@ -62,7 +62,6 @@ static inline bool ForeachAddScalarV2CheckNotNull(const aclTensorList* self, con
62 OP_CHECK_NULL(self, return false);62 OP_CHECK_NULL(self, return false);
63 OP_CHECK_NULL(scalar, return false);63 OP_CHECK_NULL(scalar, return false);
64 OP_CHECK_NULL(out, return false);64 OP_CHECK_NULL(out, return false);
65- OP_CHECK_TENSORLIST_SIZE_EQUAL(self, out, return false);
66 return true;65 return true;
67}66}
68 67 
@@ -43,3 +43,18 @@ TEST_F(l2_foreach_add_scalar_test, ascend910B2_foreach_add_scalar_test_non_conti
43 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);43 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
44 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);44 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
45}45}
46+ 
47+// x 与 out 的 tensorList 长度不一致:应返回 161002
48+TEST_F(l2_foreach_add_scalar_test, ascend910B2_foreach_add_scalar_test_list_length_mismatch)
49+{
50+ auto scalar = TensorDesc({1}, ACL_FLOAT, ACL_FORMAT_ND).ValueRange(0, 2);
51+ auto x = TensorDesc({2, 3}, ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
52+ auto out = TensorDesc({2, 3}, ACL_FLOAT, ACL_FORMAT_ND).Precision(0.001, 0.001);
53+ auto xList = TensorListDesc({x, x});
54+ auto outList = TensorListDesc({out});
55+ 
56+ auto ut = OP_API_UT(aclnnForeachAddScalar, INPUT(xList, scalar), OUTPUT(outList));
57+ uint64_t workspaceSize = 0;
58+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
59+ EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);
60+}
@@ -208,3 +208,18 @@ TEST_F(l2_foreach_add_scalar_v2_test, ascend910B2_foreach_add_scalar_v2_test_non
208 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);208 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
209 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);209 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
210}210}
211+ 
212+// x 与 out 的 tensorList 长度不一致:应返回 161002
213+TEST_F(l2_foreach_add_scalar_v2_test, ascend910B2_foreach_add_scalar_v2_test_list_length_mismatch)
214+{
215+ auto scalar_desc = ScalarDesc(1.0);
216+ auto x = TensorDesc({2, 3}, ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
217+ auto out = TensorDesc({2, 3}, ACL_FLOAT, ACL_FORMAT_ND).Precision(0.001, 0.001);
218+ auto xList = TensorListDesc({x, x});
219+ auto outList = TensorListDesc({out});
220+ 
221+ auto ut = OP_API_UT(aclnnForeachAddScalarV2, INPUT(xList, scalar_desc), OUTPUT(outList));
222+ uint64_t workspaceSize = 0;
223+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
224+ EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);
225+}
@@ -208,7 +208,7 @@ aclnnStatus aclnnForeachAddcmulScalarV2(
208 <td>x1、x2、x3、out的数据类型不一致。</td>208 <td>x1、x2、x3、out的数据类型不一致。</td>
209 </tr>209 </tr>
210 <tr>210 <tr>
211- <td>x1、x2、x3、out的shape不满足约束。</td>211+ <td>x1、x2、x3、out的shape不满足约束(含out的shape size小于x1的shape size)。</td>
212 </tr>212 </tr>
213 <tr>213 <tr>
214 <td>x1、x2、x3或out中的Tensor的元素数据类型不一致。</td>214 <td>x1、x2、x3或out中的Tensor的元素数据类型不一致。</td>
@@ -182,11 +182,24 @@ static inline bool ForeachAddcMulScalarV2CheckShape(const aclTensorList* self, c
182 // tensor 维度检查182 // tensor 维度检查
183 for (uint64_t i = 0; i < self->Size(); i++) {183 for (uint64_t i = 0; i < self->Size(); i++) {
184 OP_CHECK_MAX_DIM((*self)[i], MAX_SUPPORT_DIMS_NUMS, return false);184 OP_CHECK_MAX_DIM((*self)[i], MAX_SUPPORT_DIMS_NUMS, return false);
185+ OP_CHECK_MAX_DIM((*out)[i], MAX_SUPPORT_DIMS_NUMS, return false);
185 }186 }
186 187 
187- // self和out的shape必须一致188+ // out的元素数必须大于等于x1(文档:out的shape size大于等于入参x1的shape size)
188 for (uint64_t i = 0; i < self->Size(); i++) {189 for (uint64_t i = 0; i < self->Size(); i++) {
189- OP_CHECK_SHAPE_NOT_EQUAL((*self)[i], (*out)[i], return false);190+ const int64_t x1Size = (*self)[i]->GetViewShape().GetShapeSize();
191+ const int64_t outSize = (*out)[i]->GetViewShape().GetShapeSize();
192+ if (outSize < x1Size) {
193+ const std::string reason = ("The shape size of the " + std::to_string(i) +
194+ "th tensor in out must be greater than or equal to that of x1, but got " +
195+ std::to_string(outSize) + " and " + std::to_string(x1Size) + ".");
196+ OP_LOGE_WITHOUT_REPORT(ACLNN_ERR_PARAM_INVALID, "%s", reason.c_str());
197+ REPORT_PREDEFINED_ERR_MSG("EZ0015",
198+ (std::vector<const char*>{"param_name", "op_name", "incorrect_size", "reason"}),
199+ (std::vector<const char*>{"out", "aclnnForeachAddcmulScalarV2",
200+ (std::to_string(outSize)).c_str(), reason.c_str()}));
201+ return false;
202+ }
190 }203 }
191 return true;204 return true;
192}205}
@@ -51,7 +51,7 @@ TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_
51 EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);51 EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);
52}52}
53 53 
54-// self and out diffrent shape54+// self and out diffrent shape(out 元素数 >= x1:文档契约,应放行)
55TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_test_shape_different)55TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_test_shape_different)
56{56{
57 vector<vector<int64_t>> selfDims = {{2, 2}};57 vector<vector<int64_t>> selfDims = {{2, 2}};
@@ -69,7 +69,7 @@ TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_
69 auto ut = OP_API_UT(aclnnForeachAddcmulScalarV2, INPUT(xList, x2List, x3List, scalar_desc), OUTPUT(outList));69 auto ut = OP_API_UT(aclnnForeachAddcmulScalarV2, INPUT(xList, x2List, x3List, scalar_desc), OUTPUT(outList));
70 uint64_t workspaceSize = 0;70 uint64_t workspaceSize = 0;
71 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);71 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
72- EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);72+ EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
73}73}
74 74 
75// self and x2 diffrent shape75// self and x2 diffrent shape
@@ -215,3 +215,66 @@ TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_
215 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);215 aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
216 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);216 EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
217}217}
218+ 
219+// out 元素数大于 x1:文档要求 shape size >=,应放行
220+TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_test_out_shape_larger_numel)
221+{
222+ vector<vector<int64_t>> selfDims = {{2, 2}};
223+ auto scalar_desc = ScalarDesc(1.0);
224+ vector<vector<int64_t>> outDims = {{2, 4}};
225+ auto x = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
226+ auto x2 = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
227+ auto x3 = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
228+ auto out = TensorDesc(outDims[0], ACL_FLOAT, ACL_FORMAT_ND).Precision(0.001, 0.001);
229+ auto xList = TensorListDesc({x});
230+ auto x2List = TensorListDesc({x2});
231+ auto x3List = TensorListDesc({x3});
232+ auto outList = TensorListDesc({out});
233+ 
234+ auto ut = OP_API_UT(aclnnForeachAddcmulScalarV2, INPUT(xList, x2List, x3List, scalar_desc), OUTPUT(outList));
235+ uint64_t workspaceSize = 0;
236+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
237+ EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
238+}
239+ 
240+// out 与 x1 元素数相同但 shape 不同:文档要求 shape size >=,应放行
241+TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_test_out_shape_same_numel)
242+{
243+ vector<vector<int64_t>> selfDims = {{2, 2}};
244+ auto scalar_desc = ScalarDesc(1.0);
245+ vector<vector<int64_t>> outDims = {{4}};
246+ auto x = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
247+ auto x2 = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
248+ auto x3 = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
249+ auto out = TensorDesc(outDims[0], ACL_FLOAT, ACL_FORMAT_ND).Precision(0.001, 0.001);
250+ auto xList = TensorListDesc({x});
251+ auto x2List = TensorListDesc({x2});
252+ auto x3List = TensorListDesc({x3});
253+ auto outList = TensorListDesc({out});
254+ 
255+ auto ut = OP_API_UT(aclnnForeachAddcmulScalarV2, INPUT(xList, x2List, x3List, scalar_desc), OUTPUT(outList));
256+ uint64_t workspaceSize = 0;
257+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
258+ EXPECT_EQ(getWorkspaceResult, ACL_SUCCESS);
259+}
260+ 
261+// out 元素数小于 x1:应拒绝
262+TEST_F(l2_foreach_addcmul_scalar_v2_test, ascend910B2_foreach_addcmul_scalar_v2_test_out_shape_smaller_numel)
263+{
264+ vector<vector<int64_t>> selfDims = {{2, 4}};
265+ auto scalar_desc = ScalarDesc(1.0);
266+ vector<vector<int64_t>> outDims = {{2, 2}};
267+ auto x = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
268+ auto x2 = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
269+ auto x3 = TensorDesc(selfDims[0], ACL_FLOAT, ACL_FORMAT_ND).ValueRange(-1, 1);
270+ auto out = TensorDesc(outDims[0], ACL_FLOAT, ACL_FORMAT_ND).Precision(0.001, 0.001);
271+ auto xList = TensorListDesc({x});
272+ auto x2List = TensorListDesc({x2});
273+ auto x3List = TensorListDesc({x3});
274+ auto outList = TensorListDesc({out});
275+ 
276+ auto ut = OP_API_UT(aclnnForeachAddcmulScalarV2, INPUT(xList, x2List, x3List, scalar_desc), OUTPUT(outList));
277+ uint64_t workspaceSize = 0;
278+ aclnnStatus getWorkspaceResult = ut.TestGetWorkspaceSize(&workspaceSize);
279+ EXPECT_EQ(getWorkspaceResult, ACLNN_ERR_PARAM_INVALID);
280+}
@@ -1,12 +1,12 @@
1#!/usr/bin/env python31#!/usr/bin/env python3
2# -*- coding: utf-8 -*-2# -*- coding: utf-8 -*-
3# ----------------------------------------------------------------------------3# ----------------------------------------------------------------------------
4-# This program is free software, you can redistribute it and/or modify.4+# Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
5-# Copyright (c) 2025 Huawei Technologies Co., Ltd.5+# This program is free software, you can redistribute it and/or modify it under the terms and conditions of
6-# This file is a part of the CANN Open Software.6+# CANN Open Software License Agreement Version 2.0 (the "License").
7-# Licensed under CANN Open Software License Agreement Version 2.0 (the "License").
8# Please refer to the License for details. You may not use this file except in compliance with the License.7# Please refer to the License for details. You may not use this file except in compliance with the License.
9-# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.8+# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
9+# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10# See LICENSE in the root of the software repository for the full text of the License.10# See LICENSE in the root of the software repository for the full text of the License.
11# ----------------------------------------------------------------------------11# ----------------------------------------------------------------------------
12import sys12import sys
@@ -15,6 +15,8 @@ import numpy as np
15import re15import re
16import tensorflow as tf16import tensorflow as tf
17 17 
18+TAIL_MARKER = -999.0
19+ 
18 20 
19def parse_str_to_shape_list(shape_str):21def parse_str_to_shape_list(shape_str):
20 shape_list = []22 shape_list = []
@@ -25,44 +27,83 @@ def parse_str_to_shape_list(shape_str):
25 return shape_list27 return shape_list
26 28 
27 29 
28-def gen_data_and_golden(shape_str, scale_value=2.0, d_type="float32"):30+def gen_data_and_golden(
31+ shape_str, scale_value=2.0, d_type="float32", out_shape_str=None
32+):
29 d_type_dict = {33 d_type_dict = {
30 "float32": np.float32,34 "float32": np.float32,
31 "float16": np.float16,35 "float16": np.float16,
32 "int32": np.int32,36 "int32": np.int32,
33- "bfloat16_t": tf.bfloat16.as_numpy_dtype37+ "bfloat16_t": tf.bfloat16.as_numpy_dtype,
34 }38 }
35 np_type = d_type_dict[d_type]39 np_type = d_type_dict[d_type]
36 shape_list = parse_str_to_shape_list(shape_str)40 shape_list = parse_str_to_shape_list(shape_str)
41+ out_shape_list = (
42+ parse_str_to_shape_list(out_shape_str) if out_shape_str is not None else None
43+ )
37 if d_type == "bfloat16_t":44 if d_type == "bfloat16_t":
38- scalars = np.array([scale_value for i in range(len(shape_list))]).astype(np.float32)45+ scalars = np.array([scale_value for i in range(len(shape_list))]).astype(
46+ np.float32
47+ )
39 else:48 else:
40- scalars = np.array([scale_value for i in range(len(shape_list))]).astype(np_type)49+ scalars = np.array([scale_value for i in range(len(shape_list))]).astype(
50+ np_type
51+ )
41 for index, shape in enumerate(shape_list):52 for index, shape in enumerate(shape_list):
42- tmp_input = np.ones(shape)*1053+ tmp_input = np.ones(shape) * 10
43 tmp_input = tmp_input.astype(np_type)54 tmp_input = tmp_input.astype(np_type)
44- tmp_tensor1 = np.ones(shape)*1055+ tmp_tensor1 = np.ones(shape) * 10
45 tmp_tensor1 = tmp_tensor1.astype(np_type)56 tmp_tensor1 = tmp_tensor1.astype(np_type)
46- tmp_tensor2 = np.ones(shape)*1057+ tmp_tensor2 = np.ones(shape) * 10
47 tmp_tensor2 = tmp_tensor2.astype(np_type)58 tmp_tensor2 = tmp_tensor2.astype(np_type)
48- tmp_golden = np.ones(shape)*1059+ tmp_golden = np.ones(shape) * 10
49 tmp_golden = tmp_golden.astype(np_type)60 tmp_golden = tmp_golden.astype(np_type)
50 61 
51 for i in range(len(tmp_golden)):62 for i in range(len(tmp_golden)):
52- tmp_golden[i] = tmp_input[i] + tmp_tensor1[i] * tmp_tensor2[i] * scalars[index]63+ tmp_golden[i] = (
53- 64+ tmp_input[i] + tmp_tensor1[i] * tmp_tensor2[i] * scalars[index]
65+ )
66+ 
67+ if out_shape_list is not None:
68+ # out 元素数大于 x1 的场景:golden 覆盖 out 全长(前 x1 numel 为计算值,尾部为标记值),
69+ # 另生成 outinit 文件(全长标记值)作为 out 的初始内存——kernel 只应写前 x1 numel 个元素
70+ out_numel = int(np.prod(out_shape_list[index]))
71+ x_numel = int(np.prod(shape))
72+ tmp_out_init = np.full((out_numel,), TAIL_MARKER, dtype=np_type)
73+ tmp_golden = np.full((out_numel,), TAIL_MARKER, dtype=np_type)
74+ # 用 flat 索引逐元素取值,兼容输入为多维 shape(如 {4,6})的场景
75+ tmp_input_flat = tmp_input.flatten()
76+ tmp_tensor1_flat = tmp_tensor1.flatten()
77+ tmp_tensor2_flat = tmp_tensor2.flatten()
78+ for i in range(x_numel):
79+ tmp_golden[i] = (
80+ tmp_input_flat[i]
81+ + tmp_tensor1_flat[i] * tmp_tensor2_flat[i] * scalars[index]
82+ )
83+ 
54 tmp_golden = tmp_golden.astype(np_type)84 tmp_golden = tmp_golden.astype(np_type)
55 85 
56 tmp_input.astype(np_type).tofile(f"{d_type}_input_t_foreach_addcmul{index}.bin")86 tmp_input.astype(np_type).tofile(f"{d_type}_input_t_foreach_addcmul{index}.bin")
57- tmp_tensor1.astype(np_type).tofile(f"{d_type}_tensor1_t_foreach_addcmul{index}.bin")87+ tmp_tensor1.astype(np_type).tofile(
58- tmp_tensor2.astype(np_type).tofile(f"{d_type}_tensor2_t_foreach_addcmul{index}.bin")88+ f"{d_type}_tensor1_t_foreach_addcmul{index}.bin"
59- tmp_golden.astype(np_type).tofile(f"{d_type}_golden_t_foreach_addcmul{index}.bin")89+ )
90+ tmp_tensor2.astype(np_type).tofile(
91+ f"{d_type}_tensor2_t_foreach_addcmul{index}.bin"
92+ )
93+ tmp_golden.astype(np_type).tofile(
94+ f"{d_type}_golden_t_foreach_addcmul{index}.bin"
95+ )
96+ if out_shape_list is not None:
97+ tmp_out_init.astype(np_type).tofile(
98+ f"{d_type}_outinit_t_foreach_addcmul{index}.bin"
99+ )
60 100 
61 101 
62if __name__ == "__main__":102if __name__ == "__main__":
63- if len(sys.argv) != 4:103+ if len(sys.argv) not in (4, 5):
64- print("Param num must be 4.")104+ print("Param num must be 4 or 5 (with optional out_shape).")
65 exit(1)105 exit(1)
66 # 清理bin文件106 # 清理bin文件
67 os.system("rm -rf *.bin")107 os.system("rm -rf *.bin")
68- gen_data_and_golden(sys.argv[1], sys.argv[2], sys.argv[3])108+ out_shape_str = sys.argv[4] if len(sys.argv) == 5 else None
109+ gen_data_and_golden(sys.argv[1], sys.argv[2], sys.argv[3], out_shape_str)
@@ -1,12 +1,11 @@
1/**1/**
2- * This program is free software, you can redistribute it and/or modify.2+ * Copyright (c) 2025-2026 Huawei Technologies Co., Ltd.
3- * Copyright (c) 2025 Huawei Technologies Co., Ltd.3+ * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4- * This file is a part of the CANN Open Software.4+ * CANN Open Software License Agreement Version 2.0 (the "License").
5- * Licensed under CANN Open Software License Agreement Version 2.0 (the "License").
6 * Please refer to the License for details. You may not use this file except in compliance with the License.5 * Please refer to the License for details. You may not use this file except in compliance with the License.
7- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING6+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8- * BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. See LICENSE in the root of7+ * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
9- * the software repository for the full text of the License.8+ * See LICENSE in the root of the software repository for the full text of the License.
10 */9 */
11 10 
12/*!11/*!
@@ -193,3 +192,45 @@ TEST_F(foreach_addcmul_scalar_test, test_case_bfloat16_4)
193 192 
194 system("cd ./addcmul_scalar_data/ && python3 compare_data.py 'bfloat16_t'");193 system("cd ./addcmul_scalar_data/ && python3 compare_data.py 'bfloat16_t'");
195}194}
195+ 
196+// out 元素数大于 x1(numel 32 >= 24)的执行级用例:验证 kernel 只写前 x1 numel 个元素、out 尾部保持初始值
197+TEST_F(foreach_addcmul_scalar_test, test_case_out_larger)
198+{
199+ std::vector<std::vector<uint64_t>> shapeInfos = {{4, 6}};
200+ std::vector<std::vector<uint64_t>> outShapeInfos = {{32}};
201+ system("cp -rf "
202+ "../../../../foreach/foreach_addcmul_scalar/tests/ut/op_kernel/addcmul_scalar_data ./");
203+ system("chmod -R 755 ./addcmul_scalar_data/");
204+ system("cd ./addcmul_scalar_data/ && python3 gen_data.py '{{4, 6}}' 3 'float32' '{32}'");
205+ AscendC::SetKernelMode(KernelMode::AIV_MODE);
206+ uint32_t blockDim = 1;
207+ size_t sysWorkspaceSize = 16 * 1024 * 1024;
208+ uint8_t* workspace = (uint8_t*)AscendC::GmAlloc(sysWorkspaceSize);
209+ size_t tilingSize = sizeof(ForeachCommonTilingData);
210+ uint8_t* tiling = (uint8_t*)AscendC::GmAlloc(tilingSize);
211+ 
212+ optiling::ForeachCommonTiling tilingFuncObj;
213+ tilingFuncObj.Init(shapeInfos, 1, 4);
214+ tilingFuncObj.RunBigKernelTiling(blockDim);
215+ tilingFuncObj.FillTilingData(reinterpret_cast<ForeachCommonTilingData*>(tiling));
216+ 
217+ uint8_t* x1 = CreateTensorListForeachAddcmulScalar<float>(shapeInfos, "float32", "input");
218+ uint8_t* tensor1 = CreateTensorListForeachAddcmulScalar<float>(shapeInfos, "float32", "tensor1");
219+ uint8_t* tensor2 = CreateTensorListForeachAddcmulScalar<float>(shapeInfos, "float32", "tensor2");
220+ uint8_t* out = CreateTensorListForeachAddcmulScalar<float>(outShapeInfos, "float32", "outinit");
221+ uint8_t* scalar = (uint8_t*)AscendC::GmAlloc(sizeof(float));
222+ *((float*)scalar) = 3;
223+ 
224+ ICPU_SET_TILING_KEY(2);
225+ ICPU_RUN_KF(foreach_addcmul_scalar, blockDim, x1, tensor1, tensor2, scalar, out, workspace, tiling);
226+ 
227+ FreeTensorListForeachAddcmulScalar<float>(out, outShapeInfos, "float32");
228+ AscendC::GmFree((void*)x1);
229+ AscendC::GmFree((void*)scalar);
230+ AscendC::GmFree((void*)tensor1);
231+ AscendC::GmFree((void*)tensor2);
232+ AscendC::GmFree((void*)workspace);
233+ AscendC::GmFree((void*)tiling);
234+ 
235+ system("cd ./addcmul_scalar_data/ && python3 compare_data.py 'float32'");
236+}
@@ -149,8 +149,8 @@ aclnnStatus aclnnForeachAsin(
149 <td>传入的x或out是空指针。</td>149 <td>传入的x或out是空指针。</td>
150 </tr>150 </tr>
151 <tr>151 <tr>
152- <td rowspan="6">ACLNN_ERR_PARAM_INVALID</td>152+ <td rowspan="7">ACLNN_ERR_PARAM_INVALID</td>
153- <td rowspan="6">161002</td>153+ <td rowspan="7">161002</td>
154 <td>x或out的数据类型不在支持的范围之内。</td>154 <td>x或out的数据类型不在支持的范围之内。</td>
155 </tr>155 </tr>
156 <tr>156 <tr>
@@ -169,8 +169,6 @@ aclnnStatus aclnnForeachAsin(
169 <td>x与out中对应位置的Tensor的shape不一致。</td>169 <td>x与out中对应位置的Tensor的shape不一致。</td>
170 </tr>170 </tr>
171 <tr>171 <tr>
172- <td>ACLNN_ERR_INNER_TILING_ERROR</td>
173- <td>561002</td>
174 <td>x或out中单个Tensor列表的Tensor数量超过256。</td>172 <td>x或out中单个Tensor列表的Tensor数量超过256。</td>
175 </tr>173 </tr>
176 </tbody></table>174 </tbody></table>
@@ -151,24 +151,24 @@ aclnnStatus aclnnForeachAsin(
151 <td>x or out is a null pointer.</td>151 <td>x or out is a null pointer.</td>
152 </tr>152 </tr>
153 <tr>153 <tr>
154- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>154+ <td rowspan="3">ACLNN_ERR_PARAM_INVALID</td>
155- <td rowspan="2">161002</td>155+ <td rowspan="3">161002</td>
156 <td>The data type of x or out is not supported.</td>156 <td>The data type of x or out is not supported.</td>
157 </tr>157 </tr>
158 <tr>158 <tr>
159 <td>The data types of x and out are inconsistent.</td>159 <td>The data types of x and out are inconsistent.</td>
160 </tr>160 </tr>
161 <tr>161 <tr>
162- <td rowspan="3">ACLNN_ERR_INNER_TILING_ERROR</td>162+ <td>The dimensions of the tensors in x or out exceed 8.</td>
163- <td rowspan="3">561002</td>163+ </tr>
164+ <tr>
165+ <td rowspan="2">ACLNN_ERR_INNER_TILING_ERROR</td>
166+ <td rowspan="2">561002</td>
164 <td>The shapes of x and out do not meet the constraints.</td>167 <td>The shapes of x and out do not meet the constraints.</td>
165 </tr>168 </tr>
166 <tr>169 <tr>
167 <td>The data types of the tensors in x or out are inconsistent.</td>170 <td>The data types of the tensors in x or out are inconsistent.</td>
168 </tr>171 </tr>
169- <tr>
170- <td>The dimensions of the tensors in x or out exceed 8.</td>
171- </tr>
172 </tbody></table>172 </tbody></table>
173 173 
174## aclnnForeachAsin174## aclnnForeachAsin
@@ -149,24 +149,24 @@ aclnnStatus aclnnForeachAtan(
149 <td>传入的x或out是空指针。</td>149 <td>传入的x或out是空指针。</td>
150 </tr>150 </tr>
151 <tr>151 <tr>
152- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>152+ <td rowspan="3">ACLNN_ERR_PARAM_INVALID</td>
153- <td rowspan="2">161002</td>153+ <td rowspan="3">161002</td>
154 <td>x或out的数据类型不在支持的范围之内。</td>154 <td>x或out的数据类型不在支持的范围之内。</td>
155 </tr>155 </tr>
156 <tr>156 <tr>
157 <td>x和out的数据类型不一致。</td>157 <td>x和out的数据类型不一致。</td>
158 </tr>158 </tr>
159 <tr>159 <tr>
160- <td rowspan="3">ACLNN_ERR_INNER_TILING_ERROR</td>160+ <td>x或out中的Tensor维度超过8维。</td>
161- <td rowspan="3">561002</td>161+ </tr>
162+ <tr>
163+ <td rowspan="2">ACLNN_ERR_INNER_TILING_ERROR</td>
164+ <td rowspan="2">561002</td>
162 <td>x与out的shape不满足约束。</td>165 <td>x与out的shape不满足约束。</td>
163 </tr>166 </tr>
164 <tr>167 <tr>
165 <td>x或out中的Tensor的数据类型不一致。</td>168 <td>x或out中的Tensor的数据类型不一致。</td>
166 </tr>169 </tr>
167- <tr>
168- <td>x或out中的Tensor维度超过8维。</td>
169- </tr>
170 </tbody></table>170 </tbody></table>
171 171 
172## aclnnForeachAtan172## aclnnForeachAtan
@@ -151,25 +151,26 @@ aclnnStatus aclnnForeachAtan(
151 <td>x or out is a null pointer.</td>151 <td>x or out is a null pointer.</td>
152 </tr>152 </tr>
153 <tr>153 <tr>
154- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>154+ <td rowspan="3">ACLNN_ERR_PARAM_INVALID</td>
155- <td rowspan="2">161002</td>155+ <td rowspan="3">161002</td>
156 <td>The data type of x or out is not in the supported range.</td>156 <td>The data type of x or out is not in the supported range.</td>
157 </tr>157 </tr>
158 <tr>158 <tr>
159 <td>The data types of x and out are inconsistent.</td>159 <td>The data types of x and out are inconsistent.</td>
160 </tr>160 </tr>
161 <tr>161 <tr>
162- <td rowspan="3">ACLNN_ERR_INNER_TILING_ERROR</td>162+ <td>The dimensions of tensors in x or out exceed 8.</td>
163- <td rowspan="3">561002</td>163+ </tr>
164+ <tr>
165+ <td rowspan="2">ACLNN_ERR_INNER_TILING_ERROR</td>
166+ <td rowspan="2">561002</td>
164 <td>The shapes of x and out do not meet the constraints.</td>167 <td>The shapes of x and out do not meet the constraints.</td>
165 </tr>168 </tr>
166 <tr>169 <tr>
167 <td>The data types of Tensors in x or out are inconsistent.</td>170 <td>The data types of Tensors in x or out are inconsistent.</td>
168 </tr>171 </tr>
169 <tr>172 <tr>
170- <td>The dimensions of Tensors in x or out exceed 8.</td>173+ </tbody></table>
171- </tr>
172- </tbody></table>
173 174 
174## aclnnForeachAtan175## aclnnForeachAtan
175 176 
@@ -107,7 +107,7 @@ aclnnStatus aclnnForeachDivScalar(
107 <td>out(aclTensorList*)</td>107 <td>out(aclTensorList*)</td>
108 <td>输出</td>108 <td>输出</td>
109 <td>表示张量x除以张量scalar的输出张量列表,对应公式中的`y`。</td>109 <td>表示张量x除以张量scalar的输出张量列表,对应公式中的`y`。</td>
110- <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型和数据格式与入参`x`的数据类型和数据格式一致,shape size大于等于入参`x`的shape size。</li></ul></td>110+ <td><ul><li>支持空Tensor。</li><li>该参数中所有Tensor的数据类型保持一致。</li><li>数据类型和数据格式与入参`x`的数据类型和数据格式一致,shape与入参`x`一致。</li></ul></td>
111 <td>BFLOAT16、FLOAT16、FLOAT32</td>111 <td>BFLOAT16、FLOAT16、FLOAT32</td>
112 <td>ND</td>112 <td>ND</td>
113 <td>0-8</td>113 <td>0-8</td>
@@ -161,16 +161,14 @@ aclnnStatus aclnnForeachDivScalar(
161 <td>传入的x、scalar、out是空指针。</td>161 <td>传入的x、scalar、out是空指针。</td>
162 </tr>162 </tr>
163 <tr>163 <tr>
164- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>164+ <td rowspan="5">ACLNN_ERR_PARAM_INVALID</td>
165- <td rowspan="2">161002</td>165+ <td rowspan="5">161002</td>
166 <td>x、scalar、out的数据类型不在支持的范围之内。</td>166 <td>x、scalar、out的数据类型不在支持的范围之内。</td>
167 </tr>167 </tr>
168 <tr>168 <tr>
169 <td>x和out的数据类型不一致。</td>169 <td>x和out的数据类型不一致。</td>
170 </tr>170 </tr>
171 <tr>171 <tr>
172- <td rowspan="4">ACLNN_ERR_INNER_TILING_ERROR</td>
173- <td rowspan="4">561002</td>
174 <td>x与out的shape不满足约束。</td>172 <td>x与out的shape不满足约束。</td>
175 </tr>173 </tr>
176 <tr>174 <tr>
@@ -180,6 +178,8 @@ aclnnStatus aclnnForeachDivScalar(
180 <td>x或out中的Tensor的数据类型不一致。</td>178 <td>x或out中的Tensor的数据类型不一致。</td>
181 </tr>179 </tr>
182 <tr>180 <tr>
181+ <td>ACLNN_ERR_INNER_TILING_ERROR</td>
182+ <td>561002</td>
183 <td>scalar元素个数不为1。</td>183 <td>scalar元素个数不为1。</td>
184 </tr>184 </tr>
185 </tbody></table>185 </tbody></table>
@@ -109,7 +109,7 @@ aclnnStatus aclnnForeachDivScalar(
109 <td>out (aclTensorList*)</td>109 <td>out (aclTensorList*)</td>
110 <td>Output</td>110 <td>Output</td>
111 <td>Output tensor list of tensor x divided by tensor scalar, corresponding to `y` in the formula.</td>111 <td>Output tensor list of tensor x divided by tensor scalar, corresponding to `y` in the formula.</td>
112- <td><ul><li>Empty tensors are supported.</li><li>The data types of all tensors in this parameter are the same.</li><li>The data type and data format are the same as those of input parameter `x`, and the shape size is greater than or equal to that of input parameter `x`.</li></ul></td>112+ <td><ul><li>Empty tensors are supported.</li><li>The data types of all tensors in this parameter are the same.</li><li>The data type and data format are the same as those of input parameter `x`, and the shape is the same as that of input parameter `x`.</li></ul></td>
113 <td>BFLOAT16, FLOAT16, FLOAT32</td>113 <td>BFLOAT16, FLOAT16, FLOAT32</td>
114 <td>ND</td>114 <td>ND</td>
115 <td>0-8</td>115 <td>0-8</td>
@@ -163,16 +163,14 @@ aclnnStatus: return status code. For details, see [aclnn Return Codes](../../../
163 <td>x, scalar, or out is a null pointer.</td>163 <td>x, scalar, or out is a null pointer.</td>
164 </tr>164 </tr>
165 <tr>165 <tr>
166- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>166+ <td rowspan="5">ACLNN_ERR_PARAM_INVALID</td>
167- <td rowspan="2">161002</td>167+ <td rowspan="5">161002</td>
168 <td>The data types of x, scalar, or out are not within the supported range.</td>168 <td>The data types of x, scalar, or out are not within the supported range.</td>
169 </tr>169 </tr>
170 <tr>170 <tr>
171 <td>The data types of x and out are inconsistent.</td>171 <td>The data types of x and out are inconsistent.</td>
172 </tr>172 </tr>
173 <tr>173 <tr>
174- <td rowspan="4">ACLNN_ERR_INNER_TILING_ERROR</td>
175- <td rowspan="4">561002</td>
176 <td>The shapes of x and out do not meet the constraints.</td>174 <td>The shapes of x and out do not meet the constraints.</td>
177 </tr>175 </tr>
178 <tr>176 <tr>
@@ -182,6 +180,8 @@ aclnnStatus: return status code. For details, see [aclnn Return Codes](../../../
182 <td>The data types of tensors in x or out are inconsistent.</td>180 <td>The data types of tensors in x or out are inconsistent.</td>
183 </tr>181 </tr>
184 <tr>182 <tr>
183+ <td>ACLNN_ERR_INNER_TILING_ERROR</td>
184+ <td>561002</td>
185 <td>The number of elements in scalar is not 1.</td>185 <td>The number of elements in scalar is not 1.</td>
186 </tr>186 </tr>
187 </tbody></table>187 </tbody></table>
@@ -183,16 +183,14 @@ aclnnStatus aclnnForeachLerpScalar(
183 <td>传入的x1、x2、out是空指针。</td>183 <td>传入的x1、x2、out是空指针。</td>
184 </tr>184 </tr>
185 <tr>185 <tr>
186- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>186+ <td rowspan="5">ACLNN_ERR_PARAM_INVALID</td>
187- <td rowspan="2">161002</td>187+ <td rowspan="5">161002</td>
188 <td>x1、x2、weight、out的数据类型不在支持的范围之内。</td>188 <td>x1、x2、weight、out的数据类型不在支持的范围之内。</td>
189 </tr>189 </tr>
190 <tr>190 <tr>
191 <td>x1、x2、weight、out的数据类型不一致。</td>191 <td>x1、x2、weight、out的数据类型不一致。</td>
192 </tr>192 </tr>
193 <tr>193 <tr>
194- <td rowspan="3">ACLNN_ERR_INNER_TILING_ERROR</td>
195- <td rowspan="3">561002</td>
196 <td>x1、x2、out的shape不满足对应关系。</td>194 <td>x1、x2、out的shape不满足对应关系。</td>
197 </tr>195 </tr>
198 <tr>196 <tr>
@@ -185,16 +185,14 @@ aclnnStatus aclnnForeachLerpScalar(
185 <td>x1, x2, or out is a null pointer.</td>185 <td>x1, x2, or out is a null pointer.</td>
186 </tr>186 </tr>
187 <tr>187 <tr>
188- <td rowspan="2">ACLNN_ERR_PARAM_INVALID</td>188+ <td rowspan="5">ACLNN_ERR_PARAM_INVALID</td>
189- <td rowspan="2">161002</td>189+ <td rowspan="5">161002</td>
190 <td>The data types of x1, x2, weight, and out are not within the supported range.</td>190 <td>The data types of x1, x2, weight, and out are not within the supported range.</td>
191 </tr>191 </tr>
192 <tr>192 <tr>
193 <td>The data types of x1, x2, weight, and out are inconsistent.</td>193 <td>The data types of x1, x2, weight, and out are inconsistent.</td>
194 </tr>194 </tr>
195 <tr>195 <tr>
196- <td rowspan="3">ACLNN_ERR_INNER_TILING_ERROR</td>
197- <td rowspan="3">561002</td>
198 <td>The shapes of x1, x2, and out do not satisfy the corresponding relationship.</td>196 <td>The shapes of x1, x2, and out do not satisfy the corresponding relationship.</td>
199 </tr>197 </tr>
200 <tr>198 <tr>