Skip to content

Conversation

ooooo-create
Copy link
Contributor

@ooooo-create ooooo-create commented Jun 6, 2025

PR Category

Execute Infrastructure

PR Types

Improvements

Description

日志显示反向精度问题,都出现在 torch 包含 inf 中,torch 的自动求导是 -grad * (result * result).conj(),先进行了 output 的相乘,如果出现 inf ,就会传递下去,paddle中按顺序 -grad*result,就导致不会出现 inf。对齐 torch 的行为,感觉在数学上也更加合理。(这里加了一个精度提升,主要是看见 torch 的mul算子有这个行为,但是没加 PaddleAPITest 也能通过

  • PaddleAPITest 测试通过
    图片

Copy link

paddle-bot bot commented Jun 6, 2025

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Jun 6, 2025
@ooooo-create ooooo-create changed the title [Accuracy diff No.52] Fix accuracy diff for reciprocal API Fix accuracy diff for reciprocal API Jun 6, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Jun 6, 2025
@ooooo-create ooooo-create changed the title Fix accuracy diff for reciprocal API [Accuracy diff No.52] Fix accuracy diff for reciprocal API Jun 6, 2025
Comment on lines +3597 to +3600
MPType dout = static_cast<MPType>(arg_dout);
MPType out = static_cast<MPType>(arg_out);
return static_cast<T>(-dout *
static_cast<MPType>(static_cast<T>(out * out)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能给个torch的链接看看吗,或者写在简介里

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lshpku lshpku merged commit 49ece35 into PaddlePaddle:develop Jun 10, 2025
74 of 75 checks passed
shanjiang7 pushed a commit to shanjiang7/Paddle that referenced this pull request Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants