Skip to main content

cast_data

Function cast_data 

Source
pub fn cast_data(data: &[u8], src: SrcDtype, dst: GGMLType) -> Result<Vec<u8>>
Expand description

Cast raw little-endian tensor bytes from src to dst.

Same-dtype casts are byte-for-byte passthrough. F32→F16 rounds to nearest even; F32→BF16 rounds to nearest even with NaN preservation; everything routed through F32 uses exact widening.