-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Dy2St] Make bool(Value)
always throw error
#60902
Merged
SigureMo
merged 11 commits into
PaddlePaddle:develop
from
cattidea:dy2st/make-value-bool-always-throw-error
Jan 24, 2024
Merged
[Dy2St] Make bool(Value)
always throw error
#60902
SigureMo
merged 11 commits into
PaddlePaddle:develop
from
cattidea:dy2st/make-value-bool-always-throw-error
Jan 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
你的PR提交成功,感谢你对开源项目的贡献! |
2742195759
approved these changes
Jan 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
cyber-pioneer
approved these changes
Jan 24, 2024
eee4017
pushed a commit
to eee4017/Paddle
that referenced
this pull request
Jan 30, 2024
--------- Co-authored-by: zoooo0820 <zoooo0820@qq.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 types
Bug fixes
PR changes
Others
Description
#60836 的拆分
bool(Value) 是一种错误的用法,对于一个自定义 Object 来说,如果没有重写
__bool__
,那么bool(obj)
永远为 True,相关判断逻辑是错误的而对于编译期的 Value 来说是不可能知道值的,
__bool__
只能报错,因此本 PR 加了本限制,用户代码永远不应该触发Value.__bool__
但现存很多代码的 API 里触发了
Value.__bool__
,需要修复注意,现有代码大多并不是显式调用
bool(Value)
,大多是通过 if 隐式调用的,比如这些 case 大多是只考虑 x 是 int 的情况,没有考虑是 Value 的情况,因此传入 Value 其实走了错误的逻辑
对于这些 case,可以考虑加逻辑分支或调整写法来避免这种错误用法,如:
这里只是一些示例,但具体情况仍应具体分析
PCard-66972
问题推进 tracker
test_put_along_axis_op
fix behavior of put_along_axis and take_along_axis 易用性提升No.43 #59163 @YibinLiu666test_set_value_op
、test_while_loop_op
、test_while_op
、test_jit_setitem
、test_ifelse
test_triplet_margin_with_distance_loss
本 PRtest_adamw_op
本 PRtest_decompose_op
本 PR