code: def test_action_masking_block_multi():
      """perception test"""
  
      # prepare block input
      logits = torch.from_numpy(
          np.random.randn(32, 4).astype(np.float32)
      )
      mask = np.zeros(shape=(32, 2, 1), dtype=np.float32)
      for i in range(mask.shape[0]):
          for j in np.random.choice(mask.shape[1], size=3):
              mask[i, j] = 1.0
      mask = torch.from_numpy(mask)
  
      in_dict = {"logits": logits, "mask": mask}
  
      # with out reduction
      net = ActionMaskingBlock(
          in_keys=["logits", "mask"],
          out_keys=["masked_0", "masked_1"],
          in_shapes=[logits.shape[1:], mask.shape[1:]],
          num_actors=2,
          num_of_actor_actions=2,
      )
      str(net)
      out_dict = net(in_dict)
  
      assert isinstance(out_dict, Dict)
      assert len(out_dict.keys()) == 2
      assert out_dict["masked_0"].shape[-1] == 2
      assert out_dict["masked_1"].shape[-1] == 2
      assert net.out_shapes() == [
          out_dict["masked_0"].shape[1:],
          out_dict["masked_1"].shape[1:],
      ]
  
file_path: maze/maze/test/perception/blocks/test_general.py
imports: from typing import Dict
  import numpy
  import torch
  from torch import nn
  from maze.perception.blocks.feed_forward.dense import DenseBlock
  from maze.perception.blocks.general.action_masking import ActionMaskingBlock
  from maze.perception.blocks.general.concat import ConcatenationBlock
  from maze.perception.blocks.general.correlation import CorrelationBlock
  from maze.perception.blocks.general.flatten import FlattenBlock
  from maze.perception.blocks.general.gap import GlobalAveragePoolingBlock
  from maze.perception.blocks.general.slice import SliceBlock
  from maze.test.perception.perception_test_utils import build_multi_input_dict, build_input_dict
label_desc: Use image node_id 8 for calling a global function with example usage: test_action_masking_block_multi() without return types