Skip to content

Tensor and DType

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

Tensor and DType

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

src/gguf/tensor.rs

Tensor (directory entry)

Metadata only — no owned weights. Payload via GgufLayout::tensor_bytes.

Typical fields: name, dims, dtype, ggml_type, n_elements, byte_len, relative_offset, absolute_offset.

DType

Variant GGML note
F32 type 0
F16 type 1
BF16 type 30 (layout only)
Q8_0 type 8
Q4_K / Q5_K / Q6_K k-quants
IQ3_S type 21 (opaque)
Other(u32) catch-all

Numeric accessors: only F32/F16 have in-crate readers (read_f32_values / read_u16_values style safe APIs — no unsafe slice casts). Everything else stays raw Vec<u8>.

Helper

f16_bits_to_f32 — optional bit conversion helper (not a full dequant pipeline).

Related


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: 07a5558 (main)

Clone this wiki locally