[ MO ] Put FQ fuses under the disable_fusing key (#4829)

This commit is contained in:
Evgenya Stepyreva 2021-03-17 08:51:40 +03:00 committed by GitHub
parent 7f3a8ce885
commit f3abba3685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -34,6 +34,7 @@ class ReluFakeQuantizeMark(MiddleReplacementPattern):
"""
enabled = True
graph_condition = [lambda graph: not graph.graph['cmd_params'].disable_fusing]
def run_after(self):
return [BinarizeWeightsM1P1]

View File

@ -99,11 +99,12 @@ class Fusing(MiddleReplacementPattern):
for_graph_and_each_sub_graph_recursively(graph, normalize_eltwise_inputs)
for_graph_and_each_sub_graph_recursively(graph, lambda G: G.clean_up())
MarkNodesToFuseUpToFakeQuantize().find_and_replace_pattern(graph)
FakeQuantizeFuse().find_and_replace_pattern(graph)
AddFakeQuantizeFuse().find_and_replace_pattern(graph)
MulFakeQuantizeFuse().find_and_replace_pattern(graph)
for_graph_and_each_sub_graph_recursively(graph, lambda G: G.clean_up())
if not argv.disable_fusing:
MarkNodesToFuseUpToFakeQuantize().find_and_replace_pattern(graph)
FakeQuantizeFuse().find_and_replace_pattern(graph)
AddFakeQuantizeFuse().find_and_replace_pattern(graph)
MulFakeQuantizeFuse().find_and_replace_pattern(graph)
for_graph_and_each_sub_graph_recursively(graph, lambda G: G.clean_up())
for_graph_and_each_sub_graph_recursively(graph, fuse_pad)
for_graph_and_each_sub_graph_recursively(graph, lambda G: G.clean_up())

View File

@ -31,6 +31,7 @@ class MarkNodesToFuseUpToFakeQuantize(MiddleReplacementPattern):
"""
enabled = True
graph_condition = [lambda graph: not graph.graph['cmd_params'].disable_fusing]
def run_after(self):
return [DeleteControlFlowEdges]
@ -83,6 +84,7 @@ class FakeQuantizeFuse(MiddleReplacementPattern):
replacer duplicates node to fuse (duplicate connections of inputs of node to fuse to duplicates of it)
"""
enabled = True
graph_condition = [lambda graph: not graph.graph['cmd_params'].disable_fusing]
def run_after(self):
return [MarkNodesToFuseUpToFakeQuantize]