class_docstr: An ``Attention`` takes two inputs: a (batched) vector and a matrix, plus an optional mask on the
  rows of the matrix.  We compute the similarity between the vector and each row in the matrix,
  and then (optionally) perform a softmax over rows using those computed similarities.
  
  
  Inputs:
  
  - vector: shape ``(batch_size, embedding_dim)``
  - matrix: shape ``(batch_size, num_rows, embedding_dim)``
  - matrix_mask: shape ``(batch_size, num_rows)``, specifying which rows are just padding.
  
  Output:
  
  - attention: shape ``(batch_size, num_rows)``.
  
  Parameters
  ----------
  normalize : ``bool``, optional (default: ``True``)
      If true, we normalize the computed similarities with a softmax, to return a probability
      distribution for your attention.  If false, this is just computing a similarity score.
code: def forward(
      self,  # pylint: disable=arguments-differ
      vector,
      matrix,
      matrix_mask=None,
  ):
      similarities = self._forward_internal(vector, matrix)
      if self._normalize:
          return masked_softmax(similarities, matrix_mask)
      else:
          return similarities
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/attention/attention.py
imports: from __future__ import absolute_import
  import torch
  from allennlp.common.registrable import Registrable
  from allennlp.nn.util import masked_softmax
label_desc: Use image node_id 2 for calling the Attention obj's underlying member method code with example usage: obj.forward(vector, matrix, matrix_mask) and returns: masked_softmax, similarities