Skip to main content

per_channel_symmetric_scales

Function per_channel_symmetric_scales 

Source
pub fn per_channel_symmetric_scales<const C: usize, const N: usize>(
    weights: &[[f32; N]; C],
    qmax: i32,
) -> [f32; C]
Expand description

One symmetric weight scale per output channel, max |w| / qmax over each channel’s weights (C++ computePerChannelSymmetricScales), as TFLite quantizes depthwise and convolution weights. A channel of zeros, or a qmax of 0 or below, gets scale 1.0.