Skip to main content

Open Neural Network Exchange

Project description

ONNX Optimizer

PyPI version PyPI license PRs Welcome

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

ONNX Open Source Code of Conduct

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onnxoptimizer-0.3.11.tar.gz (18.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

onnxoptimizer-0.3.11-cp311-cp311-win_amd64.whl (381.3 kB view details)

Uploaded CPython 3.11Windows x86-64

onnxoptimizer-0.3.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (678.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

onnxoptimizer-0.3.11-cp311-cp311-macosx_10_15_x86_64.whl (577.8 kB view details)

Uploaded CPython 3.11macOS 10.15+ x86-64

onnxoptimizer-0.3.11-cp311-cp311-macosx_10_15_universal2.whl (1.0 MB view details)

Uploaded CPython 3.11macOS 10.15+ universal2 (ARM64, x86-64)

onnxoptimizer-0.3.11-cp310-cp310-win_amd64.whl (381.3 kB view details)

Uploaded CPython 3.10Windows x86-64

onnxoptimizer-0.3.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (678.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

onnxoptimizer-0.3.11-cp310-cp310-macosx_10_15_x86_64.whl (577.8 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

onnxoptimizer-0.3.11-cp310-cp310-macosx_10_15_universal2.whl (1.0 MB view details)

Uploaded CPython 3.10macOS 10.15+ universal2 (ARM64, x86-64)

onnxoptimizer-0.3.11-cp39-cp39-win_amd64.whl (380.9 kB view details)

Uploaded CPython 3.9Windows x86-64

onnxoptimizer-0.3.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (678.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

onnxoptimizer-0.3.11-cp39-cp39-macosx_10_15_x86_64.whl (578.0 kB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

onnxoptimizer-0.3.11-cp39-cp39-macosx_10_15_universal2.whl (1.0 MB view details)

Uploaded CPython 3.9macOS 10.15+ universal2 (ARM64, x86-64)

onnxoptimizer-0.3.11-cp38-cp38-win_amd64.whl (381.2 kB view details)

Uploaded CPython 3.8Windows x86-64

onnxoptimizer-0.3.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (678.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

onnxoptimizer-0.3.11-cp38-cp38-macosx_10_15_x86_64.whl (577.7 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

onnxoptimizer-0.3.11-cp38-cp38-macosx_10_15_universal2.whl (1.0 MB view details)

Uploaded CPython 3.8macOS 10.15+ universal2 (ARM64, x86-64)

onnxoptimizer-0.3.11-cp37-cp37m-win_amd64.whl (381.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

onnxoptimizer-0.3.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (679.4 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

onnxoptimizer-0.3.11-cp37-cp37m-macosx_10_15_x86_64.whl (577.0 kB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

File details

Details for the file onnxoptimizer-0.3.11.tar.gz.

File metadata

  • Download URL: onnxoptimizer-0.3.11.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

Hashes for onnxoptimizer-0.3.11.tar.gz
Algorithm Hash digest
SHA256 c52c09294a8465c659603b286d3773caeb5eeaeaa95d6eb53ed5a9e408712150
MD5 6b84bd426e4e55aa44b99efedf63729d
BLAKE2b-256 0f5c62abede0ec082cd29125b01da246c3be525ba915abdcd21612c71e23cbac

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8a6db5b81d0984f73a2777224b8ced6f73d546321e0979af2d281411e7395ee8
MD5 79293208716981db60ccb7320e1496f0
BLAKE2b-256 27b14e038f6741c729d5f7058cd9e73805a340a48fc063d3d89a491a5d952cea

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2ffe2402dfa109b6d3423314d5fd169942c1a1ef87c6d892da4b8d1de51a943
MD5 b1f372b9468ea5e494056d615b3a6f1b
BLAKE2b-256 eb7cf9816b4668564e3c351df69d302d179e2867af630dea518497866caa316e

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp311-cp311-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 3df20b979a6b66eb48bf0d996e6621f299d291869bf72dcf2e6380c54e22ad6b
MD5 a5080167900efed2bd8ad762939905e7
BLAKE2b-256 e3afa9a49bbf3d3549a1f0e5212fcafefe6ff54f5200f59072827228eb5b1717

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp311-cp311-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp311-cp311-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 e263d75d10d95798201e03b89b599b27ec0e97741dd0b3a48566d82b535e1a12
MD5 2d17f4b0e0fb75510ad27013b5835899
BLAKE2b-256 f9c0572cca1cf9d08acd4ce8139d67fa5beee8b33f9b6847f3a6610764bee835

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 89b01f3a82ec27caeede128668935cbfea09cc22151a31c4dc7c193372fc234e
MD5 b4888ff1c084396279db49aa8b7827af
BLAKE2b-256 99ae0937e8f58e9761ad248c0ca462abf899d83160b6b2802434e34bcbe22b15

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a030ae40e46f815571577b8c37371959a00cedfd2dd7008f5f9fffcdd9a777a6
MD5 5982bc56ee02fc2747773c1a7d3a62e2
BLAKE2b-256 cd5022d23f767cfe7d94ef0bd1b1a17743b376263d9ca1024dbc951098287fc3

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 b907bc60b9334936ddc5f2b45babde390e6eee09f4cc7d37d0fabadcf61a8ab7
MD5 a07e1a4264fe573a87a6a9e7ab795162
BLAKE2b-256 bad9c046807467eff9f8f435ce7b3459913e01e2c091e3fc7f9c3a3527af3567

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp310-cp310-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 b872d5e84339e94594b27a305074ccc64cbda030d7cf9af60dea0d066071e069
MD5 5ae4fee30a8e29319ea46ad5d758e0f3
BLAKE2b-256 9cfa8940653a4afde66d1eff9567b7a6e471deba0007e7e31f5037a1be3d7134

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4ab3364790e64a2d2b064a03e1619795ad5d51c99eb96947c33649814c9e91b3
MD5 5ee0c6771cbdfa8afa48130d977b661f
BLAKE2b-256 f50564724fa90efb366be6f9f00adea84d9739ba5788d3e8022c800afdd6780c

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 014e924d7a109ffdfc4def91e88ce45cefaf9ebbaf3061625f346d07a788d9d1
MD5 77faeee0fe94684e6e78370c2d723a6f
BLAKE2b-256 203a17d53a2a895208605bef9482e21765e7eeb80120f73f8a53d2ea208ce459

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 fb17041d8ffeeac286b72d3cf0e6196b0b309b9bc58520874451a5727381e378
MD5 363105d557206f063108ecf4d5b15b73
BLAKE2b-256 4c8d0f7d94614da5015a87f3e3e571ce0f7534590c8f97f1bbc7bf5ad92fbecd

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp39-cp39-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp39-cp39-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 a9370e4dff82d820c96833966ecb83171b69d6ae59cfff4aebda409ca05bfa17
MD5 6a9c24ed7db0bc7fac20f4436723529c
BLAKE2b-256 e11c8fa95cca530d76770e2efd08d52bc6444a78fa24a59420d51644d55562c8

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 fb27c7c7a11fa17efa6039ef5c4fc4a2e76c1cb26165c0f04e56130092dba016
MD5 2cc3472bf703d9579a4e53699e85695a
BLAKE2b-256 9951e5ffe977d7b1b40b44f5f681b38fc4e0d54877797951d0de1fe007c58703

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff08dcaf15b86524f623d7ff6931f69288b00b3875c5a19b803fbea6093a84e5
MD5 12e7a7b85b16dc5e6cb81f0d6e31b5d9
BLAKE2b-256 defe101c7eb0fb4a538b42fd7082d2b5c9a60a0b1387d11a07b752938e6debd8

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 f909c9d92ef84e295700cd7509f4c2e01b5d4aa0cf7e4cbf628b4de2802497ec
MD5 e074098bef7c56ab2361a42fc7e434b6
BLAKE2b-256 81d31dc573f3a418a99bb0bd5f5a108c95f4aeeea130077272f75da2b0361acb

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp38-cp38-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp38-cp38-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 5107577152e7f6afaf48b48f2c89758d571c1d77e0cf18ddeccadcf42528fd1a
MD5 bf24d5bd4e39f3ded822daff2ae43a03
BLAKE2b-256 bf071becdcffe3409b7d255587388093ad3d35034eb9ddccd6bded2d4d74f080

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4bfb6fb6608a08f97a34b392a5e3da4f3b8cfcc9be373005fb1e8a5eeb693a76
MD5 c75ddf2d0686e53040ff0237cfd86658
BLAKE2b-256 696825c381bafe5ce3cf1003fc3808cf8a80c450b94df89abb45c85921fa23ba

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30bf66b91128aae2e739820141c754813531ccf8b503ab4fa8bbaecd8919abc0
MD5 ad550482e065879c9cbbd316282758e8
BLAKE2b-256 191fd73a92ce872120dee79227e97da9a83910a0bec8191aedebe09dcd607248

See more details on using hashes here.

File details

Details for the file onnxoptimizer-0.3.11-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.3.11-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 9229e6860b03a454b6315adfb529534195c0597e1f4a996dc45b5391202d35a4
MD5 4d01d19932ee9591d25ac436edf17077
BLAKE2b-256 78cb27677c1330d7e2006f3d7f1926a2b070bb965795af5e682fe2f606fec043

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page