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.12-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85285dcec85b2090c53bf89a7c2c0187c2f48d30b4d7896f672d92fae41602e9 |
|
MD5 | 4e80eac439b2029a035add0eb44bad13 |
|
BLAKE2b-256 | 0473dde2c47db393c6dd908c6835110258dbddda544f18e58db31b5cd7e817bc |
Hashes for onnxoptimizer-0.3.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6e1b7bf58674ce12a62a3f1bba89856817dbe0ea24ed4889df7dcf8b54aae07 |
|
MD5 | 57b8c92892d64850511e79bab62af1ab |
|
BLAKE2b-256 | 8e4be79e36cb829b7bf0336a50063bb285300ae5c434cac5465f45694cc59c67 |
Hashes for onnxoptimizer-0.3.12-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba546c3692b80ebf2fdfc297e469ed3b93fe7932e1c6b5c8828d34d627b9c70 |
|
MD5 | 43aa118943949d5a7214b710b3986630 |
|
BLAKE2b-256 | 5a342697cb0e414c1ccc5c3a27987a75458866f9a905b4366197c656834b9ab2 |
Hashes for onnxoptimizer-0.3.12-cp311-cp311-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc9403429380214608e7297de1652a20f8c4673ded02a85bf9edcd8897d41aad |
|
MD5 | 69129556661cc184451a92b4efd980ca |
|
BLAKE2b-256 | 2fa3244ef1145b5150eff044762eb8aff69c1b0463423a24325180a599606f50 |
Hashes for onnxoptimizer-0.3.12-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c06a651038b671dd36ead1268f69c71e708d19d733fd9900856741b60118c19 |
|
MD5 | 768e88c3ce4e4634dd256902e588c4fc |
|
BLAKE2b-256 | 26b31810cea75c53714cbf87d2d5507d197343fc02770dcd5b67408355f359fc |
Hashes for onnxoptimizer-0.3.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd2932a820035c92eea97a4e5250dd43f853e9f30719c2ddaa2f3c08ef3426c |
|
MD5 | 1dd8861568e34c1755eba0287a559fb3 |
|
BLAKE2b-256 | be4fa209292a8a7c3bda8e51929ca5595050edf50571e3b779c9e66fbf0d1195 |
Hashes for onnxoptimizer-0.3.12-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3daa2304887bfa717d7f277090018a2bee08b2a43206534387742578f9d0bb5 |
|
MD5 | bc3a414b70e42d08b442ebae94517138 |
|
BLAKE2b-256 | bfce6fc0afb9574d8034533c268fb92769c76234f92375ff6443bc49d55b53da |
Hashes for onnxoptimizer-0.3.12-cp310-cp310-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 611f5341e9cc25d27c010459252eb242ad6d23903d087561e3fd6f5927c7b2db |
|
MD5 | 199829d4b25e31030632b386039e258d |
|
BLAKE2b-256 | d7463774434bc654fd67da1a1952c66316a8d109eab661f2fa1c94d2a9f0c54a |
Hashes for onnxoptimizer-0.3.12-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95965d75776f4b38191a997eb9cf22f26bbd4c2d15a231924921f742448ca1f9 |
|
MD5 | 5ad222af358ab3a2010e9195029c8d79 |
|
BLAKE2b-256 | 233c646c8835ff0e0e74d1a4c1a9d4c7cd8165f72081f681b83b1f777b5b908a |
Hashes for onnxoptimizer-0.3.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1ed68f7d166ed02856a41a3559e7b458177456a942d89bd56446ff9b59d057d |
|
MD5 | f379ae998b77afe2aae0553e59884139 |
|
BLAKE2b-256 | beb67b9c1dac26e9743cbbe920705b6c98a6c80e038ba850707b4b8250d7d4c5 |
Hashes for onnxoptimizer-0.3.12-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19532a41119e5ed58cc86890cbe661a301142ad20e865f4f343225a4ca039acc |
|
MD5 | f30117bdc311dd7620c05599ba7edf9a |
|
BLAKE2b-256 | cb4a8ef7bdf7f6de061a99f09432f029c80ff7128b81b6cdb89a96321b09b790 |
Hashes for onnxoptimizer-0.3.12-cp39-cp39-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9655b28b909c1dec2adcc9fba2afaaab5704a90140f3b38a20a9b83d0b9b7491 |
|
MD5 | 473fdd7dfa912e312a169f09f7187416 |
|
BLAKE2b-256 | 66c5d403f8d04648d3b3465374389a95a13827f1b33cb7f36bb9076aadfc25d5 |
Hashes for onnxoptimizer-0.3.12-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4381654e7b11055f8aff582732811405f54e60d90e69ec6d06fef4fe77d9deb5 |
|
MD5 | d7848219656ac9967a19c2b3e5990ffb |
|
BLAKE2b-256 | ea582382bf1d37a8c56376660841fffb4908c939429ae65c36363976b0460ea5 |
Hashes for onnxoptimizer-0.3.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61da9bbc9bd5941f00e037b42b6fa77d2117a34adb70dc9e3df737e3b9f3a79 |
|
MD5 | 9e8c0f098ede4b8b35b82250927833b4 |
|
BLAKE2b-256 | f5eae3b2b7178cb4a2ecee5cca44341d6e5be873f0f57fa1afc2661705fb5e42 |
Hashes for onnxoptimizer-0.3.12-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 522e6d314288e474c01addc3e5dccb55b77d1ba1f69968b12ad17ba952de87e8 |
|
MD5 | c0b278e561560bd089d68fbc0a5e5c0b |
|
BLAKE2b-256 | 14ba94031b8f3c5bfccea474cdd75b7b0a43867cdd9e14d3a33d59228be99bdf |
Hashes for onnxoptimizer-0.3.12-cp38-cp38-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eded1a6476e95b3c3a6cac57e16066c05492f8b2f7aea6f7b7bc99ed43939e0 |
|
MD5 | ba35f30f0fedfa8c687ebd8cef480e5e |
|
BLAKE2b-256 | 12250d3eab4811db18b4db3461c9352c9d996ec8fe56cdbdbf89efc69b81ed16 |
Hashes for onnxoptimizer-0.3.12-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a6bd643ea632706298d094e6634fd2ef3fab4a0eb2beb7ec80df90d6488c6c4 |
|
MD5 | 6b484b70df8425154520a96cf2f18dbb |
|
BLAKE2b-256 | cffb341fc9aaa6f9fdd75d8ac8f1d67b224687ba816016db7b9d28e34c598352 |
Hashes for onnxoptimizer-0.3.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ff23dc669875af149c88dd625d2ac49d74e7208d840cd679b695e05f2c4eb9 |
|
MD5 | 692aba8658823d9fda686b9ced11f375 |
|
BLAKE2b-256 | d1ad5e5778c8852995577539acab0da44f290f6cbcd90a2b61515bbead314fd7 |
Hashes for onnxoptimizer-0.3.12-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb83ffaa10e873e1e19aca959d275f29819881c836351b237b6a54d7015254f0 |
|
MD5 | 71df8d409c4fefb7a9bc2a5242045d3c |
|
BLAKE2b-256 | 68f3724d07596161238076403b283206e68ffbdaa89e8c39d9cbd6c1fdf0ec9a |