[][src]Trait finalfusion::embeddings::Quantize

pub trait Quantize<V> {
    fn quantize_using<T, R>(
        &self,
        n_subquantizers: usize,
        n_subquantizer_bits: u32,
        n_iterations: usize,
        n_attempts: usize,
        normalize: bool,
        rng: &mut R
    ) -> Embeddings<V, QuantizedArray>
    where
        T: TrainPQ<f32>,
        R: Rng
; fn quantize<T>(
        &self,
        n_subquantizers: usize,
        n_subquantizer_bits: u32,
        n_iterations: usize,
        n_attempts: usize,
        normalize: bool
    ) -> Embeddings<V, QuantizedArray>
    where
        T: TrainPQ<f32>
, { ... } }

Quantizable embedding matrix.

Required methods

fn quantize_using<T, R>(
    &self,
    n_subquantizers: usize,
    n_subquantizer_bits: u32,
    n_iterations: usize,
    n_attempts: usize,
    normalize: bool,
    rng: &mut R
) -> Embeddings<V, QuantizedArray> where
    T: TrainPQ<f32>,
    R: Rng

Quantize the embedding matrix using the provided RNG.

This method trains a quantizer for the embedding matrix and then quantizes the matrix using this quantizer.

Loading content...

Provided methods

fn quantize<T>(
    &self,
    n_subquantizers: usize,
    n_subquantizer_bits: u32,
    n_iterations: usize,
    n_attempts: usize,
    normalize: bool
) -> Embeddings<V, QuantizedArray> where
    T: TrainPQ<f32>, 

Quantize the embedding matrix.

This method trains a quantizer for the embedding matrix and then quantizes the matrix using this quantizer.

The xorshift PRNG is used for picking the initial quantizer centroids.

Loading content...

Implementors

impl<V, S> Quantize<V> for Embeddings<V, S> where
    V: Vocab,
    S: StorageView
[src]

fn quantize<T>(
    &self,
    n_subquantizers: usize,
    n_subquantizer_bits: u32,
    n_iterations: usize,
    n_attempts: usize,
    normalize: bool
) -> Embeddings<V, QuantizedArray> where
    T: TrainPQ<f32>, 
[src]

Loading content...