class_docstr: Executes a policy- and value-network guided MCTS search.
class_docstr_tok: ["Executes","a","policy-","and","value-network","guided","MCTS","search","."]
code: def __init__(
      self,
      environment_spec: specs.EnvironmentSpec,
      model: models.Model,
      network: snt.Module,
      discount: float,
      num_simulations: int,
      adder: Optional[adders.Adder] = None,
      variable_client: Optional[
          tf2_variable_utils.VariableClient
      ] = None,
  ):
      # Internalize components: model, network, data sink and variable source.
      self._model = model
      self._network = tf.function(network)
      self._variable_client = variable_client
      self._adder = adder
  
      # Internalize hyperparameters.
      self._num_actions = environment_spec.actions.num_values
      self._num_simulations = num_simulations
      self._actions = list(range(self._num_actions))
      self._discount = discount
  
      # We need to save the policy so as to add it to replay on the next step.
      self._probs = (
          np.ones(shape=(self._num_actions,), dtype=np.float32)
          / self._num_actions
      )
  
imports: from typing import Optional, Tuple
  import acme
  from acme import adders
  from acme import specs
  from acme.agents.tf.mcts import models
  from acme.agents.tf.mcts import search
  from acme.agents.tf.mcts import types
  from acme.tf import variable_utils
  import dm_env
  import numpy
  from scipy import special
  import sonnet
  import tensorflow
label_desc: Use image node_id 1 to create a new MCTSActor object from inherited base classes: acme with example: obj = MCTSActor(environment_spec, model, network, discount, num_simulations, adder, variable_client)