docstr: PARAMS
  ------
  attention_hidden_state: attention rnn last output
  memory: encoder outputs
  processed_memory: processed encoder outputs
  attention_weights_cat: previous and cummulative attention weights
  mask: binary mask for padded data
docstr_tok: ["PARAMS","--","--","--","attention_hidden_state",":","attention","rnn","last","output","memory",":","encoder","outputs","processed_memory",":","processed","encoder","outputs","attention_weights_cat",":","previous","and","cummulative","attention","weights","mask",":","binary","mask","for","padded","data"]
code: def forward(
      self,
      attention_hidden_state,
      memory,
      processed_memory,
      attention_weights_cat,
      mask,
  ):
      """
      PARAMS
      ------
      attention_hidden_state: attention rnn last output
      memory: encoder outputs
      processed_memory: processed encoder outputs
      attention_weights_cat: previous and cummulative attention weights
      mask: binary mask for padded data
      """
      alignment = self.get_alignment_energies(
          attention_hidden_state,
          processed_memory,
          attention_weights_cat,
      )
  
      if mask is not None:
          alignment.data.masked_fill_(mask, self.score_mask_value)
  
      attention_weights = F.softmax(alignment, dim=1)
      attention_context = torch.bmm(
          attention_weights.unsqueeze(1), memory
      )
      attention_context = attention_context.squeeze(1)
  
      return attention_context, attention_weights
  
imports: from math import sqrt
  import torch
  import torch.distributions
  from torch.autograd import Variable
  from torch import nn
  from torch.nn import functional
  from .layers import ConvNorm, LinearNorm, GlobalAvgPool
  from .utils import to_gpu, get_mask_from_lengths
label_desc: Use image node_id 3 for calling the Attention obj's underlying member method code with example usage: obj.forward(attention_hidden_state, memory, processed_memory, attention_weights_cat, mask) and returns: attention_context,  attention_weights