Skip to content

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

Closed
supriyar wants to merge 13 commits intogh/supriyar/15/basefrom
gh/supriyar/15/head
Closed

Adding quantized::conv2d function for pytorch mobile in c10#26152
supriyar wants to merge 13 commits intogh/supriyar/15/basefrom
gh/supriyar/15/head

Conversation

@supriyar
Copy link
Copy Markdown
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
Comment thread test/test_quantized.py
Comment thread aten/src/ATen/native/quantized/cpu/qconv_prepack.cpp
Copy link
Copy Markdown
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

Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp Outdated
Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp Outdated
Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp Outdated
Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp
Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp Outdated
Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp
Comment thread aten/src/ATen/native/quantized/cpu/qconv_prepack.cpp Outdated
Comment thread test/test_quantized.py Outdated
Comment thread test/test_quantized.py
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
Comment thread test/test_quantized.py Outdated
Comment thread aten/src/ATen/native/quantized/cpu/qconv.cpp Outdated
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
Copy Markdown
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

Comment thread test/test_quantized.py
np.testing.assert_equal(
Y_q_ref2.int_repr().numpy(), Y_q.int_repr().numpy())

@given(batch_size=st.integers(1, 3),
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread test/test_quantized.py
Y_scale,
Y_zp,
use_relu):
with enable_mobile_quantized_engine():
Copy link
Copy Markdown
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

Comment thread aten/src/ATen/native/quantized/cpu/qconv_prepack.cpp
Copy link
Copy Markdown
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
Copy Markdown
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
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
…26152)

Summary:
Pull Request resolved: 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
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