Skip to main content

load_tensor_f32

Function load_tensor_f32 

Source
pub fn load_tensor_f32(model: &LoadedModel, name: &str) -> Result<Tensor>
Expand description

Looks up name in model, builds a Tensor from its bytes, and dequantizes/upcasts it to f32 — the dtype every op in kopitiam-tensor actually computes in. This is the call every weight-loading site in [crate::weights] goes through: model files may ship f16, bf16, or any of the five GGUF block-quantized formats, and this one function makes the rest of the forward pass indifferent to which.

§Errors

Error::MissingTensor if name is not present in model; whatever Tensor::to_dtype would return for a dtype this crate cannot dequantize (today, every DType this loader can produce can be dequantized to f32, so this is unreachable in practice, not a real gap — see Tensor::to_dtype’s docs).