@@ -459,7 +459,7 @@ func.func @slice_dyn(%arg0: tensor<?xf32>) -> (tensor<?xf32>) {
459459// CHECK-LABEL: @pad_float
460460// CHECK-SAME: (%[[ARG0:[0-9a-zA-Z_]*]]:
461461func.func @pad_float (%arg0 : tensor <1 x2 xf32 >) -> (tensor <4 x9 xf32 >) {
462- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
462+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
463463 // TODO: Output contains multiple "arith.constant 1 : index".
464464 // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
465465 // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
@@ -469,32 +469,32 @@ func.func @pad_float(%arg0 : tensor<1x2xf32>) -> (tensor<4x9xf32>) {
469469 // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
470470 // CHECK: tensor.yield [[CST]]
471471 // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32>
472- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xf32 >)
472+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >) -> (tensor <4 x9 xf32 >)
473473 return %1 : tensor <4 x9 xf32 >
474474}
475475
476476func.func @pad_int (%arg0 : tensor <1 x2 xi32 >) -> (tensor <4 x9 xi32 >) {
477- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
477+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
478478 // CHECK: [[CST:%.+]] = arith.constant 0 : i32
479479 // CHECK: tensor.pad
480480 // CHECK: tensor.yield [[CST]]
481- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xi32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xi32 >)
481+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xi32 >, tensor <4 x i32 >) -> (tensor <4 x9 xi32 >)
482482 return %1 : tensor <4 x9 xi32 >
483483}
484484
485485func.func @pad_quant (%arg0 : tensor <1 x2 xi32 >) -> (tensor <4 x9 xi32 >) {
486- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
486+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
487487 // CHECK: [[CST:%.+]] = arith.constant 42 : i32
488488 // CHECK: tensor.pad
489489 // CHECK: tensor.yield [[CST]]
490- %1 = " tosa.pad" (%arg0 , %0 ) {quantization_info = #tosa.pad_quant <input_zp = 42 >} : (tensor <1 x2 xi32 >, tensor <2 x 2 x i32 >) -> (tensor <4 x9 xi32 >)
490+ %1 = " tosa.pad" (%arg0 , %0 ) {quantization_info = #tosa.pad_quant <input_zp = 42 >} : (tensor <1 x2 xi32 >, tensor <4 x i32 >) -> (tensor <4 x9 xi32 >)
491491 return %1 : tensor <4 x9 xi32 >
492492}
493493
494494// -----
495495
496496func.func @pad_float_explicit (%arg0 : tensor <1 x2 xf32 >) -> (tensor <4 x9 xf32 >) {
497- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
497+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
498498 // TODO: Output contains multiple "arith.constant 1 : index".
499499 // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
500500 // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
@@ -505,14 +505,14 @@ func.func @pad_float_explicit(%arg0 : tensor<1x2xf32>) -> (tensor<4x9xf32>) {
505505 // CHECK: tensor.yield [[CST]]
506506 // CHECK: } : tensor<1x2xf32> to tensor<4x9xf32>
507507 %1 = arith.constant dense <42.0 > : tensor <f32 >
508- %2 = " tosa.pad" (%arg0 , %0 , %1 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >, tensor <f32 >) -> (tensor <4 x9 xf32 >)
508+ %2 = " tosa.pad" (%arg0 , %0 , %1 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >, tensor <f32 >) -> (tensor <4 x9 xf32 >)
509509 return %2 : tensor <4 x9 xf32 >
510510}
511511
512512// -----
513513
514514func.func @pad_dyn_input (%arg0 : tensor <?x2 xf32 >) -> (tensor <?x9 xf32 >) {
515- %0 = arith.constant dense <[[ 1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
515+ %0 = arith.constant dense <[1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
516516 // TODO: Output contains multiple "arith.constant 1 : index".
517517 // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
518518 // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
@@ -522,12 +522,12 @@ func.func @pad_dyn_input(%arg0 : tensor<?x2xf32>) -> (tensor<?x9xf32>) {
522522 // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
523523 // CHECK: tensor.yield [[CST]]
524524 // CHECK: } : tensor<?x2xf32> to tensor<?x9xf32>
525- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <?x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <?x9 xf32 >)
525+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <?x2 xf32 >, tensor <4 x i32 >) -> (tensor <?x9 xf32 >)
526526 return %1 : tensor <?x9 xf32 >
527527}
528528
529529func.func @pad_dyn_padding (%arg0 : tensor <1 x2 xf32 >) -> (tensor <?x9 xf32 >) {
530- %0 = arith.constant dense <[[ -1 , 2 ], [ 3 , 4 ]] > : tensor <2 x 2 x i32 >
530+ %0 = arith.constant dense <[-1 , 2 , 3 , 4 ]> : tensor <4 x i32 >
531531 // TODO: Output contains multiple "arith.constant 1 : index".
532532 // CHECK-DAG: [[INDEX1:%.+]] = arith.constant 1 : index
533533 // CHECK-DAG: [[INDEX2:%.+]] = arith.constant 2 : index
@@ -537,7 +537,7 @@ func.func @pad_dyn_padding(%arg0 : tensor<1x2xf32>) -> (tensor<?x9xf32>) {
537537 // CHECK: tensor.pad %[[ARG0]] low{{\[}}%{{.*}}, [[INDEX3]]] high{{\[}}[[INDEX2]], [[INDEX4]]] {
538538 // CHECK: tensor.yield [[CST]]
539539 // CHECK: } : tensor<1x2xf32> to tensor<?x9xf32>
540- %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <2 x 2 x i32 >) -> (tensor <?x9 xf32 >)
540+ %1 = " tosa.pad" (%arg0 , %0 ) : (tensor <1 x2 xf32 >, tensor <4 x i32 >) -> (tensor <?x9 xf32 >)
541541 return %1 : tensor <?x9 xf32 >
542542}
543543
0 commit comments