code: def test_forward(self):
      with tempfile.TemporaryDirectory() as tmp_dir:
          dict_file = osp.join(tmp_dir, "fake_chars.txt")
          create_dummy_dict_file(dict_file)
          # test diction cfg
          dict_cfg = dict(
              type="Dictionary",
              dict_file=dict_file,
              with_start=True,
              with_end=True,
              same_start_end=False,
              with_padding=True,
              with_unknown=False,
          )
          decoder = ABILanguageDecoder(
              dict_cfg, d_model=16, d_inner=16, max_seq_len=10
          )
          logits = torch.randn(2, 10, 39)
          result = decoder.forward_train(None, logits, None)
          self.assertIn("feature", result)
          self.assertIn("logits", result)
          self.assertEqual(
              result["feature"].shape, torch.Size([2, 10, 16])
          )
          self.assertEqual(
              result["logits"].shape, torch.Size([2, 10, 39])
          )
  
          decoder = ABILanguageDecoder(
              dict_cfg,
              d_model=16,
              d_inner=16,
              max_seq_len=10,
              with_self_attn=True,
              detach_tokens=False,
          )
          logits = torch.randn(2, 10, 39)
          result = decoder.forward_test(None, logits, None)
          self.assertIn("feature", result)
          self.assertIn("logits", result)
          self.assertEqual(
              result["feature"].shape, torch.Size([2, 10, 16])
          )
          self.assertEqual(
              result["logits"].shape, torch.Size([2, 10, 39])
          )
  
file_path: mmocr/tests/test_models/test_textrecog/test_decoders/test_abi_language_decoder.py
imports: import os.path
  import tempfile
  from unittest import TestCase
  import torch
  from mmocr.models.textrecog.decoders import ABILanguageDecoder
  from mmocr.testing import create_dummy_dict_file
label_desc: Use image node_id 2 for calling the TestABILanguageDecoder obj's underlying member method code with example usage: obj.test_forward() without return types