Skip to main content

build_add

Function build_add 

Source
pub fn build_add(
    input_a: (f32, i32),
    input_b: (f32, i32),
    output: (f32, i32),
    qmin: i32,
    qmax: i32,
) -> QAdd
Expand description

Build a QAdd for inputs (scale, zero point) input_a and input_b and output output (C++ buildQAddParams with its default left shift of 20, TFLite’s). Both inputs are rescaled to twice the larger input scale; ratios are formed in f64 from the f32 scales, as the C++ does. Zero points and bounds are narrowed to i8; raise qmin to the output zero point to fuse a ReLU.