Commit Graph

11 Commits

Author SHA1 Message Date
8dbf6ae8fa ns for fx: handling for user functions in weight and unshadowed act APIs (#56292)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56292

Adds hooks for specifying user defined functions to NS weight and
unshadowed activation APIs.

Adding it to shadowed activation APIs will be a bit more work, upcoming
in a separate PR.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs.test_user_defined_function
```

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D27830409

fbshipit-source-id: 6bbddc3062c0b3e412a3147244795319c0785a92
2021-04-26 17:03:18 -07:00
75024e228c Add lint for unqualified type: ignore (#56290)
Summary:
The other half of https://github.com/pytorch/pytorch/issues/56272.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56290

Test Plan:
CI should pass on the tip of this PR, and we know that the lint works because the following CI runs (before this PR was finished) failed:

- https://github.com/pytorch/pytorch/runs/2384511062
- https://github.com/pytorch/pytorch/actions/runs/765036024

Reviewed By: seemethere

Differential Revision: D27867219

Pulled By: samestep

fbshipit-source-id: e648f07b6822867e70833e23ddafe7fb7eaca235
2021-04-21 08:07:23 -07:00
3786c2719d ns for fx: make NSTracer inherit from QuantizationTracer (#55505)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55505

This necessary to add support in NS for QAT modules, to avoid
duplicating logic between NSTracer and QuantizationTracer.

The eng work to expose the custom module and class names to
the user will be in a future PR.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs
python test/test_quantization.py TestFXNumericSuiteCoreAPIsModels
```

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D27650407

fbshipit-source-id: 431f47c5353b41c11371c5efa79657bfd085459a
2021-04-15 16:11:14 -07:00
457fac0a33 ns for fx: move more weight matching logic to weight_utils.py (#55288)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55288

No logic change, just moving util-like code to the utils file.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs
```

Imported from OSS

Reviewed By: hx89

Differential Revision: D27575423

fbshipit-source-id: cd5188a0940bb664be7d0275faa7df8ea18401a8
2021-04-14 09:04:26 -07:00
13d7b40ea0 ns for fx: add F.conv2d and F.conv3d weight extraction (#55287)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55287

Adds support for extracting weights from F.conv2d and F.conv3d.
F.conv1d and the fused variants are saved for future PRs.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs.test_extract_weights_conv_fun
```

Imported from OSS

Reviewed By: hx89

Differential Revision: D27575424

fbshipit-source-id: e945912d7d0ab320f47cab30d00d60ddb7497158
2021-04-14 09:04:24 -07:00
8062545c63 ns for fx: weight extaction for conv1d and conv3d (#55079)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55079

Extends weight extraction to conv1d and conv3d.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs
```

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D27474696

fbshipit-source-id: 9d5f892160b1b003aa557cfd099c6834e3f70ded
2021-04-02 09:35:34 -07:00
f6b25e758d ns for fx: move it to top level file (#55060)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55060

Removes the previous iteration of Numeric Suite for FX graph mode
quantization, and moves the current iteration into the top level
file.

Test Plan:
```
python test/test_quantization.py TestFXNumericSuiteCoreAPIs
python test/test_quantization.py TestFXGraphMatcher
```

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D27467725

fbshipit-source-id: 4c22b5a3221857231f9f59cf6d2908820e6a7f12
2021-04-02 09:35:27 -07:00
74ec9e7ccf compare_model_outputs_fx API implementation (#49266)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49266

compare_model_outputs_fx API implementation
ghstack-source-id: 120828880

Test Plan:
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_outputs_linear_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_outputs_conv_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_stub_linear_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_stub_conv_static_fx'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_linear_static'
buck test mode/dev caffe2/test:quantization -- 'test_compare_model_outputs_conv_static'

Reviewed By: vkuzo

Differential Revision: D25507933

fbshipit-source-id: 1b502b5eadb0fafbe9e8c2e843410bca03c63fd6
2021-02-02 10:43:25 -08:00
c354888e5d compare_model_stub_fx API implementation (#48951)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48951

compare_model_stub_fx API implementation
ghstack-source-id: 120817825

Test Plan:
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_stub_conv_static_fx'
buck test mode/dev caffe2/test:quantization_fx -- 'test_compare_model_stub_linear_static_fx'

Reviewed By: vkuzo

Differential Revision: D25379000

fbshipit-source-id: f1321d37b60b56b202e7d227e370ce13addb10cc
2021-02-01 22:16:14 -08:00
14edc726d9 Clean up some type annotations in caffe2/torch/quantization (#49942)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49942

Upgrades type annotations from Python2 to Python3

Test Plan: Sandcastle tests

Reviewed By: vkuzo

Differential Revision: D25717551

fbshipit-source-id: 1b63dc485ecf6641641b05f7ce095ae1d2d87346
2020-12-29 15:43:50 -08:00
f8722825b5 Compare Weights FX Implementation (#48056)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/48056

PyTorch FX Quantization API:  Compare weights
ghstack-source-id: 117255311

Test Plan:
buck test mode/dev caffe2/test:quantization -- 'test_remove_qconfig_observer_fx'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_dynamic_fx'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_linear_static_fx'
buck test mode/dev caffe2/test:quantization -- 'test_compare_weights_conv_static_fx'

Reviewed By: hx89

Differential Revision: D24940516

fbshipit-source-id: 301c1958c0e64ead9072e0fd002e4b21e8cb5b79
2020-11-20 17:17:19 -08:00