[quant][graphmode][refactor] Remove reduandent code (#54073)

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

Test Plan: Imported from OSS

Reviewed By: vkuzo

Differential Revision: D27086067

fbshipit-source-id: b1995138de56f1352c5df03378ebc2832bf35ef7
This commit is contained in:
Jerry Zhang 2021-03-31 17:46:37 -07:00 committed by Facebook GitHub Bot
parent 55544cb13a
commit c2adedf6fe

View File

@ -585,10 +585,8 @@ class Quantizer:
root_node, matched_nodes, pattern, obj, qconfig = matches.get(
node.name, (None, None, None, None, None))
if root_node is None:
env[node.name] = observed_graph.node_copy(node, load_arg)
elif root_node is node:
env[node.name] = observed_graph.node_copy(node, load_arg)
env[node.name] = observed_graph.node_copy(node, load_arg)
if root_node is node:
# index for input of custom module that needs to be observed in
# parent
if qconfig is not None:
@ -604,8 +602,6 @@ class Quantizer:
env,
observed_graph, load_arg, observed_node_names_set,
matched_nodes, standalone_module_input_idxs, quants)
else:
env[node.name] = observed_graph.node_copy(node, load_arg)
if node.op == 'placeholder':
# skip adding observers at the graph input if the input is