class_docstr: PaddlePaddle 2.1 casts memory_mask.dtype to memory.dtype, but in STACL,
  type of memory is list, having no dtype attribute.
class_docstr_tok: ["PaddlePaddle","2.1","casts","memory_mask.dtype","to","memory.dtype",",","but","in","STACL",",","type","of","memory","is","list",",","having","no","dtype","attribute","."]
code: def forward(
      self, tgt, memory, tgt_mask=None, memory_mask=None, cache=None
  ):
      output = tgt
      new_caches = []
      for i, mod in enumerate(self.layers):
          if cache is None:
              output = mod(
                  output,
                  memory,
                  tgt_mask=tgt_mask,
                  memory_mask=memory_mask,
                  cache=None,
              )
          else:
              output, new_cache = mod(
                  output,
                  memory,
                  tgt_mask=tgt_mask,
                  memory_mask=memory_mask,
                  cache=cache[i],
              )
              new_caches.append(new_cache)
  
      if self.norm is not None:
          output = self.norm(output)
  
      return output if cache is None else (output, new_caches)
  
file_path: PaddleHub/modules/text/simultaneous_translation/stacl/transformer_nist_wait_1/model.py
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddlenlp.transformers import WordEmbedding, PositionalEmbedding
label_desc: Use image node_id 1 for calling the Decoder obj's underlying member method code with example usage: obj.forward(tgt, memory, tgt_mask, memory_mask, cache) and returns: unknown