class_docstr: Program definition for distributional (MoG) MPO.
class_docstr_tok: ["Program","definition","for","distributional","(","MoG",")","MPO","."]
docstr: The actor process.
docstr_tok: ["The","actor","process","."]
code: def actor(
      self,
      replay: reverb.Client,
      variable_source: acme.VariableSource,
      counter: counting.Counter,
      actor_id: int,
  ) -> acme.EnvironmentLoop:
      """The actor process."""
  
      # Create environment and target networks to act with.
      environment = self._environment_factory(False)
      agent_networks = self._network_factory(self._environment_spec)
  
      # Create a stochastic behavior policy.
      behavior_network = snt.Sequential(
          [
              agent_networks["observation"],
              agent_networks["policy"],
              networks.StochasticSamplingHead(),
          ]
      )
  
      # Ensure network variables are created.
      policy_variables = {"policy": behavior_network.variables}
  
      # Create the variable client responsible for keeping the actor up-to-date.
      variable_client = tf2_variable_utils.VariableClient(
          variable_source, policy_variables, update_period=1000
      )
  
      # Make sure not to use a random policy after checkpoint restoration by
      # assigning variables before running the environment loop.
      variable_client.update_and_wait()
  
      # Component to add things into replay.
      adder = adders.NStepTransitionAdder(
          client=replay,
          n_step=self._n_step,
          discount=self._additional_discount,
      )
  
      # Create the agent.
      actor = actors.FeedForwardActor(
          policy_network=behavior_network,
          adder=adder,
          variable_client=variable_client,
      )
  
      # Create logger and counter; actors will not spam bigtable.
      save_data = actor_id == 0
      counter = counting.Counter(counter, "actor")
      logger = loggers.make_default_logger(
          "actor", save_data=save_data, time_delta=self._log_every
      )
  
      # Create the run loop and return it.
      return acme.EnvironmentLoop(environment, actor, counter, logger)
  
imports: from typing import Callable, Dict, Optional
  import acme
  from acme import datasets
  from acme import specs
  from acme.adders import reverb
  from acme.agents.tf import actors
  from acme.agents.tf.mog_mpo import learning
  from acme.tf import networks
  from acme.tf import savers
  from acme.tf import variable_utils
  from acme.utils import counting
  from acme.utils import loggers
  from acme.utils import lp_utils
  import dm_env
  import launchpad
  import reverb
  import sonnet
label_desc: Use image node_id 6 for calling the DistributedMoGMPO obj's underlying member method code with example usage: obj.actor(replay, variable_source, counter, actor_id) and returns: acme