Merged
refactor: 统一代码风格并修正Add算子文档及测试脚本 #7417
cai-chengchaoAdd on 3 days ago
refactor: 统一代码风格并修正Add算子文档及测试脚本 #7417
Merged
Merged fromcai-chengchao/ops-mathccc_1113intocann/ops-mathmaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for cai-chengchao's contribution.)3 days ago Created pull request, commit 8faf8dc8
atomgit-bot
3 days ago Comments:
3 days ago Comments:
变更摘要
本次改动以格式整理为主、少量语义修正为辅,主要围绕 math/add 算子的 aclnn 接口与测试资产:调整了 golden.py 中 complex32 黄金数据的计算方式(改用 torch 复数运算),修正了 aclnn_add.h 的参数方向注释,并将两个测试类的 golden 方法改为静态方法;同时 common/inc 下的注册宏、校验宏以及 tests/ut 下多个公共头文件被重新按新对齐方式排版,并补上文件末尾缺失的换行符。
主要改动
complex32黄金值生成改用 torch:math/add/tests/assets/golden.py的AddTestSpec中该分支不再用 numpy 复数逐元素拼接,而是先经numpy_to_torch_tensor转换,再用torch.complex、torch.add、torch.stack计算并通过torch_to_numpy_tensor输出。- 测试
golden方法声明为静态方法:AclnnAddTestSpec.golden与AclnnAddV3TestSpec.golden增加@staticmethod装饰器,签名与参数语义保持不变。 aclnnAdd接口注释方向修正:math/add/op_api/aclnn_add.h中out参数由[in]改为[out],原地接口的首个参数说明改为[in/out] selfRef。- 注册宏与检查宏的格式化重排:
common/inc/aicpu/math_aicpu_register.h的OPS_MATH_REGISTER_CPU_KERNELV2、common/inc/op_host/math_tiling_templates_registry.h的REGISTER_TILING_TEMPLATE_WITH_SOCVERSION、REGISTER_OPS_TILING_TEMPLATE等宏及OP_LOGE/OP_CHECK_IF调用仅调整换行与缩进,逻辑不变。 - 测试公共头文件签名换行与末尾换行补齐:
tests/ut/common与tests/ut/op_api/op_api_ut_common下的TilingContextPara/TilingContextFaker、OpApiUt、SaveResultToBinaryFile等声明合并换行参数列表,并为多个头文件补上文件末尾换行符。
🧩 本次 Review 已使用自定义 Skill:


Incorrect?
atomgit-bot
3 days ago Comments:
3 days ago Comments:


Incorrect?
3 days ago Added label: cann-cla/yes
CANN-robot
3 days ago Comments:
3 days ago Comments:
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 |
|---|---|---|
| */*/README.md | ✅ 陈娇, 顾宝成, 张磊 (3/2) | ✅ 陈娇 (1/1) |
| */*/op_api/*.h | ✅ 王永光, 顾宝成, 张磊 (3/2) | ✅ 王永光 (1/1) |
| math/add | ✅ 张磊, 顾宝成 (2/2) | ✅ 张磊, 顾宝成 (2/1) |
| repo-cann/ops-math | ✅ 张磊, 顾宝成 (2/2) | ✅ 张磊, 顾宝成 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


CANN-robot
3 days ago Comments:
3 days ago Comments:
3 days ago Set FelixTang7,yue-ma,zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,tang-lei01,zhangzijie,jia0liang,zl_hw,songkai111,gitcode-chenjiao,chenxingyu18,lwx1255555,pingchuantang,llimwang,gubaocheng,andong_hw,wangyongguang,fengying555682,xuejinghui,onanfield,zhanw_coding,jiangjiawei,clinglai0517,caiwenwen,yanglu-1 as approver
3 days ago Set FelixTang7,yue-ma,zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,tang-lei01,zhangzijie,jia0liang,zl_hw,songkai111,gitcode-chenjiao,chenxingyu18,lwx1255555,pingchuantang,llimwang,gubaocheng,andong_hw,wangyongguang,fengying555682,xuejinghui,onanfield,zhanw_coding,jiangjiawei,clinglai0517,caiwenwen,yanglu-1 as approver
3 days ago Set FelixTang7,yue-ma,zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,tang-lei01,zhangzijie,jia0liang,zl_hw,songkai111,gitcode-chenjiao,chenxingyu18,lwx1255555,pingchuantang,llimwang,gubaocheng,andong_hw,wangyongguang,fengying555682,xuejinghui,onanfield,zhanw_coding,jiangjiawei,clinglai0517,caiwenwen,yanglu-1 as approver
3 days ago Set FelixTang7,yue-ma,zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,tang-lei01,zhangzijie,jia0liang,zl_hw,songkai111,gitcode-chenjiao,chenxingyu18,lwx1255555,pingchuantang,llimwang,gubaocheng,andong_hw,wangyongguang,fengying555682,xuejinghui,onanfield,zhanw_coding,jiangjiawei,clinglai0517,caiwenwen,yanglu-1 as approver
Ccai-chengchao
3 days ago Change title to "refactor: 统一代码风格并修正Add算子文档及测试脚本", originally titled "fix".
3 days ago Change title to "refactor: 统一代码风格并修正Add算子文档及测试脚本", originally titled "fix".
3 days ago Modify description of pull request
cai-chengchao
3 days ago Comments:
3 days ago Comments:
compile


3 days ago Pre merge succeeded (commit_id: a188568167d82b7aea25ba006f7fc7db0aeddd42)
CANN-robot
3 days ago Comments:
3 days ago Comments:
| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


3 days ago Added label: ci-pipeline-running
3 days ago Removed label: ci-pipeline-running
3 days ago Added label: ci-pipeline-passed
gubaocheng
3 days ago Comments:
3 days ago Comments:
/lgtm
/approve
by agent


chenyifeng
2 days ago Comments:
2 days ago Comments:
您好,PR已满足合入指标,请尽快联系Committer进行合入。如暂时不需要合入,请在PR标题前加[WIP]


17 hours ago Modify description of pull request
wangyongguang
14 hours ago Comments:
14 hours ago Comments:
/approve


14 hours ago Added label: approved
12 hours ago Added label: lgtm
12 hours ago Closed associated issue
12 hours ago Merged pull request
描述
本次改动统一了 ops-math 仓库部分公共头文件与单元测试头文件的代码格式,并修正了 Add 算子的文档注释与测试脚本实现。
改动原因
改动方法
关联的Issue
测试
文档更新
类型标签