ONNX Operations Counter [WIP]
Counts number of parameters / MACs for ONNX models.
Installation
Requires Python 3.12 or newer.
pip install onnx_opcounter
calculate_macs normally relies on ONNX shape inference. For the rare models where
shape inference fails, it falls back to running the model to discover intermediate
shapes, which additionally needs onnxruntime:
pip install onnx_opcounter[runtime]
Basic Usage
Using CLI (calculate number of parameters)
onnx_opcounter {path_to_onnx_model}
Using CLI (calculate number of parameters and MACs)
onnx_opcounter --calculate-macs {path_to_onnx_model}
Using API
from onnx_opcounter import calculate_params
import onnx
model = onnx.load_model('./path/to/onnx/model')
params = calculate_params(model)
print('Number of params:', params)
License
The software is covered by Apache License 2.0.
Metadata
Release files for onnx-opcounter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| onnx_opcounter-0.1.0.tar.gz | 14.5 kB | Without provenance | Details for onnx_opcounter-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| onnx_opcounter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for onnx_opcounter-0.1.0-py3-none-any.whl |
Total release size: 25.5 kB
Release files / onnx_opcounter-0.1.0.tar.gz
| Download URL | onnx_opcounter-0.1.0.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21242efa809a00feb839d76c796f5eea0636c7120947b781c9136cf9f7a7128b
|
|
BLAKE2b-256 checksum How to use checksums |
7e791049a48bdd482e9e9c4805038df07b67d6468a93abb45ee87acf62f6581d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / onnx_opcounter-0.1.0-py3-none-any.whl
| Download URL | onnx_opcounter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a16ec73bf7f9280543759cc8078615350cb7fde2dc0d77555ee0ff620d8a422
|
|
BLAKE2b-256 checksum How to use checksums |
7055f4119d2c8f344d8f490e5804f321109a7885415da8fc20a07d9959ba0cdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for onnx-opcounter 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.