Skip to main content

Investigate ONNX models

Project description

https://github.com/sdpython/onnx-diagnostic/actions/workflows/documentation.yml/badge.svg https://badge.fury.io/py/onnx-diagnostic.svg MIT License size https://img.shields.io/badge/code%20style-black-000000.svg https://codecov.io/gh/sdpython/onnx-diagnostic/branch/main/graph/badge.svg?token=Wb9ZGDta8J

Helps investigating onnx models, exporting modes into onnx. See documentation of onnx-diagnostic.

Getting started

git clone https://github.com/sdpython/onnx-diagnostic.git
cd onnx-diagnostic
pip install -e .

or

pip install onnx-diagnostic

Enlightening Examples

Torch Export

Investigate ONNX models

Snapshot of usefuls tools

string_type

import torch
from onnx_diagnostic.helpers import string_type

inputs = (
    torch.rand((3, 4), dtype=torch.float16),
    [
        torch.rand((5, 6), dtype=torch.float16),
        torch.rand((5, 6, 7), dtype=torch.float16),
    ]
)

# with shapes
print(string_type(inputs, with_shape=True))
>>> (T10s3x4,#2[T10s5x6,T10s5x6x7])

onnx_dtype_name

import onnx
from onnx_diagnostic.helpers.onnx_helper import onnx_dtype_name

itype = onnx.TensorProto.BFLOAT16
print(onnx_dtype_name(itype))
print(onnx_dtype_name(7))
>>> BFLOAT16
>>> INT64

max_diff

Returns the maximum discrancies across nested containers containing tensors.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

onnx_diagnostic-0.3.0-py3-none-any.whl (209.8 kB view details)

Uploaded Python 3

File details

Details for the file onnx_diagnostic-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for onnx_diagnostic-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1cadcc85f8b5c52891793a65f26e9392efba33a86759c191c55e2a7c07ce98b6
MD5 fd83d5f8c0804302a493837f179abcf9
BLAKE2b-256 6e61189df33c652706533d88863fec98ccb224f13b3b68d497b6f7d84364904f

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