class_docstr: Decoder layer.
  
  Args:
      odim (int): The output dimension.
      n_layers (int): Number of ecoder layers.
      n_units (int): Number of attention units.
      d_units (int): Dimension of input vector of decoder.
      h (int): Number of attention heads.
      dropout (float): Dropout rate.
      initialW (Initializer): Initializer to initialize the weight.
      initial_bias (Initializer): Initializer to initialize the bias.
class_docstr_tok: ["Decoder","layer",".","Args",":","odim","(","int",")",":","The","output","dimension",".","n_layers","(","int",")",":","Number","of","ecoder","layers",".","n_units","(","int",")",":","Number","of","attention","units",".","d_units","(","int",")",":","Dimension","of","input","vector","of","decoder",".","h","(","int",")",":","Number","of","attention","heads",".","dropout","(","float",")",":","Dropout","rate",".","initialW","(","Initializer",")",":","Initializer","to","initialize","the","weight",".","initial_bias","(","Initializer",")",":","Initializer","to","initialize","the","bias","."]
docstr: Initialize Decoder.
docstr_tok: ["Initialize","Decoder","."]
code: def __init__(self, odim, args, initialW=None, initial_bias=None):
      """Initialize Decoder."""
      super(Decoder, self).__init__()
      self.sos = odim - 1
      self.eos = odim - 1
      initialW = (
          chainer.initializers.Uniform if initialW is None else initialW
      )
      initial_bias = (
          chainer.initializers.Uniform
          if initial_bias is None
          else initial_bias
      )
      with self.init_scope():
          self.output_norm = LayerNorm(args.adim)
          self.pe = PositionalEncoding(args.adim, args.dropout_rate)
          stvd = 1.0 / np.sqrt(args.adim)
          self.output_layer = L.Linear(
              args.adim,
              odim,
              initialW=initialW(scale=stvd),
              initial_bias=initial_bias(scale=stvd),
          )
          self.embed = L.EmbedID(
              odim,
              args.adim,
              ignore_label=-1,
              initialW=chainer.initializers.Normal(scale=1.0),
          )
      for i in range(args.dlayers):
          name = "decoders." + str(i)
          layer = DecoderLayer(
              args.adim,
              d_units=args.dunits,
              h=args.aheads,
              dropout=args.dropout_rate,
              initialW=initialW,
              initial_bias=initial_bias,
          )
          self.add_link(name, layer)
      self.n_layers = args.dlayers
  
file_path: espnet/espnet/nets/chainer_backend/transformer/decoder.py
imports: import chainer
  import chainer.functions
  import chainer.links
  import numpy
  from espnet.nets.chainer_backend.transformer.decoder_layer import DecoderLayer
  from espnet.nets.chainer_backend.transformer.embedding import PositionalEncoding
  from espnet.nets.chainer_backend.transformer.layer_norm import LayerNorm
  from espnet.nets.chainer_backend.transformer.mask import make_history_mask
label_desc: Use image node_id 1 to create a new Decoder object from inherited base classes: chainer with example: obj = Decoder(odim, args, initialW, initial_bias)