Skip to main content

Module quantization_nodes

Module quantization_nodes 

Source
Expand description

Low-level builders for ONNX QDQ (Quantize-Dequantize) graph primitives.

Each quantized weight becomes four graph elements:

Initializers:
  "{name}_quantized"  — INT8 tensor, same shape as original
  "{name}_scale"      — FP32 scalar
  "{name}_zp"         — INT8 scalar

Node:
  DequantizeLinear
    inputs:  ["{name}_quantized", "{name}_scale", "{name}_zp"]
    outputs: ["{name}"]          ← original name; downstream graph untouched

The DequantizeLinear op runs at inference time: output = (input - zero_point) × scale which matches the dequantize formula already used in QuantParams and QuantParamsInt4.

Structs§

DequantLinearNames
Canonical names for the four graph elements that replace one FP32 initializer.

Functions§

build_dequantize_linear_node
Build a DequantizeLinear NodeProto.
build_quantized_weight_tensor
INT8 tensor holding the quantized weight values.
build_scale_tensor
FP32 scale tensor.
build_zero_point_tensor
INT8 zero-point tensor.