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
[quant][graphmode][fx] Support sigmoid/hardsigmoid/tanh in qat #46738
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
… qat" Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972) [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: b44738c8fde57db49edb77e223df0a1fc7ae8840 Pull Request resolved: #46738
💊 CI failures summary and remediationsAs of commit 4a1d3b6 (more details on the Dr. CI page):
Extra GitHub checks: 1 failed
This 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 33 times. |
… qat" Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972) [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 2afac9bf2b9b45ed771e613efce63d0ebc944d06 Pull Request resolved: #46738
self.dequant = DeQuantStub() | ||
|
||
def forward(self, 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.
Does the approach here also work for cases where the scale and zero-point are not fixed? i.e for a hardTanh, the scale and zero-point depend on the arguments to init.
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, this allows to provide special fake quantize(activation_post_process) for a specific pattern (module/functional/torch op), could you write down the details, is it like following?
fake_quant = HardTanhFakeQuantize(hardtanh_instance.params)
I think this should be too hard to support in current implementation.
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.
Actually for hardtanh, our implementation calls qclamp:
Tensor qnnpack_clamp(Tensor input, Scalar min, Scalar max) { |
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.
yeah this is how it is implemented right now: https://github.com/pytorch/pytorch/blob/master/torch/quantization/fx/quantization_patterns.py#L512
… qat" Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972) [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 03ec5b5d9757f7623bca25c8db01b9ea86f4acf9 Pull Request resolved: #46738
… qat" Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972) [ghstack-poisoned]
… qat" Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972) [ghstack-poisoned]
… qat" Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972) [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: f3435814da778464d9da8ed32771e0fa746bc2ed Pull Request resolved: #46738
Summary: Test Plan: Imported from OSS Reviewed By: raghuramank100 [ghstack-poisoned]
This pull request has been merged in e927b62. |
This pull request has been merged in e927b62. |
… qat (#46738)" Summary: Test Plan: Imported from OSS Reviewed By: raghuramank100 Differential Revision: [D24547180](https://our.internmc.facebook.com/intern/diff/D24547180) [ghstack-poisoned]
Summary: Test Plan: Imported from OSS Reviewed By: raghuramank100 ghstack-source-id: f5d296debbd424a4536ad2c55cfc1646317fdb58 Pull Request resolved: #46871
Stack from ghstack:
Summary:
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D24486972