class_docstr: Decoder module
  
  :param int eprojs: encoder projection units
  :param int odim: dimension of outputs
  :param str dtype: gru or lstm
  :param int dlayers: decoder layers
  :param int dunits: decoder units
  :param int sos: start of sequence symbol id
  :param int eos: end of sequence symbol id
  :param torch.nn.Module att: attention module
  :param int verbose: verbose level
  :param list char_list: list of character strings
  :param ndarray labeldist: distribution of label smoothing
  :param float lsm_weight: label smoothing weight
  :param float sampling_probability: scheduled sampling probability
  :param float dropout: dropout rate
  :param float context_residual: if True, use context vector for token generation
  :param float replace_sos: use for multilingual (speech/text) translation
class_docstr_tok: ["Decoder","module",":","param","int","eprojs",":","encoder","projection","units",":","param","int","odim",":","dimension","of","outputs",":","param","str","dtype",":","gru","or","lstm",":","param","int","dlayers",":","decoder","layers",":","param","int","dunits",":","decoder","units",":","param","int","sos",":","start","of","sequence","symbol","id",":","param","int","eos",":","end","of","sequence","symbol","id",":","param","torch.nn.Module","att",":","attention","module",":","param","int","verbose",":","verbose","level",":","param","list","char_list",":","list","of","character","strings",":","param","ndarray","labeldist",":","distribution","of","label","smoothing",":","param","float","lsm_weight",":","label","smoothing","weight",":","param","float","sampling_probability",":","scheduled","sampling","probability",":","param","float","dropout",":","dropout","rate",":","param","float","context_residual",":","if","True",",","use","context","vector","for","token","generation",":","param","float","replace_sos",":","use","for","multilingual","(","speech\/text",")","translation"]
code: def __init__(
      self,
      eprojs,
      odim,
      dtype,
      dlayers,
      dunits,
      sos,
      eos,
      att,
      verbose=0,
      char_list=None,
      labeldist=None,
      lsm_weight=0.0,
      sampling_probability=0.0,
      dropout=0.0,
      context_residual=False,
      replace_sos=False,
      num_encs=1,
  ):
      torch.nn.Module.__init__(self)
      self.dtype = dtype
      self.dunits = dunits
      self.dlayers = dlayers
      self.context_residual = context_residual
      self.embed = torch.nn.Embedding(odim, dunits)
      self.dropout_emb = torch.nn.Dropout(p=dropout)
  
      self.decoder = torch.nn.ModuleList()
      self.dropout_dec = torch.nn.ModuleList()
      self.decoder += [
          torch.nn.LSTMCell(dunits + eprojs, dunits)
          if self.dtype == "lstm"
          else torch.nn.GRUCell(dunits + eprojs, dunits)
      ]
      self.dropout_dec += [torch.nn.Dropout(p=dropout)]
      for _ in range(1, self.dlayers):
          self.decoder += [
              torch.nn.LSTMCell(dunits, dunits)
              if self.dtype == "lstm"
              else torch.nn.GRUCell(dunits, dunits)
          ]
          self.dropout_dec += [torch.nn.Dropout(p=dropout)]
          # NOTE: dropout is applied only for the vertical connections
          # see https://arxiv.org/pdf/1409.2329.pdf
      self.ignore_id = -1
  
      if context_residual:
          self.output = torch.nn.Linear(dunits + eprojs, odim)
      else:
          self.output = torch.nn.Linear(dunits, odim)
  
      self.loss = None
      self.att = att
      self.dunits = dunits
      self.sos = sos
      self.eos = eos
      self.odim = odim
      self.verbose = verbose
      self.char_list = char_list
      # for label smoothing
      self.labeldist = labeldist
      self.vlabeldist = None
      self.lsm_weight = lsm_weight
      self.sampling_probability = sampling_probability
      self.dropout = dropout
      self.num_encs = num_encs
  
      # for multilingual E2E-ST
      self.replace_sos = replace_sos
  
      self.logzero = -10000000000.0
  
imports: import logging
  import math
  import random
  from argparse import Namespace
  import numpy
  import torch
  import torch.nn.functional
  from espnet.nets.ctc_prefix_score import CTCPrefixScore, CTCPrefixScoreTH
  from espnet.nets.e2e_asr_common import end_detect
  from espnet.nets.pytorch_backend.nets_utils import mask_by_length, pad_list, th_accuracy, to_device
  from espnet.nets.pytorch_backend.rnn.attentions import att_to_numpy
  from espnet.nets.scorer_interface import ScorerInterface
label_desc: Use image node_id 1 to create a new Decoder object from inherited base classes: torch.nn, ScorerInterface with example: obj = Decoder(eprojs, odim, dtype, dlayers, dunits, sos, eos, att, verbose, char_list, labeldist, lsm_weight, sampling_probability, dropout, context_residual, replace_sos, num_encs)