class_docstr: A2C: Advantage Actor-Critic.
  
  A2C is a synchronous, deterministic variant of Asynchronous Advantage
      Actor Critic (A3C).
  
  See https://arxiv.org/abs/1708.05144
  
  Args:
      model (A2CModel): Model to train
      optimizer (chainer.Optimizer): optimizer used to train the model
      gamma (float): Discount factor [0,1]
      num_processes (int): The number of processes
      gpu (int): GPU device id if not None nor negative.
      update_steps (int): The number of update steps
      phi (callable): Feature extractor function
      pi_loss_coef (float): Weight coefficient for the loss of the policy
      v_loss_coef (float): Weight coefficient for the loss of the value
          function
      entropy_coeff (float): Weight coefficient for the loss of the entropy
      use_gae (bool): use generalized advantage estimation(GAE)
      tau (float): gae parameter
      average_actor_loss_decay (float): Decay rate of average actor loss.
          Used only to record statistics.
      average_entropy_decay (float): Decay rate of average entropy. Used only
          to record statistics.
      average_value_decay (float): Decay rate of average value. Used only
          to record statistics.
      act_deterministically (bool): If set true, choose most probable actions
          in act method.
      batch_states (callable): method which makes a batch of observations.
          default is `chainerrl.misc.batch_states.batch_states`
class_docstr_tok: ["A2C",":","Advantage","Actor-Critic",".","A2C","is","a","synchronous",",","deterministic","variant","of","Asynchronous","Advantage","Actor","Critic","(","A3C",")",".","See","https",":","\/\/arxiv.org\/abs\/1708.05144","Args",":","model","(","A2CModel",")",":","Model","to","train","optimizer","(","chainer.Optimizer",")",":","optimizer","used","to","train","the","model","gamma","(","float",")",":","Discount","factor","[","0,1","]","num_processes","(","int",")",":","The","number","of","processes","gpu","(","int",")",":","GPU","device","id","if","not","None","nor","negative",".","update_steps","(","int",")",":","The","number","of","update","steps","phi","(","callable",")",":","Feature","extractor","function","pi_loss_coef","(","float",")",":","Weight","coefficient","for","the","loss","of","the","policy","v_loss_coef","(","float",")",":","Weight","coefficient","for","the","loss","of","the","value","function","entropy_coeff","(","float",")",":","Weight","coefficient","for","the","loss","of","the","entropy","use_gae","(","bool",")",":","use","generalized","advantage","estimation","(","GAE",")","tau","(","float",")",":","gae","parameter","average_actor_loss_decay","(","float",")",":","Decay","rate","of","average","actor","loss",".","Used","only","to","record","statistics",".","average_entropy_decay","(","float",")",":","Decay","rate","of","average","entropy",".","Used","only","to","record","statistics",".","average_value_decay","(","float",")",":","Decay","rate","of","average","value",".","Used","only","to","record","statistics",".","act_deterministically","(","bool",")",":","If","set","true",",","choose","most","probable","actions","in","act","method",".","batch_states","(","callable",")",":","method","which","makes","a","batch","of","observations",".","default","is","`","chainerrl.misc.batch_states.batch_states","`"]
code: def __init__(
      self,
      model,
      optimizer,
      gamma,
      num_processes,
      gpu=None,
      update_steps=5,
      phi=lambda x: x,
      pi_loss_coef=1.0,
      v_loss_coef=0.5,
      entropy_coeff=0.01,
      use_gae=False,
      tau=0.95,
      act_deterministically=False,
      average_actor_loss_decay=0.999,
      average_entropy_decay=0.999,
      average_value_decay=0.999,
      batch_states=batch_states,
  ):
      assert isinstance(model, A2CModel)
  
      self.model = model
      self.gpu = gpu
      if gpu is not None and gpu >= 0:
          chainer.cuda.get_device_from_id(gpu).use()
          self.model.to_gpu(device=gpu)
  
      self.optimizer = optimizer
  
      self.update_steps = update_steps
      self.num_processes = num_processes
  
      self.gamma = gamma
      self.use_gae = use_gae
      self.tau = tau
      self.act_deterministically = act_deterministically
      self.phi = phi
      self.pi_loss_coef = pi_loss_coef
      self.v_loss_coef = v_loss_coef
      self.entropy_coeff = entropy_coeff
  
      self.average_actor_loss_decay = average_actor_loss_decay
      self.average_value_decay = average_value_decay
      self.average_entropy_decay = average_entropy_decay
      self.batch_states = batch_states
  
      self.xp = self.model.xp
      self.t = 0
      self.t_start = 0
  
      # Stats
      self.average_actor_loss = 0
      self.average_value = 0
      self.average_entropy = 0
  
imports: from logging import getLogger
  import warnings
  import chainer
  from chainer import functions
  from chainerrl import agent
  from chainerrl.misc.batch_states import batch_states
  from chainerrl.recurrent import RecurrentChainMixin
label_desc: Use image node_id 1 to create a new A2C object from inherited base classes: agent, agent with example: obj = A2C(model, optimizer, gamma, num_processes, gpu, update_steps, phi, pi_loss_coef, v_loss_coef, entropy_coeff, use_gae, tau, act_deterministically, average_actor_loss_decay, average_entropy_decay, average_value_decay, batch_states)