class_docstr: D4PG learner.
  
  This is the learning component of a D4PG agent. IE it takes a dataset as input
  and implements update functionality to learn from this dataset.
class_docstr_tok: ["D4PG","learner",".","This","is","the","learning","component","of","a","D4PG","agent",".","IE","it","takes","a","dataset","as","input","and","implements","update","functionality","to","learn","from","this","dataset","."]
code: def _replicated_step(self):
      # Update target network
      online_variables = (
          *self._observation_network.variables,
          *self._critic_network.variables,
          *self._policy_network.variables,
      )
      target_variables = (
          *self._target_observation_network.variables,
          *self._target_critic_network.variables,
          *self._target_policy_network.variables,
      )
  
      # Make online -> target network update ops.
      if tf.math.mod(self._num_steps, self._target_update_period) == 0:
          for src, dest in zip(online_variables, target_variables):
              dest.assign(src)
      self._num_steps.assign_add(1)
  
      # Get data from replay (dropping extras if any). Note there is no
      # extra data here because we do not insert any into Reverb.
      sample = next(self._iterator)
  
      # This mirrors the structure of the fetches returned by self._step(),
      # but the Tensors are replaced with replicated Tensors, one per accelerator.
      replicated_fetches = self._replicator.run(
          self._step, args=(sample,)
      )
  
      def reduce_mean_over_replicas(replicated_value):
          """Averages a replicated_value across replicas."""
          # The "axis=None" arg means reduce across replicas, not internal axes.
          return self._replicator.reduce(
              reduce_op=tf.distribute.ReduceOp.MEAN,
              value=replicated_value,
              axis=None,
          )
  
      fetches = tree.map_structure(
          reduce_mean_over_replicas, replicated_fetches
      )
  
      return fetches
  
imports: import time
  from typing import Dict, Iterator, List, Optional, Union, Sequence
  import acme
  from acme import types
  from acme.tf import losses
  from acme.tf import networks
  from acme.tf import savers
  from acme.tf import utils
  from acme.utils import counting
  from acme.utils import loggers
  import numpy
  import reverb
  import sonnet
  import tensorflow
  import tree
label_desc: Use image node_id 3 for calling the D4PGLearner obj's underlying member method code with example usage: obj._replicated_step() and returns: fetches, self