onnx-tool
A tool for ONNX model:
- Shape inference.
- MACs(FLOPs) counting for each layer.
- Extract subgraph from ONNX model, or do inplace op fusion.
...
and any operation you can image with ONNX.
New: Pytorch models are also valid if torch.onnx.export succeeded.
Shape inference
how to use: data/Profile.md.
pytorch usage: data/PytorchUsage.md.
MACs counting for each layer (FLOPs=2*MACs)
how to use: data/Profile.md.
pytorch usage: data/PytorchUsage.md.
Extract subgraph from ONNX model
how to use: data/Subgraph.md.
Inplace op fusion
how to use: data/Subgraph.md.
Add any hidden tensors to model's outputs
how to use: data/Profile.md.
Tensor operations
- Export weight tensors to files
- Simplify tensor and node names, convert name from a long string to a short string
- Remove unused tensors, models like vgg19-7.onnx set its static weight tensors as its input tensors
- Set custom input and output tensors' name and dimension, change model from fixed input to dynamic input
how to use: data/Tensors.md.
How to install
pip install onnx-tool
OR
pip install --upgrade git+https://github.com/ThanatosShinji/onnx-tool.git
python>=3.6
If pip install onnx-tool failed by onnx's installation, you may try pip install onnx==1.8.1 (a lower version like this) first.
Then pip install onnx-tool again.
Known Issues
- Loop op is not supported
Results of ONNX Model Zoo and SOTA models
Some models have dynamic input shapes. The MACs varies from input shapes. The input shapes used in these results are writen to data/public/config.py. These onnx models with all tensors' shape can be downloaded: baidu drive(code: p91k) google drive
|
|
Release files for onnx-tool 0.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onnx-tool-0.2.9.tar.gz | 23.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onnx_tool-0.2.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.6 kB
Release files / onnx-tool-0.2.9.tar.gz
| Download URL | onnx-tool-0.2.9.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e1f2e82c4a4ee5223e5165ecc808401aaa2263b8495ada93d215775c187e8b6
|
|
BLAKE2b-256 checksum How to use checksums |
860b07e89e3f4cd95e38bf180c656d7a0b6e43a439b4ac86899353e059a4ef4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / onnx_tool-0.2.9-py3-none-any.whl
| Download URL | onnx_tool-0.2.9-py3-none-any.whl |
|---|---|
| Size | 22.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a429213e5c2573914cbec2786e4020e9f5b1afd69a155c9b0f88bd09191a784a
|
|
BLAKE2b-256 checksum How to use checksums |
366918c9e9574bb95226f877bb19092c94d87f120d7d7eace76e39c7fffa5847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|