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.8-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62029b1e83df4706079a135f23626b460cdfb47b33df0236e6bda5148702b007 |
|
MD5 | 6fee443ac1dbed280781cdd22568d995 |
|
BLAKE2b-256 | dff9417224261eb122fa8279adb99151b880ac4e99416b21d474206ce1d2d31e |
Hashes for onnxoptimizer-0.3.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da7241b9f1069e02621ce0762f6a013d1af84eb12542b2c4159817965c8b09b9 |
|
MD5 | b01d02584ed45e8498fbc578a2004b93 |
|
BLAKE2b-256 | 279c13a04a34985592edeb0e8ef579abd04f97cde6edab08223610b4f71320b1 |
Hashes for onnxoptimizer-0.3.8-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12ab4825d809e96c3978230d6d7696ddef87bb91837f5ec11f4cb96b3fe72a09 |
|
MD5 | 1007b25c26d3d77939e1c58dad769718 |
|
BLAKE2b-256 | 0d154dc6e5e146c78e56ded278082bdad3b31b5f84dd4872641059db81636872 |
Hashes for onnxoptimizer-0.3.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8469416d81973aea588fe0b85365a413e79cb7b155e3ca5be538b6492669944 |
|
MD5 | 82ea1ddaf34d960c31dcabd34b3ee227 |
|
BLAKE2b-256 | be5b76595fa404600b599cf33d147593c8a318d5ba027d0c41cae265b6e8b2b4 |
Hashes for onnxoptimizer-0.3.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecee31591b9e11075bfa9b46778fb7ae6ae9861f8b2187b7455cbe1529638132 |
|
MD5 | b46e74f112bc8102a9c0755a889b4786 |
|
BLAKE2b-256 | 437bbf49c6a7d5daea9173e2f5fef27cea7929adbc3fd12fd855b7fd453f3553 |
Hashes for onnxoptimizer-0.3.8-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e40530dcc08b5d504c150da90be68f7e438aeb7008dd0d79cd20058944d4087 |
|
MD5 | e5ceb5f648ed0dfa3857b21a54826e09 |
|
BLAKE2b-256 | ee31f5e680b1236716979d30a03599b6b95b0d18cf8fa9eab32f4d0f7f998839 |
Hashes for onnxoptimizer-0.3.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14c767335525db75ca2292bad0f8d84d1056764cb29ea1bd81303b3477322498 |
|
MD5 | 8c0a12848d7ff3ebcc85a0da9410ffa5 |
|
BLAKE2b-256 | 29991783bf9d2cec5271a3112afc803d65baf40590f4e08047d465c339710ead |
Hashes for onnxoptimizer-0.3.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b748c5b4ab2788325e30b189f82bf8595f92c4e7a46c6a2e6ee6b9e5c7cfc580 |
|
MD5 | c8c2f08b3e492ae2462883924c58f5e2 |
|
BLAKE2b-256 | 674600c80d9e59946c964996a1b9570af5e2c6374f221c8aa7033cbf2ec23fcc |
Hashes for onnxoptimizer-0.3.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b375f3f34c69309f873e4edfdcd9ddcd0e917749585ed5b6dc38a7c42a414df2 |
|
MD5 | 71e334fa8fb1675d99043403835d3616 |
|
BLAKE2b-256 | 03ba2a2dd88436d763e2ec4fb9fa0b53f3700c6360b198b937cdd6f5b59fc233 |
Hashes for onnxoptimizer-0.3.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f822deb51633a1e9d10097440f4419e6de337a43e428a2df88fa3b867ef5453 |
|
MD5 | de788d815a6c84c7105df392c1d7004b |
|
BLAKE2b-256 | 244d8a5048815ee7aec92934d375b60a5a1f56d966b25d751de45b999ddea680 |
Hashes for onnxoptimizer-0.3.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0047309f1fc314e2bc06ec01865005660e22c005f97b011b66be6129533b9e28 |
|
MD5 | c3816e6a42e87adafeb52e45c922f025 |
|
BLAKE2b-256 | 23ccc703bd9262d327fbacbf1d5fa3a5d48c9c79a8869881120de29d9d5d28dd |
Hashes for onnxoptimizer-0.3.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4edacafab548edb7183b8eb11807503f5612cb72f608bfd8316fae9595226c5f |
|
MD5 | 481eb4449774df9d82894b3a4c7ea2d7 |
|
BLAKE2b-256 | 3c86feb70e6db889665f9c7b9f0bc492974b33bbef3b52da33521cc0d364425d |
Hashes for onnxoptimizer-0.3.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81c73dd78a7e9f31609a0a4d0b469cb387869ea36436a3758052888067948bad |
|
MD5 | 185e40637d0f69e58a34554ad313734a |
|
BLAKE2b-256 | c6195b17dfd7636f133800cc0ea9abbdf49d4613168af8082c0225055e5718c0 |
Hashes for onnxoptimizer-0.3.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acb000dfa2dedbf513c2aec75ba2f6f0d25530a3f9f7c7fc417ee70978cdc897 |
|
MD5 | b6bb57c9cf0e28a94cc3e0a9d9e00ac1 |
|
BLAKE2b-256 | eb1fc94379b15b830974455a3bc2367eaa832dbd0503745a9d8160766b33259b |
Hashes for onnxoptimizer-0.3.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33847b812ffdab2de13695097df7f8adcfb1adf10373e2a7e85b9bbe3a8fa583 |
|
MD5 | de226a790232df3765fcd6d7eeb15a73 |
|
BLAKE2b-256 | 1fdc89ddab0425c5c24b7a392cc66180625876d13c5d5fb949ea65dc8aa47767 |