class_docstr: Program definition for distributional (MoG) MPO.
class_docstr_tok: ["Program","definition","for","distributional","(","MoG",")","MPO","."]
docstr: The Learning part of the agent.
docstr_tok: ["The","Learning","part","of","the","agent","."]
code: def learner(
      self,
      replay: reverb.Client,
      counter: counting.Counter,
  ):
      """The Learning part of the agent."""
  
      # Create online and target networks.
      online_networks = self._network_factory(self._environment_spec)
      target_networks = self._network_factory(self._environment_spec)
  
      # The dataset object to learn from.
      dataset = datasets.make_reverb_dataset(
          server_address=replay.server_address,
          batch_size=self._batch_size,
          prefetch_size=self._prefetch_size,
      )
  
      counter = counting.Counter(counter, "learner")
      logger = loggers.make_default_logger(
          "learner", time_delta=self._log_every
      )
  
      # Create policy loss module if a factory is passed.
      if self._policy_loss_factory:
          policy_loss_module = self._policy_loss_factory()
      else:
          policy_loss_module = None
  
      # Return the learning agent.
      return learning.MoGMPOLearner(
          policy_network=online_networks["policy"],
          critic_network=online_networks["critic"],
          observation_network=online_networks["observation"],
          target_policy_network=target_networks["policy"],
          target_critic_network=target_networks["critic"],
          target_observation_network=target_networks["observation"],
          discount=self._additional_discount,
          num_samples=self._num_samples,
          policy_evaluation_config=self._policy_evaluation_config,
          target_policy_update_period=self._target_policy_update_period,
          target_critic_update_period=self._target_critic_update_period,
          policy_loss_module=policy_loss_module,
          dataset=dataset,
          counter=counter,
          logger=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 5 for calling the DistributedMoGMPO obj's underlying member method code with example usage: obj.learner(replay, counter) and returns: learning