Closed
[Documentation|文档反馈]: aclnnLog10 资料 out 数据类型列漏列 DOUBLE,与同行「使用说明」及自带示例矛盾 #4131
liuhanwen8Add on  14 days agoClosed at  3 days ago
liuhanwen8
liuhanwen8
14 days ago Create

一、文档链接

  • 接口资料:math/log/docs/aclnnLog10&aclnnInplaceLog10.md(aclnnLog10GetWorkspaceSize 参数表 out 行)
  • 自带示例:math/log/examples/test_aclnn_log10.cpp

二、问题文档片段

原文(out 行,逐字复制):

      <td>当self为支持的整型或布尔类型时,out必须为FLOAT类型,其余支持类型out应该和self保持dtype一致。数据shape与self一致。</td>
      <td>FLOAT、FLOAT16、BFLOAT16、COMPLEX64、COMPLEX128</td>

现象

out 的数据类型列漏列 DOUBLE,与同一行「使用说明」矛盾:使用说明要求「其余支持类型 out
应该和 self 保持 dtype 一致」,而 self 列包含 DOUBLE;文档自带示例
test_aclnn_log10.cpp 用的正是 ACL_DOUBLE 入、ACL_DOUBLE 出。

期望

out 列应为 FLOAT、FLOAT16、BFLOAT16、DOUBLE、COMPLEX64、COMPLEX128。

环境

  • 硬件:Ascend 910B2
  • CANN:9.2.0(opp/version.info Version=9.2.0)
  • 仓库:cann/ops-math,master 最新提交 5eaca2328
  • 复现日期:2026-10-27

复现步骤

  1. 取下接口资料:git clone https://gitcode.com/cann/ops-math ,资料在 math/log/docs/。
  2. 把下面的脚本存为 repro_doc_out_double.py。
  3. 运行 python3 repro_doc_out_double.py,期望退出码 1 且打印 [DEFECT] out 列缺列 ['DOUBLE']。

复现脚本

#!/usr/bin/env python3
"""文本断言:aclnnLog10 资料 out 列必须覆盖 self 列中浮点/复数族的全部 dtype。"""
import os, re, sys
DOC = os.environ.get("LOG10_DOC") or "aclnnLog10&aclnnInplaceLog10.md"
def find_doc():
    for base in (".", "math/log/docs", "docs"):
        p = os.path.join(base, DOC)
        if os.path.isfile(p):
            return p
    return ""
def cell_of_row(text, param):
    for tr in re.findall(r"<tr>(.*?)</tr>", text, re.S):
        cells = [re.sub(r"<[^>]+>", "", c).strip()
                 for c in re.findall(r"<td[^>]*>(.*?)</td>", tr, re.S)]
        if cells and cells[0].startswith(param):
            return "\t".join(cells)
    return ""
path = find_doc()
if not path:
    print("[SKIP] 找不到资料,用 LOG10_DOC 指定"); sys.exit(2)
text = open(path, encoding="utf-8").read()
D = r"\b(?:INT8|INT16|INT32|INT64|UINT8|BOOL|FLOAT16|FLOAT|DOUBLE|BFLOAT16|COMPLEX64|COMPLEX128)\b"
s_set = set(re.findall(D, cell_of_row(text, "self(aclTensor*)")))
o_set = set(re.findall(D, cell_of_row(text, "out(aclTensor*)")))
unchanged = {"FLOAT", "FLOAT16", "BFLOAT16", "DOUBLE", "COMPLEX64", "COMPLEX128"}
missing = sorted((s_set & unchanged) - o_set)
print("[INFO] self =", sorted(s_set))
print("[INFO] out  =", sorted(o_set))
if missing:
    print("[DEFECT] out 列缺列 %s" % missing); sys.exit(1)
print("[OK] out 列覆盖 self 的全部同 dtype 取值"); sys.exit(0)

实测输出(资料未修):

[INFO] out  = ['BFLOAT16', 'COMPLEX128', 'COMPLEX64', 'FLOAT', 'FLOAT16']
[DEFECT] out 列缺列 ['DOUBLE']

阴性对照:把 DOUBLE 补进 out 列后重跑,输出 [OK] out 列覆盖 self 的全部同 dtype 取值,退出码 0。

上板确认实现支持 DOUBLE(910B2 + CANN 9.2.0):self=DOUBLE/out=DOUBLE、shape [4x2]、
输入 {1,10,100,2,3,4,5,6} → ret1=0 ret2=0,回读 0.000000 1.000000 2.000000 0.301030
(log10 正确值)。即实现支持,缺漏在资料侧。

影响

按 out 列做支持面校验或生成用例时,会把 DOUBLE 判成非法输出类型,合法的 double
精度路径被跳过或被误报成错误码不符。

建议

把 out 行数据类型列改为 FLOAT、FLOAT16、BFLOAT16、DOUBLE、COMPLEX64、COMPLEX128。

likedislike
liuhanwen8liuhanwen8
14 days ago Added label: bug-report
xujiachen8Collaborators
13 days ago Comments:

您好,感谢反馈!核对当前 master(b08e885e7fac),参数表的 self 列包含 DOUBLE,out 的使用说明又要求这类输入保持同 dtype,但 out 的数据类型列确实没有列出 DOUBLE。

实现将 DOUBLE 放在 UNCHANGED_DTYPE_LIST 中,并对这一分支检查输入、输出类型一致,因此 DOUBLE→DOUBLE 有明确的接口层依据。当前读取版本的示例已使用 FLOAT,本条的 DOUBLE 判断以参数契约和实现校验为依据,不依赖示例选型。

一个可行调整是在 out 的类型列补齐 DOUBLE,使其与同行使用说明及实现一致;保留整型/BOOL 输入要求 FLOAT 输出的既有规则。我们会持续跟踪这一资料缺项。

likedislike
Xxujiachen8Collaborators
13 days ago Assign jiaoyiming as responsible person
Xxujiachen8Collaborators
13 days ago Added label: pending-confirmation
陈思陈思Collaborators
13 days ago Removed label: pending-confirmation
CANN-robotCANN-robotCollaborators
3 days ago Close issue
CANN-robotCANN-robotCollaborators
3 days ago changed custom state from 进行中 to 已完成
CANN-robotCANN-robotCollaborators
3 days ago Added label: resolved