Skip to main content

apply_schema_quant

Function apply_schema_quant 

Source
pub fn apply_schema_quant(
    schema: &SchemaV2,
    tensors: &mut [&mut TensorDyn],
) -> DecoderResult<()>
Expand description

Walk the schema’s logical outputs and their per-scale children, attaching per-tensor Quantization to any matching integer tensor in tensors (matched by shape).

Behavior:

  • Per-channel quantization is silently skipped — the per-scale subsystem only consumes per-tensor quant.
  • Float tensors are silently skipped (they don’t carry quantization).
  • Tensors with no matching schema entry are silently left alone.
  • If a schema entry has a quant declaration but no tensor matches the declared shape, returns InvalidShape.

Idempotent: safe to call multiple times; later calls overwrite the attached quantization.