Skip to main content

ONNX Optimizer

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

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.4.2.tar.gz (12.1 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.4.2-cp312-abi3-win_amd64.whl (486.8 kB view details)

Uploaded CPython 3.12+Windows x86-64

onnxoptimizer-0.4.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

onnxoptimizer-0.4.2-cp312-abi3-macosx_10_15_universal2.whl (1.2 MB view details)

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

onnxoptimizer-0.4.2-cp311-cp311-win_amd64.whl (488.2 kB view details)

Uploaded CPython 3.11Windows x86-64

onnxoptimizer-0.4.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

onnxoptimizer-0.4.2-cp311-cp311-macosx_10_15_universal2.whl (1.2 MB view details)

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

onnxoptimizer-0.4.2-cp310-cp310-win_amd64.whl (488.1 kB view details)

Uploaded CPython 3.10Windows x86-64

onnxoptimizer-0.4.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

onnxoptimizer-0.4.2-cp310-cp310-macosx_10_15_universal2.whl (1.2 MB view details)

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

File details

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

File metadata

  • Download URL: onnxoptimizer-0.4.2.tar.gz
  • Upload date:
  • Size: 12.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for onnxoptimizer-0.4.2.tar.gz
Algorithm Hash digest
SHA256 dac4a972b5dc80a870b930e85e4b043d090d4546d7878106ef8448e07f94622e
MD5 976ceabef0d513ff20688d93c457fe32
BLAKE2b-256 5ba7e4f0e67a7e077d7cc65b968febfc53f8f52d3a22257624aa7977f14fff8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2.tar.gz:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onnxoptimizer-0.4.2-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 cc85d031f35689d36d91e79770611015014c41278fd39b664c6ccc27dc045aa0
MD5 40486a558627db9030bb62acc77d1d29
BLAKE2b-256 67c1173031e8e5f9185a168209ead6f8b5e985f951a817d7b7b9c62a335a1a33

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp312-abi3-win_amd64.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onnxoptimizer-0.4.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 af19ee4dd7a852a18511aeabdbe1e3c8b4dd8e02b187356965b269d480ac7147
MD5 5888f04147ee06b112188a59d70b9ab4
BLAKE2b-256 853ed512bf70a66f85d3d7bfc79380da24c026d6409b28c5cd48f2d91e450046

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onnxoptimizer-0.4.2-cp312-abi3-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp312-abi3-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 7229ffe7d54c692e4ba0a2516f94805a4f462e7fce7634e080a381fb82ec2378
MD5 b4aa793252b88a446adb4989d26e3129
BLAKE2b-256 e7e9bedd490a39b5201d33aea1f2812ca74bba9b30defa66fc94e3d46878b8b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp312-abi3-macosx_10_15_universal2.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 74f5400833dbdd9439d17c0fd78b962fd2ae7a369169e41e19dd09ae532350b6
MD5 46a3f16c8483739324ce15e64db14cd8
BLAKE2b-256 e65a43b60c74ea2f3024340452962b0fbbf2300907d4e88e31847f4e67faa631

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp311-cp311-win_amd64.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onnxoptimizer-0.4.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f278dc846b7144b7bdd063d0838848bdf45ce2e35d205379f169ec77deb76d9e
MD5 712321b421cbc7e84dd0380d34db4634
BLAKE2b-256 cc7c99b072778f66e0f95e43874f6a2fd2b96968979e1fb644d186abbed2f2e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp311-cp311-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 b6aeaf03ecfa626b2e716ce910b1547d450d4b79673ab1c446fd761c05c8dcf8
MD5 d98ce1874315a329d8a97fc0f292fc95
BLAKE2b-256 f8f4c0eae052169bb058c847f9ed3a4c217e2a3b2f63177e370b1ee2afd2e614

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp311-cp311-macosx_10_15_universal2.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 65185aa0a3629db7d6618762dfb6ec1afa19401048773318191eef7b55eb142c
MD5 65b374b0b1adb0a3c3bf8bd15febc65a
BLAKE2b-256 b02815ed9afb400f964cd4f1ab0bb790623d2d2a6acf755221cc717c34492b3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp310-cp310-win_amd64.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onnxoptimizer-0.4.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ee2ed3cc6cc08543fc542c65d49bf2a8933e185b454d576ae3cd1bc877ee858c
MD5 c17b361d0b8413122e70c8ce360e3c83
BLAKE2b-256 389c09f01912085cd8f2c1a1bcd6d74106d85e839f0b06fc705b843086553a8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for onnxoptimizer-0.4.2-cp310-cp310-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 73b0859397ea1ffca6e896c6799c48933f09b16226def686264e68ef386f1239
MD5 ad558c30b30a4393598238a844bfab6c
BLAKE2b-256 b7601e08c455e8262b7a8ecc2c10e586a7aaa517c0b9e3771b3c7b5ec80b6f29

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnxoptimizer-0.4.2-cp310-cp310-macosx_10_15_universal2.whl:

Publisher: build-and-test.yml on onnx/optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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