Correct way to lower tosa to linalg

Hi everyone!
I try to test a transpose mlir

func.func @transpose(%arg0: tensor<1x4x5x1xf32>) → tensor<1x4x1x5xf32> {
%perms = “tosa.const”() {value = dense<[3, 1, 0, 2]> : tensor<4xi32>} : () → tensor<4xi32>
%0 = “tosa.transpose”(%arg0, %perms) : (tensor<1x4x5x1xf32>, tensor<4xi32>) → tensor<1x4x1x5xf32>
return %0 : tensor<1x4x1x5xf32>
}

When I use the command
mlir-opt --tosa-to-linalg transpose.mlir
it returns error that
error: unable to schedule pass ‘TosaToLinalg’ on a PassManager intended to run on ‘builtin.module’!

And When I use another command
/mlir-opt --pass-pipeline=“func.func(tosa-to-linalg)” transpose.mlir
the error is
error: can’t run ‘func.func’ pass manager on ‘builtin.module’ op

So, What is the correct way to lower tosa to linalg?

When mlir-opt parses your IR it is inserting an implicit builtin.module op in this case, so your IR is really:

module {
  func.func @transpose(%arg0: tensor<1x4x5x1xf32>) → tensor<1x4x1x5xf32> {
    %perms = “tosa.const”() {value = dense<[3, 1, 0, 2]> : tensor<4xi32>} : () → tensor<4xi32>
    %0 = “tosa.transpose”(%arg0, %perms) : (tensor<1x4x5x1xf32>, tensor<4xi32>) → 
    tensor<1x4x1x5xf32>
    return %0 : tensor<1x4x1x5xf32>
  }
}

So the correct way to run the pass would be mlir-opt --pass-pipeline="builtin.module(func.func(tosa-to-linalg))"