ctc_loss_default

Function ctc_loss_default 

pub fn ctc_loss_default<B>(
    log_probs: <B as BackendTypes>::FloatTensorPrimitive,
    targets: <B as BackendTypes>::IntTensorPrimitive,
    input_lengths: <B as BackendTypes>::IntTensorPrimitive,
    target_lengths: <B as BackendTypes>::IntTensorPrimitive,
    blank: usize,
) -> <B as BackendTypes>::FloatTensorPrimitive
where B: Backend,
Expand description

Default CTC loss implementation using the forward (alpha) algorithm.

Computes the Connectionist Temporal Classification loss by summing over all valid alignments between the input and target sequences.

§Arguments

  • log_probs - Log-probabilities of shape [T, N, C]
  • targets - Target indices of shape [N, S]
  • input_lengths - Actual input sequence lengths per batch element [N]
  • target_lengths - Actual target lengths per batch element [N]
  • blank - Index of the blank label

§Returns

Per-sample loss of shape [N]