已合并
修复adaptive_max_pool2d算子精度误差 #3384
jiangjiawei创建于 3月31日
修复adaptive_max_pool2d算子精度误差 #3384
已合并
jiangjiawei创建于 3月31日
jiangjiawei成员
3月31日

描述

修复adaptive_max_pool2d算子精度误差

关联的Issue

测试

image.png

文档更新

不涉及

类型标签

  • [x ] Bug修复
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 jiangjiawei 的贡献)
Jjiangjiawei成员
3月31日 创建了 pull request,commit 23a9b175
CANN-robot
CANN-robot成员
3月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


PR Approval Progress

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

Module Approval Details

module lgtm status approve status
pooling chenqi317, zhangyuxiang0119 (2/2) zhangyuxiang0119, chenqi317 (2/1)

💡 Tip:

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

CLA Signature Pass

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

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

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

likedislike
jiangjiawei成员
3月31日 评论:

/compile

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

流水线任务触发成功
任务链接 [8f63e6e32f774b3d97413bddca84b9f8][流水线指导]

任务名称状态日志下载链接
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 >>>>>
ATK_Test_A2 ✅ SUCCESS

[2026-03-31 16:08:58]    CI执行结束

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

问题/功能描述

本次PR旨在优化自适应最大池化(AdaptiveMaxPool2D)算子中计算输入窗口索引的算法。原实现依赖基于魔数和移位的快速整数除法,新方案移除了对该特定参数的依赖,转而采用更直接、通用的整数运算公式。此修改主要提升了代码的可读性、可维护性,并增强了在不同硬件平台或数据类型下的兼容性。

修改方案描述

核心修改是移除了计算输入窗口起始和结束索引时对魔数(magic)和移位(shift)参数的依赖。新增了 startIndexNoMagicendIndexNoMagic 两个模板函数,它们直接使用输出索引、输出尺寸和输入尺寸,通过标准整数乘除运算来计算对应的输入索引。在 executeFunc 函数中,相关调用点已更新为使用新函数,简化了参数传递和计算逻辑。内部计算使用 uint64_t 类型以防止溢出,最终结果转换回原类型。

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

/compile

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

流水线任务触发成功
任务链接 [aac79f53e7394dce80a8cf12002d0c10][流水线指导]

任务名称状态日志下载链接
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 >>>>> >>>>>
codecheck_style ✅ SUCCESS
UT_Test_ophost ✅ SUCCESS
UT_Test_opapi ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
UT_Test_opgraph ✅ SUCCESS
Smoke_A900_npupool ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
ATK_Test_A2 ✅ SUCCESS

[2026-03-31 18:50:52]    CI执行结束

likedislike
CANN-robotCANN-robot成员
3月31日 添加了label:api-check-pass
此处折叠了5条事件消息 查看更多
Jjiangjiawei成员
4月1日 修改标题为 “修复adaptive_max_pool2d算子精度误差”,原标题为“fix index bug”
张喻翔
张喻翔
4月1日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
4月1日 添加了label:approved
chenqi317成员
4月1日 评论:

/lgtm
/approve

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

Review Guide

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

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