Skip to main content

quantize_gate_biases

Function quantize_gate_biases 

Source
pub fn quantize_gate_biases<const G: usize, const HID: usize>(
    biases: &[[f32; HID]; G],
    lut_input_scale: f32,
) -> [[i32; HID]; G]
Expand description

Quantize a recurrent cell’s float biases, biases[gate][unit], into the LUT input grid: round(b / lut_input_scale) in f64, ties away from zero (C++ quantizeQLSTMBiases with G = 4, quantizeQGRUBiases with G = 3). A value beyond the i32 range wraps, as the C++ conversion from long does.