已合并
【bugfix】添加format校验 #2901
liuyy611创建于 3月19日
【bugfix】添加format校验 #2901
已合并
liuyy611创建于 3月19日
liuyy611成员
3月19日

描述

aclnnSoftMarginLoss、
aclnnSoftMarginLossBackward、
aclnn_l2接口内增加CheckFormat函数对不支持数据格式进行校验提醒。

关联的Issue

https://gitcode.com/cann/ops-nn/issues/1591

测试

单算子校验,test_aclnn测试接口中修改数据格式为ACL_FORMAT_FRACTAL_NZ,编译执行算子,日志中出现warning提醒数据格式可能造成精度失败。
image1.png

image.png

文档更新

类型标签

  • Bug修复
  • 新特性
  • 性能优化
  • 文档更新
  • 其他,请描述:
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 liuyy611 的贡献)
Lliuyy611成员
3月19日 创建了 pull request,commit 4b3f9ded
CANN-robot
CANN-robot成员
3月19日 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
CANN-robotCANN-robot成员
3月19日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
3月19日 将crystalhu,yu-xinjie62,fanqirui,zhou-qilong,chenqi317,liubo75,tangweiwei2,wangyongguang,zhang-wu设为评审人
CANN-robotCANN-robot成员
3月19日 将crystalhu,yu-xinjie62,zhou-qilong,chenqi317,liubo75,tangweiwei2,wangyongguang,zhang-wu设为审查人
CANN-robot
CANN-robot成员
3月19日 评论:

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

likedislike
CANN-robot
CANN-robot成员
3月19日 评论:

问题/功能描述

为SoftMarginLoss算子的前向和反向计算添加了输入张量格式检查功能。主要解决当输入张量使用特定存储格式(FRACTAL_NZ)时可能导致的精度问题,通过运行时告警机制提醒开发者潜在风险,增强算子的健壮性和可调试性。

修改方案描述

在SoftMarginLoss前向(aclnn_soft_margin_loss.cpp)和反向(aclnn_soft_margin_loss_backward.cpp)算子的参数检查函数中,分别新增了CheckFormat函数。该函数检查输入张量(前向为self,反向为gradOutput)的存储格式,若为FORMAT_FRACTAL_NZ,则通过OP_LOGW输出警告日志。此修改不改变原有计算逻辑,仅增加了一层轻量级的格式感知与告警机制。

likedislike
Lliuyy611成员
3月19日 修改标题为 “【bugfix】添加format校验”,原标题为“添加nz_warning”
liuyy611成员
3月19日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月19日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
3月19日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robot成员
3月19日 添加了label:api-check-pass
CANN-robotCANN-robot成员
3月19日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月19日 添加了label:ci-pipeline-passed
Lliuyy611成员
3月19日 修改了pull request 的描述
Lliuyy611成员
3月19日 修改了pull request 的描述
chenqi317成员
3月23日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
3月23日 添加了label:approved
liuyy611成员
3月23日 评论:

/check-pr

likedislike
CANN-robotCANN-robot成员
3月23日 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
3月23日 评论:

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.

likedislike
liuyy611成员
3月23日 评论:

compile

likedislike
CANN-robotCANN-robot成员
3月23日 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月23日 删除了label:api-check-pass
CANN-robot
CANN-robot成员
3月23日 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robot成员
3月23日 添加了label:api-check-pass
CANN-robotCANN-robot成员
3月23日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
3月23日 添加了label:ci-pipeline-passed
於欣洁成员
3月23日 评论:

/lgtm

likedislike
CANN-robotCANN-robot成员
3月23日 添加了label:lgtm
CANN-robot
CANN-robot成员
3月23日 评论:

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.

likedislike
CANN-robotCANN-robot成员
3月23日 关闭了关联的issue
CANN-robotCANN-robot成员
3月23日 合入了pull request