code: def test_forward_works_on_simple_input(self):
      attention = LegacyMatrixAttention(DotProductSimilarity())
      sentence_1_tensor = torch.FloatTensor([[[1, 1, 1], [-1, 0, 1]]])
      sentence_2_tensor = torch.FloatTensor(
          [[[1, 1, 1], [-1, 0, 1], [-1, -1, -1]]]
      )
      result = attention(
          sentence_1_tensor, sentence_2_tensor
      ).data.numpy()
      assert result.shape == (1, 2, 3)
      assert_allclose(result, [[[3, 0, -3], [0, 2, 0]]])
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/modules/matrix_attention/legacy_matrix_attention_test.py
imports: from __future__ import absolute_import
  from numpy.testing import assert_allclose
  import torch
  from allennlp.common import Params
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.modules.matrix_attention.legacy_matrix_attention import LegacyMatrixAttention
  from allennlp.modules.matrix_attention.matrix_attention import MatrixAttention
  from allennlp.modules.similarity_functions.dot_product import DotProductSimilarity
label_desc: Use image node_id 1 for calling the TestLegacyMatrixAttention obj's underlying member method code with example usage: obj.test_forward_works_on_simple_input() without return types