Closed
[Documentation|文档反馈]: aclnnKlDiv 资料错误码表缺少「reduction 取值非法」子项,实现实际返回 161002 #4332
liuhanwen8Add on 18 days agoClosed at 18 hours ago
18 days ago Added label: documentation
陈思
17 days ago Comments:
17 days ago Comments:
您好,感谢反馈!核对 cann/ops-math 提交 212ce9d5460b1be26cfbee481aff1acbf5cc5c62 后,确认该错误码说明有遗漏:CheckReduction() 明确拒绝 reduction < 0 或 reduction > 3,CheckParams() 将其转换为 ACLNN_ERR_PARAM_INVALID,第一段接口直接返回该状态,即 161002。合法取值为 0(none)、1(mean)、2(sum)、3(batchmean)。校验实现、第一段返回路径
当前参数表只列出了合法值,161002 表也确实仅列四类场景,未覆盖非法 reduction。可行的修订是增加“reduction 取值不在 0~3 范围内”的子项,并同步将表格的两处 rowspan 从 4 调整为 5;参数说明也可补充“传入其他值时第一段返回 161002”。这与您报告的 reduction=4 结果一致。我们会继续跟踪这处文档说明的对齐。参数说明、错误码表


17 days ago Assign chen_0715 as responsible person
17 days ago Added label: pending-confirmation
15 days ago Removed label: pending-confirmation
18 hours ago Close issue
18 hours ago changed custom state from 进行中 to 已完成
16 hours ago Added label: resolved
一、文档链接 (必填)
https://gitcode.com/cann/ops-math/blob/master/math/kl_div_v2/docs/aclnnKlDiv.md
对应源码:
math/kl_div_v2/op_api/aclnn_kl_div.cpp的CheckReduction()二、问题文档片段 (必填)
「aclnnKlDivGetWorkspaceSize - 返回值」小节里 161002 的子项(表格为
rowspan="4",原文逐字复制):同页「reduction(int64_t)」参数表只列了 0/1/2/3 四个合法取值,没有说明传入其它值时的行为与返回码。
💡 存在的问题(选填)
CheckReduction()对reduction < 0 || reduction > 3直接返回ACLNN_ERR_PARAM_INVALID(161002)。板测(Ascend 910B2 / CANN 9.2.0):reduction=4时第一段接口返回 161002,第二段未执行。复现(在 ops-math 仓根目录执行,脚本对文档正文做文本断言,rc=1 即缺陷成立):
import re import sys PATH = "math/kl_div_v2/docs/aclnnKlDiv.md" md = open(PATH, encoding="utf-8").read() m = re.search(r"ACLNN_ERR_PARAM_INVALID(.{0,2000}?)</tbody>", md, re.S) if not m: print("未找到 161002 错误码段落"); sys.exit(2) cells = re.findall(r"<td[^>]*>(.*?)</td>", m.group(1), re.S) subs = [re.sub(r"<[^>]+>", "", c).strip() for c in cells if re.sub(r"<[^>]+>", "", c).strip()] print("161002 表内子项(%d 条):" % len(subs)) for s in subs: print(" -", s) if any("reduction" in s for s in subs): print("[OK] 资料已声明 reduction 非法取值的报错子项"); sys.exit(0) print("[DEFECT] 161002 表未声明 reduction 非法取值子项") sys.exit(1)实测输出:
板测侧证据(同一台机器):
reduction=4→phase1 rc=161002 ws=0。