Skip to main content

dequant_bf16

Function dequant_bf16 

Source
pub fn dequant_bf16(src: &[u8]) -> Result<Vec<f32>, QuantError>
Expand description

BF16 isn’t a block-quantized format at all – it’s IEEE-754 binary32 truncated to its sign bit + 8 exponent bits + 7 mantissa bits (the upper 16 bits of an f32), so widening it back to f32 is an exact, lossless bit shift: f32::from_bits((bits as u32) << 16), zero- padding the low 16 mantissa bits rather than any real dequantization math. Included here anyway (rather than as a one-off in ferrox-models::loader) so every real element type ferrox recognizes has one obvious home.