pub struct EmbeddingRows<'a> { /* private fields */ }Expand description
A borrowed, row-major block of embedding values, mirroring llama_embd.
llama.cpp copies the values out when the view is handed to the batch, so the borrow only has to outlive the call.
Implementations§
Source§impl<'a> EmbeddingRows<'a>
impl<'a> EmbeddingRows<'a>
Sourcepub fn new(
data: &'a [f32],
n_rows: usize,
n_embd: usize,
) -> Result<Self, BatchExtError>
pub fn new( data: &'a [f32], n_rows: usize, n_embd: usize, ) -> Result<Self, BatchExtError>
A n_rows × n_embd block.
§Errors
Returns BatchExtError::EmbeddingShape unless
n_rows * n_embd == data.len(). llama.cpp takes the shape on trust and
reads n_rows * n_embd floats, so a wrong shape would read out of
bounds.
Trait Implementations§
Source§impl<'a> Clone for EmbeddingRows<'a>
impl<'a> Clone for EmbeddingRows<'a>
impl<'a> Copy for EmbeddingRows<'a>
Auto Trait Implementations§
impl<'a> Freeze for EmbeddingRows<'a>
impl<'a> RefUnwindSafe for EmbeddingRows<'a>
impl<'a> Send for EmbeddingRows<'a>
impl<'a> Sync for EmbeddingRows<'a>
impl<'a> Unpin for EmbeddingRows<'a>
impl<'a> UnsafeUnpin for EmbeddingRows<'a>
impl<'a> UnwindSafe for EmbeddingRows<'a>
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