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","(",")"]
code: def __init__(self, blank=0, reduction="mean"):
      super(TransducerLoss, self).__init__()
      self.blank = blank
      self.reduction = reduction
      self.loss = Transducer.apply
      try:
          cuda.cuda_paths
      except ImportError:
          err_msg = "cannot import numba. To use Transducer loss\n"
          err_msg += "=============================\n"
          err_msg += "If you use your localhost:\n"
          err_msg += "pip install numba\n"
          err_msg += "export NUMBAPRO_LIBDEVICE='/usr/local/cuda/nvvm/libdevice/' \n"
          err_msg += "export NUMBAPRO_NVVM='/usr/local/cuda/nvvm/lib64/libnvvm.so' \n"
          err_msg += "================================ \n"
          err_msg += "If you use conda:\n"
          err_msg += "conda install numba cudatoolkit=XX (XX is your cuda toolkit version)"
          raise ImportError(err_msg)
  
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 1 to create a new TransducerLoss object from inherited base classes: Module with example: obj = TransducerLoss(blank, reduction)