tf2onnx
Tensorflow to ONNX converter
What it is and what it does
tf2onnx is a model converter that takes trained TensorFlow models in various formats (saved_model, checkpoint, graphdef, tflite, tensorflow.js) and translates them into ONNX format. This enables models trained in TensorFlow to run on any ONNX-compatible runtime, improving portability and deployment flexibility. The package works via a command-line interface or Python API, with support for opset versions 14-18 (default 15). It requires TensorFlow 2.13 or later and Python 3.10-3.12.
The converter handles the fundamental challenge that TensorFlow has more operations than ONNX, so not all models convert cleanly. The project documents supported operations and provides troubleshooting guidance. TensorFlow.js support is experimental. The package is actively maintained but currently seeking a new maintainer, which is worth noting when evaluating long-term reliability.
Use it for:
- Deploy TensorFlow models on inference engines that don't natively support TensorFlow format
- Convert Keras models to ONNX for cross-platform inference on mobile, edge, or cloud deployments
- Migrate TFLite models to ONNX when targeting different hardware accelerators or inference frameworks
- Enable model interoperability in ML pipelines that mix models from different training frameworks
- Export trained models for production serving on systems where TensorFlow runtime is unavailable
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts TensorFlow, Keras, TensorFlow.js, and TFLite models to ONNX format via command line or Python API, enabling model portability across different inference runtimes.
Yes, if you need to convert TensorFlow models to ONNX. The package is production-stable, actively maintained, has no known security issues, and installs with low friction. The main caveat is that not all TensorFlow operations map cleanly to ONNX, so conversion success depends on your specific model architecture. The active search for a new maintainer is a yellow flag for long-term support, but current maintenance is solid.
Install
tf2onnx on PyPI
pip
pip install tf2onnxuv
uv add tf2onnxpoetry
poetry add tf2onnxInstalling tf2onnx
Before you install
Low friction install with stable maintenance. The package is actively maintained, has no known vulnerabilities, and depends on standard libraries (numpy, onnx, protobuf, flatbuffers, requests). However, the project is actively seeking a new maintainer, which may signal future maintenance uncertainty.
License in practice
Apache-2.0 is a permissive license allowing commercial use, modification, and distribution with minimal restrictions, making this package suitable for most production and research contexts.
Quickstart
pip install tf2onnx
python -m tf2onnx.convert --saved-model tensorflow-model-path --output model.onnx
Requires TensorFlow 2.13 or later and Python 3.10-3.12; TensorFlow must be installed separately before conversion.
Verify before relying
- Extent of tensorflow.js model support coverage beyond the noted experimental status and tested tfhub models
- Performance characteristics and conversion success rates for complex or custom TensorFlow operations
- Compatibility guarantees with TensorFlow versions outside the tested 2.13-2.15 range
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — numpy, onnx, requests, flatbuffers, protobuf |
| Maintenance | actively maintained — 163 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 395,329/month — #6,981 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: tf2onnx-1.17.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
onnx2tfConverts ONNX model files to LiteRT,…
permissive · top 5,000 on PyPI
onnxmltoolsConverts machine learning models from multiple…
permissive · top 5,000 on PyPI
tensorflowjsConverts TensorFlow models to TensorFlow.js…
permissive · top 5,000 on PyPI
onnx2torchConverts ONNX models to PyTorch modules with a…
permissive · top 15,000 on PyPI
tfliteParses TensorFlow Lite (*.tflite) model files…
permissive · top 15,000 on PyPI
onnxsimSimplifies ONNX neural network models by…
permissive · top 15,000 on PyPI
onnx-graphsurgeonONNX GraphSurgeon lets you programmatically…
permissive · top 15,000 on PyPI
onnxconverter-commonProvides common utilities and functions for…
permissive · top 5,000 on PyPI
scc4onnxConverts ONNX model input tensor dimensions and…
permissive · top 15,000 on PyPI
soc4onnxChanges the opset version of an ONNX model…
permissive · top 15,000 on PyPI