code: def get_model_actions(
      scores: torch.Tensor,
      mask: Optional[torch.Tensor] = None,
      randomize_ties: bool = False,
  ) -> torch.Tensor:
      """
      Given a tensor of scores, get the indices of chosen actions.
      Chosen actions are the score argmax (within each row), subject to optional mask.
      if `randomize_ties`=True, we will also randomize the order of tied actions with
          maximum values. This has computational cost compared to not randomizing (use 1st index)
      """
      if mask is None:
          if randomize_ties:
              model_actions = argmax_random_tie_breaks(scores).reshape(
                  -1, 1
              )
          else:
              model_actions = torch.argmax(scores, dim=1).reshape(-1, 1)
      else:
          if randomize_ties:
              model_actions = argmax_random_tie_breaks(scores, mask)
          else:
              # mask out non-present arms
              scores_masked = torch.masked.as_masked_tensor(
                  scores, mask.bool()
              )
              model_actions = (
                  # pyre-fixme[16]: `Tensor` has no attribute `get_data`.
                  torch.argmax(scores_masked, dim=1)
                  .get_data()
                  .reshape(-1, 1)
              )
      return model_actions
  
file_path: ReAgent/reagent/training/cb/utils.py
imports: import logging
  from dataclasses import replace
  from typing import List, Optional, Union
  import torch
  from reagent.core.types import CBInput
label_desc: Use image node_id 3 for calling a global function with example usage: get_model_actions(scores, mask, randomize_ties) and returns: model_actions