pub struct BeamStepInput {
pub log_probs: Vec<Vec<f64>>,
}Expand description
Log-probabilities (or raw logits) for each beam at one decoding step.
Shape: [beam_width][vocab_size] — each row is the distribution for one beam.
Fields§
§log_probs: Vec<Vec<f64>>log_probs[beam_i][vocab_j] = log P(token j | history of beam i).
Implementations§
Source§impl BeamStepInput
impl BeamStepInput
Sourcepub fn new(log_probs: Vec<Vec<f64>>) -> Self
pub fn new(log_probs: Vec<Vec<f64>>) -> Self
Construct directly from pre-computed log-probabilities.
Sourcepub fn from_logits(logits: Vec<Vec<f64>>, temperature: f64) -> Self
pub fn from_logits(logits: Vec<Vec<f64>>, temperature: f64) -> Self
Construct from raw logits: apply temperature scaling then log-softmax.
Sourcepub fn vocab_size(&self) -> usize
pub fn vocab_size(&self) -> usize
Vocabulary size inferred from the first row (0 if empty).
Auto Trait Implementations§
impl Freeze for BeamStepInput
impl RefUnwindSafe for BeamStepInput
impl Send for BeamStepInput
impl Sync for BeamStepInput
impl Unpin for BeamStepInput
impl UnsafeUnpin for BeamStepInput
impl UnwindSafe for BeamStepInput
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