Skip to content

Commit

Permalink
[contrib] add tflite2tf
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjc123 committed Oct 9, 2023
1 parent f19e3db commit 23ecd05
Show file tree
Hide file tree
Showing 4 changed files with 441 additions and 0 deletions.
35 changes: 35 additions & 0 deletions contrib/tflite2tf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## TFLite2TF

A utility for model conversion between TFLite and Tensorflow SavedModel.

### Supported operators
- PAD
- ADD
- RESIZE_BILINEAR
- RESHAPE
- CONV_2D
- AVERAGE_POOL_2D
- DEPTHWISE_CONV_2D
- FULLY_CONNECTED
- DEPTH_TO_SPACE
- TRANSPOSE_CONV
- SLICE
- RELU

### Usage
```py
import sys
import subprocess
from tflite2tf import parse_tflite

parse_tflite('test.tflite')

# It will dump a script `generate_tf_savedmodel.py` in the current directory.
subprocess.call([sys.executable, 'generate_tf_savedmodel.py'])

# And then, the saved model will be saved in the "saved_model" directory.
```

### Limitations
1. It may not work if the weights are shared between certain ops
2. The generated model may not be optimal
Loading

0 comments on commit 23ecd05

Please sign in to comment.