Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOT] Compare float in guard with a threshold #70510

Conversation

SigureMo
Copy link
Member

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

float 对比时不使用完全匹配,而是改为允许 1e-13 内的误差

一般情况不会出现这个问题,目前在 SwinTransformer 上一个 guard 内的数值 0.018181818181818184 总是匹配不上,导致重复组网,而且目前该问题只能在编译器场景下复现,且有一定随机性

在出现问题的情况下,无论是 python float 直接运算还是 numpy 运算都会出现一定的精度损失,0.2 / 11 的结果会变成 0.018181818181818177,导致 guard 无法命中,由于复现困难且目前难以理解(属实超过我认知了),因此暂时在 guard 中允许一定误差,避免重复组网

PCard-66972

Copy link

paddle-bot bot commented Dec 27, 2024

你的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.

@SigureMo SigureMo changed the title [SOT] Compare float in guard with a threshold [SOT][3.13] Compare float in guard with a threshold Dec 27, 2024
@SigureMo SigureMo changed the title [SOT][3.13] Compare float in guard with a threshold [SOT] Compare float in guard with a threshold Dec 27, 2024
@SigureMo SigureMo merged commit ccbc242 into PaddlePaddle:develop Dec 27, 2024
29 checks passed
@SigureMo SigureMo deleted the sot/compare-float-in-guard-with-a-threshold branch December 27, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants