onnxsim
Simplify your ONNX model
What it is and what it does
ONNX Simplifier takes a compiled ONNX neural network model and reduces it by eliminating redundant operations through constant folding, shape inference, and graph optimization. It runs a fixed-point loop of these three techniques until the model stops changing, then optionally validates the result against the original on random inputs to ensure correctness.
The package is used to shrink models exported from frameworks like PyTorch, making them faster to load and run while preserving numerical behavior. It handles both static and dynamic input shapes, supports custom operators (including TensorRT plugins), can inline local functions, simplify subgraphs, and convert between ONNX opset versions. It is available as a Python package with a CLI, a C API, a Rust wrapper, and a zero-install web version.
Use it for:
- Reduce the size of PyTorch models exported to ONNX before deployment to edge devices or inference servers.
- Remove redundant reshape, transpose, and constant-computation nodes introduced during framework export.
- Validate that a simplified ONNX model produces numerically equivalent outputs on random test inputs.
- Upgrade or downgrade an ONNX model's opset version while cleaning up any redundant nodes the conversion introduces.
- Simplify models containing custom operators like TensorRT plugins without manually moving them to a custom domain.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Simplifies ONNX neural network models by running constant folding, shape inference, and graph optimization passes to reduce redundant operators and produce smaller, faster models.
Yes. The package is actively maintained, has no known vulnerabilities, uses permissive licenses, and solves a real problem in ONNX model deployment. Medium install friction is acceptable given the precompiled wheels for modern Python versions and multiple platforms. Install if you work with exported ONNX models and need to reduce their size or remove redundant operations.
Install
onnxsim on PyPI
pip
pip install onnxsimuv
uv add onnxsimpoetry
poetry add onnxsimInstalling onnxsim
Before you install
Medium install friction due to precompiled wheels for multiple Python versions and platforms (cp310–cp314, macOS arm64, Linux x86_64/aarch64, Windows). Active maintenance with a release 2 days ago and 4386 repository stars.
License in practice
Dual-licensed under MIT and (Apache-2.0 OR BSD-2-Clause), both permissive. You may use, modify, and distribute freely under either license's terms.
Quickstart
pip install onnxsim
import onnx
from onnxsim import simplify
model = onnx.load('model.onnx')
model_simp, check = simplify(model)
assert check, "Simplified model validation failed"
Requires Python >=3.10 and the onnx package (a runtime dependency).
Verify before relying
- Whether onnxruntime is truly optional or recommended for performance; fact sheet notes it falls back to ONNX reference evaluator but does not quantify the performance difference.
- Whether the web version and Node.js npm package share feature parity with the Python package or have limitations not mentioned in the excerpt.
Package facts
| License | MIT AND (Apache-2.0 OR BSD-2-Clause) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 2 — onnx, rich |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 542,989/month — #6,087 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: onnxsim-0.7.3-cp310-cp310-macosx_13_0_arm64.whl; onnxsim-0.7.3-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; onnxsim-0.7.3-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxsim-0.7.3-cp310-cp310-win_amd64.whl; onnxsim-0.7.3-cp311-cp311-macosx_13_0_arm64.whl; onnxsim-0.7.3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; onnxsim-0.7.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxsim-0.7.3-cp311-cp311-win_amd64.whl; onnxsim-0.7.3-cp312-abi3-macosx_13_0_arm64.whl; onnxsim-0.7.3-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; onnxsim-0.7.3-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxsim-0.7.3-cp312-abi3-win_amd64.whl; onnxsim-0.7.3-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Keywords: deep-learning, ONNX
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
onnxoptimizerApplies graph-level optimizations to ONNX…
permissive · top 15,000 on PyPI
spo4onnxApplies specialized optimization techniques to…
permissive · top 15,000 on PyPI
onnx-toolParse, analyze, optimize, and profile ONNX…
permissive · top 15,000 on PyPI
onnxscriptWrite ONNX functions and models in Python…
permissive · top 5,000 on PyPI
onnx-weeklyonnx-weekly provides a Python package for…
permissive · top 15,000 on PyPI
onnx-graphsurgeonONNX GraphSurgeon lets you programmatically…
permissive · top 15,000 on PyPI
onnx-ironnx-ir provides an in-memory intermediate…
permissive · top 5,000 on PyPI
onnx2torchConverts ONNX models to PyTorch modules with a…
permissive · top 15,000 on PyPI
onnxONNX provides an open-source format and runtime…
permissive · top 5,000 on PyPI
tf2onnxConverts TensorFlow, Keras, TensorFlow.js, and…
permissive · top 15,000 on PyPI