Closed
[Documentation|文档反馈]: aclnnL1Loss 资料声明 self/target/out 支持 INT64,但未注明仅 reduction=none 可用(mean/sum 实测 161002) #8204
liuhanwen8Add on 16 days agoClosed at 9 days ago
16 days ago Assign yourealize as responsible person
yuning_chen
16 days ago Comments:
16 days ago Comments:
yuning_chen
16 days ago Comments:
16 days ago Comments:
您好,该问题已收到,当前问题 @yourealize 正在处理中


12 days ago Assign yu-xinjie62 as responsible person, remove original responsible person: yourealize
12 days ago Assign yu-xinjie62 as responsible person, remove original responsible person: yourealize
yuning_chen
12 days ago Comments:
12 days ago Comments:
您好,该问题已收到,当前问题 @yu-xinjie62 正在处理中


11 days ago Assign ji-songyuan as responsible person, remove original responsible person: yu-xinjie62
11 days ago Assign ji-songyuan as responsible person, remove original responsible person: yu-xinjie62
yuning_chen
11 days ago Comments:
11 days ago Comments:
您好,该问题已收到,当前问题 @ji-songyuan 正在处理中


9 days ago Close issue
9 days ago changed custom state from 进行中 to 已完成
8 days ago Added label: resolved
3 days ago Assign chenjiayi_ as responsible person
chenjiayi_
3 days ago Comments:
3 days ago Comments:
补充说明本问题的跟进安排:
该 issue 已关闭,已补充 assign 给 @chenjiayi_ 复核关闭结论,原责任人 @ji-songyuan 保留协同。
当前状态:
- 关闭状态:已完成;复核项:aclnnL1Loss 资料声明 self/target/out 支持 INT64,但未注明仅 reduction=none 可用(mean/sum 实测 161002)。
- 我先核对关闭时的结论与当前 master 的实现/资料是否一致。
下一步:
- 复核完成后在本 issue 补充结论。
- 如果还有后续需要,请重新提 issue。


chenjiayi_
3 days ago Comments:
3 days ago Comments:
补充说明本问题的后续处理:
已修复并随关联 PR 合入。
处理结果:
- !14323:docs_fix
验证:
- 关联 PR(2026-11-13)已合入,变更可从 PR 记录追溯。
- 本次以 PR 记录与 issue 讨论核对为主,未重新执行复现或真机验证。
说明:合入分支与版本以 PR 记录为准;如仍有问题,请重新提 issue 并附版本、shape 与日志。
如果还有后续需要,请重新提 issue。


19 hours ago Removed responsible person chenjiayi_
[Documentation|文档反馈] aclnnL1Loss 资料声明 self/target/out 支持 INT64,但未注明仅 reduction=none 可用(mean/sum 实测 161002)
现象
资料
loss/lp_loss/docs/aclnnL1Loss.md的参数说明三处(:101self、:111target、:131out)dtype 列都写「FLOAT、FLOAT16、BFLOAT16、INT64」,未附任何 reduction 条件;实测 INT64 三个张量只在 reduction=none 下被接受,mean / sum 均返回 161002。期望
资料既然把 INT64 列进支持列表,就应写清适用条件;实测的限制来自实现
aclnn_l1_loss.cpp:67-84的CheckDtypeValid(注释「与Cuda行为保持一致」:reduction=none 时非浮点 self 不允许配浮点 target;reduction=mean 时 self 与 target 不能同时非浮点)。这类 reduction 相关的 dtype 限制在资料里完全没有体现,调用方按 dtype 列选 INT64 后,换一个 reduction 就会拿到 161002。建议二选一:① 在参数说明的 dtype 列或「约束说明」注明「INT64 仅 reduction=none 支持;reduction=mean/sum 要求浮点 dtype」;② 在错误码表补一条 161002 子项说明该组合。
环境
libopapi.so构建 2026-10-289.3.0-beta.1@99a37ee3e2c3fb57048cd1628ed7042bba70c697(2026-11-04);master 同三行仍写 INT64<!-- npu="950" id1 -->段写明「Ascend 950PR&950DT系列产品:支持」,所引参数行不受其它产品分段限定复现步骤
OFF=/usr/local/Ascend/ascend-toolkit/latest; source $OFF/set_env.sh; export ASCEND_RT_VISIBLE_DEVICES=<空闲卡号>## 复现脚本的代码存为probe.cppg++ -std=c++17 -O2 -o probe probe.cpp -I$OFF/include -I$OFF/include/aclnnop -I$OFF/include/aclnnop/level2 -L$OFF/lib64 -lopapi -lnnopbase -lascendclLD_LIBRARY_PATH=$OFF/lib64:$LD_LIBRARY_PATH ./probe复现脚本
实测输出(A5 / CANN 9.3.0.B020,aclnn 两段式直调):
// aclnnL1Loss:INT64 是否真的被拒 —— 按 reduction 三态分别实测(文档 L101/L111/L131 声明 self/target/out 支持 INT64) #include <cstdio> #include <cstdint> #include <cstring> #include <vector> #include "acl/acl.h" #include "aclnnop/aclnn_l1_loss.h" static void* Dev(int64_t b) { void* p = nullptr; aclrtMalloc(&p, b, ACL_MEM_MALLOC_HUGE_FIRST); if (p) aclrtMemset(p, b, 0, b); return p; } static aclTensor* T(std::vector<int64_t> d, aclDataType dt, void* p) { std::vector<int64_t> s(d.size(), 1); for (int i = static_cast<int>(d.size()) - 2; i >= 0; --i) s[i] = s[i + 1] * d[i + 1]; return aclCreateTensor(d.data(), d.size(), dt, s.data(), 0, ACL_FORMAT_ND, d.data(), d.size(), p); } static void Run(int64_t reduction, aclDataType sdt, aclDataType tdt, aclDataType odt, const char* tag) { void* ds = Dev(6 * 8); void* dt = Dev(6 * 8); void* doo = Dev(6 * 8); aclTensor* self = T({2, 3}, sdt, ds); aclTensor* target = T({2, 3}, tdt, dt); aclTensor* out = T({2, 3}, odt, doo); uint64_t ws = 0; aclOpExecutor* ex = nullptr; int rc1 = int(aclnnL1LossGetWorkspaceSize(self, target, reduction, out, &ws, &ex)); printf("[%s] reduction=%lld GetWorkspaceSize = %d wsSize=%llu\n", tag, (long long)reduction, rc1, (unsigned long long)ws); aclDestroyTensor(self); aclDestroyTensor(target); aclDestroyTensor(out); } int main() { aclInit(nullptr); aclrtSetDevice(0); Run(0, ACL_INT64, ACL_INT64, ACL_INT64, "INT64 全同 reduction=none"); Run(1, ACL_INT64, ACL_INT64, ACL_INT64, "INT64 全同 reduction=mean"); Run(2, ACL_INT64, ACL_INT64, ACL_INT64, "INT64 全同 reduction=sum"); Run(0, ACL_FLOAT, ACL_FLOAT, ACL_FLOAT, "FLOAT 基线 reduction=none"); aclrtResetDevice(0); aclFinalize(); return 0; }影响
调用方按 dtype 列判断「L1Loss 支持 INT64」并在 mean/sum 场景使用,会拿到 161002;而同一份文档没给出该组合非法的依据,排查会先怀疑 shape/broadcast 而绕过真正原因(reduction 与 dtype 的耦合)。属文档未披露实现限制,不是实现缺陷。
建议
优先在资料补一句 reduction 条件说明(改动最小、风险最低);若产品口径认为 INT64 本就只该在 none 下用,则把 dtype 列改为「FLOAT、FLOAT16、BFLOAT16(INT64 仅 reduction=none)」。