code: def compute_actions_from_input_dict(
      self,
      input_dict,
      explore=None,
      timestep=None,
      episodes=None,
      **kwargs,
  ):
      with torch.no_grad():
          actions = []
          for i, episode in enumerate(episodes):
              if episode.length == 0:
                  # if first time step of episode, get initial env state
                  env_state = episode.user_data["initial_state"]
                  # verify if env has been wrapped for ranked rewards
                  if (
                      self.env.__class__.__name__
                      == "RankedRewardsEnvWrapper"
                  ):
                      # r2 env state contains also the rewards buffer state
                      env_state = {
                          "env_state": env_state,
                          "buffer_state": None,
                      }
                  # create tree root node
                  obs = self.env.set_state(env_state)
                  tree_node = Node(
                      state=env_state,
                      obs=obs,
                      reward=0,
                      done=False,
                      action=None,
                      parent=RootParentNode(env=self.env),
                      mcts=self.mcts,
                  )
              else:
                  # otherwise get last root node from previous time step
                  tree_node = episode.user_data["tree_node"]
  
              # run monte carlo simulations to compute the actions
              # and record the tree
              mcts_policy, action, tree_node = self.mcts.compute_action(
                  tree_node
              )
              # record action
              actions.append(action)
              # store new node
              episode.user_data["tree_node"] = tree_node
  
              # store mcts policies vectors and current tree root node
              if episode.length == 0:
                  episode.user_data["mcts_policies"] = [mcts_policy]
              else:
                  episode.user_data["mcts_policies"].append(mcts_policy)
  
          return (
              np.array(actions),
              [],
              self.extra_action_out(
                  input_dict,
                  kwargs.get("state_batches", []),
                  self.model,
                  None,
              ),
          )
  
file_path: ray/rllib_contrib/alpha_zero/src/rllib_alpha_zero/alpha_zero/alpha_zero_policy.py
imports: import numpy
  from rllib_alpha_zero.alpha_zero.mcts import Node, RootParentNode
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.torch_policy import TorchPolicy
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.metrics.learner_info import LEARNER_STATS_KEY
label_desc: Use image node_id 3 for calling the AlphaZeroPolicy obj's underlying member method code with example usage: obj.compute_actions_from_input_dict(input_dict, explore, timestep, episodes) and returns: np,  list,  self