Merged
fix(cosh): 按人工检视意见修复完善约束文档 #7044
focusforceAdd on 7 days ago
fix(cosh): 按人工检视意见修复完善约束文档 #7044
Merged
focusforceAdd on 7 days ago
Total: 2 files changed+14-12
@@ -366,6 +366,8 @@ aclnnStatus aclnnInplaceCosh(
366 366 
367- 确定性计算:367- 确定性计算:
368 - aclnnCosh&aclnnInplaceCosh默认确定性实现。368 - aclnnCosh&aclnnInplaceCosh默认确定性实现。
369+- 执行路径:FLOAT、FLOAT16、BFLOAT16输入经AI Core计算;DOUBLE、COMPLEX64、COMPLEX128输入经AI CPU计算;INT8、INT16、INT32、INT64、UINT8、BOOL输入先转换为FLOAT参与计算,计算结果再转换为out的数据类型。
370+- 溢出行为:输入与输出数据类型相同时,若cosh(self)的计算结果超出该数据类型的最大可表示范围,输出为inf,而非饱和截断为该数据类型的最大值。例如:FLOAT输入绝对值大于约89.4、FLOAT16输入绝对值大于约11.8、BFLOAT16输入绝对值大于约89.4、DOUBLE输入绝对值大于约710.5时,输出为inf。
369 371 
370## 调用示例372## 调用示例
371 373 
@@ -103,8 +103,8 @@ aclnnStatus aclnnInplaceCosh(
103 <td>self(aclTensor*)</td>103 <td>self(aclTensor*)</td>
104 <td>Input</td>104 <td>Input</td>
105 <td>Input self in the formula.</td>105 <td>Input self in the formula.</td>
106- <td>The data type must satisfy the data type deduction rules together with the data type of out (see <a href="../../../docs/en/context/deduction_relationship.md" target="_blank">deduction relationship</a>).<br>The shape must be the same as that of out.</td>106+ <td>The data type must satisfy the data type deduction rules together with the data type of out (see <a href="../../../docs/en/context/deduction_relationship.md" target="_blank">deduction relationship</a>).<br>The shape must be the same as that of out. Supports empty tensors (zero-element input; the output is an empty tensor).</td>
107- <td>FLOAT, FLOAT16, DOUBLE</td>107+ <td>FLOAT, FLOAT16, DOUBLE, INT8, INT16, INT32, INT64, UINT8, BOOL, COMPLEX64, COMPLEX128</td>
108 <td>ND</td>108 <td>ND</td>
109 <td>Not greater than 8</td>109 <td>Not greater than 8</td>
110 <td>√</td>110 <td>√</td>
@@ -113,8 +113,8 @@ aclnnStatus aclnnInplaceCosh(
113 <td>out (aclTensor*)</td>113 <td>out (aclTensor*)</td>
114 <td>Output</td>114 <td>Output</td>
115 <td>out in the formula.</td>115 <td>out in the formula.</td>
116- <td>The data type must conform to the data type deduction rules with self (see <a href="../../../docs/en/context/deduction_relationship.md" target="_blank">deduction relationship</a>).<br>The shape must be the same as that of self.</td>116+ <td>The data type must conform to the data type deduction rules with self (see <a href="../../../docs/en/context/deduction_relationship.md" target="_blank">deduction relationship</a>).<br>The shape must be the same as that of self. Supports empty tensors (zero-element input; the output is an empty tensor).</td>
117- <td>FLOAT, FLOAT16, DOUBLE</td>117+ <td>FLOAT, FLOAT16, DOUBLE, COMPLEX64, COMPLEX128</td>
118 <td>ND</td>118 <td>ND</td>
119 <td>-</td>119 <td>-</td>
120 <td>√</td>120 <td>√</td>
@@ -141,10 +141,8 @@ aclnnStatus aclnnInplaceCosh(
141 </tr>141 </tr>
142 </tbody></table>142 </tbody></table>
143 143 
144- <!-- npu="A3" id7 -->144+ <!-- npu="950,A3,910b" id7 -->
145- - <term>Atlas A3 products</term>:145+ - <term>Ascend 950PR&950DT products</term>, <term>Atlas A3 products</term>, and <term>Atlas A2 products</term>: The self and out data types additionally support BFLOAT16.
146- - The self data type additionally supports INT8, INT16, INT32, INT64, UINT8, BOOL, COMPLEX64, COMPLEX128, BFLOAT16.
147- - The out data type additionally supports COMPLEX64, COMPLEX128, and BFLOAT16.
148 <!-- end id7 -->146 <!-- end id7 -->
149 147 
150- **Return value**148- **Return value**
@@ -257,8 +255,8 @@ aclnnStatus aclnnInplaceCosh(
257 <td>selfRef (aclTensor*)</td>255 <td>selfRef (aclTensor*)</td>
258 <td>Input/Output</td>256 <td>Input/Output</td>
259 <td>The input self in the formula, which also corresponds to the formula output out.</td>257 <td>The input self in the formula, which also corresponds to the formula output out.</td>
260- <td>-</td>258+ <td>Supports empty tensors (zero-element input; the output is an empty tensor).</td>
261- <td>FLOAT, FLOAT16, DOUBLE</td>259+ <td>FLOAT, FLOAT16, DOUBLE, COMPLEX64, COMPLEX128</td>
262 <td>ND</td>260 <td>ND</td>
263 <td>No greater than 8</td>261 <td>No greater than 8</td>
264 <td>√</td>262 <td>√</td>
@@ -285,8 +283,8 @@ aclnnStatus aclnnInplaceCosh(
285 </tr>283 </tr>
286 </tbody></table>284 </tbody></table>
287 285 
288- <!-- npu="A3" id8 -->286+ <!-- npu="950,A3,910b" id8 -->
289- - <term>Atlas A3 products</term>: selfRef additionally supports the COMPLEX64, COMPLEX128, and BFLOAT16 data types.287+ - <term>Ascend 950PR&950DT products</term>, <term>Atlas A3 products</term>, and <term>Atlas A2 products</term>: The selfRef data type additionally supports BFLOAT16.
290 <!-- end id8 -->288 <!-- end id8 -->
291 289 
292- **Return value**290- **Return value**
@@ -370,6 +368,8 @@ aclnnStatus aclnnInplaceCosh(
370 368 
371- Deterministic computation:369- Deterministic computation:
372 - aclnnCosh and aclnnInplaceCosh default to a deterministic implementation.370 - aclnnCosh and aclnnInplaceCosh default to a deterministic implementation.
371+- Execution path: FLOAT, FLOAT16, and BFLOAT16 inputs are computed on AI Core; DOUBLE, COMPLEX64, and COMPLEX128 inputs are computed on AI CPU; INT8, INT16, INT32, INT64, UINT8, and BOOL inputs are first converted to FLOAT for computation, and the computation results are then converted to the data type of out.
372+- Overflow behavior: When the input and output data types are the same, if the computation result of cosh(self) exceeds the maximum representable range of the data type, the output is inf, instead of being saturated to the maximum value of the data type. For example, the output is inf when the absolute value of the input exceeds approximately 89.4 for FLOAT, approximately 11.8 for FLOAT16, approximately 89.4 for BFLOAT16, or approximately 710.5 for DOUBLE.
atomgit-bot
atomgit-botatomgit-bot7 days ago

🟡 Medium Priority

新增行(第 373-374 行)声明「FLOAT、FLOAT16、BFLOAT16 走 AI Core;DOUBLE、COMPLEX64、COMPLEX128 走 AI CPU;INT8/INT16/INT32/INT64/UINT8/BOOL 先转 FLOAT 计算」,与代码一致(math/cosh/op_api/cosh.cpp:26-38 AICORE 列表含 BF16;op_kernel_aicpu/cosh_aicpu_def.cpp:19-20 含 DOUBLE/COMPLEX64/COMPLEX128;aclnn_cosh.cpp:47-49、127-137 整型先 Cast 到 FLOAT 再转 out dtype)。但同文件上方的参数表并未同步: 而中文版第 105/115/257 行表内已列出 INT8..BOOL、COMPLEX64、COMPLEX128,且第 142 行、284 行平台标记为 npu="950,A3,910b"(含 Atlas A2)。结果:新增行让英文文档内部出现「约束说明支持 complex/bf16/整型,但参数表不支持」的直接矛盾,且与中文版不一致;按英文文档在 Atlas A2 上选型的用户仍会误判 bf16/complex 不可用(这正是关联 Issue #4118 所报的资料低报问题),或误以为整型入参在非 A3 平台可用。修复方向:把英文版两处参数表及平台标记与中文版对齐(self/out/selfRef 表补 COMPLEX64、COMPLEX128、INT8..BOOL,补充段标记改为 npu="950,A3,910b" 并声明 A2 额外支持 BFLOAT16)。

建议:同步修改英文文档参数表与平台标记:第 107/117 行补齐 COMPLEX64、COMPLEX128、INT8/INT16/INT32/INT64/UINT8/BOOL(与中文第 105/115 行一致),第 261 行 selfRef 补齐 COMPLEX64、COMPLEX128(与中文第 257 行一致),第 144、288 行的 npu="A3" 改为 npu="950,A3,910b" 并按中文第 143、285 行声明「self/out/selfRef 额外支持 BFLOAT16」,避免新增的执行路径说明与参数表冲突。

likedislike
Incorrect?
373 373 
374## Example374## Example
375 375