class_docstr: Internal BCQ learner.
  
  This implements the Q-learning component in the discrete BCQ algorithm.
class_docstr_tok: ["Internal","BCQ","learner",".","This","implements","the","Q-learning","component","in","the","discrete","BCQ","algorithm","."]
docstr: Initializes the learner.
  
  Args:
    network: BCQ network
    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.
docstr_tok: ["Initializes","the","learner",".","Args",":","network",":","BCQ","network","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","."]
code: def __init__(
      self,
      network: discrete_networks.DiscreteFilteredQNetwork,
      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 = False,
  ):
      """Initializes the learner.
  
      Args:
        network: BCQ network
        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.
      """
  
      # Internalise agent components (replay buffer, networks, optimizer).
      # TODO(b/155086959): Fix type stubs and remove.
      self._iterator = iter(dataset)  # pytype: disable=wrong-arg-types
      self._network = network
      self._q_network = network.q_network
      self._target_q_network = copy.deepcopy(network.q_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 = [self._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.make_default_logger(
          "learner", save_data=False
      )
  
      # Create a snapshotter object.
      if checkpoint:
          self._snapshotter = tf2_savers.Snapshotter(
              objects_to_save={"network": network},
              time_delta_minutes=60.0,
          )
      else:
          self._snapshotter = None
  
imports: import copy
  from typing import Dict, List, Optional
  from acme import core
  from acme import types
  from acme.adders import reverb
  from acme.agents.tf import bc
  from acme.tf import losses
  from acme.tf import savers
  from acme.tf import utils
  from acme.tf.networks import discrete
  from acme.utils import counting
  from acme.utils import loggers
  import numpy
  import reverb
  import sonnet
  import tensorflow
  import trfl
label_desc: Use image node_id 1 to create a new _InternalBCQLearner object from inherited base classes: core, tf2_savers with example: obj = _InternalBCQLearner(network, discount, importance_sampling_exponent, learning_rate, target_update_period, dataset, huber_loss_parameter, replay_client, counter, logger, checkpoint)