ORT for Python evaluates ONNX models as full graphs, single nodes, or intermediate steps, which helps expose inefficiencies after conversion from other frameworks or model versions. section 10.3 section 10.3
It is used to:
- run a complete ONNX graph for a model. section 10.3
- inspect one node at a time, including custom nodes. section 10.3
- trace step-by-step execution with increasing verbosity. section 10.3
- test optimized nodes and compare outputs and timing. section 10.3
Linear regression graph evaluation
A linear regression graph is evaluated as Add(MatMul(X, A), B), then reworked with EyeLike and a custom AddEyeLike node to compare outputs and runtime. section 10.3
from onnx.reference import ReferenceEvaluator
sess = ReferenceEvaluator(onnx_model)
Creates a ReferenceEvaluator session from an ONNX model, the basic entry point for graph evaluation. section 10.3
sess = ReferenceEvaluator(onnx_model, verbose=verbose)
Enables verbose execution tracing on a model session for progressively more detailed intermediate visibility. section 10.3
