class_docstr: Twin Delayed Deep Deterministic Policy Gradient algorithm trainer
  as described in https://arxiv.org/pdf/1802.09477
class_docstr_tok: ["Twin","Delayed","Deep","Deterministic","Policy","Gradient","algorithm","trainer","as","described","in","https",":","\/\/arxiv.org\/pdf\/1802.09477"]
docstr: Args:
      actor_network: states -> actions, trained to maximize value
      q1_network: states, action -> q-value
      q2_network (optional): double q-learning to stabilize training
          from overestimation bias
      rl (optional): an instance of the RLParameter class, which
          defines relevant hyperparameters
      q_network_optimizer (optional): the optimizer class and
          optimizer hyperparameters for the q network(s) optimizer
      actor_network_optimizer (optional): see q_network_optimizer
      minibatch_size (optional): the size of the minibatch
      noise_variance (optional): the variance of action noise added to smooth
          q-value estimates
      noise_clip (optional): the maximum absolute value of action noise added
          to smooth q-value estimates
      delayed_policy_update (optional): the ratio of q network updates
          to target and policy network updates
      minibatches_per_step (optional, TODO: currently unused): the number of minibatch updates
          per training step
docstr_tok: ["Args",":","actor_network",":","states","-",">","actions",",","trained","to","maximize","value","q1_network",":","states",",","action","-",">","q-value","q2_network","(","optional",")",":","double","q-learning","to","stabilize","training","from","overestimation","bias","rl","(","optional",")",":","an","instance","of","the","RLParameter","class",",","which","defines","relevant","hyperparameters","q_network_optimizer","(","optional",")",":","the","optimizer","class","and","optimizer","hyperparameters","for","the","q","network","(","s",")","optimizer","actor_network_optimizer","(","optional",")",":","see","q_network_optimizer","minibatch_size","(","optional",")",":","the","size","of","the","minibatch","noise_variance","(","optional",")",":","the","variance","of","action","noise","added","to","smooth","q-value","estimates","noise_clip","(","optional",")",":","the","maximum","absolute","value","of","action","noise","added","to","smooth","q-value","estimates","delayed_policy_update","(","optional",")",":","the","ratio","of","q","network","updates","to","target","and","policy","network","updates","minibatches_per_step","(","optional",",","TODO",":","currently","unused",")",":","the","number","of","minibatch","updates","per","training","step"]
code: def __init__(
      self,
      actor_network,
      q1_network,
      q2_network=None,
      # Start TD3TrainerParameters
      rl: RLParameters = field(
          default_factory=RLParameters
      ),  # noqa: B008
      q_network_optimizer: Optimizer__Union = field(  # noqa: B008
          default_factory=Optimizer__Union.default
      ),
      actor_network_optimizer: Optimizer__Union = field(  # noqa: B008
          default_factory=Optimizer__Union.default
      ),
      minibatch_size: int = 64,
      noise_variance: float = 0.2,
      noise_clip: float = 0.5,
      delayed_policy_update: int = 2,
      minibatches_per_step: int = 1,
  ) -> None:
      """
      Args:
          actor_network: states -> actions, trained to maximize value
          q1_network: states, action -> q-value
          q2_network (optional): double q-learning to stabilize training
              from overestimation bias
          rl (optional): an instance of the RLParameter class, which
              defines relevant hyperparameters
          q_network_optimizer (optional): the optimizer class and
              optimizer hyperparameters for the q network(s) optimizer
          actor_network_optimizer (optional): see q_network_optimizer
          minibatch_size (optional): the size of the minibatch
          noise_variance (optional): the variance of action noise added to smooth
              q-value estimates
          noise_clip (optional): the maximum absolute value of action noise added
              to smooth q-value estimates
          delayed_policy_update (optional): the ratio of q network updates
              to target and policy network updates
          minibatches_per_step (optional, TODO: currently unused): the number of minibatch updates
              per training step
      """
      super().__init__()
      self.rl_parameters = rl
      self.minibatch_size = minibatch_size
      self.minibatches_per_step = minibatches_per_step or 1
  
      self.q1_network = q1_network
      self.q1_network_target = copy.deepcopy(self.q1_network)
      self.q_network_optimizer = q_network_optimizer
  
      self.q2_network = q2_network
      if self.q2_network is not None:
          self.q2_network_target = copy.deepcopy(self.q2_network)
  
      self.actor_network = actor_network
      self.actor_network_target = copy.deepcopy(self.actor_network)
      self.actor_network_optimizer = actor_network_optimizer
  
      self.noise_variance = noise_variance
      self.noise_clip_range = (-noise_clip, noise_clip)
      self.delayed_policy_update = delayed_policy_update
  
file_path: ReAgent/reagent/training/td3_trainer.py
imports: import copy
  import logging
  import reagent.core.types
  import torch
  import torch.nn.functional
  from reagent.core.configuration import resolve_defaults
  from reagent.core.dataclasses import field
  from reagent.core.parameters import CONTINUOUS_TRAINING_ACTION_RANGE, 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 TD3Trainer object from inherited base classes: RLTrainerMixin, ReAgentLightningModule with example: obj = TD3Trainer(actor_network, q1_network, q2_network, rl, q_network_optimizer, actor_network_optimizer, minibatch_size, noise_variance, noise_clip, delayed_policy_update, minibatches_per_step)