Commit Graph

60 Commits

Author SHA1 Message Date
Terry Chen
f67cf03526 [Quant] Add qint32 quantization support (#72472)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72472

Add dtype=int32 support for observer

Test Plan:
python3 test/test_quantization.py TestObserver.test_per_tensor_observers

Imported from OSS

Reviewed By: jerryzh168

Differential Revision: D34056640

fbshipit-source-id: 4fa15a7274cfbb6a7dd4e698e3989cc0c0626e7b
(cherry picked from commit bf4351de45)
2022-02-16 03:45:15 +00:00
Jerry Zhang
8b67b83c6e [quant][fx][improvement] Add lowering support for FixedQParamsOpQuantizeHandler (#72488)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72488

This is an effort to move the current implementation towards the reference quantized model design:
https://github.com/pytorch/rfcs/blob/master/RFC-0019-Extending-PyTorch-Quantization-to-Custom-Backends.md
so that we use reference model in the default fbgemm/qnnpack path

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

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D34062364

fbshipit-source-id: 50c4a86644c3f5f6fb03d2a98aa7376895c0fc84
(cherry picked from commit ed8122e44d)
2022-02-11 18:13:29 +00:00
Jerry Zhang
ac0cac7724 [quant][fx][devs] Add lowering support for torch.cat (#72487)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72487

This is an effort to move the current implementation towards the reference quantized model design:
https://github.com/pytorch/rfcs/blob/master/RFC-0019-Extending-PyTorch-Quantization-to-Custom-Backends.md
so that we use reference model in the default fbgemm/qnnpack path

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

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D34062366

fbshipit-source-id: 86673bead79180a7509b51bd577f328e90f24893
(cherry picked from commit de3e443384)
2022-02-09 06:09:57 +00:00
Jerry Zhang
4b69a2373f [quant][fx] Add lowering support for ops in GeneralTensorShapeOpQuantizeHandler (#72387)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72387

Also make GeneralTensorShapeOpQuantizeHandler produce reference patterns by default

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

Imported from OSS

Reviewed By: albanD, terrychenism

Differential Revision: D34025005

fbshipit-source-id: 01ca62cce727bbf4579ba8fb2b8c40198f327b86
(cherry picked from commit 7f3a9ab4c5)
2022-02-09 02:10:20 +00:00
Terry Chen
e4500306c8 [Quant] Enable default reference path for CopyNodeQuantizeHandler (#71168)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71168

In this PR we want to enable the reference path by default for CopyNodeQuantizeHandler

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

Imported from OSS

Reviewed By: andrewor14

Differential Revision: D33715995

fbshipit-source-id: eda44892fcea3a1cba54ac75bc020f73e1becc8c
(cherry picked from commit a2cf63f68d)
2022-01-25 23:32:11 +00:00
Vasiliy Kuznetsov
c21a540866 dbr quant: support dynamic linear (#70257)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70257

Makes dynamic quantization for linear module work in DBR quant.

Coverage for more ops and functionals will be in future PRs.

Test Plan:
```
python test/test_quantization.py -k DBR
```

Reviewed By: jerryzh168

Differential Revision: D33262300

Pulled By: vkuzo

fbshipit-source-id: c1cb0f9dd3f42216ad6ba19f4222b171ff170174
2022-01-06 13:24:55 -08:00
Vasiliy Kuznetsov
b999f87503 fx quant: move _parent_name to common utils (#69720)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/69720

This function is also useful for DBR quant, moving it from FX utils
to common utils.

Test Plan:
```
python test/test_quantization.py TestQuantizeFx
python test/test_quantization.py TestQuantizeDBR
```

Reviewed By: jerryzh168

Differential Revision: D33003473

Pulled By: vkuzo

fbshipit-source-id: 20360682c69d614a645c14fc29d3ee023d6b2623
2021-12-17 05:59:46 -08:00
Jerry Zhang
e5a1ee0e5a [quant][graphmode] Refactor fusion to use the new Pattern format (#68770)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68770

Previous fusion only works for a sequnce of ops, which is not general enough for fusion patterns
that is defined by a subgraph, this PR refactors that to make it more general

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

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D32602637

fbshipit-source-id: a7897c62081b9d71c67fb56e78484cf68deaacf6
2021-12-07 16:12:40 -08:00
Jerry Zhang
9cb52327a8 [quant][refactor] Move pattern type definition to ao/quantization/utils.py (#68769)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/68769

att, since we want to use this type in fuser_method_mapping in later PRs

Test Plan:
no change to logic, just regression test on ci
```
python test/test_quantization.py
```

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D32602636

fbshipit-source-id: 15b95241431dfca9b1088d0920bf75705b37aa9a
2021-12-07 11:00:22 -08:00
Zafar Takhirov
02dec91212 [quant] AO migration of the torch/quantization/utils.py (phase 1) (#64919)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64919

AO Team is migrating the existing torch.quantization into torch.ao.quantization. We are doing it one file at a time to make sure that the internal callsites are updated properly. This migrates the quantization utilities.
ghstack-source-id: 138303325

Test Plan: `buck test mode/dev //caffe2/test:quantization`

Reviewed By: jerryzh168

Differential Revision: D30899082

fbshipit-source-id: 85eb38c419e417147e71758b682cd095308dd0c9
2021-09-16 21:30:18 -07:00