-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[Quant] Add ConvTranspose reference module #72473
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
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
CI Flow Status⚛️ CI FlowRuleset - Version:
|
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit cb8c37b (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
not ready for merge |
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
| this is useful when user want to use this module in other backends like Glow. | ||
| """ | ||
| __annotations__ = {"bias": Optional[torch.Tensor]} | ||
| _IS_REFERNECE = True |
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.
nit: IS_REFERENCE (fix typo)?
| class M(torch.nn.Module): | ||
| def __init__(self): | ||
| super().__init__() | ||
| self.conv = nn.ConvTranspose2d(1, 1, 1) |
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.
can we test the 1d and 3d variants as well
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
| qmod = mapping[type(mod)] | ||
| if hasattr(qmod, '_IS_REFERENCE') and qmod._IS_REFERENCE: | ||
| assert mod.qconfig is not None | ||
| weight_post_process = mod.qconfig.weight() |
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.
we need to run the weight_process_process with weight of the module:
weight_post_process(mod.weight)
| x = self.quant(x) | ||
| x = self.dequant(x) | ||
| x = self.conv(x) | ||
| x = self.quant(x) |
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.
is this is the module for reference conv transpose, we need to use two different QuantStubs since they are recording the scale/zero_point at a specific point
| x = self.dequant(x) | ||
| return x | ||
|
|
||
| class RefM(torch.nn.Module): |
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.
not sure which one you want to use quantized conv transpose (instead of reference), but the one that is using normal path will have one quant and one dequant:
x = self.quant(x)
x = self.convtranspose(x)
x = self.dequant(x)
since the quantized convtranspose takes quantized Tensor as input and outputs a quantized Tensor
| __annotations__ = {"bias": Optional[torch.Tensor]} | ||
| _IS_REFERENCE = True | ||
|
|
||
| def _save_to_state_dict(self, destination, prefix, keep_vars): |
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.
can we refactor these to utils and use the same copy of code instead of duplicating code?
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
jerryzh168
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.
Looks good overall, had a few comments inline
|
@terrychenism has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: #72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c
|
Hey @terrychenism. |
|
Reverting as it breaks MacOS test sanity, see https://hud.pytorch.org/commit/pytorch/pytorch/7a031ec17f5cfc052e618694d4bee28381a6051d |
|
This pull request has been reverted by e6fd28f. To re-land this change, please open another pull request, assignthe same reviewers, fix the CI failures that caused the revert and make sure that the failing CI runs on the PR by applying the proper ciflow label (e.g., ciflow/trunk). |
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D34126542](https://our.internmc.facebook.com/intern/diff/D34126542) [ghstack-poisoned]
|
@terrychenism has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D34292446](https://our.internmc.facebook.com/intern/diff/D34292446) [ghstack-poisoned]
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Summary: Pull Request resolved: pytorch/pytorch#72473 Add ConvTranspose reference module Test Plan: python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op Imported from OSS Reviewed By: jerryzh168 Differential Revision: D34126542 fbshipit-source-id: 7da167695a1fd9c141059bce14cce4f0608b086c (cherry picked from commit dee22dcf483e5b7f057ff6038acb893a6b01c91e)
Stack from ghstack:
Summary:
Add ConvTranspose reference module
Test Plan:
python3 test/test_quantization.py TestQuantizeEagerOps.test_conv_transpose_op
Reviewers:
Subscribers:
Tasks:
Tags: