[SOT] Compare float in guard with a threshold #70510
Merged
+55
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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