torch.nn.functional.ctc_loss
function ctc_loss(log_probs: Tensor, targets: Tensor, input_lengths: Tensor, target_lengths: Tensor, options?: CTCLossOptions): Tensorfunction ctc_loss(log_probs: Tensor, targets: Tensor, input_lengths: Tensor, target_lengths: Tensor, blank: number, reduction: 'none' | 'mean' | 'sum', zero_infinity: boolean): TensorCTC (Connectionist Temporal Classification) loss.
Computes the CTC loss between log-probability sequences and target sequences. Used for sequence-to-sequence tasks where alignment is unknown, such as speech recognition and handwriting recognition.
Parameters
log_probsTensor- Log probabilities of shape [T, N, C] where T=time, N=batch, C=classes
targetsTensor- Target sequences of shape [N, S] where S=max target length
input_lengthsTensor- Tensor of shape [N] with length of each input sequence
target_lengthsTensor- Tensor of shape [N] with length of each target sequence
optionsCTCLossOptionsoptional