code: def test_weights_are_correct_sizes(self):
      # pylint: disable=protected-access
      similarity = MultiHeadedSimilarity(
          num_heads=3,
          tensor_1_dim=9,
          tensor_1_projected_dim=6,
          tensor_2_dim=6,
          tensor_2_projected_dim=12,
      )
      assert list(similarity._tensor_1_projection.size()) == [9, 6]
      assert list(similarity._tensor_2_projection.size()) == [6, 12]
      with pytest.raises(ConfigurationError):
          similarity = MultiHeadedSimilarity(
              num_heads=3, tensor_1_dim=10
          )
      with pytest.raises(ConfigurationError):
          params = Params(
              {"num_heads": 3, "tensor_1_dim": 9, "tensor_2_dim": 10}
          )
          MultiHeadedSimilarity.from_params(params)
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/modules/similarity_functions/multiheaded_test.py
imports: from __future__ import with_statement
  from __future__ import absolute_import
  from numpy.testing import assert_almost_equal
  import pytest
  import torch
  from torch.nn.parameter import Parameter
  from allennlp.common import Params
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.modules.similarity_functions import MultiHeadedSimilarity
label_desc: Use image node_id 1 for calling the TestMultiHeadedSimilarityFunction obj's underlying member method code with example usage: obj.test_weights_are_correct_sizes() without return types