@@ -75,6 +75,26 @@ func @QuantizeConv2DPerChannel(%arg0: tensor<1x224x224x3x!quant.uniform<u8:f32,
7575// CHECK-NEXT: return %[[conv]]
7676}
7777
78+ // CHECK-LABEL: QuantizeConv2DPerChannelConst
79+ func @QuantizeConv2DPerChannelConst (%arg0: tensor <1 x224 x224 x3 x!quant.uniform <u8 :f32 , 1.5 >>,
80+ %arg1: tensor <32 x3 x3 x3 x!quant.uniform <u8 <1 :255 >:f32 :3 , {1.0,2.0,3.0 }>>) -> tensor <1 x112 x112 x32 xf32 > {
81+ %bias = " tfl.pseudo_const" () {value = dense <1.000000e+00 > : tensor <32 xf32 >} : () -> tensor <32 xf32 >
82+ %input = " tfl.dequantize" (%arg0 ) : (tensor <1 x224 x224 x3 x!quant.uniform <u8 :f32 , 1.5 >>) -> tensor <1 x224 x224 x3 xf32 >
83+ %weight = " tfl.dequantize" (%arg1 ) : (tensor <32 x3 x3 x3 x!quant.uniform <u8 <1 :255 >:f32 :3 , {1.0,2.0,3.0 }>>) -> tensor <32 x3 x3 x3 xf32 >
84+ %conv = " tfl.conv_2d" (%input , %weight , %bias ) {dilation_h_factor = 1 : i32 , dilation_w_factor = 1 : i32 ,
85+ fused_activation_function = " NONE" , padding = " SAME" , stride_h = 2 : i32 , stride_w = 2 : i32 }
86+ : (tensor <1 x224 x224 x3 xf32 >, tensor <32 x3 x3 x3 xf32 >, tensor <32 xf32 >) -> tensor <1 x112 x112 x32 xf32 >
87+ return %conv : tensor <1 x112 x112 x32 xf32 >
88+
89+ // CHECK-NEXT: %[[cst:.*]] = constant dense<1.000000e+00> : tensor<32xf32>
90+ // CHECK-NEXT: %[[qbias:.*]] = "tfl.quantize"(%[[cst]]) {qtype = tensor<32x!quant.uniform<i32:f32:0, {1.500000e+00,3.000000e+00,4.500000e+00}>>, volatile}
91+ // CHECK-NEXT: %[[bias:.*]] = "tfl.dequantize"(%[[qbias]])
92+ // CHECK-NEXT: %[[in:.*]] = "tfl.dequantize"(%arg0)
93+ // CHECK-NEXT: %[[w:.*]] = "tfl.dequantize"(%arg1)
94+ // CHECK-NEXT: %[[conv:.*]] = "tfl.conv_2d"(%[[in]], %[[w]], %[[bias]])
95+ // CHECK-NEXT: return %[[conv]]
96+ }
97+
7898// CHECK-LABEL: QuantizeConv2DPerChannels
7999func @QuantizeConv2DPerChannels (%arg0: tensor <1 x224 x224 x3 x!quant.uniform <u8 :f32 :3 , {1.0,2.0,3.0 }>>,
80100 %arg1: tensor <32 x3 x3 x3 x!quant.uniform <u8 <1 :255 >:f32 :3 , {1.0,2.0,3.0 }>>) -> tensor <1 x112 x112 x32 xf32 > {
0 commit comments