class_docstr: This class implements the Transduce loss computation with forward-backward algorithm.
  Sequence Transduction with naive implementation : https://arxiv.org/pdf/1211.3711.pdf
  
  The TranducerLoss(nn.Module) use Transducer(autograd.Function)
  to compute the forward-backward loss and gradients.
  
  Input tensors must be on a cuda device.
  
  Example
  -------
  >>> import torch
  >>> loss = TransducerLoss(blank=0)
  >>> logits = torch.randn((1,2,3,5)).cuda().requires_grad_()
  >>> labels = torch.Tensor([[1,2]]).cuda().int()
  >>> act_length = torch.Tensor([2]).cuda().int()
  >>> # U = label_length+1
  >>> label_length = torch.Tensor([2]).cuda().int()
  >>> l = loss(logits, labels, act_length, label_length)
  >>> l.backward()
class_docstr_tok: ["This","class","implements","the","Transduce","loss","computation","with","forward-backward","algorithm",".","Sequence","Transduction","with","naive","implementation",":","https",":","\/\/arxiv.org\/pdf\/1211.3711.pdf","The","TranducerLoss","(","nn.Module",")","use","Transducer","(","autograd.Function",")","to","compute","the","forward-backward","loss","and","gradients",".","Input","tensors","must","be","on","a","cuda","device",".","Example","--","--","--","-",">",">",">","import","torch",">",">",">","loss","=","TransducerLoss","(","blank=0",")",">",">",">","logits","=","torch.randn","(","(","1,2,3,5",")",")",".cuda","(",")",".requires_grad_","(",")",">",">",">","labels","=","torch.Tensor","(","[","[","1,2","]","]",")",".cuda","(",")",".int","(",")",">",">",">","act_length","=","torch.Tensor","(","[","2","]",")",".cuda","(",")",".int","(",")",">",">",">","#","U","=","label_length+1",">",">",">","label_length","=","torch.Tensor","(","[","2","]",")",".cuda","(",")",".int","(",")",">",">",">","l","=","loss","(","logits",",","labels",",","act_length",",","label_length",")",">",">",">","l.backward","(",")"]
docstr: Computes the transducer loss.
docstr_tok: ["Computes","the","transducer","loss","."]
code: def forward(self, logits, labels, T, U):
      """Computes the transducer loss."""
      # Transducer.apply function take log_probs tensor.
      if all(t.is_cuda for t in (logits, labels, T, U)):
          log_probs = logits.log_softmax(-1)
          return self.loss(
              log_probs, labels, T, U, self.blank, self.reduction
          )
      else:
          raise ValueError(
              f"Found inputs tensors to be on {[logits.device, labels.device, T.device, U.device]} while needed to be on a 'cuda' device to use the transducer loss."
          )
  
file_path: speechbrain/speechbrain/nnet/loss/transducer_loss.py
imports: import torch
  from torch.autograd import Function
  from torch.nn import Module
  import logging
  import math
  import warnings
label_desc: Use image node_id 2 for calling the TransducerLoss obj's underlying member method code with example usage: obj.forward(logits, labels, T, U) and returns: self