code: def test_get_action_embeddings(self):
      action_embeddings = torch.rand(5, 4)
      self.state.action_embeddings = action_embeddings
      self.state.output_action_embeddings = action_embeddings
      self.state.action_biases = torch.rand(5, 1)
      actions_to_embed = [[0, 4], [1], [2, 3, 4]]
      (
          embeddings,
          _,
          _,
          mask,
      ) = WikiTablesDecoderStep._get_action_embeddings(
          self.state, actions_to_embed
      )
      assert_almost_equal(
          mask.detach().cpu().numpy(), [[1, 1, 0], [1, 0, 0], [1, 1, 1]]
      )
      assert tuple(embeddings.size()) == (3, 3, 4)
      assert_almost_equal(
          embeddings[0, 0].detach().cpu().numpy(),
          action_embeddings[0].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[0, 1].detach().cpu().numpy(),
          action_embeddings[4].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[0, 2].detach().cpu().numpy(),
          action_embeddings[0].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[1, 0].detach().cpu().numpy(),
          action_embeddings[1].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[1, 1].detach().cpu().numpy(),
          action_embeddings[0].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[1, 2].detach().cpu().numpy(),
          action_embeddings[0].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[2, 0].detach().cpu().numpy(),
          action_embeddings[2].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[2, 1].detach().cpu().numpy(),
          action_embeddings[3].detach().cpu().numpy(),
      )
      assert_almost_equal(
          embeddings[2, 2].detach().cpu().numpy(),
          action_embeddings[4].detach().cpu().numpy(),
      )
  
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 4 for calling the WikiTablesDecoderStepTest obj's underlying member method code with example usage: obj.test_get_action_embeddings() without return types