pub struct QuantizedVector {
pub params: QuantizationParams,
pub norm: f32,
/* private fields */
}Expand description
Unstable: INT8 quantized vector; struct layout and invariants may change.
Quantized int8 vector with its parameters.
Fields§
§params: QuantizationParamsUnstable: quantization parameters; may be separated from the vector.
norm: f32Unstable: L2 norm; may be removed or moved.
Implementations§
Source§impl QuantizedVector
impl QuantizedVector
Sourcepub fn from_f32(vector: &[f32]) -> Self
pub fn from_f32(vector: &[f32]) -> Self
Unstable: quantization constructor; clamping behavior may change.
Sourcepub fn to_f32(&self) -> Vec<f32>
pub fn to_f32(&self) -> Vec<f32>
Unstable: dequantizes this vector using its stored scale.
See docs/simd.md for the encoding and error bounds.
Sourcepub fn dot_product(&self, other: &QuantizedVector) -> f32
pub fn dot_product(&self, other: &QuantizedVector) -> f32
Unstable: delegates to dot_product_i8; SIMD dispatch may change.
Sourcepub fn cosine_similarity(&self, other: &QuantizedVector) -> f32
pub fn cosine_similarity(&self, other: &QuantizedVector) -> f32
Unstable: delegates to cosine_similarity_i8; SIMD dispatch may change.
Trait Implementations§
Source§impl Clone for QuantizedVector
impl Clone for QuantizedVector
Source§fn clone(&self) -> QuantizedVector
fn clone(&self) -> QuantizedVector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for QuantizedVector
impl RefUnwindSafe for QuantizedVector
impl Send for QuantizedVector
impl Sync for QuantizedVector
impl Unpin for QuantizedVector
impl UnsafeUnpin for QuantizedVector
impl UnwindSafe for QuantizedVector
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