﻿# torch.export to ONNX: a quantizer compatibility matrix needs separate stages

Separate capture, floating-point parity, quantizer acceptance and target execution while pinning PyTorch, ONNX Script, opsets, shapes and calibration.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/torch-export-onnxscript-quantizer-compatibility-matrix-validation-stages/
Language: en

A compatibility matrix for the torch.export-based ONNX path should record several separate outcomes: whether capture succeeds, whether the exported graph computes the intended result, whether a quantizer accepts it, and whether the final target executes it as intended. A single “supported” cell hides these boundaries and can turn a successful export into an unjustified deployment claim.

## Pin the producer before testing consumers

The [versioned PyTorch ONNX documentation](https://docs.pytorch.org/docs/2.15/onnx.html) describes the torch.export-based path selected through dynamo. It captures tensor computation, records shape constraints, and translates the resulting representation into ONNX. Example inputs alone can fix input shapes, so dynamic dimensions require an explicit contract rather than an assumption of universal shape flexibility.

The [official ONNX Script release list](https://github.com/microsoft/onnxscript/releases) supplies another independently versioned producer component. The inspected release metadata dates version 0.7.2 to September 9, 2026, resolving the incomplete date in the incoming record. Its notes include changes to operator lowering and shape handling. Package version, source framework, exporter mode, and model graph therefore all belong in the matrix; a release date alone cannot prove downstream compatibility.

## Separate valid serialization from correct computation

Record the ONNX representation version and complete domain-opset imports alongside shapes, dtypes, and any external tensor files. A graph can parse correctly while using operators or attributes unsupported by a consumer. Conversely, a rejected import may be a representation issue before accelerator execution begins. The [ONNX version-contract guide](/journal/fg2-onnx-ir-version-opset-domain-separation/) explains those distinctions.

For each representative model, preserve a native reference and compare floating-point exported outputs on inputs that exercise the intended shape range and operator behavior. PyTorch's verify option uses ONNX Runtime. Passing that check is valuable evidence for that path, not a certification of a different backend, quantized artifact, or every possible input. Report the checked population and tolerance rather than an unexplained parity label.

## Quantization adds another transformation boundary

The [official ONNX Runtime quantization guide](https://onnxruntime.ai/docs/performance/model-optimizations/quantization.html) separates preprocessing, quantization, and debugging, and describes both quantized operators and quantize/dequantize representations. It also notes that quantization can reduce accuracy. An exporter producing ordinary operators does not guarantee that the selected quantizer handles every resulting pattern.

Keep calibration data, transformation options, quantized representation, and final artifact distinct from the original floating-point export. Compare quality before and after quantization instead of treating successful conversion as numerical preservation. A graph accepted by one quantization tool does not automatically establish support in another tool targeting a different accelerator.

## Record failure stages instead of one compatibility flag

A useful row names a concrete producer combination, model, shapes, target build, and quantization recipe. It then records capture/export status, floating-point parity, quantizer acceptance, target execution, and final task-quality evidence. Missing or untested stages should remain explicit. No compatibility experiments were run for this article, and no populated support matrix is claimed.

Distinguish a backend that rejects an operator from one that runs a supported subgraph elsewhere. Mere completion does not identify the execution device or performance boundary. Repeat a selected case after changing versions, preserving the former artifact and actual error message. The [software-stack reproducibility guide](/journal/software-stack-reproducibility/) explains why that history matters. This method turns exporter and quantizer documentation into a reviewable evaluation contract, rather than assuming every consumer inherits every producer's latest operator coverage.
