Skip to main content

Module check

Module check 

Source
Expand description

Extensible model checker / validator (ONNX_RS §8).

The architecture mirrors §8.1: a ValidationRule trait, a Severity / Violation model, and an OnnxChecker registry that runs an ordered set of rules and can be extended with custom ones (§8.3). The built-in rules include schema-driven node conformance (see [rules]).

Note: the runtime onnx_runtime_loader already rejects many malformed models at load time (dangling refs, duplicate producers, missing opset imports, cycles, …). This checker is complementary: it runs against an already-built Model so tools can validate graphs they constructed in memory and so organisations can layer their own rules on top.

Structs§

AttributeProtoValidityRule
Validate attribute names, discriminators, union payloads, and per-node attribute-name uniqueness.
DuplicateValueNameRule
No two distinct values may carry the same (non-empty) name — ONNX graphs are SSA, so a name identifies a unique edge (ONNX_RS §8.2 UniqueValueNamesRule).
FunctionProtoValidityRule
Validate model-local functions using the v1.20 checker topology/import rules plus signature, default-attribute, and unique-ID rules.
GraphAcyclicRule
The dataflow graph must be acyclic (ONNX_RS §8.2 GraphAcyclicRule). Wraps the IR’s own topological-order check.
InitializerTypeMatchesDeclaredRule
Initializer tensor element types must match their graph value declarations (ONNX_RS §8.2 InitializerTypeMatchesDeclaredRule).
InputOutputDeclaredRule
Graph inputs and outputs must reference live, named values (ONNX_RS §8.2 InputOutputDeclaredRule). The shared IR always carries dtype and shape for a live value, so liveness plus a non-empty ONNX name establishes declaration.
IrVersionFeatureRule
Validate fields and invariants whose legality changed at a particular ONNX IR version. Training-only fields are intentionally ignored.
IrVersionSupportedRule
The ONNX IR version is required and must not exceed the version implemented by this v1.20-bound checker (IR 13).
MetadataKeysUniqueRule
Metadata maps are encoded as repeated entries and therefore require an explicit distinct-key check at every protobuf scope.
MissingOpsetImportRule
Every operator domain referenced by a node must be declared in opset_imports (ONNX_RS §8.2, IR rule OpsetImportPresentRule).
MultiDeviceConfigurationRule
Validate the IR v11+ multi-device configuration and sharding annotations.
NoUnconnectedNodesRule
Every present node input must have a source, and every named node output must be consumed, exported, or captured by a subgraph (ONNX_RS §8.2).
OnnxChecker
The standard, extensible checker (ONNX_RS §8.2).
ProtoTypeValidityRule
Validate every retained TypeProto, including container requirements and ONNX-ML opaque types.
SchemaNodeConformsRule
Each node must resolve to an opset-compatible schema and conform to its input/output and attribute declarations (ONNX_RS §8.2).
SparseTensorValidityRule
Validate sparse tensor COO structure, index type/shape, bounds, ordering, and uniqueness.
TensorPayloadValidityRule
Validate dense tensor dimensions, storage-field selection, payload size, segment bounds, and external-data constraints.
TypeConstraintSatisfiedRule
Node input/output element types must satisfy and consistently bind the type variables declared by the resolved operator schema (ONNX_RS §8.2).
ValidationContext
Shared context handed to every rule during a check.
ValidationResult
The outcome of running a checker (ONNX_RS §8.2).
Violation
A single problem found by a ValidationRule.

Enums§

Severity
Severity of a Violation (ONNX_RS §8.1).
ViolationLocation
Where a Violation was found (ONNX_RS §8.1).

Traits§

ValidationRule
A rule that checks one aspect of a model (ONNX_RS §8.1).