class_docstr: PyTorch version of above ActionMaskingModel.
class_docstr_tok: ["PyTorch","version","of","above","ActionMaskingModel","."]
code: def __init__(
      self,
      obs_space,
      action_space,
      num_outputs,
      model_config,
      name,
      **kwargs,
  ):
      orig_space = getattr(obs_space, "original_space", obs_space)
      assert (
          isinstance(orig_space, Dict)
          and "action_mask" in orig_space.spaces
          and "observations" in orig_space.spaces
      )
  
      TorchModelV2.__init__(
          self,
          obs_space,
          action_space,
          num_outputs,
          model_config,
          name,
          **kwargs,
      )
      nn.Module.__init__(self)
  
      self.internal_model = TorchFC(
          orig_space["observations"],
          action_space,
          num_outputs,
          model_config,
          name + "_internal",
      )
  
      # disable action masking --> will likely lead to invalid actions
      self.no_masking = False
      if "no_masking" in model_config["custom_model_config"]:
          self.no_masking = model_config["custom_model_config"][
              "no_masking"
          ]
  
file_path: ray/rllib/examples/models/action_mask_model.py
imports: from gymnasium.spaces import Dict
  from ray.rllib.models.tf.fcnet import FullyConnectedNetwork
  from ray.rllib.models.tf.tf_modelv2 import TFModelV2
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.models.torch.fcnet import FullyConnectedNetwork
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.torch_utils import FLOAT_MIN
label_desc: Use image node_id 1 to create a new TorchActionMaskModel object from inherited base classes: TorchModelV2, nn with example: obj = TorchActionMaskModel(obs_space, action_space, num_outputs, model_config, name)