Implementation:Onnx Onnx Helper Version Table
| Knowledge Sources | |
|---|---|
| Domains | Versioning, Compatibility |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
Concrete tool for querying ONNX version mappings provided by the ONNX helper module.
Description
VERSION_TABLE is a constant data structure in helper.py that maps each ONNX release to its corresponding IR version, ai.onnx opset version, ai.onnx.ml opset version, and (from ONNX 1.7+) ai.onnx.training opset version. The companion find_min_ir_version_for function accepts a list of OperatorSetIdProto objects and returns the minimum IR version required to support all the specified opsets.
Usage
Import VERSION_TABLE when you need to look up version relationships, and find_min_ir_version_for when constructing a model with explicit opset imports to determine the correct IR version.
Code Reference
Source Location
- Repository: onnx
- File: onnx/helper.py
- Lines: 46-78 (VERSION_TABLE), 105-130 (find_min_ir_version_for)
Signature
VERSION_TABLE: list[tuple[str, int, int, int] | tuple[str, int, int, int, int]] = [
# (release_version, ir_version, ai.onnx_opset, ai.onnx.ml_opset, [ai.onnx.training_opset])
("1.0", 3, 1, 1),
...
("1.20.0", 13, 25, 5, 1),
]
def find_min_ir_version_for(
opsetidlist: Sequence[OperatorSetIdProto],
ignore_unknown: bool = False,
) -> int:
"""Given list of opset ids, determine minimum IR version required.
Args:
opsetidlist: A sequence of OperatorSetIdProto.
ignore_unknown: If True, ignore unknown domains and return default.
Returns:
The minimum IR version required (integer).
"""
Import
from onnx.helper import VERSION_TABLE, find_min_ir_version_for
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| VERSION_TABLE | list[tuple] | N/A | Constant: list of (release, ir_ver, onnx_opset, ml_opset, [training_opset]) |
| opsetidlist | Sequence[OperatorSetIdProto] | Yes | List of opset id protos for version lookup |
| ignore_unknown | bool | No | Ignore unknown domains (default: False) |
Outputs
| Name | Type | Description |
|---|---|---|
| return | int | Minimum IR version required for the given opset imports |
Usage Examples
Look Up Version Mapping
from onnx.helper import VERSION_TABLE
# Find the opset version for ONNX 1.16.0
for release, ir_ver, onnx_opset, ml_opset, *rest in VERSION_TABLE:
if release == "1.16.0":
print(f"IR: {ir_ver}, ai.onnx opset: {onnx_opset}, ML opset: {ml_opset}")
# Output: IR: 10, ai.onnx opset: 21, ML opset: 5
Find Minimum IR Version
from onnx.helper import find_min_ir_version_for, make_opsetid
opsets = [make_opsetid("", 17)]
ir_version = find_min_ir_version_for(opsets)
print(f"Minimum IR version for opset 17: {ir_version}")