class_docstr: E2E module.
  
  :param int idim: dimension of inputs
  :param int odim: dimension of outputs
  :param Namespace args: argument Namespace containing options
docstr: Construct an E2E object.
  
  :param int idim: dimension of inputs
  :param int odim: dimension of outputs
  :param Namespace args: argument Namespace containing options
code: def __init__(self, idim, odim, args, ignore_id=-1):
      """Construct an E2E object.
  
      :param int idim: dimension of inputs
      :param int odim: dimension of outputs
      :param Namespace args: argument Namespace containing options
      """
      torch.nn.Module.__init__(self)
  
      # fill missing arguments for compatibility
      args = fill_missing_args(args, self.add_arguments)
  
      if args.transformer_attn_dropout_rate is None:
          args.transformer_attn_dropout_rate = args.dropout_rate
  
      self.adim = args.adim  # used for CTC (equal to d_model)
      self.mtlalpha = args.mtlalpha
  
      if args.mtlalpha > 0.0:
          self.ctc = CTC(
              odim,
              args.adim,
              args.dropout_rate,
              ctc_type=args.ctc_type,
              reduce=True,
          )
      else:
          self.ctc = None
  
      self.intermediate_ctc_weight = args.intermediate_ctc_weight
      self.intermediate_ctc_layers = None
      if args.intermediate_ctc_layer != "":
          self.intermediate_ctc_layers = [
              int(i) for i in args.intermediate_ctc_layer.split(",")
          ]
  
      self.encoder = Encoder(
          idim=idim,
          selfattention_layer_type=args.transformer_encoder_selfattn_layer_type,
          attention_dim=args.adim,
          attention_heads=args.aheads,
          conv_wshare=args.wshare,
          conv_kernel_length=args.ldconv_encoder_kernel_length,
          conv_usebias=args.ldconv_usebias,
          linear_units=args.eunits,
          num_blocks=args.elayers,
          input_layer=args.transformer_input_layer,
          dropout_rate=args.dropout_rate,
          positional_dropout_rate=args.dropout_rate,
          attention_dropout_rate=args.transformer_attn_dropout_rate,
          stochastic_depth_rate=args.stochastic_depth_rate,
          intermediate_layers=self.intermediate_ctc_layers,
          ctc_softmax=self.ctc.softmax
          if args.self_conditioning
          else None,
          conditioning_layer_dim=odim,
      )
      if args.mtlalpha < 1:
          self.decoder = Decoder(
              odim=odim,
              selfattention_layer_type=args.transformer_decoder_selfattn_layer_type,
              attention_dim=args.adim,
              attention_heads=args.aheads,
              conv_wshare=args.wshare,
              conv_kernel_length=args.ldconv_decoder_kernel_length,
              conv_usebias=args.ldconv_usebias,
              linear_units=args.dunits,
              num_blocks=args.dlayers,
              dropout_rate=args.dropout_rate,
              positional_dropout_rate=args.dropout_rate,
              self_attention_dropout_rate=args.transformer_attn_dropout_rate,
              src_attention_dropout_rate=args.transformer_attn_dropout_rate,
          )
          self.criterion = LabelSmoothingLoss(
              odim,
              ignore_id,
              args.lsm_weight,
              args.transformer_length_normalized_loss,
          )
      else:
          self.decoder = None
          self.criterion = None
      self.blank = 0
      self.sos = odim - 1
      self.eos = odim - 1
      self.odim = odim
      self.ignore_id = ignore_id
      self.subsample = get_subsample(
          args, mode="asr", arch="transformer"
      )
      self.reporter = Reporter()
  
      self.reset_parameters(args)
  
      if args.report_cer or args.report_wer:
          self.error_calculator = ErrorCalculator(
              args.char_list,
              args.sym_space,
              args.sym_blank,
              args.report_cer,
              args.report_wer,
          )
      else:
          self.error_calculator = None
      self.rnnlm = None
  
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 4 to create a new E2E object from inherited base classes: ASRInterface, torch.nn with example: obj = E2E(idim, odim, args, ignore_id)