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: Forward decoder.
  
  :param xp.array e: input token ids, int64 (batch, maxlen_out)
  :param xp.array yy_mask: input token mask, uint8  (batch, maxlen_out)
  :param xp.array source: encoded memory, float32  (batch, maxlen_in, feat)
  :param xp.array xy_mask: encoded memory mask, uint8  (batch, maxlen_in)
  :return e: decoded token score before softmax (batch, maxlen_out, token)
  :rtype: chainer.Variable
docstr_tok: ["Forward","decoder",".",":","param","xp.array","e",":","input","token","ids",",","int64","(","batch",",","maxlen_out",")",":","param","xp.array","yy_mask",":","input","token","mask",",","uint8","(","batch",",","maxlen_out",")",":","param","xp.array","source",":","encoded","memory",",","float32","(","batch",",","maxlen_in",",","feat",")",":","param","xp.array","xy_mask",":","encoded","memory","mask",",","uint8","(","batch",",","maxlen_in",")",":","return","e",":","decoded","token","score","before","softmax","(","batch",",","maxlen_out",",","token",")",":","rtype",":","chainer.Variable"]
code: def forward(self, ys_pad, source, x_mask):
      """Forward decoder.
  
      :param xp.array e: input token ids, int64 (batch, maxlen_out)
      :param xp.array yy_mask: input token mask, uint8  (batch, maxlen_out)
      :param xp.array source: encoded memory, float32  (batch, maxlen_in, feat)
      :param xp.array xy_mask: encoded memory mask, uint8  (batch, maxlen_in)
      :return e: decoded token score before softmax (batch, maxlen_out, token)
      :rtype: chainer.Variable
      """
      xp = self.xp
      sos = np.array([self.sos], np.int32)
      ys = [np.concatenate([sos, y], axis=0) for y in ys_pad]
      e = F.pad_sequence(ys, padding=self.eos).data
      e = xp.array(e)
      # mask preparation
      xy_mask = self.make_attention_mask(e, xp.array(x_mask))
      yy_mask = self.make_attention_mask(e, e)
      yy_mask *= make_history_mask(xp, e)
  
      e = self.pe(self.embed(e))
      batch, length, dims = e.shape
      e = e.reshape(-1, dims)
      source = source.reshape(-1, dims)
      for i in range(self.n_layers):
          e = self["decoders." + str(i)](
              e, source, xy_mask, yy_mask, batch
          )
      return self.output_layer(self.output_norm(e)).reshape(
          batch, length, -1
      )
  
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 3 for calling the Decoder obj's underlying member method code with example usage: obj.forward(ys_pad, source, x_mask) and returns: self