class_docstr: Program definition for distributed DDPG (D3PG).
class_docstr_tok: ["Program","definition","for","distributed","DDPG","(","D3PG",")","."]
docstr: Build the distributed agent topology.
docstr_tok: ["Build","the","distributed","agent","topology","."]
code: def build(self, name="ddpg"):
      """Build the distributed agent topology."""
      program = lp.Program(name=name)
  
      with program.group("replay"):
          replay = program.add_node(lp.ReverbNode(self.replay))
  
      with program.group("counter"):
          counter = program.add_node(lp.CourierNode(self.counter))
  
          if self._max_actor_steps:
              _ = program.add_node(
                  lp.CourierNode(
                      self.coordinator, counter, self._max_actor_steps
                  )
              )
  
      with program.group("learner"):
          learner = program.add_node(
              lp.CourierNode(self.learner, replay, counter)
          )
  
      with program.group("evaluator"):
          program.add_node(
              lp.CourierNode(self.evaluator, learner, counter)
          )
  
      if not self._num_caches:
          # Use our learner as a single variable source.
          sources = [learner]
      else:
          with program.group("cacher"):
              # Create a set of learner caches.
              sources = []
              for _ in range(self._num_caches):
                  cacher = program.add_node(
                      lp.CacherNode(
                          learner,
                          refresh_interval_ms=2000,
                          stale_after_ms=4000,
                      )
                  )
                  sources.append(cacher)
  
      with program.group("actor"):
          # Add actors which pull round-robin from our variable sources.
          for actor_id in range(self._num_actors):
              source = sources[actor_id % len(sources)]
              program.add_node(
                  lp.CourierNode(self.actor, replay, source, counter)
              )
  
      return program
  
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.ddpg import learning
  from acme.tf import networks
  from acme.tf import savers
  from acme.tf import utils
  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
  import tensorflow
label_desc: Use image node_id 8 for calling the DistributedDDPG obj's underlying member method code with example usage: obj.build(name) and returns: program