code: def test_forward_does_correct_computation(self):
      encoder = CnnEncoder(
          embedding_dim=2, num_filters=1, ngram_filter_sizes=(1, 2)
      )
      constant_init = Initializer.from_params(
          Params({"type": "constant", "val": 1.0})
      )
      initializer = InitializerApplicator([(".*", constant_init)])
      initializer(encoder)
      input_tensor = torch.FloatTensor([[[0.7, 0.8], [0.1, 1.5]]])
      encoder_output = encoder(input_tensor, None)
      assert_almost_equal(
          encoder_output.data.numpy(),
          numpy.asarray([[1.6 + 1.0, 3.1 + 1.0]]),
          decimal=6,
      )
  
file_path: allennlp/tests/modules/seq2vec_encoders/cnn_encoder_test.py
imports: import numpy
  from numpy.testing import assert_almost_equal
  import torch
  from allennlp.common import Params
  from allennlp.modules.seq2vec_encoders import CnnEncoder
  from allennlp.nn import InitializerApplicator, Initializer
  from allennlp.common.testing import AllenNlpTestCase
label_desc: Use image node_id 3 for calling the TestCnnEncoder obj's underlying member method code with example usage: obj.test_forward_does_correct_computation() without return types