@@ -172,6 +172,78 @@ func.func @test_transpose_conv2d(%arg0: tensor<1x32x32x8xi8>, %arg1: tensor<16x1
172172 return %0 : tensor <1 x32 x32 x16 xi8 >
173173}
174174
175+ // -----
176+
177+ func.func @test_transpose_conv2d_invalid_padding_top (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
178+ // expected-error@+1 {{'tosa.transpose_conv2d' op expected out_pad_top > -KH, but got: out_pad_top=-3 and KH=1}}
179+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : -3 , 0 , 0 , 0 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
180+ return %0 : tensor <1 x32 x32 x16 xf32 >
181+ }
182+
183+ // -----
184+
185+ func.func @test_transpose_conv2d_invalid_padding_bottom (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
186+ // expected-error@+1 {{'tosa.transpose_conv2d' op expected out_pad_bottom > -KH, but got: out_pad_bottom=-1 and KH=1}}
187+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , -1 , 0 , 0 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
188+ return %0 : tensor <1 x32 x32 x16 xf32 >
189+ }
190+
191+ // -----
192+
193+ func.func @test_transpose_conv2d_invalid_padding_left (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
194+ // expected-error@+1 {{'tosa.transpose_conv2d' op expected out_pad_left > -KW, but got: out_pad_left=-8 and KW=1}}
195+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , -8 , 0 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
196+ return %0 : tensor <1 x32 x32 x16 xf32 >
197+ }
198+
199+ // -----
200+
201+ func.func @test_transpose_conv2d_invalid_padding_right (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
202+ // expected-error@+1 {{'tosa.transpose_conv2d' op expected out_pad_right > -KW, but got: out_pad_right=-9 and KW=1}}
203+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , 0 , -9 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
204+ return %0 : tensor <1 x32 x32 x16 xf32 >
205+ }
206+
207+ // -----
208+
209+ func.func @test_transpose_conv2d_invalid_stride_y (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
210+ // expected-error@+1 {{'tosa.transpose_conv2d' op expect all stride values to be >= 1, got [0, 1]}}
211+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , 0 , 0 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 0 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
212+ return %0 : tensor <1 x32 x32 x16 xf32 >
213+ }
214+
215+ // -----
216+
217+ func.func @test_transpose_conv2d_invalid_stride_x (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
218+ // expected-error@+1 {{'tosa.transpose_conv2d' op expect all stride values to be >= 1, got [1, 0]}}
219+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , 0 , 0 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 1 , 0 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
220+ return %0 : tensor <1 x32 x32 x16 xf32 >
221+ }
222+
223+ // -----
224+
225+ func.func @test_transpose_conv2d_invalid_output_height (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x33 x32 x16 xf32 > {
226+ // expected-error@+1 {{'tosa.transpose_conv2d' op dimension mismatch: expected OH == (IH - 1) * stride_y + out_pad_top + out_pad_bottom + KH, but got 33 != (32 - 1) * 1 + 0 + 0 + 1}}
227+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , 0 , 0 >, out_shape = array<i64 : 1 , 33 , 32 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x33 x32 x16 xf32 >
228+ return %0 : tensor <1 x33 x32 x16 xf32 >
229+ }
230+
231+ // -----
232+
233+ func.func @test_transpose_conv2d_invalid_output_width (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <16 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x40 x16 xf32 > {
234+ // expected-error@+1 {{'tosa.transpose_conv2d' op dimension mismatch: expected OW == (IW - 1) * stride_x + out_pad_left + out_pad_right + KW, but got 40 != (32 - 1) * 1 + 0 + 0 + 1}}
235+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , 0 , 0 >, out_shape = array<i64 : 1 , 32 , 40 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <16 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x40 x16 xf32 >
236+ return %0 : tensor <1 x32 x40 x16 xf32 >
237+ }
238+
239+ // -----
240+
241+ func.func @test_transpose_conv2d_invalid_bias (%arg0: tensor <1 x32 x32 x8 xf32 >, %arg1: tensor <16 x1 x1 x8 xf32 >, %arg2: tensor <5 xf32 >, %arg3: tensor <1 xf32 >, %arg4: tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 > {
242+ // expected-error@+1 {{'tosa.transpose_conv2d' op bias channels expected to be equal to output channels (16) or 1, got 5}}
243+ %0 = tosa.transpose_conv2d %arg0 , %arg1 , %arg2 , %arg3 , %arg4 {acc_type = f32 , out_pad = array<i64 : 0 , 0 , 0 , 0 >, out_shape = array<i64 : 1 , 32 , 32 , 16 >, stride = array<i64 : 1 , 1 >} : (tensor <1 x32 x32 x8 xf32 >, tensor <16 x1 x1 x8 xf32 >, tensor <5 xf32 >, tensor <1 xf32 >, tensor <1 xf32 >) -> tensor <1 x32 x32 x16 xf32 >
244+ return %0 : tensor <1 x32 x32 x16 xf32 >
245+ }
246+
175247// -----
176248// CHECK-LABEL: conv2d_quant_any_acc
177249func.func @test_conv2d_quant_any_acc (%arg0: tensor <1 x4 x4 x4 x!quant.any <i8 <-8 :7 >>>, %arg1: tensor <8 x1 x1 x4 x!quant.any <i8 <-8 :7 >>>, %arg2: tensor <8 x!quant.any <i8 <-8 :7 >>>) -> tensor <1 x4 x4 x8 x!quant.any <i8 <-8 :7 >>> {
0 commit comments