ONNX reference

What AI Model Inspector reads from an ONNX file

ONNX stores a model as protobuf data. Its graph describes values flowing through operator nodes, while initializers usually hold learned weights or constants.

Model-level information

The inspector reads the IR version, model version, producer name and version, domain, documentation string, imported operator sets, and string metadata properties. It also reports the graph name and counts for inputs, outputs, nodes, dense initializers, sparse initializers, and value-info records.

An operator-set import pairs a domain with a version. The default domain is displayed as ai.onnx. This helps identify the operator definitions a compatible runtime needs, but the inspector does not validate that every node conforms to the imported version.

Graph structure

Graph inputs and outputs include their names and declared types. For tensors, the report shows the element type and dimensions. A dimension can be a number, a symbolic name such as batch_size, or ? when it is not specified. Sequence, map, optional, and sparse-tensor type descriptions are recognized, although only ordinary tensor types are retained as structured data for memory calculations.

Each node includes its name, operator type, domain, ordered input names, ordered output names, and attribute count. Attribute contents are skipped. Each dense initializer includes its name, data type, and dimensions; its raw values are not decoded.

Tensor relationships

The tool builds a relationship map by matching node input and output names. Declared graph inputs that are also initializers are treated as initializer inputs rather than runtime inputs. A forward trace starts at the remaining graph inputs. A backward trace starts at graph outputs.

The dependency report shows reachable tensors, nodes, operator types, initializers, and path depth. Read interpreting ONNX graphs for a small example and the meaning of each part.

Information used for memory estimates

Initializer shapes and data types supply the ONNX weight estimate. The tool can recognize an explicit past/present KV-cache interface by tensor names and symbolic batch and sequence dimensions. If no matching cache tensors exist, it reports no cache rather than guessing one from the graph architecture. See the calculation reference for the exact rules.

Current limits

The complete ONNX file is read into browser memory before parsing. The parser supports the protobuf fields needed for the report, not every ONNX field. It skips node attribute values, tensor payload values, external-data locations, functions, training information, and sparse-initializer contents. It does not perform ONNX shape inference.

The tool does not execute operators, validate graph correctness, test runtime compatibility, edit the model, or act as a debugger. Unknown protobuf fields are skipped when their wire type is supported. Malformed data or unsupported wire types can stop parsing.

Choose an ONNX file to see its report. You can also compare two ONNX models by loading both at once.