How to Convert MLIR tfl.custom operations

I am working on converting TFLite models to my own Machine Learning Library.
I am doing this by converting the TFLite MLIR Dialect to my own MLIR ML Dialect.
I created a fork on Tensorflow, and implemented my library that does the conversion, it works fine.
But for some models, I am seeing tfl.custom ops, which a FlexXXX code:

"tfl.custom"(%arg0) {custom_code = "FlexSquare", custom_option = #tfl<const_bytes : "...">} : (tensor<512xf16>) -> tensor<512xf16>

From what I understand, these are TF ops not supported in TFLite, that can be exported to the Flatbuffers using the option tf.lite.OpsSet.SELECT_TF_OPS.
How should I convert these to my own Dialect, the custom_option seems completely opaque ? Is there an MLIR pass to convert those ops to another dialect more readable ?


Hi @nashoba

What code are you using to convert to tflite?


Hi @George_Soloupis, I am not doing the conversion to TFLite.
My program takes a TFLite flatbuffer file as input, converts it to MLIR, then translate it to my custom dialect.
I have no control on how these TFLite flatbuffers are generated, the goal is to support any .tflite file the clients might give me.