pub struct LogSpaceSoftmax { /* private fields */ }Expand description
Log-space softmax accumulator for online computation.
Implementations§
Source§impl LogSpaceSoftmax
impl LogSpaceSoftmax
Sourcepub fn update(&mut self, block_max: f64, block_log_sum_exp: f64) -> f64
pub fn update(&mut self, block_max: f64, block_log_sum_exp: f64) -> f64
Update with a new block of scores.
Sourcepub fn update_raw(&mut self, block_max: f64, block_sum_exp: f64) -> f64
pub fn update_raw(&mut self, block_max: f64, block_sum_exp: f64) -> f64
Update with raw block statistics (not in log-space).
Sourcepub fn normalization_factor(&self) -> f64
pub fn normalization_factor(&self) -> f64
Compute the final normalization factor: 1 / sum(exp(scores - m)).
Sourcepub fn merge(&mut self, other: &LogSpaceSoftmax) -> f64
pub fn merge(&mut self, other: &LogSpaceSoftmax) -> f64
Merge another log-space accumulator into this one.
Trait Implementations§
Source§impl Clone for LogSpaceSoftmax
impl Clone for LogSpaceSoftmax
Source§fn clone(&self) -> LogSpaceSoftmax
fn clone(&self) -> LogSpaceSoftmax
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogSpaceSoftmax
impl Debug for LogSpaceSoftmax
Auto Trait Implementations§
impl Freeze for LogSpaceSoftmax
impl RefUnwindSafe for LogSpaceSoftmax
impl Send for LogSpaceSoftmax
impl Sync for LogSpaceSoftmax
impl Unpin for LogSpaceSoftmax
impl UnwindSafe for LogSpaceSoftmax
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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