code: def forward(
      self,
      dec_seq,
      enc_hiddens,
      last_hidden,
      method,
      return_last_state=False,
  ):
      # dec_seq = [B, T_, V], enc_hiddens = [B, T, H], last_hidden = [B, H]
      total_steps = dec_seq.get_shape().as_list()[1]
      states = last_hidden
      cell_outputs = list()
      for time_step in range(total_steps):
          attention_weights = self.score(
              enc_hiddens, last_hidden, method
          )
          attention_weights = tf.expand_dims(
              attention_weights, 1
          )  # [B, 1, T]
          context = tf.matmul(
              attention_weights, enc_hiddens
          )  # [B, 1, H]
          context = tf.squeeze(context, 1)  # [B, H]
          inputs = tf.concat([dec_seq[:, time_step, :], context], 1)
          if not isinstance(states, list):
              states = [states]
          cell_output, states = self.cell.call(
              inputs, states, training=self.is_train
          )
          cell_outputs.append(cell_output)
          last_hidden = states[0]
  
      cell_outputs = tf.convert_to_tensor(cell_outputs)
      cell_outputs = tf.transpose(cell_outputs, perm=[1, 0, 2])
      if return_last_state:
          return cell_outputs, last_hidden
      return cell_outputs
  
imports: import numpy
  import tensorflow
  import tensorlayer
  from tensorlayer.layers import Dense, Dropout, Input
  from tensorlayer.layers.core import Layer
  from tensorlayer.models import Model
label_desc: Use image node_id 4 for calling the Decoder_Attention obj's underlying member method code with example usage: obj.forward(dec_seq, enc_hiddens, last_hidden, method, return_last_state) and returns: cell_outputs, cell_outputs,  last_hidden