#[repr(u8)]pub enum WeightQuantization {
Float32 = 0,
Float16 = 1,
UInt8 = 2,
UInt4 = 3,
}Expand description
Quantization format for sparse vector weights
Float32 preserves input precision. Smaller weight representations trade precision for payload size; retrieval quality depends on the workload and must be measured. Integer encodings also store per-vector scale and offset, so total index-size savings differ from the ratio of weight widths.
Variants§
Float32 = 0
Full 32-bit float precision
Float16 = 1
16-bit float (half precision), two bytes per weight
UInt8 = 2
8-bit integer codes with per-vector scale and offset
UInt4 = 3
4-bit integer codes (two per byte) with per-vector scale and offset
Implementations§
Source§impl WeightQuantization
impl WeightQuantization
Sourcepub fn bytes_per_weight(&self) -> f32
pub fn bytes_per_weight(&self) -> f32
Bytes per weight (approximate for UInt4)
Trait Implementations§
Source§impl Clone for WeightQuantization
impl Clone for WeightQuantization
impl Copy for WeightQuantization
Source§impl Debug for WeightQuantization
impl Debug for WeightQuantization
Source§impl Default for WeightQuantization
impl Default for WeightQuantization
Source§impl<'de> Deserialize<'de> for WeightQuantization
impl<'de> Deserialize<'de> for WeightQuantization
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for WeightQuantization
Source§impl PartialEq for WeightQuantization
impl PartialEq for WeightQuantization
Source§impl Serialize for WeightQuantization
impl Serialize for WeightQuantization
impl StructuralPartialEq for WeightQuantization
Auto Trait Implementations§
impl Freeze for WeightQuantization
impl RefUnwindSafe for WeightQuantization
impl Send for WeightQuantization
impl Sync for WeightQuantization
impl Unpin for WeightQuantization
impl UnsafeUnpin for WeightQuantization
impl UnwindSafe for WeightQuantization
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more