Skip to content

Adding quantized::conv2d function for pytorch mobile in c10 #26152

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

Closed
wants to merge 13 commits into from

Conversation

supriyar
Copy link
Contributor

@supriyar supriyar commented Sep 13, 2019

Stack from ghstack:

Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D17459892

Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:
@pytorchbot pytorchbot added module: operators oncall: quantization Quantization support in PyTorch labels Sep 13, 2019
supriyar added a commit that referenced this pull request Sep 13, 2019
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: b390f37
Pull Request resolved: #26152
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:
supriyar added a commit that referenced this pull request Sep 13, 2019
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 01cc178
Pull Request resolved: #26152
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:
supriyar added a commit that referenced this pull request Sep 13, 2019
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: aa6a36d
Pull Request resolved: #26152
Copy link
Collaborator

@dzhulgakov dzhulgakov left a comment

Choose a reason for hiding this comment

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

looking good, some comments

Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:
@supriyar supriyar requested a review from dzhulgakov September 15, 2019 00:31
supriyar added a commit to supriyar/pytorch that referenced this pull request Sep 15, 2019
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: b33ea74
Pull Request resolved: pytorch#26152
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@supriyar supriyar requested a review from dzhulgakov September 17, 2019 20:58
Copy link
Collaborator

@dzhulgakov dzhulgakov left a comment

Choose a reason for hiding this comment

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

I guess one of us would need to rebase depending on whether permute PR lands first or not

@@ -1323,6 +1322,129 @@ def test_qlinear_qnnpack(self, batch_size, input_channels, output_channels, use_
np.testing.assert_equal(
Y_q_ref2.int_repr().numpy(), Y_q.int_repr().numpy())

@given(batch_size=st.integers(1, 3),
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need separate tests for qnnpack? can't we just use the same set of tests as for fbgemm? (and iterate over available engines in the beginning)

same applies to linear tests above

Copy link
Contributor

Choose a reason for hiding this comment

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

Ensuring numeric consistency of QNNPACK and FBGEMM is also a requirement for quantization aware training to work, so it will be good to check that both kernels pass the same tests. For QNNPACK we should also add tests that allow for full use of dynamic range of wts and activations

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline. Will merge tests in a different PR.

Y_scale,
Y_zp,
use_relu):
with enable_mobile_quantized_engine():
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I'd rather rename it to a function taking qengine as an argument, but since it's a test - it's minor

Copy link
Contributor

@raghuramank100 raghuramank100 left a comment

Choose a reason for hiding this comment

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

Few comments/questions. Thanks!

Summary:
This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
zdevito pushed a commit to zdevito/ATen that referenced this pull request Sep 19, 2019
Summary:
Pull Request resolved: pytorch/pytorch#26152

This change adds the support to call QNNPACK using the refactored API for Conv2d operators

Test Plan:
python test/test_quantized.py TestQNNPackOps.test_qconv_qnnpack

Imported from OSS

Differential Revision: D17459892

fbshipit-source-id: d20b3e8b81dd403541cb2b9164731448ca229695
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in b23be95.

@facebook-github-bot facebook-github-bot deleted the gh/supriyar/15/head branch October 28, 2019 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merged oncall: quantization Quantization support in PyTorch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants