Module safetensors::tensor 
source · Expand description
Module Containing the most important structures
Structs§
- The stuct representing the header of safetensor files which allow indexing into the raw byte-buffer array and how to interpret it.
 - A structure owning some metadata to lookup tensors on a shared
databyte-buffer (not owned). - A single tensor information. Endianness is assumed to be little endian Ordering is assumed to be ‘C’.
 - A view of a Tensor within the file. Contains references to data within the full byte-buffer And is thus a readable view of a single tensor
 
Enums§
- The various available dtypes. They MUST be in increasing alignment order
 - Possible errors that could occur while reading A Safetensor file.
 
Traits§
- The trait necessary to enable safetensors to serialize a tensor If you have an owned tensor like this:
 
Functions§
- Serialize to an owned byte buffer the dictionnary of tensors.
 - Serialize to a regular file the dictionnary of tensors. Writing directly to file reduces the need to allocate the whole amount to memory.