Bugfix for fuse qconfig comparison (#63384)
authorCharles David Hernandez <cdhernandez@fb.com>
Wed, 18 Aug 2021 20:30:35 +0000 (13:30 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 18 Aug 2021 20:31:56 +0000 (13:31 -0700)
commit877e6f2be3e78258247fb969577cb86be392e90c
tree5a7f1f807db4310396455f62fc25c48220300a79
parent2aa19f33c6272cb016c629792ddc70cf9636fc9a
Bugfix for fuse qconfig comparison (#63384)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63384

In some cases the changes to qconfig on module would cause the
fusions to fail. This bugfix solves that problem by adding a
qconfig_function_comparison that compares the functions within the
qconfig rather than the modules the qconfigs are on. The comparison
looks at the partial object within QConfig.activation/weight.p and
compares args, keywords and func. This is necessary to do mannually
because partial doesn't have __eq__ implemented and so == reverts to is.

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

Imported from OSS

Reviewed By: supriyar, ejguan

Differential Revision: D30386264

fbshipit-source-id: 51e358c021c39d6f48dc12ad2a82b2838677b9de
test/quantization/fx/test_quantize_fx.py
torch/quantization/fx/prepare.py
torch/quantization/qconfig.py