Registry / ai-ml / onnx-tool

onnx-tool

JSON →
library1.0.1pypypi✓ verified 86d ago

A library for parsing, editing, optimizing, and profiling ONNX models. Current version 1.0.1, no defined release cadence. Primarily used for model analysis and shape inference.

pip install onnx-tool
INSTALL
IMPORT
SIG · ONNX-TOOL
O
onnx-tool
ai-mlpythonv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Model
✓ from onnx_tool import Model
✗ from onnx_tool import ModelParser
Graph
✓ from onnx_tool import Graph
loadmodel
✓ from onnx_tool import loadmodel

Load an ONNX model and print graph information.

from onnx_tool import ModelParser import onnx # Load an ONNX model model_path = 'model.onnx' model = onnx.load(model_path) # Create parser and get model graph info parser = ModelParser(model) print(parser.graph_info())
Debug
Known issues
gotchaonnx-tool expects ONNX models in protobuf format; ensure you use onnx.load() rather than onnx.load_model() which is deprecated in newer ONNX versions.
fix
Use onnx.load(model_path) to load the model.
affects: all
gotchaThe ModelParser's graph_info() may return different keys across versions; always handle dictionary keys dynamically.
fix
Iterate over keys with .items() and check for presence.
affects: <=1.0.1
deprecatedThe function 'infer_shapes' has been moved to a separate module 'shape_inference' in some versions; check documentation.
fix
Use from onnx_tool.shape_inference import infer_shapes if available.
affects: <=1.0.0
breakingVersion 1.0.0 changed the base class for ModelParser; existing code inheriting from it may break.
fix
Update subclass to match new API; see changelog.
affects: 1.0.0
Upgrade
Version history
1.0.1latest on PyPI · released Apr 19, 2026
Audit
Dependencies
onnxrequiredCore dependency for ONNX model handling
numpyrequiredArray operations and shape calculations
Agent activity
2 hits · last 30 days
node
2
Resources
onnx-tool — pip install onnx-tool · libregistry