66// CHECK: }
77
88func.func @test_cancel_transpose_transpose (%arg0: tensor <1 x2 x3 xi32 >) -> (tensor <1 x2 x3 xi32 >) {
9- %0 = arith.constant dense <[1 , 2 , 0 ]> : tensor <3 xi32 >
9+ %0 = " tosa.const " () { value = dense <[1 , 2 , 0 ]> : tensor < 3 x i32 >} : () -> tensor <3 xi32 >
1010 %1 = tosa.transpose %arg0 , %0 : (tensor <1 x2 x3 xi32 >, tensor <3 xi32 >) -> tensor <2 x3 x1 xi32 >
11- %2 = arith.constant dense <[2 , 0 , 1 ]> : tensor <3 xi32 >
11+ %2 = " tosa.const " () { value = dense <[2 , 0 , 1 ]> : tensor < 3 x i32 >} : () -> tensor <3 xi32 >
1212 %3 = tosa.transpose %1 , %2 : (tensor <2 x3 x1 xi32 >, tensor <3 xi32 >) -> tensor <1 x2 x3 xi32 >
1313 return %3 : tensor <1 x2 x3 xi32 >
1414}
@@ -21,7 +21,7 @@ func.func @test_cancel_transpose_transpose(%arg0: tensor<1x2x3xi32>) -> (tensor<
2121// CHECK: }
2222
2323func.func @test_remove_identity_transpose (%arg0: tensor <1 x2 x3 xi32 >) -> (tensor <1 x2 x3 xi32 >) {
24- %0 = arith.constant dense <[0 , 1 , 2 ]> : tensor <3 xi32 >
24+ %0 = " tosa.const " () { value = dense <[0 , 1 , 2 ]> : tensor < 3 x i32 >} : () -> tensor <3 xi32 >
2525 %1 = tosa.transpose %arg0 , %0 : (tensor <1 x2 x3 xi32 >, tensor <3 xi32 >) -> tensor <1 x2 x3 xi32 >
2626 return %1 : tensor <1 x2 x3 xi32 >
2727}
@@ -30,15 +30,15 @@ func.func @test_remove_identity_transpose(%arg0: tensor<1x2x3xi32>) -> (tensor<1
3030
3131// CHECK-LABEL: func.func @test_do_not_cancel_different_transpose(
3232// CHECK-SAME: %[[VAL_0:.*]]: tensor<2x3x4x5xi32>) -> tensor<5x4x3x2xi32> {
33- // CHECK: %[[VAL_1:.*]] = arith.constant dense<[3, 2, 1, 0]> : tensor<4xi32>
33+ // CHECK: %[[VAL_1:.*]] = "tosa.const"() <{value = dense<[3, 2, 1, 0]> : tensor<4xi32>}> : () -> tensor<4xi32>
3434// CHECK: %[[VAL_2:.*]] = tosa.transpose %[[VAL_0]], %[[VAL_1]] : (tensor<2x3x4x5xi32>, tensor<4xi32>) -> tensor<5x4x3x2xi32>
3535// CHECK: return %[[VAL_2]] : tensor<5x4x3x2xi32>
3636// CHECK: }
3737
3838func.func @test_do_not_cancel_different_transpose (%arg0: tensor <2 x3 x4 x5 xi32 >) -> (tensor <5 x4 x3 x2 xi32 >) {
39- %0 = arith.constant dense <[1 , 2 , 0 , 3 ]> : tensor <4 xi32 >
39+ %0 = " tosa.const " () { value = dense <[1 , 2 , 0 , 3 ]> : tensor < 4 x i32 >} : () -> tensor <4 xi32 >
4040 %1 = tosa.transpose %arg0 , %0 : (tensor <2 x3 x4 x5 xi32 >, tensor <4 xi32 >) -> tensor <3 x4 x2 x5 xi32 >
41- %2 = arith.constant dense <[3 , 1 , 0 , 2 ]> : tensor <4 xi32 >
41+ %2 = " tosa.const " () { value = dense <[3 , 1 , 0 , 2 ]> : tensor < 4 x i32 >} : () -> tensor <4 xi32 >
4242 %3 = tosa.transpose %1 , %2 : (tensor <3 x4 x2 x5 xi32 >, tensor <4 xi32 >) -> tensor <5 x4 x3 x2 xi32 >
4343 return %3 : tensor <5 x4 x3 x2 xi32 >
4444}
@@ -47,15 +47,15 @@ func.func @test_do_not_cancel_different_transpose(%arg0: tensor<2x3x4x5xi32>) ->
4747
4848// CHECK-LABEL: func.func @test_prefer_compose_transpose(
4949// CHECK-SAME: %[[VAL_0:.*]]: tensor<1x2x3x4xi32>) -> tensor<4x3x2x1xi32> {
50- // CHECK: %[[VAL_1:.*]] = arith.constant dense<[3, 2, 1, 0]> : tensor<4xi32>
50+ // CHECK: %[[VAL_1:.*]] = "tosa.const"() <{value = dense<[3, 2, 1, 0]> : tensor<4xi32>}> : () -> tensor<4xi32>
5151// CHECK: %[[VAL_2:.*]] = tosa.transpose %[[VAL_0]], %[[VAL_1]] : (tensor<1x2x3x4xi32>, tensor<4xi32>) -> tensor<4x3x2x1xi32>
5252// CHECK: return %[[VAL_2]] : tensor<4x3x2x1xi32>
5353// CHECK: }
5454
5555func.func @test_prefer_compose_transpose (%arg0: tensor <1 x2 x3 x4 xi32 >) -> (tensor <4 x3 x2 x1 xi32 >) {
56- %0 = arith.constant dense <[1 , 2 , 0 , 3 ]> : tensor <4 xi32 >
56+ %0 = " tosa.const " () { value = dense <[1 , 2 , 0 , 3 ]> : tensor < 4 x i32 >} : () -> tensor <4 xi32 >
5757 %1 = tosa.transpose %arg0 , %0 : (tensor <1 x2 x3 x4 xi32 >, tensor <4 xi32 >) -> tensor <2 x3 x1 x4 xi32 >
58- %2 = arith.constant dense <[3 , 1 , 0 , 2 ]> : tensor <4 xi32 >
58+ %2 = " tosa.const " () { value = dense <[3 , 1 , 0 , 2 ]> : tensor < 4 x i32 >} : () -> tensor <4 xi32 >
5959 %3 = tosa.transpose %1 , %2 : (tensor <2 x3 x1 x4 xi32 >, tensor <4 xi32 >) -> tensor <4 x3 x2 x1 xi32 >
6060 return %3 : tensor <4 x3 x2 x1 xi32 >
6161}
0 commit comments