class_docstr: The legacy implementation of ``MatrixAttention``.
  
  It should be considered deprecated as it uses much more memory than the newer specialized
  ``MatrixAttention`` modules.
  
  Parameters
  ----------
  similarity_function: ``SimilarityFunction``, optional (default=``DotProductSimilarity``)
      The similarity function to use when computing the attention.
code: def __init__(self, similarity_function=None):
      super(LegacyMatrixAttention, self).__init__()
      self._similarity_function = (
          similarity_function or DotProductSimilarity()
      )
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/matrix_attention/legacy_matrix_attention.py
imports: from __future__ import absolute_import
  import torch
  from allennlp.modules.similarity_functions.dot_product import DotProductSimilarity
  from allennlp.modules.similarity_functions.similarity_function import SimilarityFunction
  from allennlp.modules.matrix_attention.matrix_attention import MatrixAttention
label_desc: Use image node_id 1 to create a new LegacyMatrixAttention object from inherited base classes: MatrixAttention with example: obj = LegacyMatrixAttention(similarity_function)