code: def test_get_actions_to_consider(self):
      # pylint: disable=protected-access
      valid_actions_1 = {"e": [0, 1, 2, 4]}
      valid_actions_2 = {"e": [0, 1, 3]}
      valid_actions_3 = {"e": [2, 3, 4]}
      self.state.grammar_state[0] = GrammarState(
          ["e"], {}, valid_actions_1, {}, is_nonterminal
      )
      self.state.grammar_state[1] = GrammarState(
          ["e"], {}, valid_actions_2, {}, is_nonterminal
      )
      self.state.grammar_state[2] = GrammarState(
          ["e"], {}, valid_actions_3, {}, is_nonterminal
      )
  
      # We're making a bunch of the actions linked actions here, pretending that there are only
      # two global actions.
      self.state.action_indices = {
          (0, 0): 1,
          (0, 1): 0,
          (0, 2): -1,
          (0, 3): -1,
          (0, 4): -1,
          (1, 0): -1,
          (1, 1): 0,
          (1, 2): -1,
          (1, 3): -1,
      }
  
      (
          considered,
          to_embed,
          to_link,
      ) = WikiTablesDecoderStep._get_actions_to_consider(self.state)
      # These are _global_ action indices.  They come from actions [[(0, 0), (0, 1)], [(1, 1)], []].
      expected_to_embed = [[1, 0], [0], []]
      assert to_embed == expected_to_embed
      # These are _batch_ action indices with a _global_ action index of -1.
      # They come from actions [[(0, 2), (0, 4)], [(1, 0), (1, 3)], [(0, 2), (0, 3), (0, 4)]].
      expected_to_link = [[2, 4], [0, 3], [2, 3, 4]]
      assert to_link == expected_to_link
      # These are _batch_ action indices, with padding in between the embedded actions and the
      # linked actions (and after the linked actions, if necessary).
      expected_considered = [
          [0, 1, 2, 4, -1],
          [1, -1, 0, 3, -1],
          [-1, -1, 2, 3, 4],
      ]
      assert considered == expected_considered
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/models/semantic_parsing/wikitables/wikitables_decoder_step_test.py
imports: from __future__ import absolute_import
  from numpy.testing import assert_almost_equal
  import torch
  from allennlp.common import Params
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.models.semantic_parsing.wikitables.wikitables_decoder_state import WikiTablesDecoderState
  from allennlp.models.semantic_parsing.wikitables.wikitables_decoder_step import WikiTablesDecoderStep
  from allennlp.modules import SimilarityFunction
  from allennlp.nn.decoding import GrammarState, RnnState
  from allennlp.semparse.type_declarations.type_declaration import is_nonterminal
label_desc: Use image node_id 2 for calling the WikiTablesDecoderStepTest obj's underlying member method code with example usage: obj.test_get_actions_to_consider() without return types