@@ -52,6 +52,8 @@ def __init__(self, **kwargs):
52
52
'DequantizeConv2DEluQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
53
53
'DequantizeConv2DBiasAddLeakyReluQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
54
54
'DequantizeConv2DLeakyReluQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
55
+ 'DequantizeConv2DBiasAddSigmoidQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
56
+ 'DequantizeConv2DSigmoidQuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
55
57
'DequantizeConv2DBiasAddLeakyReluAddV2QuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
56
58
'DequantizeConv2DLeakyReluAddV2QuantizeV2' : self .apply_newly_conv_biasadd_addn_relu_fusion ,
57
59
'DequantizeConv2DAddRelu6QuantizeV2' : self .apply_newly_conv_biasadd_relu_fusion ,
@@ -813,6 +815,8 @@ def apply_newly_conv_biasadd_relu_fusion(self, match_node_name):
813
815
# Dequantize + Conv2D + Elu + QuantizeV2
814
816
# Dequantize + Conv2D + BiasAdd + LeakyRelu + QuantizeV2
815
817
# Dequantize + Conv2D + LeakyRelu + QuantizeV2
818
+ # Dequantize + Conv2D + BiasAdd + Sigmoid + QuantizeV2
819
+ # Dequantize + Conv2D + Sigmoid + QuantizeV2
816
820
# Dequantize + Conv2D + Add + Relu6 + QuantizeV2
817
821
# Dequantize + Conv2D + Add + Relu + QuantizeV2
818
822
# Dequantize + DepthwiseConv2dNative + Add + Relu6 + QuantizeV2
@@ -826,7 +830,7 @@ def apply_newly_conv_biasadd_relu_fusion(self, match_node_name):
826
830
matched_node = self .node_name_mapping [match_node_name [1 ]]
827
831
828
832
second_node = self .node_name_mapping [match_node_name [2 ]].node
829
- if second_node .op in ('Relu' , 'Relu6' , 'LeakyRelu' , 'Elu' ):
833
+ if second_node .op in ('Relu' , 'Relu6' , 'LeakyRelu' , 'Elu' , 'Sigmoid' ):
830
834
new_match_node_name = self ._insert_dummy_biasadd (match_node_name , matched_node )
831
835
return self .apply_newly_conv_biasadd_relu_fusion (new_match_node_name )
832
836
@@ -882,6 +886,7 @@ def apply_newly_conv_biasadd_relu_fusion(self, match_node_name):
882
886
[bias_node_name ] + all_input_names [2 :] + control_inputs
883
887
is_leakyrelu = self .node_name_mapping [relu_node_name ].node .op == "LeakyRelu"
884
888
is_elu = self .node_name_mapping [relu_node_name ].node .op == "Elu"
889
+ is_sigmoid = self .node_name_mapping [relu_node_name ].node .op == "Sigmoid"
885
890
886
891
node_op = '_QuantizedDepthwiseConv2D'
887
892
if node .op == 'Conv2D' :
@@ -911,7 +916,9 @@ def apply_newly_conv_biasadd_relu_fusion(self, match_node_name):
911
916
if is_leakyrelu :
912
917
fused_ops = [b'BiasAdd' , b'LeakyRelu' ]
913
918
if is_elu :
914
- fused_ops = [b'BiasAdd' , b'Elu' ]
919
+ fused_ops = [b'BiasAdd' , b'Elu' ]
920
+ if is_sigmoid :
921
+ fused_ops = [b'BiasAdd' , b'Sigmoid' ]
915
922
helper .set_attr_string_list (quantized_conv_node , 'fused_ops' , fused_ops )
916
923
helper .set_attr_type_list (quantized_conv_node , 'Thost_inputs' , [
917
924
input_data_type .as_datatype_enum ,
0 commit comments