Skip to main content

tensor_from_entry

Function tensor_from_entry 

Source
pub fn tensor_from_entry(
    model: &LoadedModel,
    entry: &TensorEntry,
) -> Result<Tensor>
Expand description

Builds a Tensor from one TensorEntry’s bytes, preserving its on-disk DType exactly (still block-quantized if entry.dtype is quantized, still f16/bf16 if the file stored it that way).

Call Tensor::to_dtype(DType::F32) on the result to get a tensor the rest of kopitiam-tensor’s ops (which are f32-only, see that crate’s docs) can actually compute on; load_tensor_f32 does exactly that in one step; it is what every weight-loading call site in this crate uses.