Skip to main content

validate_no_dangling_refs

Function validate_no_dangling_refs 

Source
pub fn validate_no_dangling_refs(graph: &Graph) -> Result<(), LoaderError>
Expand description

Reject graphs with a node input that has no source.

The graph builder materializes an unresolved input name as a fresh named value with no producer (see graph_builder::get_or_create); such a value is legal only if it is a graph input or an initializer. Any other producer-less consumed value is a dangling reference — a structurally malformed graph that onnx_runtime_ir::Graph::validate does not catch (it only requires graph outputs to be sourced, not node inputs). We reject it at load, naming the offending node and tensor.

Must run after initializers are attached to graph.initializers so initializer-backed inputs are recognized as sourced.