# onnxsim/onnxsim

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/onnxsim-onnxsim).**

4,353 stars · 430 forks · C++ · Apache-2.0

## Links

- GitHub: https://github.com/onnxsim/onnxsim
- Homepage: https://onnxsim.github.io/onnxsim/
- awesome-repositories: https://awesome-repositories.com/repository/onnxsim-onnxsim.md

## Topics

`deep-learning` `onnx` `pytorch`

## Description

onnxsim is a deep learning graph optimizer and model simplifier designed to reduce the complexity of ONNX computation graphs. It functions as a model compressor that replaces complex operator sequences with simplified constant outputs to decrease operational overhead.

The project achieves simplification through constant folding inference, which replaces subgraphs of constant operators with pre-computed constant tensors. It utilizes pattern-based graph rewriting and static computation graph analysis to identify and remove redundant nodes or unreachable operations.

The tool covers broad model optimization capabilities, including operator redundancy elimination and the removal of unnecessary reshape or identity nodes. These processes streamline the execution flow and reduce the memory footprint of the model.

## Tags

### Artificial Intelligence & ML

- [Model Graph Optimizers](https://awesome-repositories.com/f/artificial-intelligence-ml/model-graph-optimizers.md) — Simplifies and optimizes model graphs to reduce operational overhead and improve inference performance. ([source](https://cdn.jsdelivr.net/gh/onnxsim/onnxsim@master/README.md))
- [ONNX Model Optimizers](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/serving-and-runtime/large-language-model-optimization/model-inference-optimizations/onnx-model-optimizers.md) — Cleans up ONNX model structures by removing unnecessary nodes to streamline execution flow.
- [Operator](https://awesome-repositories.com/f/artificial-intelligence-ml/natural-language-processing/tokenizers/byte-level-tokenizers/redundancy-removers/operator.md) — Eliminates identity operations and unnecessary reshape nodes that do not alter mathematical output.
- [Model Compression](https://awesome-repositories.com/f/artificial-intelligence-ml/neural-networks/model-compression.md) — Decreases the memory footprint of models by replacing complex operator sequences with constant outputs.
- [ONNX Intermediate Representation Manipulators](https://awesome-repositories.com/f/artificial-intelligence-ml/onnx-intermediate-representation-manipulators.md) — Provides direct manipulation of the ONNX intermediate representation to optimize model structure.
- [Deep Learning Optimization](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/training-algorithms/deep-learning-optimization.md) — Prepares neural networks for production by simplifying computational graphs to improve efficiency.

### Programming Languages & Runtimes

- [Constant Folding](https://awesome-repositories.com/f/programming-languages-runtimes/constant-folding.md) — Implements constant folding to replace complex operator subgraphs with pre-computed constant tensors.

### Software Engineering & Architecture

- [Graph Pattern Rewriters](https://awesome-repositories.com/f/software-engineering-architecture/code-transformation-tools/pattern-based-replacements/graph-pattern-rewriters.md) — Uses pattern-based rewriting to replace operator sequences with simplified equivalent structures.

### Testing & Quality Assurance

- [Execution Graph Analysis](https://awesome-repositories.com/f/testing-quality-assurance/static-code-analysis/unreachable-code-analysis/execution-graph-analysis.md) — Analyzes the execution graph to identify unreachable operations and redundant nodes for removal.
