# tensorplay.nn.functional.ctc_loss

Source: https://www.tensorplay.cn/docs/generated/tensorplay.nn.functional.ctc_loss.html

# tensorplay.nn.functional.ctc_loss

tensorplay.nn.functional.ctc_loss(log_probs: TensorBase, targets: TensorBase, input_lengths, target_lengths, blank: [int](https://docs.python.org/3/library/functions.html#int) = 0, reduction: [str](https://docs.python.org/3/library/stdtypes.html#str) = 'mean', zero_infinity: [bool](https://docs.python.org/3/library/functions.html#bool) = False) &#x2192; TensorBase[[source]](../_modules/tensorplay/nn/functional.html#ctc_loss)

Compute the Connectionist Temporal Classification loss.

Vectorized dynamic-programming port of aten/src/ATen/native/LossCTC.cpp
(alpha recurrence over the blank-extended target sequence); autograd flows
through log_probs via the composed primitives.

Parameters:

- log_probs – \((T, N, C)\) or \((T, C)\) log-softmax outputs.

- targets – \((N, S)\) or concatenated \((\sum S_n,)\) .

- target_lengths ( input_lengths / ) – \((N,)\) or scalars.

- blank – index of the blank label. Default: 0.

- reduction – 'none' | 'mean' | 'sum' .

- zero_infinity – zero out infinite losses (targets too long for T).
