@@ -700,3 +700,25 @@ func.func @concat_non_axis_dyn_mixed(%arg0: tensor<?x1xf32>, %arg1: tensor<?x1xf
700
700
%0 = " tosa.concat" (%arg0 , %arg1 , %arg2 ) <{axis = 1 : i32 }> : (tensor <?x1 xf32 >, tensor <?x1 xf32 >, tensor <?x1 xf32 >) -> tensor <5 x3 xf32 >
701
701
return
702
702
}
703
+
704
+ // -----
705
+
706
+ // CHECK-LABEL: func @pad_extraction
707
+ // CHECK-SAME: (%[[ARG0_SSA:.*]]: tensor<2x2xi32>, %[[PAD_INPUT_TENSOR_SSA:.*]]: tensor<1xi32>)
708
+ func.func @pad_extraction (%arg0: tensor <2 x2 xi32 >, %pad_input_tensor: tensor <1 xi32 >) -> tensor <4 x5 xi32 > {
709
+ // CHECK-DAG: %[[C0_INDEX:.*]] = arith.constant 0 : index
710
+ // CHECK-DAG: %[[EXTRACTED_PAD_VAL:.*]] = tensor.extract %[[PAD_INPUT_TENSOR_SSA]][%[[C0_INDEX]]] : tensor<1xi32>
711
+
712
+ // CHECK: %[[C_PAD_LOW_0:.*]] = arith.constant 1 : index
713
+ // CHECK: %[[C_PAD_HIGH_0:.*]] = arith.constant 1 : index
714
+ // CHECK: %[[C_PAD_LOW_1:.*]] = arith.constant 0 : index
715
+ // CHECK: %[[C_PAD_HIGH_1:.*]] = arith.constant 3 : index
716
+
717
+ // CHECK: %{{.*}} = tensor.pad %[[ARG0_SSA]] low[%[[C_PAD_LOW_0]], %[[C_PAD_LOW_1]]] high[%[[C_PAD_HIGH_0]], %[[C_PAD_HIGH_1]]] {
718
+ // CHECK: tensor.yield %[[EXTRACTED_PAD_VAL]] : i32
719
+ // CHECK: } : tensor<2x2xi32> to tensor<4x5xi32>
720
+
721
+ %padding_indices = tosa.const_shape {values = dense <[1 , 1 , 0 , 3 ]> : tensor <4 xindex >} : () -> !tosa.shape <4 >
722
+ %result = " tosa.pad" (%arg0 , %padding_indices , %pad_input_tensor ) : (tensor <2 x2 xi32 >, !tosa.shape <4 >, tensor <1 xi32 >) -> tensor <4 x5 xi32 >
723
+ return %result : tensor <4 x5 xi32 >
724
+ }
0 commit comments