Hello everyone,
I am looking at the tosa.transpose operation and I have questions regarding the ‘perms’ attribute.
I found examples in the test cases of MLIR that uses perms both as an attribute and operand
for example,
func @transpose_nofold(%arg0: tensor<3x3xf32>) -> tensor<3x3xf32> {
// CHECK: "tosa.transpose"
%0 = arith.constant dense<[1, 0]> : tensor<2xi32>
%1 = "tosa.transpose"(%arg0, %0) { perms = [1, 0] }: (tensor<3x3xf32>, tensor<2xi32>) -> tensor<3x3xf32>
return %1 : tensor<3x3xf32>
}
and
func @transpose_fold(%arg0: tensor<3x4xf32>) -> tensor<3x4xf32> {
// CHECK: return %arg0
%0 = arith.constant dense<[0, 1]> : tensor<2xi32>
%1 = "tosa.transpose"(%arg0, %0) { perms = [1, 0] }: (tensor<3x4xf32>, tensor<2xi32>) -> tensor<3x4xf32>
return %1 : tensor<3x4xf32>
}
Looking at the code, the perms passed as an operand (%0 in the above test cases) should be used for permuting the dimensions of %arg0.
I am curious about how the ‘perms’ attribute is used in the operation.
Thank you!