pub struct CTCLoss { /* private fields */ }Expand description
Connectionist Temporal Classification (CTC) Loss.
Used for sequence-to-sequence tasks where alignment is unknown. Common in speech recognition and OCR.
Reference: Graves et al., “Connectionist Temporal Classification” (2006)
Implementations§
Source§impl CTCLoss
impl CTCLoss
pub fn blank_idx(&self) -> usize
Sourcepub fn forward(
&self,
log_probs: &[Vec<f32>],
targets: &[usize],
input_length: usize,
target_length: usize,
) -> f32
pub fn forward( &self, log_probs: &[Vec<f32>], targets: &[usize], input_length: usize, target_length: usize, ) -> f32
Compute CTC loss using forward-backward algorithm.
§Arguments
log_probs- Log probabilities [T, C] (time x classes)targets- Target sequence (class indices, no blanks)input_length- Length of input sequencetarget_length- Length of target sequence
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CTCLoss
impl RefUnwindSafe for CTCLoss
impl Send for CTCLoss
impl Sync for CTCLoss
impl Unpin for CTCLoss
impl UnwindSafe for CTCLoss
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