code: def test_can_init_cosine(self):
      legacy_attention = Attention.from_params(
          Params({"type": "cosine"})
      )
      isinstance(legacy_attention, CosineAttention)
  
file_path: allennlp/tests/modules/attention/cosine_attention_test.py
imports: import torch
  from numpy.testing import assert_almost_equal
  import numpy
  from allennlp.common import Params
  from allennlp.common.testing.test_case import AllenNlpTestCase
  from allennlp.modules.attention.attention import Attention
  from allennlp.modules.attention.cosine_attention import CosineAttention
label_desc: Use image node_id 1 for calling the TestCosineAttention obj's underlying member method code with example usage: obj.test_can_init_cosine() without return types