Skip to main content

execute_graph_via_per_op

Function execute_graph_via_per_op 

Source
pub fn execute_graph_via_per_op<B: Backend + ?Sized>(
    backend: &B,
    graph: &GraphProto,
    inputs: HashMap<String, B::Tensor>,
) -> Result<HashMap<String, B::Tensor>, B::Error>
Expand description

Default body for Backend::execute — walks graph.node in topological order, dispatching each through the typed per-op methods on backend. The implementation is a tight linear scan: ONNX guarantees graph.node is topologically ordered, so no petgraph / explicit ordering is needed.

Op-types must be in bb_ir::tensor_primitives::TENSOR_PRIMITIVES_OPS. A graph containing extension ops (Relu, Conv, …) needs either a backend that overrides execute natively OR a lowering pass (future work) decomposing the extensions into primitives.