Fix KeyError returned by _maybe_get_last_node_only_observer (#58443)

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

Test Plan: arc lint

Reviewed By: vkuzo

Differential Revision: D28494119

fbshipit-source-id: 05abf4e12051afc237096812fb0ee08a8b9447f9
This commit is contained in:
Emily Shen
2021-05-18 12:40:15 -07:00
committed by Facebook GitHub Bot
parent 46484e8dfe
commit 07da584dbd

View File

@ -84,7 +84,7 @@ class QuantizeHandler(ABC):
"""
for maybe_obs_node, _ in self.last_node.users.items():
if maybe_obs_node.op == 'call_module':
maybe_obs = quantizer.modules[maybe_obs_node.name]
maybe_obs = quantizer.modules[maybe_obs_node.target]
if is_activation_post_process(maybe_obs):
return maybe_obs
return None