pub enum CompressionPolicy {
Compress,
Passthrough,
Fp16,
}Expand description
Variants§
Compress
Full codec pipeline: rotate → scalar quantize → optional FP16 residual.
Requires a trained Codebook and a
CodecConfig. Produces StorageTag::U8
output.
Passthrough
Store raw f32 bytes with no transformation (1× compression ratio).
The four bytes of each f32 are stored in little-endian order inside
the indices field of a CompressedVector.
Produces StorageTag::F32 output.
Fp16
Cast each f32 to a 16-bit float and store 2 bytes per dimension
in little-endian order (2× compression ratio).
Precision loss is bounded by the f16 range; max |error| is
typically below 1e-2 for normalised embedding values.
Produces StorageTag::F16 output.
Implementations§
Source§impl CompressionPolicy
impl CompressionPolicy
Sourcepub const fn requires_codec(&self) -> bool
pub const fn requires_codec(&self) -> bool
Returns true for policies that run the full codec pipeline.
Only CompressionPolicy::Compress requires a trained codebook;
the other policies bypass the codec entirely.
Sourcepub const fn storage_tag(&self) -> StorageTag
pub const fn storage_tag(&self) -> StorageTag
Returns the StorageTag that describes the byte layout used by this policy.
Trait Implementations§
Source§impl Clone for CompressionPolicy
impl Clone for CompressionPolicy
Source§fn clone(&self) -> CompressionPolicy
fn clone(&self) -> CompressionPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more