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.7-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f19c3e6f801dd7423de2f0d37036e0c72e44e68006cafd657a1e6979ee710a75 |
|
MD5 | 31a6a6e5d0767d96c82f8ae1b3a33bf9 |
|
BLAKE2b-256 | 9d893e4a71b86044581b963e41b45a6693dcac0e8f533ebc1833df1e43486325 |
Hashes for onnxoptimizer-0.3.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd5fe3eb74be391e3665c7641e1641ee3ddfe6ba15fcecd6066160bbd34cba30 |
|
MD5 | b082ac438aeee177f77fde3bc153607e |
|
BLAKE2b-256 | b6f06fd95668dccee227da9b331037dce4d7501b1a36ff3ceca98f8d9f1790ed |
Hashes for onnxoptimizer-0.3.7-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 708644520a5002669593e8953d4cb9dd30ed44b7ec0b143cf23b9e0130917743 |
|
MD5 | cf43cb154dd35645dd277ee506d33833 |
|
BLAKE2b-256 | c126b70c47f10f05ec21647c457e8ab01f16ac9fe5d11a23d867db7ca3ca9177 |
Hashes for onnxoptimizer-0.3.7-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55457e367c8927506e0fb9763fd649febd6e6be8825bf2fe1f8682313753be51 |
|
MD5 | 559aee2ae6396d55e2936ed44ff5d118 |
|
BLAKE2b-256 | fbe39abf5c2e112b50fe797998edca4a522765d3b6bf17c358a674059e0f0d40 |
Hashes for onnxoptimizer-0.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0edcda27ffbce95d3fd6f83c5d3b34de54077e848e5a69ca7d91496c8a7c805 |
|
MD5 | 159b5a82c708d23cbe1c8269214b84e3 |
|
BLAKE2b-256 | 5f328bf234916bb71bb8e2edcafda7010edde637eca076719ffe4ff11da6c334 |
Hashes for onnxoptimizer-0.3.7-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eb5ac9b4f18ec88d2bcebff2e62594e900821b6e21df409b28a80c408ce8772 |
|
MD5 | 48ff4cbfe4fe3496f0e27ae1d4e7e832 |
|
BLAKE2b-256 | 7a666d76891a14f24b425a07e028efe7d3d95e2d260a8ff1aafcb6bf3fecd69a |
Hashes for onnxoptimizer-0.3.7-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06ad94394307b085181089e1395263c07717871bb4a47c1797bb058c47fe1d2e |
|
MD5 | 8f2c8637f606f1a71ccb997ba7e5b3d8 |
|
BLAKE2b-256 | 90115993c746de4f40e3bbbd9f7d6e7f8adfebb95a6c18ee3b7efe83c814396b |
Hashes for onnxoptimizer-0.3.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e15a6ea762ba3f6dae6aa5c83a8d9110fe84189824e590b072f352ff8244206f |
|
MD5 | 06334c893cb0d1fa0d0994e3cffadd44 |
|
BLAKE2b-256 | cf722384d1cc7be17469931c64555b795a840f65106554130d12c456981a0054 |
Hashes for onnxoptimizer-0.3.7-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44192da3028cb805b3a6013d4b64c6a247a2d89f8173f2616fc07d667879848b |
|
MD5 | b205d2fc6304f3ffa196ec509a941b3c |
|
BLAKE2b-256 | 3450e4966b70aa4cf9070e41b3181db49ee675c13a168304767d8617adeb7b05 |
Hashes for onnxoptimizer-0.3.7-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ad6a2626cfcfaded7e594c47dc2c13eea6c02faa1024fb9e1200fd1467b32cb |
|
MD5 | 2826eaffe30b5a4c8d76325a355f4864 |
|
BLAKE2b-256 | 0fab06577e09ddc7a72173288c53acd9a5391f1f2ef22a1da512d322d2c6ccb7 |
Hashes for onnxoptimizer-0.3.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 917d26dd389358252de0c8a2d3a6812d7e8521cc547cef769ad98c857c194506 |
|
MD5 | 1eb77a8546b7d97476060cfa63b906f1 |
|
BLAKE2b-256 | 8fee023ced07049d1777b1611ad148e631b8befb03946a0bc011a79b810131ca |
Hashes for onnxoptimizer-0.3.7-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d716bb20fa4cc5608ff3202bc85b765797fdf4f253919efa956bbadb60106c21 |
|
MD5 | a812e46471635afad94a9f83adbf6d68 |
|
BLAKE2b-256 | 8da31e6c4811647840ef1118a8a0446782e7ae2f136d47933309192ec7cfa0e1 |
Hashes for onnxoptimizer-0.3.7-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d380c6fc8847caaae2c8ea25183b152b8cc88f45876c40efa836077628f0f149 |
|
MD5 | aac7edda3da286743e574b1546334a6d |
|
BLAKE2b-256 | f19658b71528715f9b101a0baab9bd233ceec39ad80e10691834087c87a30241 |
Hashes for onnxoptimizer-0.3.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16f76c2d52f9b5091f7c1b9ab60ba51303fefe29a5fb642829932fc6afb0e060 |
|
MD5 | 78aa4346409aaff9af5dbf7d46aa99ae |
|
BLAKE2b-256 | eaacc34054f5c03f02928f59c242213829387d35880b3f16b968840e3f756744 |
Hashes for onnxoptimizer-0.3.7-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 217510e8eb8f26196b25066165b31cd3af71f030af92fc6801692f574b36bb1c |
|
MD5 | 1fb6360b2d8aec1931861ecd678d3534 |
|
BLAKE2b-256 | c6e514f31f043825d5fdfbb34af678e14f4c032aaa3a28e3f650e7ea1b7e6108 |