@@ -58,12 +58,16 @@ def __init__(self, **kwargs):
5858 'DequantizeConv2DSigmoidQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
5959 'DequantizeConv2DBiasAddLeakyReluAddV2QuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6060 'DequantizeConv2DBiasAddLeakyReluAddQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
61+ 'DequantizeConv2DBiasAddReluAddV2QuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
62+ 'DequantizeConv2DBiasAddReluAddQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6163 'DequantizeConv2DBiasAddAddLeakyReluQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6264 'DequantizeConv2DBiasAddAddV2LeakyReluQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6365 'DequantizeConv2DAddLeakyReluQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6466 'DequantizeConv2DAddV2LeakyReluQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6567 'DequantizeConv2DLeakyReluAddV2QuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6668 'DequantizeConv2DLeakyReluAddQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
69+ 'DequantizeConv2DReluAddV2QuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
70+ 'DequantizeConv2DReluAddQuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
6771 'DequantizeConv2DAddRelu6QuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
6872 'DequantizeConv2DAddReluQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
6973 'DequantizeConv2DBiasAddAddRelu6MulMulQuantizeV2' : self .apply_conv_biasadd_hardswish_fusion ,
@@ -1194,7 +1198,9 @@ def apply_newly_conv_biasadd_addn_relu_fusion(self, match_node_name):
11941198 # Dequantize + Conv2D + BiasAdd + AddV2 + Relu6 + QuantizeV2
11951199 # Dequantize + Conv2D + BiasAdd + Add + Relu + QuantizeV2
11961200 # Dequantize + Conv2D + BiasAdd + LeakyRelu + AddV2 + QuantizeV2
1201+ # Dequantize + Conv2D + BiasAdd + Relu + AddV2(Add) + QuantizeV2
11971202 # Dequantize + Conv2D + LeakyRelu + AddV2 + QuantizeV2
1203+ # Dequantize + Conv2D + Relu + AddV2(Add) + QuantizeV2
11981204 # Dequantize + Conv2D + Add + Add + Relu + QuantizeV2
11991205 # Dequantize + Conv2D + BiasAdd + Add + Relu + QuantizeV2
12001206 skip_node_name = match_node_name [2 :]
@@ -1236,8 +1242,8 @@ def apply_newly_conv_biasadd_addn_relu_fusion(self, match_node_name):
12361242 return self .apply_newly_conv_biasadd_fusion (match_node_name [:3 ] + [match_node_name [- 1 ]])
12371243
12381244 forth_node = self .node_name_mapping [match_node_name [4 ]].node
1239- if forth_node .op != 'LeakyRelu' :
1240- if third_node .op != 'LeakyRelu' and not self ._find_relu_node (matched_node .node ):
1245+ if forth_node .op not in ( 'LeakyRelu' , 'Relu' ) :
1246+ if third_node .op not in ( 'LeakyRelu' , 'Relu' ) and not self ._find_relu_node (matched_node .node ):
12411247 return self .apply_newly_conv_biasadd_fusion (match_node_name [:3 ] + [match_node_name [- 1 ]])
12421248
12431249 is_leakyrelu_add_fusion = third_node .op == 'LeakyRelu' and forth_node .op .find ('Add' ) != - 1
@@ -1251,7 +1257,7 @@ def apply_newly_conv_biasadd_addn_relu_fusion(self, match_node_name):
12511257
12521258 sum_node_name = self .node_name_mapping [match_node_name [3 + relu_offset ]].node .input [sum_index ]
12531259 deq_node = self .node_name_mapping [sum_node_name ].node
1254- if (deq_node .op != 'LeakyRelu' and deq_node .op != 'Dequantize' ) or \
1260+ if (deq_node .op != 'LeakyRelu' and deq_node .op != 'Dequantize' and deq_node . op != 'BiasAdd' ) or \
12551261 deq_node .op .find ("Quantize" ) != - 1 :
12561262 return self .apply_newly_conv_biasadd_fusion (match_node_name [:3 ]+ [match_node_name [- 1 ]])
12571263
@@ -1350,7 +1356,7 @@ def apply_newly_conv_biasadd_addn_relu_fusion(self, match_node_name):
13501356
13511357 self .add_output_graph_node (quantized_conv_node )
13521358
1353- if is_leakyrelu_add_fusion or is_leakyrelu :
1359+ if is_leakyrelu_add_fusion or is_leakyrelu or is_relu_add_fusion :
13541360 quantize_down_name = self ._add_quantize_down_nodes (
13551361 node , quantized_node_name , dtypes .qint8 , False )
13561362 self ._intel_cpu_add_dequantize_result_node (
0 commit comments