class_docstr: Locally sensitive attention model.
  
  Args:
      attention_rnn_dim (int): Number of hidden units for RNN.
      encoder_embedding_dim (int): Number of embedding dimensions in the Encoder.
      attention_hidden_dim (int): Dimension of attention hidden representation.
      attention_location_n_filter (int): Number of filters for Attention model.
      attention_location_kernel_size (int): Kernel size for Attention model.
class_docstr_tok: ["Locally","sensitive","attention","model",".","Args",":","attention_rnn_dim","(","int",")",":","Number","of","hidden","units","for","RNN",".","encoder_embedding_dim","(","int",")",":","Number","of","embedding","dimensions","in","the","Encoder",".","attention_hidden_dim","(","int",")",":","Dimension","of","attention","hidden","representation",".","attention_location_n_filter","(","int",")",":","Number","of","filters","for","Attention","model",".","attention_location_kernel_size","(","int",")",":","Kernel","size","for","Attention","model","."]
docstr: Pass the input through the Attention model.
  
  Args:
      attention_hidden_state (Tensor): Attention rnn last output with shape (n_batch, ``attention_rnn_dim``).
      memory (Tensor): Encoder outputs with shape (n_batch, max of ``text_lengths``, ``encoder_embedding_dim``).
      processed_memory (Tensor): Processed Encoder outputs
          with shape (n_batch, max of ``text_lengths``, ``attention_hidden_dim``).
      attention_weights_cat (Tensor): Previous and cumulative attention weights
          with shape (n_batch, current_num_frames * 2, max of ``text_lengths``).
      mask (Tensor): Binary mask for padded data with shape (n_batch, current_num_frames).
  
  Returns:
      attention_context (Tensor): Context vector with shape (n_batch, ``encoder_embedding_dim``).
      attention_weights (Tensor): Attention weights with shape (n_batch, max of ``text_lengths``).
docstr_tok: ["Pass","the","input","through","the","Attention","model",".","Args",":","attention_hidden_state","(","Tensor",")",":","Attention","rnn","last","output","with","shape","(","n_batch",",","``","attention_rnn_dim","``",")",".","memory","(","Tensor",")",":","Encoder","outputs","with","shape","(","n_batch",",","max","of","``","text_lengths","``",",","``","encoder_embedding_dim","``",")",".","processed_memory","(","Tensor",")",":","Processed","Encoder","outputs","with","shape","(","n_batch",",","max","of","``","text_lengths","``",",","``","attention_hidden_dim","``",")",".","attention_weights_cat","(","Tensor",")",":","Previous","and","cumulative","attention","weights","with","shape","(","n_batch",",","current_num_frames","*","2",",","max","of","``","text_lengths","``",")",".","mask","(","Tensor",")",":","Binary","mask","for","padded","data","with","shape","(","n_batch",",","current_num_frames",")",".","Returns",":","attention_context","(","Tensor",")",":","Context","vector","with","shape","(","n_batch",",","``","encoder_embedding_dim","``",")",".","attention_weights","(","Tensor",")",":","Attention","weights","with","shape","(","n_batch",",","max","of","``","text_lengths","``",")","."]
code: def forward(
      self,
      attention_hidden_state: Tensor,
      memory: Tensor,
      processed_memory: Tensor,
      attention_weights_cat: Tensor,
      mask: Tensor,
  ) -> Tuple[Tensor, Tensor]:
      r"""Pass the input through the Attention model.
  
      Args:
          attention_hidden_state (Tensor): Attention rnn last output with shape (n_batch, ``attention_rnn_dim``).
          memory (Tensor): Encoder outputs with shape (n_batch, max of ``text_lengths``, ``encoder_embedding_dim``).
          processed_memory (Tensor): Processed Encoder outputs
              with shape (n_batch, max of ``text_lengths``, ``attention_hidden_dim``).
          attention_weights_cat (Tensor): Previous and cumulative attention weights
              with shape (n_batch, current_num_frames * 2, max of ``text_lengths``).
          mask (Tensor): Binary mask for padded data with shape (n_batch, current_num_frames).
  
      Returns:
          attention_context (Tensor): Context vector with shape (n_batch, ``encoder_embedding_dim``).
          attention_weights (Tensor): Attention weights with shape (n_batch, max of ``text_lengths``).
      """
      alignment = self._get_alignment_energies(
          attention_hidden_state,
          processed_memory,
          attention_weights_cat,
      )
  
      alignment = alignment.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: import warnings
  from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
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