Commit Graph

7 Commits

Author SHA1 Message Date
Angela Yi
c0b7c59e55 [quant] Equalization Observer modifications (#59953)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/59953

The following modifications were made to the equalization
observers due to design changes:
- [InputEqualizationObserver] Replaced `calculate_qparams()` with
`calculate_scaled_minmax()` since we will need to return the scaled
min/max values to update the following input quantization observer
- [WeightEqualizationObserver] We no longer need a row observer since
this will be taken care of by the following weight quantization observer
- [WeightEqualizationObserver] Following the previous comment, we no
longer need to calculate the scaled qparam values. Instead, we will use
the equalization scale to later scale the weights and the qparams will
be taken care of by the weight quantization observer.

Test Plan:
`python test/test_quantization.py
TestEqualizeFx.test_input_weight_eq_observer`

Imported from OSS

Reviewed By: supriyar

Differential Revision: D29135332

fbshipit-source-id: be7e468273c8b62fc183b1e1ec50f6bd6d8cf831
2021-06-16 22:32:30 -07:00
Jerry Zhang
7484c56fa3 [quant][graphmode][fx] Fix a condition check for CopyNode (#53585)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53585

Previously fp16_static CopyNode would be marked as unquantized because of
an incorrect condition check of whether a Node is statically quantized or not.
This PR fixes that.

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26912677

fbshipit-source-id: 4ddb538714c5ba2db28430de5e1cf2931baf1993
2021-03-11 09:32:20 -08:00
Jerry Zhang
b685864f50 [quant][graphmode][fx] Add reference option support for linear_static_fp16 (#52650)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52650

linear_dynamic_fp16 has following dtypes for activation, weight, bias, output:
(fp32, fp16, fp32, fp32)

linear_static_fp16 has following dtypes:
(fp16, fp16, fp16, fp16)

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26599803

fbshipit-source-id: b4a8345d355125070be718a227288cc848cc8bbc
2021-02-27 08:25:44 -08:00
Jerry Zhang
177694681e [quant][graphmode][fx] Add reference option support for linear_dynamic_fp16 (#52534)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52534

Currently linear_dynamic_fp16 has a signature that's tied to fbgemm/qnnpack
We'll need to produce a pattern equivalent to linear_dynamic_fp16 to support extensions
to other backends

Test Plan:
python test/test_quantization.py TestQuantizeFxOps.test_linear_dynamic_fp16

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D26557726

fbshipit-source-id: 270c9f781f73c79416a092b7831294cabca84b0c
2021-02-26 21:12:22 -08:00
Zafar
7d28f1c81d [quant][refactor] Minor refactor of some typos (#50304)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50304

Does not include any functional changes -- purely for fixing minor typos in the `fuser_method_mappings.py`

Test Plan: Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D25857248

Pulled By: z-a-f

fbshipit-source-id: 3f9b864b18bda8096e7cd52922dc21be64278887
2021-01-12 15:23:13 -08:00
Jerry Zhang
ed57f804fa [quant][refactor] Move some util functions from torch/quantization/fx/utils.py to torch/quantization/utils.py (#48107)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/48107

Test Plan: Imported from OSS

Reviewed By: supriyar

Differential Revision: D25026495

fbshipit-source-id: 3634b6b95a18670232600874b1e593180ea9f44c
2020-11-18 22:32:19 -08:00
Jerry Zhang
dd77d5a1d4 [quant][refactor] factor out get_combined_dict function (#47781)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/47781

Test Plan: Imported from OSS

Reviewed By: supriyar

Differential Revision: D24900303

fbshipit-source-id: 1a2cb0ec536384abcd140e0d073f0965ed2800cd
2020-11-11 21:01:31 -08:00