Pull Request已成功合入, 合并人@CANN-robot
(感谢 liuyy611 的贡献)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
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| loss | ✅ chenqi317, yu-xinjie62 (2/2) | ✅ chenqi317 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
liuyy611, thanks for your pull request. All authors of the commits have signed the CLA. 👍


🔵 source code change are detected, tasks labels is removed in this pull request!


问题/功能描述
为SoftMarginLoss算子的前向和反向计算添加了输入张量格式检查功能。主要解决当输入张量使用特定存储格式(FRACTAL_NZ)时可能导致的精度问题,通过运行时告警机制提醒开发者潜在风险,增强算子的健壮性和可调试性。
修改方案描述
在SoftMarginLoss前向(aclnn_soft_margin_loss.cpp)和反向(aclnn_soft_margin_loss_backward.cpp)算子的参数检查函数中,分别新增了CheckFormat函数。该函数检查输入张量(前向为self,反向为gradOutput)的存储格式,若为FORMAT_FRACTAL_NZ,则通过OP_LOGW输出警告日志。此修改不改变原有计算逻辑,仅增加了一层轻量级的格式感知与告警机制。


流水线任务触发成功
任务链接 [2d2353d149244e3fbd57f05145737184][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 解析CI分支 | ✅ SUCCESS | ||
| codecheck | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| API_Check | ✅ SUCCESS | >>>>> | |
| Pre_Compile | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| Smoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-03-19 10:49:28] CI执行结束


The following labels are not ready.
lgtm: Please wait for reviewers to review the code.
ci-pipeline-passed: The ci-pipeline-passed label is expired. Please compile again.


流水线任务触发成功
任务链接 [56d0802a1e5140a8ac22077e239e9490][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_mobile_station | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_single | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_experimental | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_950 | ✅ SUCCESS | >>>>> | >>>>> |
| Pre_Compile | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_X86_mobile_station_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_950_ubuntu24 | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_single_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_experimental_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_ARM_950_ubuntu24 | ✅ SUCCESS | >>>>> | |
| Compile_X86_monitor | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_ARM_monitor | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| Smoke_A900_npupool | ✅ SUCCESS | >>>>> | |
| API_Check | ✅ SUCCESS | >>>>> |
[2026-03-23 14:14:04] CI执行结束


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: chenqi317.
Reviewers who wrote a comment of /lgtm are: chenqi317, yu-xinjie62.


描述
aclnnSoftMarginLoss、
aclnnSoftMarginLossBackward、
aclnn_l2接口内增加CheckFormat函数对不支持数据格式进行校验提醒。
关联的Issue
https://gitcode.com/cann/ops-nn/issues/1591
测试
单算子校验,test_aclnn测试接口中修改数据格式为ACL_FORMAT_FRACTAL_NZ,编译执行算子,日志中出现warning提醒数据格式可能造成精度失败。

文档更新
类型标签