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: Construct an E2E object.
  
  :param int idim: dimension of inputs
  :param int odim: dimension of outputs
  :param Namespace args: argument Namespace containing options
docstr_tok: ["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):
      """Construct an E2E object.
  
      :param int idim: dimension of inputs
      :param int odim: dimension of outputs
      :param Namespace args: argument Namespace containing options
      """
      super(E2E, self).__init__()
      torch.nn.Module.__init__(self)
  
      # fill missing arguments for compatibility
      args = fill_missing_args(args, self.add_arguments)
  
      self.etype = args.etype
      self.verbose = args.verbose
      # NOTE: for self.build method
      args.char_list = getattr(args, "char_list", None)
      self.char_list = args.char_list
      self.outdir = args.outdir
      self.space = args.sym_space
      self.blank = args.sym_blank
      self.reporter = Reporter()
  
      # below means the last number becomes eos/sos ID
      # note that sos/eos IDs are identical
      self.sos = odim - 1
      self.eos = odim - 1
      self.pad = 0
      # NOTE: we reserve index:0 for <pad> although this is reserved for a blank class
      # in ASR. However, blank labels are not used in MT.
      # To keep the vocabulary size,
      # we use index:0 for padding instead of adding one more class.
  
      # subsample info
      self.subsample = get_subsample(args, mode="mt", arch="rnn")
  
      # label smoothing info
      if args.lsm_type and os.path.isfile(args.train_json):
          logging.info("Use label smoothing with " + args.lsm_type)
          labeldist = label_smoothing_dist(
              odim, args.lsm_type, transcript=args.train_json
          )
      else:
          labeldist = None
  
      # multilingual related
      self.multilingual = getattr(args, "multilingual", False)
      self.replace_sos = getattr(args, "replace_sos", False)
  
      # encoder
      self.embed = torch.nn.Embedding(
          idim, args.eunits, padding_idx=self.pad
      )
      self.dropout = torch.nn.Dropout(p=args.dropout_rate)
      self.enc = encoder_for(args, args.eunits, self.subsample)
      # attention
      self.att = att_for(args)
      # decoder
      self.dec = decoder_for(
          args, odim, self.sos, self.eos, self.att, labeldist
      )
  
      # tie source and target emeddings
      if args.tie_src_tgt_embedding:
          if idim != odim:
              raise ValueError(
                  "When using tie_src_tgt_embedding, idim and odim must be equal."
              )
          if args.eunits != args.dunits:
              raise ValueError(
                  "When using tie_src_tgt_embedding, eunits and dunits must be equal."
              )
          self.embed.weight = self.dec.embed.weight
  
      # tie emeddings and the classfier
      if args.tie_classifier:
          if args.context_residual:
              raise ValueError(
                  "When using tie_classifier, context_residual must be turned off."
              )
          self.dec.output.weight = self.dec.embed.weight
  
      # weight initialization
      self.init_like_fairseq()
  
      # options for beam search
      if args.report_bleu:
          trans_args = {
              "beam_size": args.beam_size,
              "penalty": args.penalty,
              "ctc_weight": 0,
              "maxlenratio": args.maxlenratio,
              "minlenratio": args.minlenratio,
              "lm_weight": args.lm_weight,
              "rnnlm": args.rnnlm,
              "nbest": args.nbest,
              "space": args.sym_space,
              "blank": args.sym_blank,
              "tgt_lang": False,
          }
  
          self.trans_args = argparse.Namespace(**trans_args)
          self.report_bleu = args.report_bleu
      else:
          self.report_bleu = False
      self.rnnlm = None
  
      self.logzero = -10000000000.0
      self.loss = None
      self.acc = None
  
imports: import argparse
  import logging
  import math
  import os
  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.mt_interface import MTInterface
  from espnet.nets.pytorch_backend.initialization import uniform_init_parameters
  from espnet.nets.pytorch_backend.nets_utils import get_subsample, pad_list, to_device
  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.utils.fill_missing_args import fill_missing_args
label_desc: Use image node_id 5 to create a new E2E object from inherited base classes: MTInterface, torch.nn with example: obj = E2E(idim, odim, args)