{"id":28008,"library":"onnx-tool","title":"onnx-tool","description":"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.","status":"active","version":"1.0.1","language":"python","source_language":"en","source_url":"https://github.com/ThanatosShinji/onnx-tool","tags":["onnx","model-analysis","profiling","optimization"],"install":[{"cmd":"pip install onnx-tool","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for ONNX model handling","package":"onnx","optional":false},{"reason":"Array operations and shape calculations","package":"numpy","optional":false}],"imports":[{"note":"ModelParser is directly under onnx_tool, not a submodule","wrong":"from onnx_tool.model import ModelParser","symbol":"ModelParser","correct":"from onnx_tool import ModelParser"},{"note":"Module is named profiler, not profile","wrong":"from onnx_tool.profile import profiler","symbol":"profiler","correct":"from onnx_tool import profiler"}],"quickstart":{"code":"from onnx_tool import ModelParser\nimport onnx\n\n# Load an ONNX model\nmodel_path = 'model.onnx'\nmodel = onnx.load(model_path)\n\n# Create parser and get model graph info\nparser = ModelParser(model)\nprint(parser.graph_info())","lang":"python","description":"Load an ONNX model and print graph information."},"warnings":[{"fix":"Use onnx.load(model_path) to load the model.","message":"onnx-tool expects ONNX models in protobuf format; ensure you use onnx.load() rather than onnx.load_model() which is deprecated in newer ONNX versions.","severity":"gotcha","affected_versions":"all"},{"fix":"Iterate over keys with .items() and check for presence.","message":"The ModelParser's graph_info() may return different keys across versions; always handle dictionary keys dynamically.","severity":"gotcha","affected_versions":"<=1.0.1"},{"fix":"Use from onnx_tool.shape_inference import infer_shapes if available.","message":"The function 'infer_shapes' has been moved to a separate module 'shape_inference' in some versions; check documentation.","severity":"deprecated","affected_versions":"<=1.0.0"},{"fix":"Update subclass to match new API; see changelog.","message":"Version 1.0.0 changed the base class for ModelParser; existing code inheriting from it may break.","severity":"breaking","affected_versions":"1.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from onnx_tool import ModelParser' instead of 'from onnx_tool.model import ModelParser'.","cause":"Incorrect import path; trying to import from a submodule that doesn't exist.","error":"AttributeError: module 'onnx_tool' has no attribute 'model'"},{"fix":"Use onnx.utils.Extractor for subgraph extraction.","cause":"The function was removed in version 1.0.0; use onnx.utils.Extractor instead.","error":"ImportError: cannot import name 'extract_subgraph' from 'onnx_tool'"},{"fix":"Verify the model file is valid ONNX using onnx.checker.check_model(model).","cause":"The model has no nodes or the graph is malformed; often due to loading a non-ONNX file.","error":"TypeError: 'NoneType' object is not iterable when calling graph_info()"},{"fix":"Upgrade ONNX model opset or ensure nodes have required attributes (e.g., kernel_shape for Conv).","cause":"ONNX opset version is too old or node attributes are missing; profiler expects certain fields.","error":"onnx_tool.profiler.ProfilerError: Missing 'parameters' field in node"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}