code: def test_forward_shapes(self):
      self.parser.eval(Stage.EVAL)
      tokens = torch.tensor([[0, 1, 2, 3]])
      seq_lens = torch.tensor([tokens.shape[1]])
      dict_feat = (
          torch.tensor([[1, 1, 1, 1, 1, 1, 3, 1]]),
          torch.tensor([[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0]]),
          torch.tensor([[1, 1, 2, 1]]),
      )
  
      actions, scores = self.parser(
          tokens=tokens, seq_lens=seq_lens, dict_feat=dict_feat
      )[0]
      self.assertGreater(actions.shape[1], tokens.shape[1])
      self.assertEqual(actions.shape[0:2], scores.shape[0:2])
      self.assertEqual(
          scores.shape[2], len(self.parser.actions_vocab.itos)
      )
  
      # Beam Search Test
      self.parser.eval(Stage.TEST)
      results = self.parser(
          tokens=tokens,
          seq_lens=seq_lens,
          dict_feat=dict_feat,
          beam_size=3,
          top_k=3,
      )
      self.assertEqual(len(results), 3)
      for actions, scores in results:
          self.assertGreater(actions.shape[1], tokens.shape[1])
          self.assertEqual(actions.shape[0:2], scores.shape[0:2])
          self.assertEqual(
              scores.shape[2], len(self.parser.actions_vocab.itos)
          )
  
imports: import unittest
  from collections import Counter
  import torch
  import torch.nn
  from pytext.common.constants import Stage
  from pytext.config.module_config import PoolingType
  from pytext.legacy.vocab import Vocab
  from pytext.models.embeddings import DictEmbedding, EmbeddingList, WordEmbedding
  from pytext.models.semantic_parsers.rnng.rnng_data_structures import CompositionalNN, CompositionalSummationNN, Element, ParserState, StackLSTM
  from pytext.models.semantic_parsers.rnng.rnng_parser import RNNGParser
label_desc: Use image node_id 7 for calling the RNNGParserTest obj's underlying member method code with example usage: obj.test_forward_shapes() without return types