Skip to content

Latest commit

 

History

History

converter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Examples for model conversion

简体中文

Background

Sometimes, we might need to convert PyTorch model to TFLite format in order to facilitate the deployment of the model on the device side. The existing conversion method usually takes the following procedures.

  1. Convert to an ONNX model via torch.onnx.export
  2. Convert to a Tensorflow frozen model via onnx2tensorflow
  3. Convert to a TFLite model via tensorflow.lite.TFLiteConverter

This method has the following shortcomings.

  1. The conversion is a lengthy process and often lead to problems
  2. The conversion of quantized models is not supported
  3. The models with LSTM cannot be converted
  4. The model converted with onnx2tf has many redundant OPs

To solve the above problems, we implement this converter that translates models from PyTorch to TFLite directly.

Features

  1. Support for PyTorch 1.6+
  2. Support for quantized models
  3. Support for the LSTM op
  4. A lot of optimization pass including continuous transpose, reshape elimination, no-op removal and etc.
  5. Written in 100% Python, which is easy to maintain

Code structure