pytorch/test/quantization
Andrew Or 873f772df2 [quant][pt2] Fix QAT convert for resnet18 (#103759)
Summary:
Before this commit, only prepare QAT numerics matched
between PT2 and FX for resnet18. Convert numerics diverged,
however, for two reasons:

(1) Existing patterns did not handle inplace ReLUs. This commit
fixes this by adding extra patterns that use these ReLUs instead
of the normal ones.

(2) Subgraph rewriter could not handle skip connections in
quantized models, because the dequantize node is used in both
the conv node within the match pattern, and an inplace add node
outside of the match pattern. This led the subgraph matcher to
filter out the match, complaining that it was not self contained.
This commit fixes this problem by duplicating the dequantize
nodes, one for each user, such that subsequent matches will
be self contained.

Test Plan: python test/test_quantization.py TestQuantizePT2EModels.test_qat_resnet18

Reviewed By: jerryzh168

Differential Revision: D46564114

Pull Request resolved: https://github.com/pytorch/pytorch/pull/103759
Approved by: https://github.com/jerryzh168
2023-06-21 15:36:07 +00:00
..
ao_migration ao migration: remove package test as this behavior is tested by other things (#94422) 2023-02-13 16:33:40 +00:00
bc [BE] [3/3] Rewrite super() calls in test (#94592) 2023-02-12 22:20:53 +00:00
core Enable quantized_max_pool3d (#101654) 2023-05-23 00:45:38 +00:00
eager [BE] [3/3] Rewrite super() calls in test (#94592) 2023-02-12 22:20:53 +00:00
fx [PT2][Quant] Update op names for decomposed quantized lib (#103251) 2023-06-15 04:37:58 +00:00
jit [BE] Move flatbuffer related python C bindings to script_init (#97476) 2023-03-28 17:56:32 +00:00
pt2e [quant][pt2] Fix QAT convert for resnet18 (#103759) 2023-06-21 15:36:07 +00:00
serialized [ao] fix incorrect integer cast on histogram observer bounds (#90355) 2022-12-12 20:30:44 +00:00
__init__.py