class_docstr: E2E module.
  
  :param int idim: dimension of inputs
  :param int odim: dimension of outputs
  :param Namespace args: argument Namespace containing options
class_docstr_tok: ["E2E","module",".",":","param","int","idim",":","dimension","of","inputs",":","param","int","odim",":","dimension","of","outputs",":","param","Namespace","args",":","argument","Namespace","containing","options"]
docstr: E2E forward.
  
  :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)
  :param torch.Tensor ilens: batch of lengths of input sequences (B)
  :param torch.Tensor ys_pad: batch of padded token id sequence tensor (B, Lmax)
  :return: loss value
  :rtype: torch.Tensor
code: def forward(self, xs_pad, ilens, ys_pad, ys_pad_src):
      """E2E forward.
  
      :param torch.Tensor xs_pad: batch of padded input sequences (B, Tmax, idim)
      :param torch.Tensor ilens: batch of lengths of input sequences (B)
      :param torch.Tensor ys_pad: batch of padded token id sequence tensor (B, Lmax)
      :return: loss value
      :rtype: torch.Tensor
      """
      # 0. Extract target language ID
      if self.multilingual:
          tgt_lang_ids = ys_pad[:, 0:1]
          ys_pad = ys_pad[
              :, 1:
          ]  # remove target language ID in the beginning
      else:
          tgt_lang_ids = None
  
      # 1. Encoder
      hs_pad, hlens, _ = self.enc(xs_pad, ilens)
  
      # 2. ST attention loss
      self.loss_st, self.acc, _ = self.dec(
          hs_pad, hlens, ys_pad, lang_ids=tgt_lang_ids
      )
  
      # 3. ASR loss
      (
          self.loss_asr_att,
          acc_asr,
          self.loss_asr_ctc,
          cer_ctc,
          cer,
          wer,
      ) = self.forward_asr(hs_pad, hlens, ys_pad_src)
  
      # 4. MT attention loss
      self.loss_mt, acc_mt = self.forward_mt(ys_pad, ys_pad_src)
  
      # 5. Compute BLEU
      if self.training or not self.report_bleu:
          self.bleu = 0.0
      else:
          lpz = None
  
          nbest_hyps = self.dec.recognize_beam_batch(
              hs_pad,
              torch.tensor(hlens),
              lpz,
              self.trans_args,
              self.char_list,
              self.rnnlm,
              lang_ids=tgt_lang_ids.squeeze(1).tolist()
              if self.multilingual
              else None,
          )
          # remove <sos> and <eos>
          list_of_refs = []
          hyps = []
          y_hats = [
              nbest_hyp[0]["yseq"][1:-1] for nbest_hyp in nbest_hyps
          ]
          for i, y_hat in enumerate(y_hats):
              y_true = ys_pad[i]
  
              seq_hat = [
                  self.char_list[int(idx)]
                  for idx in y_hat
                  if int(idx) != -1
              ]
              seq_true = [
                  self.char_list[int(idx)]
                  for idx in y_true
                  if int(idx) != -1
              ]
              seq_hat_text = "".join(seq_hat).replace(
                  self.trans_args.space, " "
              )
              seq_hat_text = seq_hat_text.replace(
                  self.trans_args.blank, ""
              )
              seq_true_text = "".join(seq_true).replace(
                  self.trans_args.space, " "
              )
  
              hyps += [seq_hat_text.split(" ")]
              list_of_refs += [[seq_true_text.split(" ")]]
  
          self.bleu = (
              nltk.bleu_score.corpus_bleu(list_of_refs, hyps) * 100
          )
  
      asr_ctc_weight = self.mtlalpha
      self.loss_asr = (
          asr_ctc_weight * self.loss_asr_ctc
          + (1 - asr_ctc_weight) * self.loss_asr_att
      )
      self.loss = (
          (1 - self.asr_weight - self.mt_weight) * self.loss_st
          + self.asr_weight * self.loss_asr
          + self.mt_weight * self.loss_mt
      )
      loss_st_data = float(self.loss_st)
      loss_asr_data = float(self.loss_asr)
      loss_mt_data = float(self.loss_mt)
      loss_data = float(self.loss)
      if loss_data < CTC_LOSS_THRESHOLD and not math.isnan(loss_data):
          self.reporter.report(
              loss_asr_data,
              loss_mt_data,
              loss_st_data,
              acc_asr,
              acc_mt,
              self.acc,
              cer_ctc,
              cer,
              wer,
              self.bleu,
              loss_data,
          )
      else:
          logging.warning("loss (=%f) is not correct", loss_data)
      return self.loss
  
imports: import argparse
  import copy
  import logging
  import math
  import os
  from itertools import groupby
  import chainer
  import nltk
  import numpy
  import torch
  from chainer import reporter
  from espnet.nets.e2e_asr_common import label_smoothing_dist
  from espnet.nets.pytorch_backend.ctc import CTC
  from espnet.nets.pytorch_backend.initialization import lecun_normal_init_parameters, set_forget_bias_to_one
  from espnet.nets.pytorch_backend.nets_utils import get_subsample, pad_list, to_device, to_torch_tensor
  from espnet.nets.pytorch_backend.rnn.argument import add_arguments_rnn_attention_common, add_arguments_rnn_decoder_common, add_arguments_rnn_encoder_common
  from espnet.nets.pytorch_backend.rnn.attentions import att_for
  from espnet.nets.pytorch_backend.rnn.decoders import decoder_for
  from espnet.nets.pytorch_backend.rnn.encoders import encoder_for
  from espnet.nets.st_interface import STInterface
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 8 for calling the E2E obj's underlying member method code with example usage: obj.forward(xs_pad, ilens, ys_pad, ys_pad_src) and returns: self