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 batch_observe_and_train(
      self, batch_obs, batch_reward, batch_done, batch_reset
  ):
      if any(batch_reset):
          warnings.warn(
              "A2C currently does not support resetting an env without reaching a terminal state during training. When receiving True in batch_reset, A2C considers it as True in batch_done instead."
          )  # NOQA
          batch_done = list(batch_done)
          for i, reset in enumerate(batch_reset):
              if reset:
                  batch_done[i] = True
  
      statevar = self.batch_states(batch_obs, self.xp, self.phi)
  
      self.masks[self.t - self.t_start - 1] = self.xp.array(
          [0.0 if done else 1.0 for done in batch_done]
      )
      self.rewards[self.t - self.t_start - 1] = self.xp.array(
          batch_reward, dtype=self.xp.float32
      )
      self.states[self.t - self.t_start] = statevar
  
      if self.t - self.t_start == self.update_steps:
          self.update()
  
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 7 for calling the A2C obj's underlying member method code with example usage: obj.batch_observe_and_train(batch_obs, batch_reward, batch_done, batch_reset) without return types