How to mofify tensor type?

I’d like to modify the tensor type
for example, the original IR is:
module {
func.func @forward(%arg0: tensor<1x3x224x224xf32>) → tensor<1x3x224x224xf32> {

return %2 : tensor<1x3x224x224xf32>
}
}
expected IR is:
module {
func.func @forward(%arg0: tensor<1x3x224x224xi8>) → tensor<1x3x224x224xi8> {

return %2 : tensor<1x3x224x224xi8>
}
}

type converter Pattern Rewriting : Generic DAG-to-DAG Rewriting - MLIR seems to be my solution.
but it is for dialect conversion, my case is transform in one dialect rather than conversion between dialects

what’s more, func bufferize pass seems to be another reference
but it is used for coverting tensor type to memref type by using to_memref, to_tensor op

i wonder if there is reference for my case.

thanks.

See presentation * 2020-11-19: Type Conversions the Not-So-Hard Way: MLIR’s new composable bufferize passes ; slides - recording

In particular:

  • The dialect conversion infra is a misnomer – it can be used to convert even within the same dialect
  • That describes how to set up the type converter – indeed, func-bufferize is probably your best reference.

thank you very much.
i solved my problem and it works :slight_smile: