Skip to main content

encode_row_q4_k

Function encode_row_q4_k 

Source
pub fn encode_row_q4_k(src: &[f32], out: &mut Vec<u8>) -> Option<()>
Expand description

Encodes a whole row (or any slice whose length is a multiple of Q4_K_BLOCK_ELEMS) into Q4_K super-blocks, appending to out.

Returns None when src.len() is not a multiple of the super-block size. llama.cpp handles that case by silently changing typetensor_type_fallback rewrites a Q4_K tensor with an awkward row length to Q5_0, and to F16 if that does not fit either – and ferrox has neither encoder, so this refuses instead of padding. Padding would write more elements than the tensor’s shape declares and every following row would decode shifted.