@@ -262,7 +262,7 @@ func.func @test_concat(%arg0 : tensor<2x1xf32>, %arg1 : tensor<2x2xf32>) -> tens
262262
263263// -----
264264
265- func.func @test_pad_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: !tosa.shape <6 >) -> tensor <13 x21 x3 xf32 > {
265+ func.func @test_pad_padding_non_const (%arg0: tensor <13 x21 x3 xf32 >, %arg1: !tosa.shape <6 >) -> tensor <13 x21 x3 xf32 > {
266266 %pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
267267 // expected-error@+1 {{'tosa.pad' op shape operand is not compile time resolvable}}
268268 %0 = tosa.pad %arg0 , %arg1 , %pad_const : (tensor <13 x21 x3 xf32 >, !tosa.shape <6 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
@@ -271,19 +271,19 @@ func.func @test_pad_non_const(%arg0: tensor<13x21x3xf32>, %arg1: !tosa.shape<6>)
271271
272272// -----
273273
274- func.func @test_pad_non_const (%arg0: tensor <13 x21 x3 xi8 >, %arg1: tensor <1 xi8 >) -> tensor <13 x 21 x 3 x i8 > {
274+ 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 > {
275275 %0 = tosa.const_shape {values = dense <[0 , 0 , 0 , 1 , 0 , 1 ]> : tensor <6 xindex >} : () -> !tosa.shape <6 >
276276 // expected-error@+1 {{'tosa.pad' op expected compile time resolvable constant, but got variable value for operand #2}}
277- %1 = tosa.pad %arg0 , %0 , %arg1 : (tensor <13 x21 x3 xi8 >, !tosa.shape <6 >, tensor <1 xi8 >) -> tensor <13 x 21 x 3 x i8 >
278- return %1 : tensor <13 x 21 x 3 x i8 >
277+ %1 = tosa.pad %arg0 , %0 , %arg1 : (tensor <13 x21 x3 xi8 >, !tosa.shape <6 >, tensor <1 xi8 >) -> tensor <13 x 22 x 4 x i8 >
278+ return %1 : tensor <13 x 22 x 4 x i8 >
279279}
280280
281281// -----
282282
283283func.func @test_pad_io_rank_mismatch (%arg0: tensor <13 x21 xf32 >) {
284284 %0 = tosa.const_shape {values = dense <1 > : tensor <4 xindex >} : () -> !tosa.shape <4 >
285285 %pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
286- // expected-error@+1 {{'tosa.pad' op expect same input and output tensor rank. }}
286+ // expected-error@+1 {{'tosa.pad' op expect same input and output tensor rank}}
287287 %1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 xf32 >, !tosa.shape <4 >, tensor <1 xf32 >) -> tensor <13 x21 x3 xf32 >
288288}
289289
@@ -297,17 +297,7 @@ func.func @test_concat_input_rank_mismatch(%arg0: tensor<1x2x3xf32>, %arg1: tens
297297
298298// -----
299299
300- func.func @test_pad_invalid_padding_rank (%arg0: tensor <13 x21 xf32 >) {
301- %0 = tosa.const_shape {values = dense <1 > : tensor <6 xindex >} : () -> !tosa.shape <6 >
302- %pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
303- // expected-error@+1 {{'tosa.pad' op expected padding tensor dim 0 to have size 4 (2*rank(shape1)) but got size 6}}
304- %1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x21 xf32 >, !tosa.shape <6 >, tensor <1 xf32 >) -> tensor <13 x21 xf32 >
305- return
306- }
307-
308- // -----
309-
310- func.func @test_pad_invalid_padConst_rank (%arg0: tensor <13 x21 xf32 >, %arg1: tensor <2 x2 xi32 >) {
300+ func.func @test_pad_invalid_padConst_rank (%arg0: tensor <13 x21 xf32 >) {
311301 %0 = tosa.const_shape {values = dense <1 > : tensor <4 xindex >} : () -> !tosa.shape <4 >
312302 %1 = " tosa.const" () {values = dense <3.14 > : tensor <2 xf32 >} : () -> tensor <2 xf32 >
313303 // expected-error@+1 {{'tosa.pad' op operand #2 must be tosa-conformant scalar tensor of number values, but got 'tensor<2xf32>'}}
@@ -317,12 +307,12 @@ func.func @test_pad_invalid_padConst_rank(%arg0: tensor<13x21xf32>, %arg1: tenso
317307
318308// -----
319309
320- func.func @test_pad_padding_shape_mismatch (%arg0: tensor <13 x 21 x 3 x f32 >) -> tensor < 13 x 21 x 3 x f32 > {
321- %0 = tosa.const_shape {values = dense <1 > : tensor <4 x index >} : () -> !tosa.shape <4 >
322- %pad_const = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
323- // expected-error@+1 {{'tosa.pad' op expected padding tensor dim 0 to have size 6 (2*rank(shape1)) but got size 4 }}
324- %1 = tosa.pad %arg0 , %0 , %pad_const : (tensor <13 x 21 x 3 x f32 >, !tosa.shape <4 >, tensor <1 xf32 >) -> tensor <13 x 21 x 3 x f32 >
325- return %1 : tensor < 13 x 21 x 3 x f32 >
310+ func.func @test_pad_invalid_padding_value (%arg0: tensor <10 x f32 >) {
311+ %0 = tosa.const_shape {values = dense <[- 1 , 1 ] > : tensor <2 x index >} : () -> !tosa.shape <2 >
312+ %1 = " tosa.const" () {values = dense <3.14 > : tensor <1 xf32 >} : () -> tensor <1 xf32 >
313+ // expected-error@+1 {{padding value must all be non-negative, got -1 }}
314+ %2 = tosa.pad %arg0 , %0 , %1 : (tensor <10 x f32 >, !tosa.shape <2 >, tensor <1 xf32 >) -> tensor <10 x f32 >
315+ return
326316}
327317
328318// -----
0 commit comments