code: def apply_possible_actions_mask(
      scores: torch.Tensor,
      possible_actions_mask: Optional[torch.Tensor] = None,
      invalid_score: float = NEG_INF,
  ) -> torch.Tensor:
      if possible_actions_mask is None:
          return scores
      possible_actions_mask = possible_actions_mask.unsqueeze(0)
      assert (
          scores.shape == possible_actions_mask.shape
      ), f"{scores.shape} != {possible_actions_mask.shape}"
      scores[~possible_actions_mask] = invalid_score
      return scores
  
file_path: ReAgent/reagent/gym/policies/scorers/discrete_scorer.py
imports: from typing import Optional, Tuple
  import reagent.core.types
  import torch
  from reagent.gym.preprocessors.trainer_preprocessor import get_possible_actions_for_gym
  from reagent.gym.types import Scorer
  from reagent.models.base import ModelBase
label_desc: Use image node_id 1 for calling a global function with example usage: apply_possible_actions_mask(scores, possible_actions_mask, invalid_score) and returns: scores, scores