Pull Request已成功合入, 合并人@CANN-robot
(感谢 陈海杰 的贡献)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 |
|---|---|---|
| quant | ✅ 陈昊文, 刘杰 (2/2) | ✅ 陈昊文, 刘杰 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chenhaijie1423, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [54a73b0ecd4d4ae9827c741d10de1137][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | >>>>> |
| Compile_Pre | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910b | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_910c | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_X86_monitor_950 | ✅ SUCCESS | >>>>> | >>>>> |
| UT_Test_ophost | ✅ SUCCESS | ||
| UT_Test_opapi | ✅ SUCCESS | ||
| UT_Test_kernel | ✅ SUCCESS | ||
| UT_Test_opgraph | ✅ SUCCESS | ||
| PreSmoke_A900 | ✅ SUCCESS | >>>>> | |
| PreSmoke_ATK_Test_A2 | ✅ SUCCESS | >>>>> |
[2026-06-24 17:31:07] CI执行结束


流水线任务触发成功
任务链接 [4a778ecd45664f9e804b13c7f964259f][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck_checkpr | ✅ SUCCESS | ||
| StaticCheck_codespell_check | ✅ SUCCESS | ||
| StaticCheck_link_validity_check | ✅ SUCCESS | ||
| StaticCheck_resource_existence_check | ✅ SUCCESS | ||
| StaticCheck_tag_closed_check | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_style | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ⚠️ WARNING | >>>>> | >>>>> |
| SCA | ✅ SUCCESS | >>>>> |
[2026-06-24 17:27:18] CI执行结束


/approve


/lgtm
/approve


变更摘要
此 PR 聚焦于 FlatQuant 模块的代码清理(clean code)修复,涉及算子推导形状(infer shape)与 ACLNN API 两个源文件。改动主要围绕浮点数比较的规范性改进:引入基于 epsilon 的浮点相等判断辅助函数 IsFloatEqual/IsDoubleEqual,并用具名 constexpr 常量替换魔术数字,以提升代码可读性和浮点比较的健壮性。
主要改动
-
新增
IsFloatEqual辅助函数:在flat_quant_infershape.cpp中添加static bool IsFloatEqual(float, float),使用std::numeric_limits<float>::epsilon()进行安全浮点比较,避免直接判等带来的精度风险。 -
新增具名
constexpr浮点常量:在flat_quant_infershape.cpp中引入ZERO_FLOAT、SIX_FLOAT、TWELVE_FLOAT等常量,替代原先散布在推导逻辑中的魔术数字(如0.0f、6.0f、12.0f),增强语义清晰度。 -
统一
aclnn_flat_quant.cpp的参数校验逻辑:在CheckMaxValid等参数校验函数中,确保dstTypeMax的取值范围判断采用IsDoubleEqual进行浮点安全比较,与推导形状侧保持一致的代码规范。


描述
FlatQuant修复cleancode
关联的Issue
https://gitcode.com/cann/ops-nn/issues/3533
测试
aclnn调用和infershape调用验证OK
文档更新
不涉及
类型标签