liveBook · Manning

Opset

As explained in Quantization and Fast Inference

An opset is a versioned set of ONNX operators with defined semantics that ONNX runtimes implement.

An opset is ONNX’s standardized set of operators, such as Conv, MatMul, and Relu, with precise mathematical definitions that runtimes must implement identically. This shared semantics helps make ONNX graphs portable across inference runtimes. section 6.4

Listing 6.6 Export ResNet-18 to ONNX
torch.onnx.export(
    model,
    dummy_input,                                       #A
    "resnet18_fp32.onnx",
    opset_version=17,                                  #B
    input_names=["input"],
    output_names=["output"],
    dynamic_axes={"input": {0: "batch"},
                  "output": {0: "batch"}},             #C
    dynamo=False,                                      #D
)

The export call shows where an opset version is specified: this ResNet-18 example sets opset_version to 17. section 6.4

How Quantization and Fast Inference covers it

How deep it goes
Specifies more than 180 operators with precise mathematical definitions that runtimes must implement identically.
Examples
Uses a ResNet-18 export call that sets opset_version to 17.
What you can do after
Configure a PyTorch ONNX export to target opset version 17.
How it connects
Connects ONNX operator semantics to PyTorch export and runtimes including ONNX Runtime, TensorRT, OpenVINO, and CoreML.

This explainer was generated by Manning's knowledge graph from the text of Quantization and Fast Inference. The section links point to the parts of the book it draws on.