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.9-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cec72f97d2d2891f02edcffc92585f59169096738cb82a81bd75dc77f2ce68a5 |
|
MD5 | 2c33b24484e0203be0d18bd1dda8a834 |
|
BLAKE2b-256 | 57dfb98a2f02438b5964e74c2680875c3c5cd99a63a5bea57e977b38b36142c0 |
Hashes for onnxoptimizer-0.3.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43807f5fd7fbeb447875f4956a2c2f079375eb1cd8d1fcea387163678151c692 |
|
MD5 | 29a6043a6e981fb524e5f406e421e5a6 |
|
BLAKE2b-256 | 444b7bf63f7c8719b10923d956549053a86af2e512cdbaac22d2d50a96ae06ef |
Hashes for onnxoptimizer-0.3.9-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63e3a63f1ef1af1ef17091b0469ed6948ee3afe579a2ea36dab068b618a6d179 |
|
MD5 | 5d2765ceeaa8d2158e55294a008bacd6 |
|
BLAKE2b-256 | f5020b7af280bb4e1d4b64413598ee203e928c975bc2436f9d9f7e3cd4c315b4 |
Hashes for onnxoptimizer-0.3.9-cp311-cp311-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67e8ba2456f4cd895e8ef52bff6489e2a4ae078ee2be5897f4a61dfb999b2fa3 |
|
MD5 | 06a62869b0e9100213510966cc0f3806 |
|
BLAKE2b-256 | d3fbaa5d2d05b4f8f905cfe739680383b386051de6d543bb588f047d329496ce |
Hashes for onnxoptimizer-0.3.9-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97afd20cbe523231d3e98e78817cdb76ff7fd253335181bf75f5dbbc07d45406 |
|
MD5 | 3f898ee65b5791cf9c49744aec8441d9 |
|
BLAKE2b-256 | 76c05c8fd15c8d6e713cba4b05e9d5c7081216a0bf4e13813cbd216f2b4fddcd |
Hashes for onnxoptimizer-0.3.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a52b430e01e8ff2da87d7186d0c3777d3d31c2ca99051c8ced5bcfc25ffbd02c |
|
MD5 | 17a2919b4d269a1270dd1d8e439d89db |
|
BLAKE2b-256 | 73876a673335a8a46f082539abf90aff53fe036bc4d7e14d3772adeda3623d32 |
Hashes for onnxoptimizer-0.3.9-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d41731ccd8c2307038b6694b94b4a5b253c1125c1f657fd08e197695f439ff1f |
|
MD5 | 76c11504df68233e3f666b6c20f1924b |
|
BLAKE2b-256 | 9234389e7eb4748f4362b7e2d757e6a54e724f71ffb989b0acd2d2eb1ed81ce8 |
Hashes for onnxoptimizer-0.3.9-cp310-cp310-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57f14ac26931fdefba37d122b27de675a49cf768f5a2588dc9b85f750c2cdaad |
|
MD5 | 41181120b5bf946b00a6171ad02bc077 |
|
BLAKE2b-256 | ec29b8c5a3c352fe180d49cbd5497136abaa2da3bba64e0746067a120050d1b9 |
Hashes for onnxoptimizer-0.3.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6019ce7ca7952ba2883cbdf4fc429e1ef87513faf7ddf038d34b82bd698d79a2 |
|
MD5 | 2dc33d92e81aceb724993c5ed73c5fa3 |
|
BLAKE2b-256 | d924cd6023ad0a96cd787b5240704e477800b152162ae81cddd092b76d0874b7 |
Hashes for onnxoptimizer-0.3.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 503782725738582fed80adad8dc5bb57fb97c6dd80c15f33e18416d60b012d11 |
|
MD5 | 94ce4b9779bcb78cf450a7f6b5783904 |
|
BLAKE2b-256 | 7b298259f91939ef2b4a9ed4516934f85e8bdf4a72a9592de7fbb3db3e4f0bde |
Hashes for onnxoptimizer-0.3.9-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da0c3e128da90c08bf00259b7c72b8cfdb9b9f637401c1cd3873d7776339f585 |
|
MD5 | dc67a6d7df875ae05dde4098bdafc5d4 |
|
BLAKE2b-256 | b4991fc20f4b6075d46a61abe659fd9c2c41c7df6937efae5b3fee3f2bf00606 |
Hashes for onnxoptimizer-0.3.9-cp39-cp39-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 259a5227568b3279a686642dfdc8d892f10c2b03bdaa15e6e75ee4f1a0aa806b |
|
MD5 | 33b027da5a59cb7801a64cba6a9ab101 |
|
BLAKE2b-256 | 2b71875d44fca5fcc201116512a1cd2b4d9896ffa6547e7cd05668acc9f8b028 |
Hashes for onnxoptimizer-0.3.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 093d558b99124ff76d0c0988f2d7a46d2268a99e80e3b5bfda6dba6e8a46d335 |
|
MD5 | 0343d2115adc0cf902dcfd1c2efd25c7 |
|
BLAKE2b-256 | e533d316a80ddd89f470ffe80cf76b38b5139a3d402cbf4b48895ab6ed87d092 |
Hashes for onnxoptimizer-0.3.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce5e0ab8ec35617d6b608bc9a290aa7fde95768a065440e6326e1fb932edb140 |
|
MD5 | 734a93665ba8a70bbd34c4e100862087 |
|
BLAKE2b-256 | b18062c08f78a6c809b5f053726d60f13944243370cdccd64fe5ad9d58e6b895 |
Hashes for onnxoptimizer-0.3.9-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e54598b295eed8f9b6501314194dc47158ed7dda8d9cf9f2597d14e8750d9b7 |
|
MD5 | a4cefc938c03afaafee6041428af1280 |
|
BLAKE2b-256 | a50a55dd8ec939ef25b033fa5a7ccd616de1f7cafc01df40c18c7c06d409f354 |
Hashes for onnxoptimizer-0.3.9-cp38-cp38-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eeb52da14297085c5b64337deb54019dc6dd038d4eee0bac69d9cceb8dc13c2 |
|
MD5 | aeb1ba1e70a017508a01869ef0c53b2b |
|
BLAKE2b-256 | 5c2bc4d7658d0b8a119375f09e70e287308a2adb59eadf7639159c79b802023a |
Hashes for onnxoptimizer-0.3.9-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 857344b9b79c86009f31ff199e45a8f1a78ec9ae07de8d1dc1769d307797ce60 |
|
MD5 | 8c5e73eb020e21de672deb5142e997d5 |
|
BLAKE2b-256 | 4aa630e68cc20370c513fd885489c6c9cce87b31cc318fd0123a946d9cf98207 |
Hashes for onnxoptimizer-0.3.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38dc7cfa4408120496ea8e9aa6c73053d0cf0ad32ac8e7d2632857f85fb80689 |
|
MD5 | 2bceebaca4cc7ab8c5bdf850eccb7608 |
|
BLAKE2b-256 | 0a70ba8952c8014993bbfc1f710bdf7d7daa226f850d5dbf2638902c91a64693 |
Hashes for onnxoptimizer-0.3.9-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cf35dcffe7e080f8d2bb9c67a7f0277408575a509632df22dfdbb75046dec33 |
|
MD5 | 31e22fec5d8228961f9add22f560024e |
|
BLAKE2b-256 | 0fae078c8301a0c800b8b00bc52a2fcd9f8d4b393ad6c9885b5f4dc07bfe1e66 |