class_docstr: Distributional DQN learner.
class_docstr_tok: ["Distributional","DQN","learner","."]
docstr: Initializes the learner.
  
  Args:
    network: the online Q network (the one being optimized) that outputs
      (q_values, q_logits, atoms).
    target_network: the target Q critic (which lags behind the online net).
    discount: discount to use for TD updates.
    importance_sampling_exponent: power to which importance weights are raised
      before normalizing.
    learning_rate: learning rate for the q-network update.
    target_update_period: number of learner steps to perform before updating
      the target networks.
    dataset: dataset to learn from, whether fixed or from a replay buffer
      (see `acme.datasets.reverb.make_reverb_dataset` documentation).
    huber_loss_parameter: Quadratic-linear boundary for Huber loss.
    replay_client: client to replay to allow for updating priorities.
    counter: Counter object for (potentially distributed) counting.
    logger: Logger object for writing logs to.
    checkpoint: boolean indicating whether to checkpoint the learner or not.
docstr_tok: ["Initializes","the","learner",".","Args",":","network",":","the","online","Q","network","(","the","one","being","optimized",")","that","outputs","(","q_values",",","q_logits",",","atoms",")",".","target_network",":","the","target","Q","critic","(","which","lags","behind","the","online","net",")",".","discount",":","discount","to","use","for","TD","updates",".","importance_sampling_exponent",":","power","to","which","importance","weights","are","raised","before","normalizing",".","learning_rate",":","learning","rate","for","the","q-network","update",".","target_update_period",":","number","of","learner","steps","to","perform","before","updating","the","target","networks",".","dataset",":","dataset","to","learn","from",",","whether","fixed","or","from","a","replay","buffer","(","see","`","acme.datasets.reverb.make_reverb_dataset","`","documentation",")",".","huber_loss_parameter",":","Quadratic-linear","boundary","for","Huber","loss",".","replay_client",":","client","to","replay","to","allow","for","updating","priorities",".","counter",":","Counter","object","for","(","potentially","distributed",")","counting",".","logger",":","Logger","object","for","writing","logs","to",".","checkpoint",":","boolean","indicating","whether","to","checkpoint","the","learner","or","not","."]
code: def __init__(
      self,
      network: networks.IQNNetwork,
      target_network: snt.Module,
      discount: float,
      importance_sampling_exponent: float,
      learning_rate: float,
      target_update_period: int,
      dataset: tf.data.Dataset,
      huber_loss_parameter: float = 1.0,
      replay_client: Optional[reverb.TFClient] = None,
      counter: Optional[counting.Counter] = None,
      logger: Optional[loggers.Logger] = None,
      checkpoint: bool = True,
  ):
      """Initializes the learner.
  
      Args:
        network: the online Q network (the one being optimized) that outputs
          (q_values, q_logits, atoms).
        target_network: the target Q critic (which lags behind the online net).
        discount: discount to use for TD updates.
        importance_sampling_exponent: power to which importance weights are raised
          before normalizing.
        learning_rate: learning rate for the q-network update.
        target_update_period: number of learner steps to perform before updating
          the target networks.
        dataset: dataset to learn from, whether fixed or from a replay buffer
          (see `acme.datasets.reverb.make_reverb_dataset` documentation).
        huber_loss_parameter: Quadratic-linear boundary for Huber loss.
        replay_client: client to replay to allow for updating priorities.
        counter: Counter object for (potentially distributed) counting.
        logger: Logger object for writing logs to.
        checkpoint: boolean indicating whether to checkpoint the learner or not.
      """
  
      # Internalise agent components (replay buffer, networks, optimizer).
      self._iterator = iter(dataset)  # pytype: disable=wrong-arg-types
      self._network = network
      self._target_network = target_network
      self._optimizer = snt.optimizers.Adam(learning_rate)
      self._replay_client = replay_client
  
      # Internalise the hyperparameters.
      self._discount = discount
      self._target_update_period = target_update_period
      self._importance_sampling_exponent = importance_sampling_exponent
      self._huber_loss_parameter = huber_loss_parameter
  
      # Learner state.
      self._variables: List[List[tf.Tensor]] = [
          network.trainable_variables
      ]
      self._num_steps = tf.Variable(0, dtype=tf.int32)
  
      # Internalise logging/counting objects.
      self._counter = counter or counting.Counter()
      self._logger = logger or loggers.TerminalLogger(
          "learner", time_delta=1.0
      )
  
      # Create a snapshotter object.
      if checkpoint:
          self._checkpointer = tf2_savers.Checkpointer(
              time_delta_minutes=5,
              objects_to_save={
                  "network": self._network,
                  "target_network": self._target_network,
                  "optimizer": self._optimizer,
                  "num_steps": self._num_steps,
              },
          )
          self._snapshotter = tf2_savers.Snapshotter(
              objects_to_save={"network": network},
              time_delta_minutes=60.0,
          )
      else:
          self._checkpointer = None
          self._snapshotter = None
  
imports: from typing import Dict, List, Optional, Tuple
  from acme import core
  from acme import types
  from acme.adders import reverb
  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
label_desc: Use image node_id 1 to create a new IQNLearner object from inherited base classes: core, tf2_savers with example: obj = IQNLearner(network, target_network, discount, importance_sampling_exponent, learning_rate, target_update_period, dataset, huber_loss_parameter, replay_client, counter, logger, checkpoint)