code: def __init__(
      self,
      action_space,
      device,
      atoms=51,
      v_min=-10,
      v_max=10,
      batch_size=32,
      multi_step=3,
      discount=0.99,
      history=4,
      conv_layers=3,
      hidden_size=512,
      noisy_std=0.1,
      learning_rate=0.0000625,
      adam_epsilon=1.5e-4,
      max_grad_norm=10,
      model=None,
  ):
      self.action_space = action_space
      self.atoms = atoms
  
      self.Vmin = v_min
      self.Vmax = v_max
  
      self.support = torch.linspace(v_min, v_max, self.atoms).to(
          device=device
      )
      self.delta_z = (v_max - v_min) / (self.atoms - 1)
  
      self.batch_size = batch_size
  
      self.multi_step = multi_step
      self.discount = discount
      self.max_grad_norm = max_grad_norm
  
      DQN = conv_layers_dqn_class_mapping.get(conv_layers, DQN3)
  
      self.online_net = DQN(
          self.action_space,
          history=history,
          hidden_size=hidden_size,
          atoms=atoms,
          noisy_std=noisy_std,
      ).to(device=device)
  
      if model and os.path.isfile(model):
          self.online_net.load_state_dict(
              torch.load(model, map_location="cpu")
          )
  
      self.online_net.train()
  
      self.target_net = DQN(
          self.action_space,
          history=history,
          hidden_size=hidden_size,
          atoms=atoms,
          noisy_std=noisy_std,
      ).to(device=device)
      self.update_target_net()
      self.target_net.train()
  
      for param in self.target_net.parameters():
          param.requires_grad = False
  
      self.optimiser = torch.optim.Adam(
          self.online_net.parameters(),
          lr=learning_rate,
          eps=adam_epsilon,
      )
  
file_path: SerpentAI/serpent/machine_learning/reinforcement_learning/rainbow_dqn/rainbow_agent.py
imports: import os
  import random
  import torch
  from torch import nn, optim
  from serpent.machine_learning.reinforcement_learning.rainbow_dqn.dqn import DQN3, DQN4
label_desc: Use image node_id 1 to create a new RainbowAgent object  with example: obj = RainbowAgent(action_space, device, atoms, v_min, v_max, batch_size, multi_step, discount, history, conv_layers, hidden_size, noisy_std, learning_rate, adam_epsilon, max_grad_norm, model)