Module tensor

Source
Expand description

Module Containing the most important structures

Structs§

Metadata
The stuct representing the header of safetensor files which allow indexing into the raw byte-buffer array and how to interpret it.
SafeTensors
A structure owning some metadata to lookup tensors on a shared data byte-buffer (not owned).
TensorInfo
A single tensor information. Endianness is assumed to be little endian Ordering is assumed to be ‘C’.
TensorView
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§

Dtype
The various available dtypes. They MUST be in increasing alignment order
SafeTensorError
Possible errors that could occur while reading A Safetensor file.

Traits§

View
The trait necessary to enable safetensors to serialize a tensor If you have an owned tensor like this:

Functions§

serialize
Serialize to an owned byte buffer the dictionnary of tensors.
serialize_to_file
Serialize to a regular file the dictionnary of tensors. Writing directly to file reduces the need to allocate the whole amount to memory.