class_docstr: Implementation of 51 Categorical DQN (C51)
  
  See https://arxiv.org/abs/1707.06887 for details
class_docstr_tok: ["Implementation","of","51","Categorical","DQN","(","C51",")","See","https",":","\/\/arxiv.org\/abs\/1707.06887","for","details"]
docstr: Args:
      q_network: states, action -> q-value
      q_network_target: model that provides targets
      actions(optional): list of agent's actions
      rl (optional): an instance of the RLParameter class, which
          defines relevant hyperparameters
      double_q_learning (optional): whether or not double Q learning, enabled by default,
      minibatch_size (optional): the size of the minibatch
      minibatches_per_step (optional): the number of minibatch updates
          per training step
      num_atoms (optional): number of "canonical returns"in the discretized value distributions
      qmin (optional): minimum q-value
      qmax (optional): maximum q-value
      optimizer (optional): the optimizer class and
          optimizer hyperparameters for the q network(s) optimizer
docstr_tok: ["Args",":","q_network",":","states",",","action","-",">","q-value","q_network_target",":","model","that","provides","targets","actions","(","optional",")",":","list","of","agent","'s","actions","rl","(","optional",")",":","an","instance","of","the","RLParameter","class",",","which","defines","relevant","hyperparameters","double_q_learning","(","optional",")",":","whether","or","not","double","Q","learning",",","enabled","by","default",",","minibatch_size","(","optional",")",":","the","size","of","the","minibatch","minibatches_per_step","(","optional",")",":","the","number","of","minibatch","updates","per","training","step","num_atoms","(","optional",")",":","number","of","``","canonical","returns","''","in","the","discretized","value","distributions","qmin","(","optional",")",":","minimum","q-value","qmax","(","optional",")",":","maximum","q-value","optimizer","(","optional",")",":","the","optimizer","class","and","optimizer","hyperparameters","for","the","q","network","(","s",")","optimizer"]
code: def __init__(
      self,
      q_network,
      q_network_target,
      actions: List[str] = field(default_factory=list),  # noqa: B008
      rl: RLParameters = field(
          default_factory=RLParameters
      ),  # noqa: B008
      double_q_learning: bool = True,
      minibatch_size: int = 1024,
      minibatches_per_step: int = 1,
      num_atoms: int = 51,
      qmin: float = -100,
      qmax: float = 200,
      optimizer: Optimizer__Union = field(  # noqa: B008
          default_factory=Optimizer__Union.default
      ),
  ) -> None:
      """
      Args:
          q_network: states, action -> q-value
          q_network_target: model that provides targets
          actions(optional): list of agent's actions
          rl (optional): an instance of the RLParameter class, which
              defines relevant hyperparameters
          double_q_learning (optional): whether or not double Q learning, enabled by default,
          minibatch_size (optional): the size of the minibatch
          minibatches_per_step (optional): the number of minibatch updates
              per training step
          num_atoms (optional): number of "canonical returns"in the discretized value distributions
          qmin (optional): minimum q-value
          qmax (optional): maximum q-value
          optimizer (optional): the optimizer class and
              optimizer hyperparameters for the q network(s) optimizer
      """
      super().__init__()
      self.double_q_learning = double_q_learning
      self.minibatch_size = minibatch_size
      self.minibatches_per_step = minibatches_per_step
      self._actions = actions
      self.q_network = q_network
      self.q_network_target = q_network_target
      self.q_network_optimizer = optimizer
      self.qmin = qmin
      self.qmax = qmax
      self.num_atoms = num_atoms
      self.rl_parameters = rl
      self.register_buffer("support", None)
      self.support = torch.linspace(
          self.qmin, self.qmax, self.num_atoms
      )
      self.scale_support = (self.qmax - self.qmin) / (
          self.num_atoms - 1.0
      )
  
      self.register_buffer("reward_boosts", None)
      self.reward_boosts = torch.zeros([1, len(self._actions)])
      if self.rl_parameters.reward_boost is not None:
          # pyre-fixme[16]: Optional type has no attribute `keys`.
          for k in self.rl_parameters.reward_boost.keys():
              i = self._actions.index(k)
              # pyre-fixme[16]: Optional type has no attribute `__getitem__`.
              self.reward_boosts[
                  0, i
              ] = self.rl_parameters.reward_boost[k]
  
file_path: ReAgent/reagent/training/c51_trainer.py
imports: from typing import List
  import reagent.core.types
  import torch
  from reagent.core.configuration import resolve_defaults
  from reagent.core.dataclasses import field
  from reagent.core.parameters import RLParameters
  from reagent.optimizer import Optimizer__Union, SoftUpdate
  from reagent.training.reagent_lightning_module import ReAgentLightningModule
  from reagent.training.rl_trainer_pytorch import RLTrainerMixin
label_desc: Use image node_id 1 to create a new C51Trainer object from inherited base classes: RLTrainerMixin, ReAgentLightningModule with example: obj = C51Trainer(q_network, q_network_target, actions, rl, double_q_learning, minibatch_size, minibatches_per_step, num_atoms, qmin, qmax, optimizer)