Open Neural Network Exchange
Project description
ONNX Optimizer
Introduction
ONNX provides a C++ library for performing arbitrary optimizations on ONNX models, as well as a growing list of prepackaged optimization passes.
The primary motivation is to share work between the many ONNX backend implementations. Not all possible optimizations can be directly implemented on ONNX graphs - some will need additional backend-specific information - but many can, and our aim is to provide all such passes along with ONNX so that they can be re-used with a single function call.
You may be interested in invoking the provided passes, or in implementing new ones (or both).
Installation
You can install onnxoptimizer from PyPI:
pip3 install onnxoptimizer
Note that you may need to upgrade your pip first if you have trouble:
pip3 install -U pip
If you want to build from source:
git clone --recursive https://github.com/onnx/optimizer onnxoptimizer
cd onnxoptimizer
pip3 install -e .
Note that you need to install protobuf before building from source.
Command-line API
Now you can use command-line api in terminal instead of python script.
python -m onnxoptimizer input_model.onnx output_model.onnx
Arguments list is following:
# python3 -m onnxoptimizer -h
usage: python -m onnxoptimizer input_model.onnx output_model.onnx
onnxoptimizer command-line api
optional arguments:
-h, --help show this help message and exit
--print_all_passes print all available passes
--print_fuse_elimination_passes
print all fuse and elimination passes
-p [PASSES ...], --passes [PASSES ...]
list of optimization passes name, if no set, fuse_and_elimination_passes will be used
--fixed_point fixed point
Roadmap
- More built-in pass
- Separate graph rewriting and constant folding (or a pure graph rewriting mode, see issue #9 for the details)
Relevant tools
-
onnx-simplifier: A handy and popular tool based on onnxoptimizer
-
convertmodel.com: onnx optimizer compiled as WebAssembly so that it can be used out-of-the-box
Code of Conduct
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for onnxoptimizer-0.3.10-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 064cc155a01e11b038fda0e4e1ee514eb6487b5dd3e3128cd35d268ff8770ba2 |
|
MD5 | 52b715b1d5e7b3d34dfb14055099a80c |
|
BLAKE2b-256 | b15cf74377abfc02af52074066383769e1c6918a6a4e47b8893393bd7a96c5df |
Hashes for onnxoptimizer-0.3.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05d24a9b76641f16866a2f99c177b631fba17c8da55afcd8aa404fdd8cf769dc |
|
MD5 | 6009277e5622e625012942680fb51d74 |
|
BLAKE2b-256 | 5cc91987f0fe72f8bf76cde187426ef581005e8c367670c0fd74a3ec9cfea7cd |
Hashes for onnxoptimizer-0.3.10-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9df03e49e758b3d57d3f9ce7e78588deb3f7e040a0753910665c386a98822bdb |
|
MD5 | 7298c90b0f75ffa31265d387b8a523fa |
|
BLAKE2b-256 | d5c2e51a899deedfcbd012694814e118406b3343796893bf825fc844f57491d5 |
Hashes for onnxoptimizer-0.3.10-cp311-cp311-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efc14a0be850efe2472991f6d089b59ad4942bcc7a3c53f1623b931d93213bde |
|
MD5 | e4df2d2a9cb33d6a7f1286aef9179fd2 |
|
BLAKE2b-256 | ef3dbd419824caa80eb0e4d0d5f1aef82afa4ab3876fb4f1b048e001546b86d0 |
Hashes for onnxoptimizer-0.3.10-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 063609bf76ae5e787686b10f08f176f70cccabb08aa25b8ff99ea30fbaaafdb7 |
|
MD5 | b980e81146ed7df154e4efeb519b5c6b |
|
BLAKE2b-256 | 4e4ae5ed30fbab9e17c0b49174b63d7928d02fbfc6eefa92bec27c7e3bc776cf |
Hashes for onnxoptimizer-0.3.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dab6d00b202ddf82655d816f43292e947166b6a465b59047712a1c1c0cd70ee2 |
|
MD5 | 7807fc1b2059ff851a154898c0614bdc |
|
BLAKE2b-256 | 1a4510b20448cc43e372e187e9483a0d3ffa16a124ed1bd70909cac55c2e27d4 |
Hashes for onnxoptimizer-0.3.10-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b3044a9cd7d3b83e84ac443dfd5373911fb275e26c5843fb1eec75fb58775a1 |
|
MD5 | a171bcbc5c8dd68e15638c9e7195e291 |
|
BLAKE2b-256 | 48e81c50701888e55c2b22925490c7caa18fb5a5ca32a2b8f51ce08d504b69a3 |
Hashes for onnxoptimizer-0.3.10-cp310-cp310-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dd82596fc81d508d635e75e0eb0a4517fdecd16bde0808d0e2661e560a6cc5f |
|
MD5 | 6ca80d9b22488ed082eb256f6db5a91a |
|
BLAKE2b-256 | 0b6b1fcdd0f822b19436e30a8b584f6d8261ba59c50ccbab1597499c732d5df4 |
Hashes for onnxoptimizer-0.3.10-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c637600ad403fc1ab3bf5b9d670385d817ef2e062871a82745db0d0afcf03cdf |
|
MD5 | ffb05decf5d3b636d190b42a2730091b |
|
BLAKE2b-256 | 7e004d20e925f3cb6b73a839199b2a3bb96c7a10c5507a86fa5ccfba17df50af |
Hashes for onnxoptimizer-0.3.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58bbebd245cedfb4b3d01babefb54ed70468d4de5ea01308567e1522ff7f14e3 |
|
MD5 | d05b50432a972b7501dbc50bfe6ff735 |
|
BLAKE2b-256 | c64b96e198bba4970166ce3d111b6263c6044f695cd11402f201f4c417be6475 |
Hashes for onnxoptimizer-0.3.10-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a532786bd7920552c5058824d6449720736cdd3547edb3504ec53c46a48093de |
|
MD5 | 2ebb07f999ea12e07964d183aefa98b5 |
|
BLAKE2b-256 | 98d1a0900a3635c6b5ea7ebed3d105d2e497bf103759542af59cb7e94cd40c0b |
Hashes for onnxoptimizer-0.3.10-cp39-cp39-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8982f4fadfd81401b6bffe0aaea2eb4757ca4e989ba9974105309d53fcaa3cb9 |
|
MD5 | 2dc95fb1632842bb5f55e8aeb0f4afa7 |
|
BLAKE2b-256 | 2b909ca973dece0c1d2f057509a06c71b1a6716b4af34887274796d229bbc481 |
Hashes for onnxoptimizer-0.3.10-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50142ac2aba3e292b57f50446f10966602e009ef5ea7458b63e3fa1a5f186057 |
|
MD5 | 1e3556bb47247926b93186bd258f6e77 |
|
BLAKE2b-256 | 8ab2c1ed9d0c03a06e61637a28bc08145728443f599f80952e074c1b63f59410 |
Hashes for onnxoptimizer-0.3.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 534a4d5c41cb6aab7c3b7dbb051664bf99e4ed28033a02d2ff610041b9104689 |
|
MD5 | 566ec863f6ba8d77c7e5d1de173e684b |
|
BLAKE2b-256 | c8913666af5b6ef852e35d30b4ae2b35b61dbbbee4576cf1c0a09ce59f2e5485 |
Hashes for onnxoptimizer-0.3.10-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02456d52f00a699100ac799f45096e7ed0157915c7a27503412c187415df3a30 |
|
MD5 | 0d3345a51b4d145b768981f1250f627b |
|
BLAKE2b-256 | dc65565a78b687986da6c8fe0809299a385688cdda8ab0d03d477d3f34bb5c8f |
Hashes for onnxoptimizer-0.3.10-cp38-cp38-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b4cf84685b980931ef80db594f1c9c9f628b79fb0ffde31216942139ea0561 |
|
MD5 | 18c59d021a499ff69d8620920aaae571 |
|
BLAKE2b-256 | 7c051d708007e320df856965239ee07e1483b5553fb95bb27215ee0d8d613c8c |
Hashes for onnxoptimizer-0.3.10-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ac6f63346091cceb23b5a5507b4a6caad9023d340a952901fac68b2e4e20831 |
|
MD5 | 8f260713706ecf17320bd9ab40f2ea7e |
|
BLAKE2b-256 | a76e4359a94c4dd78ef8fee2e2df3ecfb8b5da1a32ce415f4ff6a506a5cdd2a8 |
Hashes for onnxoptimizer-0.3.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab956e2dcb94030be9dc4c8b8fd41cb12283c4e6d9e19d40cee2653551ec1b73 |
|
MD5 | faff2c0a81f84337986900e187ec7881 |
|
BLAKE2b-256 | cfdaeef19afe998950d1d7b0b6487bfbe5162f5ebe9c8cb54706795a76d3f8f9 |
Hashes for onnxoptimizer-0.3.10-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59968fd584318dc996646a97cd862d4c206327b3ad10861268763ccd0c7e27bf |
|
MD5 | ac292ab2aa781c51455b681b920e0fc8 |
|
BLAKE2b-256 | ccc974de84c87a4fc78618e375b25f5db34fa4f897efe10a6bd72a28fa1c25ec |