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
inputandtargetshould 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 oflabelsshould be \([1, C)\), as \(0\) is reserved for blank.Use
padding_maskto fill it when length is not sufficient.- Parameters:
- inputs (Sequence[dragon.Tensor]) – The tensor
inputandtarget. - 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.