@@ -98,3 +98,26 @@ func.func @depthwise_conv2d_no_const_zero_point(%arg0: tensor<4x10x10x2xi8>, %ar
9898 %0 = tosa.depthwise_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = i32 , pad = array<i64 : 0 , 0 , 0 , 0 >, stride = array<i64 : 1 , 1 >, dilation = array<i64 : 1 , 1 >} : (tensor <4 x10 x10 x2 xi8 >, tensor <1 x1 x2 x3 xi8 >, tensor <6 xi32 >, tensor <1 xi8 >, tensor <1 xi8 >) -> tensor <4 x10 x10 x6 xi32 >
9999 return %0 : tensor <4 x10 x10 x6 xi32 >
100100}
101+
102+ // -----
103+ // CHECK-LABEL: func.func @depthwise_conv2d_as_mul_dynamic_batch_bias(
104+ // CHECK-SAME: %[[INP:.*]]: tensor<?x10x10x2xf32>,
105+ // CHECK-SAME: %[[WTS:.*]]: tensor<1x1x2x3xf32>,
106+ // CHECK-SAME: %[[BIAS:.*]]: tensor<?xf32>) -> tensor<?x10x10x6xf32> {
107+ // CHECK: %[[BIAS_EXPANDED_SHAPE:.*]] = tosa.const_shape {values = dense<[1, 1, 1, -1]> : tensor<4xindex>} : () -> !tosa.shape<4>
108+ // CHECK: %[[RES_EXPANDED_SHAPE:.*]] = tosa.const_shape {values = dense<[-1, 10, 10, 6]> : tensor<4xindex>} : () -> !tosa.shape<4>
109+ // CHECK: %[[MUL_SHIFT:.*]] = "tosa.const"() <{values = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
110+ // CHECK: %[[WTS_EXPANDED_SHAPE:.*]] = tosa.const_shape {values = dense<[1, 1, 1, 2, 3]> : tensor<5xindex>} : () -> !tosa.shape<5>
111+ // CHECK: %[[INP_EXPANDED_SHAPE:.*]] = tosa.const_shape {values = dense<[-1, 10, 10, 2, 1]> : tensor<5xindex>} : () -> !tosa.shape<5>
112+ // CHECK: %[[INP_RESHAPED:.*]] = tosa.reshape %[[INP]], %[[INP_EXPANDED_SHAPE]] : (tensor<?x10x10x2xf32>, !tosa.shape<5>) -> tensor<?x10x10x2x1xf32>
113+ // CHECK: %[[WTS_RESHAPED:.*]] = tosa.reshape %[[WTS]], %[[WTS_EXPANDED_SHAPE]] : (tensor<1x1x2x3xf32>, !tosa.shape<5>) -> tensor<1x1x1x2x3xf32>
114+ // CHECK: %[[MUL:.*]] = tosa.mul %[[INP_RESHAPED]], %[[WTS_RESHAPED]], %[[MUL_SHIFT]] : (tensor<?x10x10x2x1xf32>, tensor<1x1x1x2x3xf32>, tensor<1xi8>) -> tensor<?x10x10x2x3xf32>
115+ // CHECK: %[[RES_RESHAPED:.*]] = tosa.reshape %[[MUL]], %[[RES_EXPANDED_SHAPE]] : (tensor<?x10x10x2x3xf32>, !tosa.shape<4>) -> tensor<?x10x10x6xf32>
116+ // CHECK: %[[BIAS_RESHAPED:.*]] = tosa.reshape %[[BIAS]], %[[BIAS_EXPANDED_SHAPE]] : (tensor<?xf32>, !tosa.shape<4>) -> tensor<1x1x1x?xf32>
117+ // CHECK: %[[RES:.*]] = tosa.add %[[RES_RESHAPED]], %[[BIAS_RESHAPED]] : (tensor<?x10x10x6xf32>, tensor<1x1x1x?xf32>) -> tensor<?x10x10x6xf32>
118+ // CHECK: return %[[RES]]
119+ func.func @depthwise_conv2d_as_mul_dynamic_batch_bias (%arg0: tensor <?x10 x10 x2 xf32 >, %arg1: tensor <1 x1 x2 x3 xf32 >, %arg2: tensor <?xf32 >) -> tensor <?x10 x10 x6 xf32 > {
120+ %zp = " tosa.const" () <{values = dense <0.0 > : tensor <1 xf32 >}> : () -> tensor <1 xf32 >
121+ %0 = tosa.depthwise_conv2d %arg0 , %arg1 , %arg2 , %zp , %zp {acc_type = f32 , pad = array<i64 : 0 , 0 , 0 , 0 >, stride = array<i64 : 1 , 1 >, dilation = array<i64 : 1 , 1 >} : (tensor <?x10 x10 x2 xf32 >, tensor <1 x1 x2 x3 xf32 >, tensor <?xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <?x10 x10 x6 xf32 >
122+ return %0 : tensor <?x10 x10 x6 xf32 >
123+ }
0 commit comments