pub struct MultiVectorEmbedding {
pub token_vectors: Vec<Vec<f32>>,
}Expand description
ColBERT-style multi-vector representation (per-token embeddings).
Each inner vector is the embedding of a single token. Used for late interaction scoring via MaxSim.
Fields§
§token_vectors: Vec<Vec<f32>>Per-token embedding vectors.
Implementations§
Source§impl MultiVectorEmbedding
impl MultiVectorEmbedding
Sourcepub fn from_dense_chunked(vec: &[f32], num_tokens: usize) -> Self
pub fn from_dense_chunked(vec: &[f32], num_tokens: usize) -> Self
Build a multi-vector representation by chunking a dense vector into
num_tokens roughly-equal sub-vectors.
Each sub-vector acts as a pseudo per-token embedding. When native
per-token embeddings are available from the model, use
MultiVectorEmbedding::from_token_vectors instead.
Sourcepub fn from_token_vectors(token_vectors: Vec<Vec<f32>>) -> Self
pub fn from_token_vectors(token_vectors: Vec<Vec<f32>>) -> Self
Build directly from pre-computed per-token embedding vectors.
Trait Implementations§
Source§impl Clone for MultiVectorEmbedding
impl Clone for MultiVectorEmbedding
Source§fn clone(&self) -> MultiVectorEmbedding
fn clone(&self) -> MultiVectorEmbedding
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 moreSource§impl Debug for MultiVectorEmbedding
impl Debug for MultiVectorEmbedding
Source§impl PartialEq for MultiVectorEmbedding
impl PartialEq for MultiVectorEmbedding
Source§fn eq(&self, other: &MultiVectorEmbedding) -> bool
fn eq(&self, other: &MultiVectorEmbedding) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for MultiVectorEmbedding
Auto Trait Implementations§
impl Freeze for MultiVectorEmbedding
impl RefUnwindSafe for MultiVectorEmbedding
impl Send for MultiVectorEmbedding
impl Sync for MultiVectorEmbedding
impl Unpin for MultiVectorEmbedding
impl UnsafeUnpin for MultiVectorEmbedding
impl UnwindSafe for MultiVectorEmbedding
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