code: def forward(self, x, sPrev):
      batch_size, T, _ = x.shape  # [b x T x xDim]
      x = paddle.reshape(x, [-1, self.xDim])  # [(b x T) x xDim]
      xProj = self.xEmbed(x)  # [(b x T) x attDim]
      xProj = paddle.reshape(
          xProj, [batch_size, T, -1]
      )  # [b x T x attDim]
  
      sPrev = sPrev.squeeze(0)
      sProj = self.sEmbed(sPrev)  # [b x attDim]
      sProj = paddle.unsqueeze(sProj, 1)  # [b x 1 x attDim]
      sProj = paddle.expand(
          sProj, [batch_size, T, self.attDim]
      )  # [b x T x attDim]
  
      sumTanh = paddle.tanh(sProj + xProj)
      sumTanh = paddle.reshape(sumTanh, [-1, self.attDim])
  
      vProj = self.wEmbed(sumTanh)  # [(b x T) x 1]
      vProj = paddle.reshape(vProj, [batch_size, T])
      alpha = F.softmax(
          vProj, axis=1
      )  # attention weights for each sample in the minibatch
      return alpha
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import paddle
  from paddle import nn
  from paddle.nn import functional
label_desc: Use image node_id 2 for calling the AttentionUnit obj's underlying member method code with example usage: obj.forward(x, sPrev) and returns: alpha