@@ -303,7 +303,7 @@ func.func @test_concat_axis_out_of_range(%arg0: tensor<1x2xf32>, %arg1: tensor<2
303
303
304
304
// -----
305
305
306
- func.func @test_pad_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: !tosa.shape <6 >) -> tensor <13 x21 x3 xf32 > {
306
+ func.func @test_pad_padding_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: !tosa.shape <6 >) -> tensor <13 x21 x3 xf32 > {
307
307
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
308
308
// expected-error@+1 {{'tosa.pad' op shape operand is not compile time resolvable}}
309
309
%0 = tosa.pad %arg0 , %arg1 , %pad_const : (tensor <13 x21 x3 xf32 >, !tosa.shape <6 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
@@ -312,9 +312,18 @@ func.func @test_pad_non_const(%arg0: tensor<13x21x3xf32>, %arg1: !tosa.shape<6>)
312
312
313
313
// -----
314
314
315
- func.func @test_pad_non_const (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x 21 x 3 x i8 > {
315
+ func.func @test_pad_pad_const_non_const (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x 22 x 4 x i8 > {
316
316
%0 = tosa.const_shape {values = dense <[0 , 0 , 0 , 1 , 0 , 1 ]> : tensor <6 xindex >} : () -> !tosa.shape <6 >
317
317
// expected-error@+1 {{'tosa.pad' op expected compile time resolvable constant, but got variable value for operand #2}}
318
+ %1 = tosa.pad %arg0 , %0 , %arg1 : (tensor <13 x21 x3 xi8 >, !tosa.shape <6 >, tensor <1 xi8 >) -> tensor <13 x22 x4 xi8 >
319
+ return %1 : tensor <13 x22 x4 xi8 >
320
+ }
321
+
322
+ // -----
323
+
324
+ func.func @test_pad_output_mismatch (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x21 x3 xi8 > {
325
+ %0 = tosa.const_shape {values = dense <[0 , 0 , 0 , 1 , 0 , 1 ]> : tensor <6 xindex >} : () -> !tosa.shape <6 >
326
+ // expected-error@+1 {{mismatch in output shape at dimension 1: expected 21 + 0 + 1 = 22, but got 21}}
318
327
%1 = tosa.pad %arg0 , %0 , %arg1 : (tensor <13 x21 x3 xi8 >, !tosa.shape <6 >, tensor <1 xi8 >) -> tensor <13 x21 x3 xi8 >
319
328
return %1 : tensor <13 x21 x3 xi8 >
320
329
}
@@ -324,7 +333,7 @@ func.func @test_pad_non_const(%arg0: tensor<13x21x3xi8>, %arg1: tensor<1xi8>) ->
324
333
func.func @test_pad_io_rank_mismatch (%arg0: tensor <13 x21 xf32 >) {
325
334
%0 = tosa.const_shape {values = dense <1 > : tensor <4 xindex >} : () -> !tosa.shape <4 >
326
335
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
327
- // expected-error@+1 {{'tosa.pad' op expect same input and output tensor rank. }}
336
+ // expected-error@+1 {{'tosa.pad' op expect same input and output tensor rank}}
328
337
%1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 xf32 >, !tosa.shape <4 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
329
338
}
330
339
@@ -341,7 +350,7 @@ func.func @test_concat_input_rank_mismatch(%arg0: tensor<1x2x3xf32>, %arg1: tens
341
350
func.func @test_pad_invalid_padding_rank (%arg0: tensor <13 x21 xf32 >) {
342
351
%0 = tosa.const_shape {values = dense <1 > : tensor <6 xindex >} : () -> !tosa.shape <6 >
343
352
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
344
- // expected-error@+1 {{'tosa.pad' op expected padding tensor dim 0 to have size 4 (2*rank(shape1)) but got size 6}}
353
+ // expected-error@+1 {{'tosa.pad' op padding tensor must have 2 * 2 = 4 elements, but got 6}}
345
354
%1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 xf32 >, !tosa.shape <6 >, tensor <1 xf32 >) -> tensor <13 x21 xf32 >
346
355
return
347
356
}
@@ -361,7 +370,7 @@ func.func @test_pad_invalid_padConst_rank(%arg0: tensor<13x21xf32>, %arg1: tenso
361
370
func.func @test_pad_padding_shape_mismatch (%arg0: tensor <13 x21 x3 xf32 >) -> tensor <13 x21 x3 xf32 > {
362
371
%0 = tosa.const_shape {values = dense <1 > : tensor <4 xindex >} : () -> !tosa.shape <4 >
363
372
%pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
364
- // expected-error@+1 {{'tosa.pad' op expected padding tensor dim 0 to have size 6 (2*rank(shape1)) but got size 4}}
373
+ // expected-error@+1 {{'tosa.pad' op padding tensor must have 3 * 2 = 6 elements, but got 4}}
365
374
%1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 x3 xf32 >, !tosa.shape <4 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
366
375
return %1 : tensor <13 x21 x3 xf32 >
367
376
}
0 commit comments