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

dragon.Tensor – The output tensor.