code: def _single_act(
      actor_id: int,
      model: torch.nn.Module,
      input_tensor: torch.Tensor,
      device: str,
      mc_n_sim: int,
      N_bar: int,
      cob: ChangeOfBasis,
      max_rank: int,
  ):
      """Executes an episode for a single actor using the MCTS.
      The method is called multiple times in parallel with different actor ids.
  
      Args:
          actor_id (int): The id of the actor.
          model (torch.nn.Module): The model used to take the action.
          input_tensor (torch.Tensor): State of the game.
          device (str): The name of the torch device used for training.
          mc_n_sim (int): Number of simulations during Monte Carlo tree search.
          N_bar (int): N_bar parameter used to compute tau when improving the
          policy.
          cob (ChangeOfBasis): The change of basis used to generate the input
          tensor.
          max_rank (int): The maximum matrix rank achieved by the actor before
          tree search is stopped.
      """
      print(f"Acting with actor {actor_id}")
      model.to(device)
      cob.device = device
      input_tensor = input_tensor.to(device)
      input_tensor_cob = cob(input_tensor)
      states, policies, rewards = actor_prediction(
          model, input_tensor_cob, max_rank, mc_n_sim, N_bar
      )
      print(f"Actor {actor_id} finished")
      states = [s.to("cpu") for s in states]
      policies = policies.to("cpu")
      rewards = rewards.to("cpu")
      return actor_id, states, policies, rewards
  
file_path: nebuly/optimization/open_alpha_tensor/open_alpha_tensor/core/training.py
imports: from pathlib import Path
  from typing import Tuple, List
  import torch.optim
  import tqdm
  from torch.utils.data import DataLoader
  from open_alpha_tensor.config import BASE_CHECKPOINT_DATA_DIR, BASE_CHECKPOINT_DIR
  from open_alpha_tensor.core.actors.stage import actor_prediction
  from open_alpha_tensor.core.data.basis_change import ChangeOfBasis
  from open_alpha_tensor.core.data.dataset import TensorGameDataset
  from open_alpha_tensor.core.data.generation import f_prob_distribution
  from open_alpha_tensor.core.data.utils import map_action_to_triplet
  from open_alpha_tensor.core.modules.alpha_tensor import AlphaTensorModel
label_desc: Use image node_id 1 for calling a global function with example usage: _single_act(actor_id, model, input_tensor, device, mc_n_sim, N_bar, cob, max_rank) and returns: actor_id,  states,  policies,  rewards