pub struct LlamaBatch<'tokens> {
pub initialized_logits: Vec<i32>,
pub llama_batch: llama_batch,
/* private fields */
}Fields§
§initialized_logits: Vec<i32>§llama_batch: llama_batchImplementations§
Source§impl<'tokens> LlamaBatch<'tokens>
impl<'tokens> LlamaBatch<'tokens>
pub fn clear(&mut self)
Sourcepub fn add(
&mut self,
sampled_token: &SampledToken,
pos: llama_pos,
seq_ids: &[i32],
logits: bool,
) -> Result<(), BatchAddError>
pub fn add( &mut self, sampled_token: &SampledToken, pos: llama_pos, seq_ids: &[i32], logits: bool, ) -> Result<(), BatchAddError>
§Errors
Returns an error if there is insufficient space in the buffer or if integer conversions fail.
Sourcepub fn add_sequence(
&mut self,
tokens: &[LlamaToken],
seq_id: i32,
logits_all: bool,
) -> Result<(), BatchAddError>
pub fn add_sequence( &mut self, tokens: &[LlamaToken], seq_id: i32, logits_all: bool, ) -> Result<(), BatchAddError>
§Errors
Returns an error if there is insufficient space in the buffer or if integer conversions fail.
Sourcepub fn new(n_tokens: usize, n_seq_max: i32) -> Result<Self, BatchAddError>
pub fn new(n_tokens: usize, n_seq_max: i32) -> Result<Self, BatchAddError>
§Errors
Returns an error if n_tokens exceeds i32::MAX.
Sourcepub fn get_one(tokens: &'tokens [LlamaToken]) -> Result<Self, BatchAddError>
pub fn get_one(tokens: &'tokens [LlamaToken]) -> Result<Self, BatchAddError>
§Errors
Returns an error if the provided token buffer is empty or if integer conversions fail.
pub const fn n_tokens(&self) -> i32
Trait Implementations§
Source§impl<'tokens> Debug for LlamaBatch<'tokens>
impl<'tokens> Debug for LlamaBatch<'tokens>
Source§impl Drop for LlamaBatch<'_>
impl Drop for LlamaBatch<'_>
Auto Trait Implementations§
impl<'tokens> Freeze for LlamaBatch<'tokens>
impl<'tokens> RefUnwindSafe for LlamaBatch<'tokens>
impl<'tokens> !Send for LlamaBatch<'tokens>
impl<'tokens> !Sync for LlamaBatch<'tokens>
impl<'tokens> Unpin for LlamaBatch<'tokens>
impl<'tokens> UnsafeUnpin for LlamaBatch<'tokens>
impl<'tokens> UnwindSafe for LlamaBatch<'tokens>
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> 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