Build tensorflow or tensorflow lite models based on tensorflow MLIR IR

Hi tensorflow team and friends,

I am working on a project to build tensorflow models based on tensorflow MLIR IR. According to one of your video (Inside TensorFlow: MLIR for TF developers - YouTube), TFLite converter leverages the MLIR IR to generate TFLite models from tensorflow models. Therefore, I assume that the converter has integrated the tool that I need.

My questions are: (1) if I have generated tensorflow dialect IR ('tf' Dialect  |  TensorFlow MLIR), how could I build a tensorflow model or the protobuf file? (2) Similarly, if I have the TFLite dialect IR, could I generate the tflite flatbuf file? (3) Is there any existing tool that I can leverage or any resource that I can refer to?


Does anyone have any idea?


You would want to look at the translate tools here. tf-mlir-translate has the conversions to/from external formats. For exporting back to graphdef youd want to first run island breakup pass too (there is tf-graph-export registered pipeline which you can use with tf-opt for that and some other passes).

The translate tool is mostly for testing/development so the user experience is intended for that audience (e.g., it has sharp edges). It does show the paths to invoke (and indeed for tflite converter and new bridge we wrap these up in a more user facing package). Let me know if it doesn’t work.



1 Like

Thanks for your information.