pub struct Embeddings<F> { /* private fields */ }Expand description
One or multiple embeddings stored consecutively in a flat vector.
Implementations§
Source§impl<F> Embeddings<F>
impl<F> Embeddings<F>
Sourcepub fn new(dimension: usize) -> Self
pub fn new(dimension: usize) -> Self
Declares an empty vector of embeddings of the specified dimensions.
Sourcepub fn from_single_embedding(embedding: Vec<F>) -> Self
pub fn from_single_embedding(embedding: Vec<F>) -> Self
Declares a vector of embeddings containing a single element.
The dimension is inferred from the length of the passed embedding.
Sourcepub fn from_inner(data: Vec<F>, dimension: usize) -> Result<Self, Vec<F>>
pub fn from_inner(data: Vec<F>, dimension: usize) -> Result<Self, Vec<F>>
Declares a vector of embeddings from its components.
data.len() must be a multiple of dimension, otherwise an error is returned.
Sourcepub fn embedding_count(&self) -> usize
pub fn embedding_count(&self) -> usize
Returns the number of embeddings in this vector of embeddings.
Sourcepub fn into_inner(self) -> Vec<F>
pub fn into_inner(self) -> Vec<F>
Deconstructs self into the inner flat vector.
Sourcepub fn iter(&self) -> impl Iterator<Item = &[F]> + '_
pub fn iter(&self) -> impl Iterator<Item = &[F]> + '_
Iterates over the embeddings contained in the flat vector.
Auto Trait Implementations§
impl<F> Freeze for Embeddings<F>
impl<F> RefUnwindSafe for Embeddings<F>where
F: RefUnwindSafe,
impl<F> Send for Embeddings<F>where
F: Send,
impl<F> Sync for Embeddings<F>where
F: Sync,
impl<F> Unpin for Embeddings<F>where
F: Unpin,
impl<F> UnwindSafe for Embeddings<F>where
F: UnwindSafe,
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 more