code: def attention(self, query, enc_output, mask=None):
      query = paddle.unsqueeze(query, [1])
      memory = paddle.static.nn.fc(
          enc_output,
          self.hidden_size,
          num_flatten_dims=2,
          weight_attr=ParamAttr(
              name="dec_memory_w",
              initializer=nn.initializer.Uniform(
                  low=-self.init_scale, high=self.init_scale
              ),
          ),
      )
      attn = paddle.matmul(query, memory, transpose_y=True)
  
      if mask:
          attn = paddle.transpose(attn, [1, 0, 2])
          attn = attn + (mask * 1000000000)
          attn = paddle.transpose(attn, [1, 0, 2])
      weight = nn.functional.softmax(attn)
      weight_memory = paddle.matmul(weight, memory)
  
      return weight_memory
  
imports: import time
  from collections import OrderedDict
  import numpy
  import paddle
  import paddle.nn
  from paddle import ParamAttr
  from paddle.nn import BeamSearchDecoder
  from paddle.nn import dynamic_decode
  from paddle.nn import LSTMCell
  from paddle.nn import RNN
  from paddle.nn import RNNCellBase
  from paddlehub.compat.task.base_task import BaseTask
  from paddlehub.compat.task.metrics import compute_bleu
label_desc: Use image node_id 2 for calling the AttentionDecoderCell obj's underlying member method code with example usage: obj.attention(query, enc_output, mask) and returns: weight_memory