6
6
// CHECK: }
7
7
8
8
func.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 >
10
10
%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 >
12
12
%3 = tosa.transpose %1 , %2 : (tensor <2 x3 x1 xi32 >, tensor <3 xi32 >) -> tensor <1 x2 x3 xi32 >
13
13
return %3 : tensor <1 x2 x3 xi32 >
14
14
}
@@ -21,7 +21,7 @@ func.func @test_cancel_transpose_transpose(%arg0: tensor<1x2x3xi32>) -> (tensor<
21
21
// CHECK: }
22
22
23
23
func.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 >
25
25
%1 = tosa.transpose %arg0 , %0 : (tensor <1 x2 x3 xi32 >, tensor <3 xi32 >) -> tensor <1 x2 x3 xi32 >
26
26
return %1 : tensor <1 x2 x3 xi32 >
27
27
}
@@ -30,15 +30,15 @@ func.func @test_remove_identity_transpose(%arg0: tensor<1x2x3xi32>) -> (tensor<1
30
30
31
31
// CHECK-LABEL: func.func @test_do_not_cancel_different_transpose(
32
32
// 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>
34
34
// CHECK: %[[VAL_2:.*]] = tosa.transpose %[[VAL_0]], %[[VAL_1]] : (tensor<2x3x4x5xi32>, tensor<4xi32>) -> tensor<5x4x3x2xi32>
35
35
// CHECK: return %[[VAL_2]] : tensor<5x4x3x2xi32>
36
36
// CHECK: }
37
37
38
38
func.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 >
40
40
%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 >
42
42
%3 = tosa.transpose %1 , %2 : (tensor <3 x4 x2 x5 xi32 >, tensor <4 xi32 >) -> tensor <5 x4 x3 x2 xi32 >
43
43
return %3 : tensor <5 x4 x3 x2 xi32 >
44
44
}
@@ -47,15 +47,15 @@ func.func @test_do_not_cancel_different_transpose(%arg0: tensor<2x3x4x5xi32>) ->
47
47
48
48
// CHECK-LABEL: func.func @test_prefer_compose_transpose(
49
49
// 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>
51
51
// CHECK: %[[VAL_2:.*]] = tosa.transpose %[[VAL_0]], %[[VAL_1]] : (tensor<1x2x3x4xi32>, tensor<4xi32>) -> tensor<4x3x2x1xi32>
52
52
// CHECK: return %[[VAL_2]] : tensor<4x3x2x1xi32>
53
53
// CHECK: }
54
54
55
55
func.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 >
57
57
%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 >
59
59
%3 = tosa.transpose %1 , %2 : (tensor <2 x3 x1 x4 xi32 >, tensor <4 xi32 >) -> tensor <4 x3 x2 x1 xi32 >
60
60
return %3 : tensor <4 x3 x2 x1 xi32 >
61
61
}
0 commit comments