Practical overview
When it fits
Use tf2onnx when a model in a supported TensorFlow-family format needs an ONNX export for subsequent ONNX-compatible tooling.
Who it is for
- Machine-learning developers exporting supported TensorFlow-family models to ONNX.
- Teams adding an ONNX export step to a model migration workflow.
Documented uses
- Convert a TensorFlow SavedModel into an ONNX file.
- Export checkpoint, GraphDef, TFLite or TensorFlow.js model inputs using their documented conversion options.
- Select an ONNX opset for the generated graph.
Requirements & limits
The project is a public GitHub repository licensed under Apache-2.0. The README documents installation from PyPI or GitHub.
- The default output opset is 15; opsets 14–18 are supported and tested, while 6–13 are not tested.
- Checkpoint and GraphDef inputs require graph input and output names.
- TensorFlow.js support is experimental, and not all models may convert correctly.
- TensorFlow operations can exceed ONNX mappings, so inspect the supported-operation mapping for model-specific needs.
- The README states that the project is seeking a new maintainer.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Convert a SavedModel to ONNX
Create an ONNX file from a TensorFlow SavedModel using the documented command-line workflow.
Before you start
- Python 3.10–3.12 and TensorFlow 2.x; the project tests with TensorFlow 2.13 or later.
- tf2onnx installed and a TensorFlow SavedModel directory.
- ONNX 1.9 or later; tf2onnx installs or upgrades ONNX if needed.
Steps
Install tf2onnx with the command below.
pip install -U tf2onnxRun the command below, replacing the paths with the input directory and desired output filename.
python -m tf2onnx.convert --saved-model tensorflow-model-path --output model.onnxIf you need a different ONNX opset, add
--opsetand the selected version.
Expected outcome
The command writes an ONNX model file at the specified output path; the default opset is 15.
Guide limitations
- The project supports and tests ONNX opsets 14–18; opsets 6–13 are not tested.
- TensorFlow has operations that may not map successfully to ONNX; consult the supported-operation mapping and troubleshooting guide.
Convert a TFLite model to ONNX
Export a TFLite model to an ONNX file using the documented CLI example.
Before you start
- tf2onnx installed and a
.tflitemodel file. - Python 3.10–3.12; the project supports TensorFlow 2.x.
Steps
Install tf2onnx with the command below.
pip install -U tf2onnxRun the command below, substituting the input model path and output filename.
python -m tf2onnx.convert --opset 16 --tflite tflite-file --output model.onnx
Expected outcome
The command specifies an ONNX output file and opset 16.
Guide limitations
- The project notes that TensorFlow operations can cause mapping issues during conversion.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 13 October 2026
- Original website title
- onnx/tensorflow-onnx · Official homepage title · retained in its source language

