CTCLoss¶
- class dragon.vm.torch.nn.CTCLoss(
 padding_mask=- 1,
 reduction='mean'
 )[source]¶
- Compute the ctc loss with batched labels. [Graves & Gomez, 2006]. - Examples: - # t: num_steps # n: batch_size # c: num_classes(with blank at 0) t, n, c = 8, 4, 5 m = torch.nn.CTCLoss(padding_mask=-1).cuda() logits = torch.ones(t, n, c) labels = torch.tensor([[1, 2, 3], [1, 2, -1], [1, -1, -1], [1, 1, 1]], dtype='int32') loss = m(logits, labels) - See also 
