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 forward(self, matrix_1, matrix_2):
      tiled_matrix_1 = matrix_1.unsqueeze(2).expand(
          matrix_1.size()[0],
          matrix_1.size()[1],
          matrix_2.size()[1],
          matrix_1.size()[2],
      )
      tiled_matrix_2 = matrix_2.unsqueeze(1).expand(
          matrix_2.size()[0],
          matrix_1.size()[1],
          matrix_2.size()[1],
          matrix_2.size()[2],
      )
      return self._similarity_function(tiled_matrix_1, tiled_matrix_2)
  
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 2 for calling the LegacyMatrixAttention obj's underlying member method code with example usage: obj.forward(matrix_1, matrix_2) and returns: self