class_docstr: Manages state and performs updates for IMPALA learner.
code: def __init__(
      self,
      agent: agent_lib.Agent,
      rng_key,
      opt: optax.GradientTransformation,
      batch_size: int,
      discount_factor: float,
      frames_per_iter: int,
      max_abs_reward: float = 0,
      logger=None,
  ):
      if jax.device_count() > 1:
          warnings.warn(
              "Note: the impala example will only take advantage of a "
              "single accelerator."
          )
  
      self._agent = agent
      self._opt = opt
      self._batch_size = batch_size
      self._discount_factor = discount_factor
      self._frames_per_iter = frames_per_iter
      self._max_abs_reward = max_abs_reward
  
      # Data pipeline objects.
      self._done = False
      self._host_q = queue.Queue(maxsize=self._batch_size)
      self._device_q = queue.Queue(maxsize=1)
  
      # Prepare the parameters to be served to actors.
      params = agent.initial_params(rng_key)
      self._params_for_actor = (0, jax.device_get(params))
  
      # Set up logging.
      if logger is None:
          logger = util.NullLogger()
      self._logger = logger
  
imports: import functools
  import itertools
  import queue
  import threading
  import warnings
  import dm_env
  import haiku
  from examples.impala import agent
  from examples.impala import util
  import jax
  from jax.example_libraries import optimizers
  import jax.numpy
  import numpy
  import optax
  import rlax
label_desc: Use image node_id 1 to create a new Learner object  with example: obj = Learner(agent, rng_key, opt, batch_size, discount_factor, frames_per_iter, max_abs_reward, logger)