code: def test_forward_works_with_higher_order_tensors(self):
      linear = LinearSimilarity(7, 7, combination="x,y")
      weights = numpy.random.rand(14)
      linear._weight_vector = Parameter(
          torch.from_numpy(weights).float()
      )
      linear._bias = Parameter(torch.FloatTensor([0.0]))
      a_vectors = numpy.random.rand(5, 4, 3, 6, 7)
      b_vectors = numpy.random.rand(5, 4, 3, 6, 7)
      result = linear(
          torch.from_numpy(a_vectors).float(),
          torch.from_numpy(b_vectors).float(),
      )
      result = result.data.numpy()
      assert result.shape == (5, 4, 3, 6)
      combined_vectors = numpy.concatenate(
          [a_vectors[3, 2, 1, 3, :], b_vectors[3, 2, 1, 3, :]]
      )
      expected_result = numpy.dot(combined_vectors, weights)
      assert_almost_equal(
          result[3, 2, 1, 3], expected_result, decimal=6
      )
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/modules/similarity_functions/linear_test.py
imports: from __future__ import absolute_import
  import numpy
  from numpy.testing import assert_almost_equal
  import torch
  from torch.nn.parameter import Parameter
  from allennlp.common import Params
  from allennlp.modules.similarity_functions import LinearSimilarity
  from allennlp.common.testing import AllenNlpTestCase
label_desc: Use image node_id 3 for calling the TestLinearSimilarityFunction obj's underlying member method code with example usage: obj.test_forward_works_with_higher_order_tensors() without return types