code: def test_cls_at_end(self):
      embedding = (
          torch.arange(20).reshape(5, 4).unsqueeze(-1).expand(5, 4, 7)
      )
      mask = torch.tensor(
          [
              [True, True, True, True],
              [True, True, True, False],
              [True, True, True, True],
              [True, False, False, False],
              [True, True, False, False],
          ]
      )
      expected = (
          torch.LongTensor([3, 6, 11, 12, 17])
          .unsqueeze(-1)
          .expand(5, 7)
      )
  
      encoder = ClsPooler(embedding_dim=7, cls_is_last_token=True)
      pooled = encoder(embedding, mask=mask)
  
      assert list(pooled.size()) == [5, 7]
      numpy.testing.assert_array_almost_equal(expected, pooled)
  
file_path: allennlp/tests/modules/seq2vec_encoders/cls_pooler_test.py
imports: import numpy
  import torch
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.modules.seq2vec_encoders.cls_pooler import ClsPooler
label_desc: Use image node_id 2 for calling the TestClsPooler obj's underlying member method code with example usage: obj.test_cls_at_end() without return types