-
Notifications
You must be signed in to change notification settings - Fork 26.3k
conditionally defined var better error message #20911
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
Conversation
Krovatkin
left a comment
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.
![]()
|
|
||
| // var is only defined in one branch save error in case it's used later | ||
| auto err = [&](const std::string& v, const std::string& branch) { | ||
| ErrorReport error(stmt); |
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.
this will get thrown when we try to do getVar to unify value types?
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.
No, this uses the same mechanism we use when we cannot unify the type of two values. We don't emit an error now, and cache the error msg if they try to use the var again later.
pytorch/torch/csrc/jit/script/compiler.cpp
Line 429 in 4d676d5
| // check if this value was not emitted in an if statement because of a |
facebook-github-bot
left a comment
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.
@eellison has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@pytorchbot rebase this please |
|
@pytorchbot retest this please |
facebook-github-bot
left a comment
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.
@eellison is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
i will do loops in a follow up after some other changes I am working on have landed