已合并
test: 新增 aclnnThnnFusedLstmCell 算子 ST 测试用例及 CPU golden 执行插件 #9567
Nice try创建于 8月31日
test: 新增 aclnnThnnFusedLstmCell 算子 ST 测试用例及 CPU golden 执行插件 #9567
已合并
Nice try创建于 8月31日
Nice try
Nice try成员
8月31日

描述

本 PR 为 thnn_fused_lstm_cell 算子新增 ST(系统测试)用例:基于 ATK 测试框架,新增 208 条 aclnnThnnFusedLstmCell 用例配置及对应的 CPU golden 执行插件。

改动内容

  • 新增 rnn/thnn_fused_lstm_cell/tests/st/aclnnThnnFusedLstmCell/all_aclnnThnnFusedLstmCell.json:208 条 ST 用例(id 0~207,version v2.1),覆盖 fp16/fp32 两种输入数据类型,shape 覆盖 batch 0~16777216、hidden_size 4~67108864 的常规/大 shape/边界(is_boundary,共 8 条)场景。
  • 新增 rnn/thnn_fused_lstm_cell/tests/st/aclnnThnnFusedLstmCell/executor_aclnnThnnFusedLstmCell.py:ATK 执行插件,注册 thnn_fused_lstm_cell_api API 类型,实现算子 CPU golden 计算(gates = inputGates + hiddenGates + b_ih + b_hh,门控激活 i/f/g/o,cy = fcx + ig,hy = o*tanh(cy));低精度输入先转 fp32 计算再回转,与 NPU 内核 cast-in/fp32 计算/cast-out 行为对齐,保证混合容差比对有效。

关联的Issue

测试

  • 新增 ST 用例通过 ATK 框架执行:CPU 路径由 executor 插件计算 golden,NPU 路径使用 atk aclnn 命令经 pyaclnn 后端调用两段式 aclnn API(aclnn_name=ThnnFusedLstmCell)。

文档更新

无

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Nice try 的贡献)
Nice tryNice try成员
8月31日 创建了 pull request,commit 7844d212
atomgit-bot
atomgit-bot
8月31日 评论:

变更摘要

本 PR 为 aclnnThnnFusedLstmCell 接口新增 ST(系统测试)用例:在 rnn/thnn_fused_lstm_cell/tests/st/aclnnThnnFusedLstmCell/ 目录下新增用例清单文件 all_aclnnThnnFusedLstmCell.json 与 CPU golden 执行插件 executor_aclnnThnnFusedLstmCell.py。执行插件通过 atk 框架注册 thnn_fused_lstm_cell_api,实现了 LSTM cell 的前向计算公式(gates = inputGates + hiddenGates + b_ih + b_hh,按 [i, f, g, o] 切分并分别施加 sigmoid/tanh,最终输出 hy、cy、storage),仅支持 CPU(golden)路径,低精度输入会先转 fp32 计算再转回原 dtype,与 NPU 内核 cast-in/fp32 计算/cast-out 的行为对齐,以保证混合容差比对的准确性。

主要改动

  • 新增 ST 执行插件:在 executor_aclnnThnnFusedLstmCell.py 中定义 ThnnFusedLstmCellApi 类,继承 BaseApi 并通过 @register("thnn_fused_lstm_cell_api") 注册,__call__ 方法实现 CPU golden 计算并返回 (hy, cy, storage) 三元组。
  • 输入解析逻辑:静态方法 _extract_inputs 按名称从 kwargs 优先、args 兜底提取 inputGates、hiddenGates、cx、inputBias、hiddenBias 五个输入,解析失败时抛出 ValueError。
  • 偏置校验与数值精度处理:校验 inputBias 与 hiddenBias 必须同存同缺(与 aclnn 入口 C++ 校验一致),并对低精度输入统一转 torch.float32 计算后回转原 dtype,且对非 CPU 设备抛出 RuntimeError。
  • 新增用例清单文件:添加 all_aclnnThnnFusedLstmCell.json 作为 ST 用例清单配置(本补丁中无具体内容,仅新增空文件)。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月31日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月31日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
8月31日 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
rnn ✅ 汤平川, 钱泽洪 (2/2) ✅ 钱泽洪, 汤平川 (2/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

Nice_try, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
此处折叠了57条消息 查看更多
qianzehong成员
8月31日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
8月31日 添加了label:approved
CANN-robotCANN-robot成员
8月31日 添加了label:lgtm
CANN-robotCANN-robot成员
8月31日 关闭了关联的issue
CANN-robotCANN-robot成员
8月31日 合入了pull request