mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
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 |
||
|---|---|---|
| .. | ||
| ao_migration | ||
| bc | ||
| core | ||
| eager | ||
| fx | ||
| jit | ||
| pt2e | ||
| serialized | ||
| __init__.py | ||