Change condition in swap module

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

Test Plan:
python test/test_quantization.py

Imported from OSS

Differential Revision: D16570928

Pulled By: jerryzh168

fbshipit-source-id: 70f36f577ac657d015f3d7738819867742088e5a
This commit is contained in:
Jerry Zhang 2019-07-30 17:16:29 -07:00 committed by Facebook Github Bot
parent ab584c738b
commit bc64324da9

View File

@ -275,7 +275,7 @@ def swap_module(mod, mapping):
The corresponding quantized module of `mod`
"""
new_mod = mod
if hasattr(mod, 'observer'):
if hasattr(mod, 'qconfig') and mod.qconfig is not None:
if type(mod) in mapping:
new_mod = mapping[type(mod)].from_float(mod)