Convert scalar to tensor before quantizer annoate#2958
Convert scalar to tensor before quantizer annoate#2958cccclai wants to merge 2 commits intogh/cccclai/2/basefrom
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.
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