Skip to content
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

Closed
wants to merge 7 commits into from

Conversation

jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Oct 22, 2020

Stack from ghstack:

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D24486972

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]
jerryzh168 added a commit that referenced this pull request Oct 22, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: b44738c8fde57db49edb77e223df0a1fc7ae8840
Pull Request resolved: #46738
@dr-ci
Copy link

dr-ci bot commented Oct 22, 2020

💊 CI failures summary and remediations

As of commit 4a1d3b6 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

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.

See how this bot performed.

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]
jerryzh168 added a commit that referenced this pull request Oct 23, 2020
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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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) {
, which doesn't need LUTs. In this case, we should treat it like ReLU, i.e there is no fake-quant or observer needed at the output as there is no quantization that occurs inside the op.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… qat"

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D24486972](https://our.internmc.facebook.com/intern/diff/D24486972)

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Oct 23, 2020
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]
jerryzh168 added a commit that referenced this pull request Oct 23, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: f3435814da778464d9da8ed32771e0fa746bc2ed
Pull Request resolved: #46738
jerryzh168 added a commit that referenced this pull request Oct 26, 2020
Summary:

Test Plan: Imported from OSS

Reviewed By: raghuramank100

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e927b62.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e927b62.

jerryzh168 added a commit that referenced this pull request Oct 26, 2020
… qat (#46738)"

Summary:

Test Plan: Imported from OSS

Reviewed By: raghuramank100

Differential Revision: [D24547180](https://our.internmc.facebook.com/intern/diff/D24547180)

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Oct 26, 2020
Summary:

Test Plan: Imported from OSS

Reviewed By: raghuramank100

ghstack-source-id: f5d296debbd424a4536ad2c55cfc1646317fdb58
Pull Request resolved: #46871
facebook-github-bot pushed a commit that referenced this pull request Oct 27, 2020
… (#46871)

Summary: Pull Request resolved: #46871

Test Plan:
Imported from OSS

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D24547180

fbshipit-source-id: d2eb9aa74c6e5436204376b1a2ebcc6188d3562f
@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/475/head branch October 30, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants