class_docstr: Transducer tasks module.
docstr: Forward main and auxiliary task.
  
  Args:
      enc_out: Encoder output sequences. (B, T, D_enc)
      aux_enc_out: Encoder intermediate output sequences. (B, T_aux, D_enc_aux)
      dec_out: Decoder output sequences. (B, U, D_dec)
      target: Target label ID sequences. (B, L)
      t_len: Time lengths. (B,)
      aux_t_len: Auxiliary time lengths. (B,)
      u_len: Label lengths. (B,)
  
  Returns:
      : Weighted losses.
        (transducer loss, ctc loss, aux Transducer loss, KL div loss, LM loss)
      cer: Sentence-level CER score.
      wer: Sentence-level WER score.
docstr_tok: ["Forward","main","and","auxiliary","task",".","Args",":","enc_out",":","Encoder","output","sequences",".","(","B",",","T",",","D_enc",")","aux_enc_out",":","Encoder","intermediate","output","sequences",".","(","B",",","T_aux",",","D_enc_aux",")","dec_out",":","Decoder","output","sequences",".","(","B",",","U",",","D_dec",")","target",":","Target","label","ID","sequences",".","(","B",",","L",")","t_len",":","Time","lengths",".","(","B",",",")","aux_t_len",":","Auxiliary","time","lengths",".","(","B",",",")","u_len",":","Label","lengths",".","(","B",",",")","Returns",":",":","Weighted","losses",".","(","transducer","loss",",","ctc","loss",",","aux","Transducer","loss",",","KL","div","loss",",","LM","loss",")","cer",":","Sentence-level","CER","score",".","wer",":","Sentence-level","WER","score","."]
code: def forward(
      self,
      enc_out: torch.Tensor,
      aux_enc_out: List[torch.Tensor],
      dec_out: torch.Tensor,
      labels: torch.Tensor,
      enc_out_len: torch.Tensor,
      aux_enc_out_len: torch.Tensor,
  ) -> Tuple[Tuple[Any], float, float]:
      """Forward main and auxiliary task.
  
      Args:
          enc_out: Encoder output sequences. (B, T, D_enc)
          aux_enc_out: Encoder intermediate output sequences. (B, T_aux, D_enc_aux)
          dec_out: Decoder output sequences. (B, U, D_dec)
          target: Target label ID sequences. (B, L)
          t_len: Time lengths. (B,)
          aux_t_len: Auxiliary time lengths. (B,)
          u_len: Label lengths. (B,)
  
      Returns:
          : Weighted losses.
            (transducer loss, ctc loss, aux Transducer loss, KL div loss, LM loss)
          cer: Sentence-level CER score.
          wer: Sentence-level WER score.
  
      """
      if self.use_symm_kl_div_loss:
          assert self.use_aux_transducer_loss
  
      (
          trans_loss,
          ctc_loss,
          lm_loss,
          aux_trans_loss,
          symm_kl_div_loss,
      ) = (
          0.0,
          0.0,
          0.0,
          0.0,
          0.0,
      )
  
      (
          target,
          lm_loss_target,
          t_len,
          aux_t_len,
          u_len,
      ) = self.get_transducer_tasks_io(
          labels,
          enc_out_len,
          aux_enc_out_len,
      )
  
      joint_out, trans_loss = self.compute_transducer_loss(
          enc_out, dec_out, target, t_len, u_len
      )
  
      if self.use_ctc_loss:
          ctc_loss = self.compute_ctc_loss(
              enc_out, target, t_len, u_len
          )
  
      if self.use_aux_transducer_loss:
          (
              aux_trans_loss,
              symm_kl_div_loss,
          ) = self.compute_aux_transducer_and_symm_kl_div_losses(
              aux_enc_out,
              dec_out,
              joint_out,
              target,
              aux_t_len,
              u_len,
          )
  
      if self.use_lm_loss:
          lm_loss = self.compute_lm_loss(dec_out, lm_loss_target)
  
      return (
          self.transducer_loss_weight * trans_loss,
          self.ctc_loss_weight * ctc_loss,
          self.aux_transducer_loss_weight * aux_trans_loss,
          self.symm_kl_div_loss_weight * symm_kl_div_loss,
          self.lm_loss_weight * lm_loss,
      )
  
file_path: espnet/espnet/nets/pytorch_backend/transducer/transducer_tasks.py
imports: from typing import Any, List, Optional, Tuple
  import torch
  from espnet.nets.pytorch_backend.nets_utils import pad_list
  from espnet.nets.pytorch_backend.transducer.joint_network import JointNetwork
  from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import LabelSmoothingLoss
label_desc: Use image node_id 9 for calling the TransducerTasks obj's underlying member method code with example usage: obj.forward(enc_out, aux_enc_out, dec_out, labels, enc_out_len, aux_enc_out_len) and returns: unknown,  unknown,  unknown,  unknown,  unknown