class_docstr: Decoder layer.
  
  Args:
      eprojs (int): Dimension of input variables from encoder.
      odim (int): The output dimension.
      dtype (str): Decoder type.
      dlayers (int): Number of layers for decoder.
      dunits (int): Dimension of input vector of decoder.
      sos (int): Number to indicate the start of sequences.
      eos (int): Number to indicate the end of sequences.
      att (Module): Attention module defined at
          `espnet.espnet.nets.chainer_backend.attentions`.
      verbose (int): Verbosity level.
      char_list (List[str]): List of all characters.
      labeldist (numpy.array): Distributed array of counted transcript length.
      lsm_weight (float): Weight to use when calculating the training loss.
      sampling_probability (float): Threshold for scheduled sampling.
class_docstr_tok: ["Decoder","layer",".","Args",":","eprojs","(","int",")",":","Dimension","of","input","variables","from","encoder",".","odim","(","int",")",":","The","output","dimension",".","dtype","(","str",")",":","Decoder","type",".","dlayers","(","int",")",":","Number","of","layers","for","decoder",".","dunits","(","int",")",":","Dimension","of","input","vector","of","decoder",".","sos","(","int",")",":","Number","to","indicate","the","start","of","sequences",".","eos","(","int",")",":","Number","to","indicate","the","end","of","sequences",".","att","(","Module",")",":","Attention","module","defined","at","`","espnet.espnet.nets.chainer_backend.attentions","`",".","verbose","(","int",")",":","Verbosity","level",".","char_list","(","List","[","str","]",")",":","List","of","all","characters",".","labeldist","(","numpy.array",")",":","Distributed","array","of","counted","transcript","length",".","lsm_weight","(","float",")",":","Weight","to","use","when","calculating","the","training","loss",".","sampling_probability","(","float",")",":","Threshold","for","scheduled","sampling","."]
docstr: Calculate all of attentions.
  
  Args:
      hs (list of chainer.Variable | N-dimensional array):
          Input variable from encoder.
      ys (list of chainer.Variable | N-dimensional array):
          Input variable of decoder.
  
  Returns:
      chainer.Variable: List of attention weights.
docstr_tok: ["Calculate","all","of","attentions",".","Args",":","hs","(","list","of","chainer.Variable","|","N-dimensional","array",")",":","Input","variable","from","encoder",".","ys","(","list","of","chainer.Variable","|","N-dimensional","array",")",":","Input","variable","of","decoder",".","Returns",":","chainer.Variable",":","List","of","attention","weights","."]
code: def calculate_all_attentions(self, hs, ys):
      """Calculate all of attentions.
  
      Args:
          hs (list of chainer.Variable | N-dimensional array):
              Input variable from encoder.
          ys (list of chainer.Variable | N-dimensional array):
              Input variable of decoder.
  
      Returns:
          chainer.Variable: List of attention weights.
  
      """
      # prepare input and output word sequences with sos/eos IDs
      eos = self.xp.array([self.eos], "i")
      sos = self.xp.array([self.sos], "i")
      ys_in = [F.concat([sos, y], axis=0) for y in ys]
      ys_out = [F.concat([y, eos], axis=0) for y in ys]
  
      # padding for ys with -1
      # pys: utt x olen
      pad_ys_in = F.pad_sequence(ys_in, padding=self.eos)
      pad_ys_out = F.pad_sequence(ys_out, padding=-1)
  
      # get length info
      olength = pad_ys_out.shape[1]
  
      # initialization
      c_list = [None]  # list of cell state of each layer
      z_list = [None]  # list of hidden state of each layer
      for _ in range(1, self.dlayers):
          c_list.append(None)
          z_list.append(None)
      att_w = None
      att_ws = []
      self.att.reset()  # reset pre-computation of h
  
      # pre-computation of embedding
      eys = self.embed(pad_ys_in)  # utt x olen x zdim
      eys = F.separate(eys, axis=1)
  
      # loop for an output sequence
      for i in range(olength):
          att_c, att_w = self.att(hs, z_list[0], att_w)
          ey = F.hstack((eys[i], att_c))  # utt x (zdim + hdim)
          z_list, c_list = self.rnn_forward(
              ey, z_list, c_list, z_list, c_list
          )
          att_ws.append(att_w)  # for debugging
  
      att_ws = F.stack(att_ws, axis=1)
      att_ws.to_cpu()
  
      return att_ws.data
  
file_path: espnet/espnet/nets/chainer_backend/rnn/decoders.py
imports: import logging
  import random
  from argparse import Namespace
  import chainer
  import chainer.functions
  import chainer.links
  import numpy
  import espnet.nets.chainer_backend.deterministic_embed_id
  from espnet.nets.ctc_prefix_score import CTCPrefixScore
  from espnet.nets.e2e_asr_common import end_detect
label_desc: Use image node_id 5 for calling the Decoder obj's underlying member method code with example usage: obj.calculate_all_attentions(hs, ys) and returns: att_ws