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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onnxoptimizer-0.3.13.tar.gz.
File metadata
- Download URL: onnxoptimizer-0.3.13.tar.gz
- Upload date:
- Size: 18.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | e08b726e0d4577e51e529f36bc324bf11b7cff12852cf3eee081f05c8b8c6f33 | |
| MD5 | 56977dfdfaaf7b117c7cfe9d7b4ac6e2 | |
| BLAKE2b-256 | 68bde8671229c2f1f99eb02961cac51e55ca64dbbe0d62791b6743cc8b9950b1 |
File details
Details for the file onnxoptimizer-0.3.13-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 381.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 82e606024a6dce999a8586d1f4b6af2ec454f7c5fd69807672a79067017a4812 | |
| MD5 | 0333f1fa02ff7fd697f12e531cd9e716 | |
| BLAKE2b-256 | dc0aedd2900c20702fbd7ccce59337720ad936d55da196e248804d91128b9b5f |
File details
Details for the file onnxoptimizer-0.3.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 678.1 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 2f985cfef0fa2b7cf9ae64a36ca8dacb3e1861e31fa41fb85645cdbd73ccab6a | |
| MD5 | 32a9ca0a53d8577dec88abe889248b59 | |
| BLAKE2b-256 | 281b6dbb0e6f62c00b3c14f027316d0e4173f4ed82068ae64b40770d60a2156f |
File details
Details for the file onnxoptimizer-0.3.13-cp311-cp311-macosx_10_15_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp311-cp311-macosx_10_15_x86_64.whl
- Upload date:
- Size: 578.2 kB
- Tags: CPython 3.11, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | a65b2ff1d480f966f906fdc3731cd6a844762e0aae1876eeafb7586048d6be96 | |
| MD5 | 8f07f5b609adb1cd9175ae710f732d80 | |
| BLAKE2b-256 | 3882dd92b6515a4965bb9136775a3cae84224a258285f8d84f2f2bbfd2fdaa15 |
File details
Details for the file onnxoptimizer-0.3.13-cp311-cp311-macosx_10_15_universal2.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp311-cp311-macosx_10_15_universal2.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.11, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | dcd1c529cb3d285f1bc75480ebe198a43f6bcc84ad010386f6e2d7bcd3052501 | |
| MD5 | dbef6e4f1fdae536d7fc4c9ff2fbb6c2 | |
| BLAKE2b-256 | 708f4a9bb2ba490b7e8f9e8f5ad7a2e6f9c43bd5590f7affed4e2e9874fd2a0e |
File details
Details for the file onnxoptimizer-0.3.13-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 381.7 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f34db9dc55a682d3e5e60f5e6ff62101410620d2b70bef41f6158481a9a0b5ec | |
| MD5 | 68b2211b8bfe26f223b8541be69e5e70 | |
| BLAKE2b-256 | 0ec83a33f3dceb754f5a83751703b524ba788642545318bb2083c49402dcede1 |
File details
Details for the file onnxoptimizer-0.3.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 678.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 98716324135ac5505529423dbba5479273e6f46a0f895ac611a29ed8a6f79690 | |
| MD5 | 8e8576e7021efb9e037cf92bde516570 | |
| BLAKE2b-256 | cd0c1769400bafbc3797fe725fa29d66256a7944101d65590ebdaf867d3b81f3 |
File details
Details for the file onnxoptimizer-0.3.13-cp310-cp310-macosx_10_15_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp310-cp310-macosx_10_15_x86_64.whl
- Upload date:
- Size: 578.2 kB
- Tags: CPython 3.10, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 542b43b13c3b1b7b72aae2579a2d75ef68dcf0513231bb1cb2b5f3c8af838d87 | |
| MD5 | d40796909cf5df097a5c4f6203cf8c86 | |
| BLAKE2b-256 | 174d613b5ce51cccb0bf55502810400ed0966e61bd571f81d68e2d095d69635e |
File details
Details for the file onnxoptimizer-0.3.13-cp310-cp310-macosx_10_15_universal2.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp310-cp310-macosx_10_15_universal2.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.10, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 019968dc02b37ab87588b67331f15719a9fcfc5de54de866dd7b02eaad68bdd5 | |
| MD5 | 6d65c122860c96aee7862ecade937623 | |
| BLAKE2b-256 | 333c8a8320e295f80ae268233e72a9ae81fd35f6f7a6d00fcc02d3b1186a19aa |
File details
Details for the file onnxoptimizer-0.3.13-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 381.3 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f97f454cc2602095e341219f5c1b828d1588351251e4a4108017fd132ac5590c | |
| MD5 | 08974c070cb573a98fcf026545bf31a5 | |
| BLAKE2b-256 | b2910b39b5bdac89997c7d19120077525f10b3043e9748ae5ab71b7f25b1b9e3 |
File details
Details for the file onnxoptimizer-0.3.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 678.2 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 2cfa79a41d2439c47e6675f19cc6bcd7dce5d5da492f9bcde71dc0eba739dea6 | |
| MD5 | 4e3b0a08c196f083b452324f9cf378be | |
| BLAKE2b-256 | 034c5a134dbf4cc421ed50ea8d22bdddc4d12d745303d276411592ed6681afd0 |
File details
Details for the file onnxoptimizer-0.3.13-cp39-cp39-macosx_10_15_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp39-cp39-macosx_10_15_x86_64.whl
- Upload date:
- Size: 578.3 kB
- Tags: CPython 3.9, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 9c0516d96da47875e9a36d0c9689e2d3e6f72950d98425ccfeba793b6ba4f55e | |
| MD5 | c1805a4eadb1e536eafcd00e78b23ab8 | |
| BLAKE2b-256 | 1c82123bcdf2d30f4d148c394bd112a761365ecbc4e1e95a544c55ca0d51dcb3 |
File details
Details for the file onnxoptimizer-0.3.13-cp39-cp39-macosx_10_15_universal2.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp39-cp39-macosx_10_15_universal2.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.9, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 1949c259bc87a92680b1d4ee54813dc712a4328b4d4e140ec44c1739862baccc | |
| MD5 | cf03b91fa54ba1bc87ab97945a88a587 | |
| BLAKE2b-256 | 36e47fe1fdd73ee94986b87dc52113780a8ca480288ff662abe819185df3177d |
File details
Details for the file onnxoptimizer-0.3.13-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 381.7 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 3dc63c930db678d07cdd816618b6d990dadb572691c62576962c2aab995a0ba1 | |
| MD5 | 0b503a26745e9d0dd2760604692cea46 | |
| BLAKE2b-256 | 0409486981928df4c1e91655c4137580379bc960fee245189daf18b606450c52 |
File details
Details for the file onnxoptimizer-0.3.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 677.8 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | e3a08e7d3077830bbc99009442230547cae2e9f74682b4fffa42036b88ac49ea | |
| MD5 | 55a44ccb6de1c276e8a9894a8c51ca79 | |
| BLAKE2b-256 | d46a829d91c22f1b369d228cef1da1f47433a00d5d55a9bf40d7f1a41eca6104 |
File details
Details for the file onnxoptimizer-0.3.13-cp38-cp38-macosx_10_15_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp38-cp38-macosx_10_15_x86_64.whl
- Upload date:
- Size: 578.2 kB
- Tags: CPython 3.8, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | ad02bd61d5731587bcecb4aef3ecde6d22fdb0a36c8a2fb6c9b78b6b3cf30e42 | |
| MD5 | 880fe352aef88eaff423fff2774649dc | |
| BLAKE2b-256 | 8ad9415e0c415dfb91c58598a96402fdd5d42b907ed50a6990477cd9e4616b5d |
File details
Details for the file onnxoptimizer-0.3.13-cp38-cp38-macosx_10_15_universal2.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp38-cp38-macosx_10_15_universal2.whl
- Upload date:
- Size: 1.0 MB
- Tags: CPython 3.8, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f6a93aa863e23e040b23822b783b5d9bc1bf3a2153909bcc68dd9cd61c824798 | |
| MD5 | 243dcf7d8d07de379a45131c568b5c5c | |
| BLAKE2b-256 | 966f1d06402da188a5635c955febe56f37e2fc8fa4fdc6ccdbc9aab9195e7a17 |
File details
Details for the file onnxoptimizer-0.3.13-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 381.6 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | f809f7ba336e6569e699b4e6741042ef71e8db30bb60a3380faae87c59d6118f | |
| MD5 | b4763debee05ab45577f12e348e859b3 | |
| BLAKE2b-256 | a650c763c4a6764e27de0ba1ecb23ad401edb7c3a7fa0bf8a97e9c8fec1eba86 |
File details
Details for the file onnxoptimizer-0.3.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 679.0 kB
- Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 917363d773f6b517a6edb97b9d1d64cd49dc12ee507d9daef04a443d2d8889a5 | |
| MD5 | 91ae7f38d8cc940c973e300ea822d8e0 | |
| BLAKE2b-256 | 2dbcf890e716c9c339af0be07f2c30e96e35a5532d73fc33251d75389a68b27d |
File details
Details for the file onnxoptimizer-0.3.13-cp37-cp37m-macosx_10_15_x86_64.whl.
File metadata
- Download URL: onnxoptimizer-0.3.13-cp37-cp37m-macosx_10_15_x86_64.whl
- Upload date:
- Size: 577.5 kB
- Tags: CPython 3.7m, macOS 10.15+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | feb5fb749cb9b12602fef7bae034aaf9a36baa05d068fb3d991bbb758c0508bb | |
| MD5 | 3d85072d29cdf9fd52c26cd8d9f1eb55 | |
| BLAKE2b-256 | 512fa81f21ce2139d74caf5205b28d5fb7ced033ccfbee8031b95217f2806888 |