-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[tensorexpr] Fix promotion of booleans #43097
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
Boolean arguments weren't promoted, so if you tried to write a comparison with types such as `Tensor(Bool) == Int` you'd fail typechecking inside the TE engine. [ghstack-poisoned]
Boolean arguments weren't promoted, so if you tried to write a comparison with types such as `Tensor(Bool) == Int` you'd fail typechecking inside the TE engine. [ghstack-poisoned]
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.
Looks good!
os() << *v->base_handle(); | ||
return; | ||
} | ||
if (v->dtype().scalar_type() == ScalarType::Bool) { |
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.
Why do we need to special case Bool here? A comment could be helpful.
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.
Good idea, I'll add it. For posterity, there's no __ldg overload for bool, so we need to use normal array indexing.
Boolean arguments weren't promoted, so if you tried to write a comparison with types such as `Tensor(Bool) == Int` you'd fail typechecking inside the TE engine. [ghstack-poisoned]
Boolean arguments weren't promoted, so if you tried to write a comparison with types such as `Tensor(Bool) == Int` you'd fail typechecking inside the TE engine. [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 013b97e (more details on the Dr. CI page):
ci.pytorch.org: 1 failedThis comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 1 time. |
@bertmaher merged this pull request in 6c99d56. |
Stack from ghstack:
Boolean arguments weren't promoted, so if you tried to write a comparison with
types such as
Tensor(Bool) == Int
you'd fail typechecking inside the TEengine.
Differential Revision: D23167926