Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Onnx Onnx Result Validation

From Leeroopedia


Knowledge Sources
Domains Testing, Numerical_Validation
Last Updated 2026-02-10 00:00 GMT

Overview

A numerical comparison mechanism that verifies the correctness of computed tensor outputs against expected reference values within specified tolerance bounds.

Description

Result validation compares the outputs of model inference against known reference values to verify correctness. Due to floating-point arithmetic, exact equality is rarely expected; instead, comparisons use relative and absolute tolerance bounds. If any element in the output tensors differs from the expected values by more than the specified tolerances, the validation fails with a detailed error message showing the location and magnitude of the discrepancy.

This principle is fundamental to testing ONNX operator implementations, verifying model transformations (ensuring that version conversion or composition preserves semantics), and validating that optimized runtimes produce results consistent with the reference evaluator.

Usage

Use this principle after running model inference (via the reference evaluator or any other runtime) to compare outputs against expected values. Adjust tolerance parameters based on the precision requirements: tighter tolerances for double-precision computations, looser for float16 or quantized models.

Theoretical Basis

Numerical comparison with tolerance:

|ab|atol+rtol×|b|

Where:

  • a is the actual (computed) value
  • b is the desired (reference) value
  • atol is the absolute tolerance (default: 0)
  • rtol is the relative tolerance (default: 1e-7)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment