code: def test_non_normalized_attention_works(self):
      attention = LegacyAttention(normalize=False)
      sentence_tensor = torch.FloatTensor(
          [[[-1, 0, 4], [1, 1, 1], [-1, 0, 4], [-1, 0, -1]]]
      )
      query_tensor = torch.FloatTensor([[0.1, 0.8, 0.5]])
      result = attention(query_tensor, sentence_tensor).data.numpy()
      assert_almost_equal(result, [[1.9, 1.4, 1.9, -0.6]])
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/modules/attention/legacy_attention_test.py
imports: from __future__ import absolute_import
  import numpy
  from numpy.testing import assert_almost_equal
  import torch
  from allennlp.common import Params
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.modules.attention.attention import Attention
  from allennlp.modules.attention.legacy_attention import LegacyAttention
label_desc: Use image node_id 6 for calling the TestLegacyAttention obj's underlying member method code with example usage: obj.test_non_normalized_attention_works() without return types