@@ -272,7 +272,7 @@ func.func @test_concat(%arg0 : tensor<2x1xf32>, %arg1 : tensor<2x2xf32>) -> tens
272
272
273
273
// -----
274
274
275
- func.func @test_pad_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: !tosa.shape <6 >) -> tensor <13 x21 x3 xf32 > {
275
+ func.func @test_pad_padding_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: !tosa.shape <6 >) -> tensor <13 x21 x3 xf32 > {
276
276
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
277
277
// expected-error@+1 {{'tosa.pad' op shape operand is not compile time resolvable}}
278
278
%0 = tosa.pad %arg0 , %arg1 , %pad_const : (tensor <13 x21 x3 xf32 >, !tosa.shape <6 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
@@ -281,9 +281,18 @@ func.func @test_pad_non_const(%arg0: tensor<13x21x3xf32>, %arg1: !tosa.shape<6>)
281
281
282
282
// -----
283
283
284
- func.func @test_pad_non_const (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x 21 x 3 x i8 > {
284
+ func.func @test_pad_const_non_const (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x 22 x 4 x i8 > {
285
285
%0 = tosa.const_shape {values = dense <[0 , 0 , 0 , 1 , 0 , 1 ]> : tensor <6 xindex >} : () -> !tosa.shape <6 >
286
286
// expected-error@+1 {{'tosa.pad' op expected compile time resolvable constant, but got variable value for operand #2}}
287
+ %1 = tosa.pad %arg0 , %0 , %arg1 : (tensor <13 x21 x3 xi8 >, !tosa.shape <6 >, tensor <1 xi8 >) -> tensor <13 x22 x4 xi8 >
288
+ return %1 : tensor <13 x22 x4 xi8 >
289
+ }
290
+
291
+ // -----
292
+
293
+ func.func @test_pad_output_mismatch (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x21 x3 xi8 > {
294
+ %0 = tosa.const_shape {values = dense <[0 , 0 , 0 , 1 , 0 , 1 ]> : tensor <6 xindex >} : () -> !tosa.shape <6 >
295
+ // expected-error@+1 {{mismatch in output shape at dimension 1: expected 21 + 0 + 1 = 22, but got 21}}
287
296
%1 = tosa.pad %arg0 , %0 , %arg1 : (tensor <13 x21 x3 xi8 >, !tosa.shape <6 >, tensor <1 xi8 >) -> tensor <13 x21 x3 xi8 >
288
297
return %1 : tensor <13 x21 x3 xi8 >
289
298
}
@@ -293,7 +302,7 @@ func.func @test_pad_non_const(%arg0: tensor<13x21x3xi8>, %arg1: tensor<1xi8>) ->
293
302
func.func @test_pad_io_rank_mismatch (%arg0: tensor <13 x21 xf32 >) {
294
303
%0 = tosa.const_shape {values = dense <1 > : tensor <4 xindex >} : () -> !tosa.shape <4 >
295
304
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
296
- // expected-error@+1 {{'tosa.pad' op expect same input and output tensor rank. }}
305
+ // expected-error@+1 {{'tosa.pad' op expect same input and output tensor rank}}
297
306
%1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 xf32 >, !tosa.shape <4 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
298
307
}
299
308
@@ -310,7 +319,7 @@ func.func @test_concat_input_rank_mismatch(%arg0: tensor<1x2x3xf32>, %arg1: tens
310
319
func.func @test_pad_invalid_padding_rank (%arg0: tensor <13 x21 xf32 >) {
311
320
%0 = tosa.const_shape {values = dense <1 > : tensor <6 xindex >} : () -> !tosa.shape <6 >
312
321
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
313
- // expected-error@+1 {{'tosa.pad' op expected padding tensor dim 0 to have size 4 (2*rank(shape1)) but got size 6}}
322
+ // expected-error@+1 {{'tosa.pad' op padding tensor must have 2 * 2 = 4 elements, but got 6}}
314
323
%1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 xf32 >, !tosa.shape <6 >, tensor <1 xf32 >) -> tensor <13 x21 xf32 >
315
324
return
316
325
}
@@ -330,7 +339,7 @@ func.func @test_pad_invalid_padConst_rank(%arg0: tensor<13x21xf32>, %arg1: tenso
330
339
func.func @test_pad_padding_shape_mismatch (%arg0: tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 > {
331
340
%0 = tosa.const_shape {values = dense <1 > : tensor <4 xindex >} : () -> !tosa.shape <4 >
332
341
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
333
- // expected-error@+1 {{'tosa.pad' op expected padding tensor dim 0 to have size 6 (2*rank(shape1)) but got size 4}}
342
+ // expected-error@+1 {{'tosa.pad' op padding tensor must have 3 * 2 = 6 elements, but got 4}}
334
343
%1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 x3 xf32 >, !tosa.shape <4 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
335
344
return %1 : tensor <13 x21 x3 xf32 >
336
345
}
0 commit comments