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 logit and label 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 of labels 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 logit and label.
  • padding_mask (int, optional, default=-1) – The mask for padding the redundant labels.
Returns:

dragon.Tensor – The output tensor.