Skip to main content

ctc_loss

Function ctc_loss 

pub fn ctc_loss(
    log_probs: Tensor<3>,
    targets: Tensor<2, Int>,
    input_lengths: Tensor<1, Int>,
    target_lengths: Tensor<1, Int>,
    blank: usize,
) -> Tensor<1>
Expand description

Computes the CTC loss.

§Arguments

  • log_probs - Log-probabilities of shape [T, N, C]
  • targets - Target label 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]