ctc_loss¶
dragon.losses.
ctc_loss
(
inputs,
padding_mask=- 1,
**kwargs
)[source]¶Compute the ctc loss with batched labels. [Graves & Gomez, 2006].
The shape of
input
andtarget
should be \((T, N, C)\), \((N, C)\) respectively, where \(T\) is the sequence length, \(N\) is the batch size, and \(C\) is max label length. The range oflabels
should be \([1, C)\), as \(0\) is reserved for blank.Use
padding_mask
to fill it when length is not sufficient.- Parameters:
- inputs (Sequence[dragon.Tensor]) – The tensor
input
andtarget
. - padding_mask (int, optional, default=-1) – The mask for padding the redundant labels.
- inputs (Sequence[dragon.Tensor]) – The tensor
- Returns:
dragon.Tensor – The output tensor.