Skip to main content

insert_q_dq

Function insert_q_dq 

Source
pub fn insert_q_dq(
    graph: Graph,
    record: &HashMap<NodeId, CalibrationEntry>,
) -> Graph
Expand description

Insert Quantize → Dequantize pairs at every tap in record. Returns a graph where each tagged node is followed by a Quantize → Dequantize pair, and every consumer of the original tap reads from the dequantized output instead.

One-pass build: when we copy a consumer node, we rewrite any input edge that refers to a tap so it points at the tap’s DQ instead. The Q and DQ nodes themselves are exempt (we identify them via their Op::Quantize / Op::Dequantize discriminants — the tap’s raw value still flows in to the Quantize).