-
Notifications
You must be signed in to change notification settings - Fork 607
Convert scalar to tensor before quantizer annoate #2958
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
Differential Revision: [D55946527](https://our.internmc.facebook.com/intern/diff/D55946527/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/2958
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 1 Unrelated FailureAs of commit de04834 with merge base e733f2d ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D55946527 |
Differential Revision: [D55946527](https://our.internmc.facebook.com/intern/diff/D55946527/) ghstack-source-id: 221922774 Pull Request resolved: #2958
Differential Revision: [D55946527](https://our.internmc.facebook.com/intern/diff/D55946527/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D55946527 |
Pull Request resolved: #2958 ghstack-source-id: 222058912 @exported-using-ghexport In case like ``` def f(x, 2): return x * 2 ``` Since 2 is a scalar, we'd need to convert them to tensor so quantizer knows how to handle Differential Revision: [D55946527](https://our.internmc.facebook.com/intern/diff/D55946527/)
It seems to convert the scalar node of the binary op into a tensor node and allow the node to be quantized.
|
if non_const_arg is None or const_arg is None: | ||
continue | ||
|
||
tensor_constant = torch.tensor([const_arg], dtype=torch.float32) |
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.
Maybe we will want to infer data type from data.
Oh I see what's going. The |
Stale PR |
1 similar comment
Stale PR |
Stack from ghstack (oldest at bottom):
Differential Revision: D55946527