code: def discrete_dqn_scorer(q_network: ModelBase) -> Scorer:
      @torch.no_grad()
      def score(
          preprocessed_obs: rlt.FeatureData,
          possible_actions_mask: Optional[torch.Tensor] = None,
      ) -> torch.Tensor:
          q_network.eval()
          scores = q_network(preprocessed_obs)
          # qrdqn returns (batchsize, num_actions, num_atoms)
          if scores.dim() == 3:
              scores = scores.mean(dim=2)
          assert (
              scores.dim() == 2
          ), f"{scores.shape} isn't (batchsize, num_actions)."
          q_network.train()
          scores = apply_possible_actions_mask(
              scores, possible_actions_mask
          )
          return scores
  
      return score
  
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 2 for calling a global function with example usage: discrete_dqn_scorer(q_network) and returns: score, scores