class_docstr: A3C: Asynchronous Advantage Actor-Critic.
  
  See http://arxiv.org/abs/1602.01783
  
  Args:
      model (A3CModel): Model to train
      optimizer (chainer.Optimizer): optimizer used to train the model
      t_max (int): The model is updated after every t_max local steps
      gamma (float): Discount factor [0,1]
      beta (float): Weight coefficient for the entropy regularizaiton term.
      process_idx (int): Index of the process.
      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
      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: ["A3C",":","Asynchronous","Advantage","Actor-Critic",".","See","http",":","\/\/arxiv.org\/abs\/1602.01783","Args",":","model","(","A3CModel",")",":","Model","to","train","optimizer","(","chainer.Optimizer",")",":","optimizer","used","to","train","the","model","t_max","(","int",")",":","The","model","is","updated","after","every","t_max","local","steps","gamma","(","float",")",":","Discount","factor","[","0,1","]","beta","(","float",")",":","Weight","coefficient","for","the","entropy","regularizaiton","term",".","process_idx","(","int",")",":","Index","of","the","process",".","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","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,
      t_max,
      gamma,
      beta=1e-2,
      process_idx=0,
      phi=lambda x: x,
      pi_loss_coef=1.0,
      v_loss_coef=0.5,
      keep_loss_scale_same=False,
      normalize_grad_by_t_max=False,
      use_average_reward=False,
      average_reward_tau=1e-2,
      act_deterministically=False,
      average_entropy_decay=0.999,
      average_value_decay=0.999,
      batch_states=batch_states,
  ):
      assert isinstance(model, A3CModel)
      # Globally shared model
      self.shared_model = model
  
      # Thread specific model
      self.model = copy.deepcopy(self.shared_model)
      async_.assert_params_not_shared(self.shared_model, self.model)
  
      self.optimizer = optimizer
  
      self.t_max = t_max
      self.gamma = gamma
      self.beta = beta
      self.phi = phi
      self.pi_loss_coef = pi_loss_coef
      self.v_loss_coef = v_loss_coef
      self.keep_loss_scale_same = keep_loss_scale_same
      self.normalize_grad_by_t_max = normalize_grad_by_t_max
      self.use_average_reward = use_average_reward
      self.average_reward_tau = average_reward_tau
      self.act_deterministically = act_deterministically
      self.average_value_decay = average_value_decay
      self.average_entropy_decay = average_entropy_decay
      self.batch_states = batch_states
  
      self.t = 0
      self.t_start = 0
      self.past_action_log_prob = {}
      self.past_action_entropy = {}
      self.past_states = {}
      self.past_rewards = {}
      self.past_values = {}
      self.average_reward = 0
      # A3C won't use a explorer, but this arrtibute is referenced by run_dqn
      self.explorer = None
  
      # Stats
      self.average_value = 0
      self.average_entropy = 0
  
imports: import copy
  from logging import getLogger
  import chainer
  from chainer import functions
  import numpy
  from chainerrl import agent
  from chainerrl.misc import async_
  from chainerrl.misc.batch_states import batch_states
  from chainerrl.misc import copy_param
  from chainerrl.recurrent import Recurrent
  from chainerrl.recurrent import RecurrentChainMixin
  from chainerrl.recurrent import state_kept
label_desc: Use image node_id 1 to create a new A3C object from inherited base classes: agent, agent with example: obj = A3C(model, optimizer, t_max, gamma, beta, process_idx, phi, pi_loss_coef, v_loss_coef, keep_loss_scale_same, normalize_grad_by_t_max, use_average_reward, average_reward_tau, act_deterministically, average_entropy_decay, average_value_decay, batch_states)