class_docstr: An action masking block.
  
  The block takes two keys as input where the first key contains the logits tensor and the second key contains the
  binary mask tensor. Masking is performed by adding the smallest possible float32 number to the logits where the
  corresponding mask value is False (0.0).
  
  :param in_keys: Keys identifying the input tensors.
  :param out_keys: Keys identifying the output tensors.
  :param in_shapes: List of input shapes.
class_docstr_tok: ["An","action","masking","block",".","The","block","takes","two","keys","as","input","where","the","first","key","contains","the","logits","tensor","and","the","second","key","contains","the","binary","mask","tensor",".","Masking","is","performed","by","adding","the","smallest","possible","float32","number","to","the","logits","where","the","corresponding","mask","value","is","False","(","0.0",")",".",":","param","in_keys",":","Keys","identifying","the","input","tensors",".",":","param","out_keys",":","Keys","identifying","the","output","tensors",".",":","param","in_shapes",":","List","of","input","shapes","."]
docstr: Compute the forward pass for a single actor.
  
  :param action_logits: the action logits
  :param action_mask: the actions mask
docstr_tok: ["Compute","the","forward","pass","for","a","single","actor",".",":","param","action_logits",":","the","action","logits",":","param","action_mask",":","the","actions","mask"]
code: def _forward_multi(
      self, action_logits: torch.Tensor, action_mask: torch.Tensor
  ) -> Dict[str, torch.Tensor]:
      """Compute the forward pass for a single actor.
  
      :param action_logits: the action logits
      :param action_mask: the actions mask
      """
      actor_actions_dict = dict()
      for actor_idx in range(self.num_actors):
          start_idx = actor_idx * self.num_of_actor_actions
          end_idx = start_idx + self.num_of_actor_actions
  
          mask = action_mask[..., actor_idx, :]
          inverted_mask = torch.tensor(1.0).to(mask.device) - mask
          machine_logits = (
              action_logits[..., start_idx:end_idx]
              + inverted_mask * np.finfo(np.float32).min
          )
  
          actor_actions_dict[self.out_keys[actor_idx]] = machine_logits
  
      return actor_actions_dict
  
file_path: maze/maze/perception/blocks/general/action_masking.py
imports: from typing import Union, List, Dict, Sequence
  import numpy
  import torch
  from maze.core.annotations import override
  from maze.perception.blocks.base import PerceptionBlock
label_desc: Use image node_id 3 for calling the ActionMaskingBlock obj's underlying member method code with example usage: obj._forward_multi(action_logits, action_mask) and returns: actor_actions_dict