class_docstr: BC learner.
  
  This is the learning component of a BC agent. IE it takes a dataset as input
  and implements update functionality to learn from this dataset.
class_docstr_tok: ["BC","learner",".","This","is","the","learning","component","of","a","BC","agent",".","IE","it","takes","a","dataset","as","input","and","implements","update","functionality","to","learn","from","this","dataset","."]
docstr: Initializes the learner.
  
  Args:
    network: the BC network (the one being optimized)
    learning_rate: learning rate for the cross-entropy update.
    dataset: dataset to learn from.
    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",":","the","BC","network","(","the","one","being","optimized",")","learning_rate",":","learning","rate","for","the","cross-entropy","update",".","dataset",":","dataset","to","learn","from",".","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: snt.Module,
      learning_rate: float,
      dataset: tf.data.Dataset,
      counter: Optional[counting.Counter] = None,
      logger: Optional[loggers.Logger] = None,
      checkpoint: bool = True,
  ):
      """Initializes the learner.
  
      Args:
        network: the BC network (the one being optimized)
        learning_rate: learning rate for the cross-entropy update.
        dataset: dataset to learn from.
        counter: Counter object for (potentially distributed) counting.
        logger: Logger object for writing logs to.
        checkpoint: boolean indicating whether to checkpoint the learner.
      """
  
      self._counter = counter or counting.Counter()
      self._logger = logger or loggers.TerminalLogger(
          "learner", time_delta=1.0
      )
  
      # Get an iterator over the dataset.
      self._iterator = iter(dataset)  # pytype: disable=wrong-arg-types
      # TODO(b/155086959): Fix type stubs and remove.
  
      self._network = network
      self._optimizer = snt.optimizers.Adam(learning_rate)
  
      self._variables: List[List[tf.Tensor]] = [
          network.trainable_variables
      ]
      self._num_steps = tf.Variable(0, dtype=tf.int32)
  
      # 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
  
file_path: acme/acme/agents/tf/bc/learning.py
imports: from typing import Dict, List, Optional
  import acme
  from acme import types
  from acme.tf import savers
  from acme.tf import utils
  from acme.utils import counting
  from acme.utils import loggers
  import numpy
  import sonnet
  import tensorflow
label_desc: Use image node_id 1 to create a new BCLearner object from inherited base classes: acme, tf2_savers with example: obj = BCLearner(network, learning_rate, dataset, counter, logger, checkpoint)