class_docstr: 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 source sequences (B, Tmax, idim)
  :param torch.Tensor ilens: batch of lengths of source sequences (B)
  :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax)
  :return: ctc loss value
  :rtype: torch.Tensor
  :return: attention loss value
  :rtype: torch.Tensor
  :return: accuracy in attention decoder
  :rtype: float
code: def forward(self, xs_pad, ilens, ys_pad):
      """E2E forward.
  
      :param torch.Tensor xs_pad: batch of padded source sequences (B, Tmax, idim)
      :param torch.Tensor ilens: batch of lengths of source sequences (B)
      :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax)
      :return: ctc loss value
      :rtype: torch.Tensor
      :return: attention loss value
      :rtype: torch.Tensor
      :return: accuracy in attention decoder
      :rtype: float
      """
      # 1. forward encoder
      xs_pad = xs_pad[:, : max(ilens)]  # for data parallel
      src_mask = (
          make_non_pad_mask(ilens.tolist())
          .to(xs_pad.device)
          .unsqueeze(-2)
      )
      if self.intermediate_ctc_layers:
          hs_pad, hs_mask, hs_intermediates = self.encoder(
              xs_pad, src_mask
          )
      else:
          hs_pad, hs_mask = self.encoder(xs_pad, src_mask)
      self.hs_pad = hs_pad
  
      # 2. forward decoder
      if self.decoder is not None:
          ys_in_pad, ys_out_pad = add_sos_eos(
              ys_pad, self.sos, self.eos, self.ignore_id
          )
          ys_mask = target_mask(ys_in_pad, self.ignore_id)
          pred_pad, pred_mask = self.decoder(
              ys_in_pad, ys_mask, hs_pad, hs_mask
          )
          self.pred_pad = pred_pad
  
          # 3. compute attention loss
          loss_att = self.criterion(pred_pad, ys_out_pad)
          self.acc = th_accuracy(
              pred_pad.view(-1, self.odim),
              ys_out_pad,
              ignore_label=self.ignore_id,
          )
      else:
          loss_att = None
          self.acc = None
  
      # TODO(karita) show predicted text
      # TODO(karita) calculate these stats
      cer_ctc = None
      loss_intermediate_ctc = 0.0
      if self.mtlalpha == 0.0:
          loss_ctc = None
      else:
          batch_size = xs_pad.size(0)
          hs_len = hs_mask.view(batch_size, -1).sum(1)
          loss_ctc = self.ctc(
              hs_pad.view(batch_size, -1, self.adim), hs_len, ys_pad
          )
          if not self.training and self.error_calculator is not None:
              ys_hat = self.ctc.argmax(
                  hs_pad.view(batch_size, -1, self.adim)
              ).data
              cer_ctc = self.error_calculator(
                  ys_hat.cpu(), ys_pad.cpu(), is_ctc=True
              )
          # for visualization
          if not self.training:
              self.ctc.softmax(hs_pad)
  
          if (
              self.intermediate_ctc_weight > 0
              and self.intermediate_ctc_layers
          ):
              for hs_intermediate in hs_intermediates:
                  # assuming hs_intermediates and hs_pad has same length / padding
                  loss_inter = self.ctc(
                      hs_intermediate.view(batch_size, -1, self.adim),
                      hs_len,
                      ys_pad,
                  )
                  loss_intermediate_ctc += loss_inter
  
              loss_intermediate_ctc /= len(self.intermediate_ctc_layers)
  
      # 5. compute cer/wer
      if (
          self.training
          or self.error_calculator is None
          or self.decoder is None
      ):
          cer, wer = None, None
      else:
          ys_hat = pred_pad.argmax(dim=-1)
          cer, wer = self.error_calculator(ys_hat.cpu(), ys_pad.cpu())
  
      # copied from e2e_asr
      alpha = self.mtlalpha
      if alpha == 0:
          self.loss = loss_att
          loss_att_data = float(loss_att)
          loss_ctc_data = None
      elif alpha == 1:
          self.loss = loss_ctc
          if self.intermediate_ctc_weight > 0:
              self.loss = (
                  (1 - self.intermediate_ctc_weight) * loss_ctc
                  + self.intermediate_ctc_weight * loss_intermediate_ctc
              )
          loss_att_data = None
          loss_ctc_data = float(loss_ctc)
      else:
          self.loss = alpha * loss_ctc + (1 - alpha) * loss_att
          if self.intermediate_ctc_weight > 0:
              self.loss = (
                  (1 - alpha - self.intermediate_ctc_weight) * loss_att
                  + alpha * loss_ctc
                  + self.intermediate_ctc_weight * loss_intermediate_ctc
              )
          loss_att_data = float(loss_att)
          loss_ctc_data = float(loss_ctc)
  
      loss_data = float(self.loss)
      if loss_data < CTC_LOSS_THRESHOLD and not math.isnan(loss_data):
          self.reporter.report(
              loss_ctc_data,
              loss_att_data,
              self.acc,
              cer_ctc,
              cer,
              wer,
              loss_data,
          )
      else:
          logging.warning("loss (=%f) is not correct", loss_data)
      return self.loss
  
imports: import logging
  import math
  from argparse import Namespace
  import numpy
  import torch
  from espnet.nets.asr_interface import ASRInterface
  from espnet.nets.ctc_prefix_score import CTCPrefixScore
  from espnet.nets.e2e_asr_common import ErrorCalculator, end_detect
  from espnet.nets.pytorch_backend.ctc import CTC
  from espnet.nets.pytorch_backend.e2e_asr import CTC_LOSS_THRESHOLD, Reporter
  from espnet.nets.pytorch_backend.nets_utils import get_subsample, make_non_pad_mask, th_accuracy
  from espnet.nets.pytorch_backend.rnn.decoders import CTC_SCORING_RATIO
  from espnet.nets.pytorch_backend.transformer.add_sos_eos import add_sos_eos
  from espnet.nets.pytorch_backend.transformer.argument import add_arguments_transformer_common
  from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention, RelPositionMultiHeadedAttention
  from espnet.nets.pytorch_backend.transformer.decoder import Decoder
  from espnet.nets.pytorch_backend.transformer.dynamic_conv import DynamicConvolution
  from espnet.nets.pytorch_backend.transformer.dynamic_conv2d import DynamicConvolution2D
  from espnet.nets.pytorch_backend.transformer.encoder import Encoder
  from espnet.nets.pytorch_backend.transformer.initializer import initialize
  from espnet.nets.pytorch_backend.transformer.label_smoothing_loss import LabelSmoothingLoss
  from espnet.nets.pytorch_backend.transformer.mask import subsequent_mask, target_mask
  from espnet.nets.pytorch_backend.transformer.plot import PlotAttentionReport
  from espnet.nets.scorers.ctc import CTCPrefixScorer
  from espnet.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 6 for calling the E2E obj's underlying member method code with example usage: obj.forward(xs_pad, ilens, ys_pad) and returns: self