class_docstr: Ranibow Agent with recycled parameters.
class_docstr_tok: ["Ranibow","Agent","with","recycled","parameters","."]
code: def __init__(
      self,
      num_actions,
      network="nature",
      reset_mode=None,
      width=1,
      num_updates_per_train_step=1,
      batch_size_statistics=256,
      target_update_strategy="training_step",
      weight_decay=0.0,
      summary_writer=None,
      is_debugging=False,
  ):
      network_name = network
      if network == "nature":
          network = networks.ScalableRainbowNetwork
      else:
          raise ValueError(f"Invalid network: {network}")
      super().__init__(
          num_actions,
          network=functools.partial(network, width=width),
          summary_writer=summary_writer,
      )
  
      if weight_decay > 0:
          # TODO(gsokar) we may compare the performance with adamw.
          # lets keep it under a condition till we check its effect.
          self.optimizer = optax.chain(
              optax.add_decayed_weights(weight_decay), self.optimizer
          )
          self.optimizer_state = self.optimizer.init(self.online_params)
  
      self.batch_size_statistics = batch_size_statistics
      self.target_update_strategy = target_update_strategy
      self.is_debugging = is_debugging
      if reset_mode is not None:
          if reset_mode == "neurons":
              self.weight_recycler = weight_recyclers.NeuronRecycler(
                  network.layer_names, network=network_name
              )
          elif reset_mode == "weights":
              self.weight_recycler = weight_recyclers.LayerReset(
                  network.layer_names
              )
          else:
              raise ValueError(f"Invalid reset mode: {reset_mode}")
      else:
          self.weight_recycler = weight_recyclers.BaseRecycler(
              network.layer_names
          )
      self._num_updates_per_train_step = num_updates_per_train_step
  
file_path: dopamine/dopamine/labs/redo/recycled_rainbow_agent.py
imports: import functools
  from dopamine.jax.agents.rainbow import rainbow_agent
  from dopamine.labs.redo import networks
  from dopamine.labs.redo import weight_recyclers
  from dopamine.metrics import statistics_instance
  import gin
  import jax
  import jax.numpy
  import optax
label_desc: Use image node_id 1 to create a new RecycledRainbowAgent object from inherited base classes: rainbow_agent with example: obj = RecycledRainbowAgent(num_actions, network, reset_mode, width, num_updates_per_train_step, batch_size_statistics, target_update_strategy, weight_decay, summary_writer, is_debugging)