Python-side evaluation can inspect an ONNX model’s full graph, individual nodes, and intermediate values. This helps locate inefficiencies introduced during conversion or framework migration. section 10.3
For operational evaluation, it can:
- Run a complete model or an individual node using ONNX’s ReferenceEvaluator. section 10.3
- Increase verbosity to show operations, input values, and intermediate outputs. section 10.3
- Compare original and custom-node implementations for output agreement and execution time. section 10.3
from onnx.reference import ReferenceEvaluator
sess = ReferenceEvaluator(onnx_model)
A minimal ReferenceEvaluator setup for running an ONNX model. section 10.3
sess = ReferenceEvaluator(onnx_optimized_model, verbose=2,
➥ new_ops=[AddEyeLike])
Register a custom operator with the evaluator to test an optimized graph. section 10.3
