Your ONNX export is more complicated than it looks
It exists because ONNX exporters love to turn a single reshape into a dozen shape-gathering nodes.

What it does
ONNX Simplifier takes a trained model in ONNX format and prunes the computational graph. It runs constant folding across the whole graph, replacing clusters of redundant operators—like the shape-gathering spaghetti that PyTorch sometimes emits for a simple reshape—with their actual computed values. The result is a smaller, cleaner model that still passes ONNX’s own validation check.
The interesting bit
The project ships both a Python package and a browser-based version that runs entirely offline via GitHub Pages, which is a neat trick for a graph-rewriting tool that handles potentially proprietary model files.
Key highlights
- Performs whole-graph inference to fold redundant operators into constants.
- Ships a fully offline web UI via GitHub Pages—no server upload required.
- Validates the rewritten graph against the original to ensure correctness.
- Adopted by deployment pipelines including YOLOv5, MMDetection, and ncnn.
- Exposes a minimal Python API returning both the cleaned model and a pass/fail check.
Verdict
Worth keeping in your toolkit if you regularly export from PyTorch to deployment runtimes like ncnn. Less useful if you already work with hand-tuned ONNX graphs that never picked up exporter cruft.
Frequently asked
- What is onnxsim/onnxsim?
- It exists because ONNX exporters love to turn a single reshape into a dozen shape-gathering nodes.
- Is onnxsim open source?
- Yes — onnxsim/onnxsim is open source, released under the Apache-2.0 license.
- What language is onnxsim written in?
- onnxsim/onnxsim is primarily written in C++.
- How popular is onnxsim?
- onnxsim/onnxsim has 4.4k stars on GitHub.
- Where can I find onnxsim?
- onnxsim/onnxsim is on GitHub at https://github.com/onnxsim/onnxsim.