


ctc_loss = nn.CTCLoss()
      >>> loss = ctc_loss(input, target, input_lengths, target_lengths)
      >>> loss.backward()
      >>>
      >>>
      >>> # Target are to be un-padded and unbatched (effectively N=1)
      >>> T = 50      # Input sequence length
      >>> C = 20      # Number of classes (including blank)
      >>>
      >>> # Initialize random batch of input vectors, for *size = (T,C)
      >>> input = torch.randn(T, C).log_softmax(2).detach().requires_grad_()
      >>> input_lengths = torch.tensor(T, dtype=torch.long)
      >>>
      >>> # Initialize random batch of targets (0 = blank, 1:C = classes)
      >>> target_lengths = torch.randint(low=1, high=T, size=(), dtype=torch.long)
      >>> target = torch.randint(low=1, high=C, size=(target_lengths,), dtype=torch.long)
      >>> ctc_loss = nn.CTCLoss()
      >>> loss = ctc_loss(input, target, input_lengths, target_lengths)
      >>> loss.backward()



Reference:
      A. Graves et al.: Connectionist Temporal Classification: