pub struct JointEmbeddingSpace { /* private fields */ }
Expand description
Joint embedding space for cross-modal alignment
Implementations§
Source§impl JointEmbeddingSpace
impl JointEmbeddingSpace
pub fn new(config: JointEmbeddingConfig) -> Self
Sourcepub fn project_to_joint_space(
&self,
modality: Modality,
embedding: &Vector,
) -> Result<Vector>
pub fn project_to_joint_space( &self, modality: Modality, embedding: &Vector, ) -> Result<Vector>
Project modality-specific embedding to joint space
Sourcepub fn cross_modal_similarity(
&self,
modality1: Modality,
embedding1: &Vector,
modality2: Modality,
embedding2: &Vector,
) -> Result<f32>
pub fn cross_modal_similarity( &self, modality1: Modality, embedding1: &Vector, modality2: Modality, embedding2: &Vector, ) -> Result<f32>
Compute cross-modal similarity in joint space
Sourcepub fn contrastive_align(
&mut self,
positive_pairs: &[(Modality, Vector, Modality, Vector)],
negative_pairs: &[(Modality, Vector, Modality, Vector)],
) -> Result<f32>
pub fn contrastive_align( &mut self, positive_pairs: &[(Modality, Vector, Modality, Vector)], negative_pairs: &[(Modality, Vector, Modality, Vector)], ) -> Result<f32>
Contrastive learning alignment training
Sourcepub fn cross_modal_search(
&self,
query_modality: Modality,
query_embedding: &Vector,
candidate_modality: Modality,
candidate_embeddings: &[Vector],
top_k: usize,
) -> Result<Vec<(usize, f32)>>
pub fn cross_modal_search( &self, query_modality: Modality, query_embedding: &Vector, candidate_modality: Modality, candidate_embeddings: &[Vector], top_k: usize, ) -> Result<Vec<(usize, f32)>>
Find cross-modal nearest neighbors in joint space
Sourcepub fn zero_shot_retrieval(
&self,
query_modality: Modality,
query_embedding: &Vector,
target_modality: Modality,
target_embeddings: &[Vector],
top_k: usize,
) -> Result<Vec<(usize, f32)>>
pub fn zero_shot_retrieval( &self, query_modality: Modality, query_embedding: &Vector, target_modality: Modality, target_embeddings: &[Vector], top_k: usize, ) -> Result<Vec<(usize, f32)>>
Zero-shot cross-modal retrieval
Sourcepub fn multi_modal_fusion(
&self,
modalities: &[(Modality, Vector)],
) -> Result<Vector>
pub fn multi_modal_fusion( &self, modalities: &[(Modality, Vector)], ) -> Result<Vector>
Multi-modal fusion in joint space
Sourcepub fn get_training_stats(&self) -> TrainingStatistics
pub fn get_training_stats(&self) -> TrainingStatistics
Get training statistics
Sourcepub fn get_cache_stats(&self) -> (usize, f32)
pub fn get_cache_stats(&self) -> (usize, f32)
Get alignment cache statistics
Auto Trait Implementations§
impl Freeze for JointEmbeddingSpace
impl !RefUnwindSafe for JointEmbeddingSpace
impl Send for JointEmbeddingSpace
impl Sync for JointEmbeddingSpace
impl Unpin for JointEmbeddingSpace
impl !UnwindSafe for JointEmbeddingSpace
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
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.