docstr: IMPALA algorithm
  
  Args:
      model (parl.Model): forward network of policy and value
      sample_batch_steps (int): steps of each environment sampling.
      gamma (float): discounted factor for reward computation.
      vf_loss_coeff (float): coefficient of the value function loss.
      clip_rho_threshold (float): clipping threshold for importance weights (rho).
      clip_pg_rho_threshold (float): clipping threshold on rho_s in \rho_s \delta log \pi(a|x) (r + \gamma v_{s+1} - V(x_s)).
docstr_tok: ["IMPALA","algorithm","Args",":","model","(","parl.Model",")",":","forward","network","of","policy","and","value","sample_batch_steps","(","int",")",":","steps","of","each","environment","sampling",".","gamma","(","float",")",":","discounted","factor","for","reward","computation",".","vf_loss_coeff","(","float",")",":","coefficient","of","the","value","function","loss",".","clip_rho_threshold","(","float",")",":","clipping","threshold","for","importance","weights","(","rho",")",".","clip_pg_rho_threshold","(","float",")",":","clipping","threshold","on","rho_s","in","\\rho_s","\\delta","log","\\pi","(","a|x",")","(","r","+","\\gamma","v_","{","s+1","}","-","V","(","x_s",")",")","."]
code: def __init__(
      self,
      model,
      sample_batch_steps=None,
      gamma=None,
      vf_loss_coeff=None,
      clip_rho_threshold=None,
      clip_pg_rho_threshold=None,
  ):
      r"""IMPALA algorithm
  
      Args:
          model (parl.Model): forward network of policy and value
          sample_batch_steps (int): steps of each environment sampling.
          gamma (float): discounted factor for reward computation.
          vf_loss_coeff (float): coefficient of the value function loss.
          clip_rho_threshold (float): clipping threshold for importance weights (rho).
          clip_pg_rho_threshold (float): clipping threshold on rho_s in \rho_s \delta log \pi(a|x) (r + \gamma v_{s+1} - V(x_s)).
      """
      assert isinstance(sample_batch_steps, int)
      assert isinstance(gamma, float)
      assert isinstance(vf_loss_coeff, float)
      assert isinstance(clip_rho_threshold, float)
      assert isinstance(clip_pg_rho_threshold, float)
      self.sample_batch_steps = sample_batch_steps
      self.gamma = gamma
      self.vf_loss_coeff = vf_loss_coeff
      self.clip_rho_threshold = clip_rho_threshold
      self.clip_pg_rho_threshold = clip_pg_rho_threshold
  
      self.model = model
  
      clip = paddle.nn.ClipGradByGlobalNorm(clip_norm=40.0)
      self.optimizer = paddle.optimizer.Adam(
          learning_rate=0.001,
          parameters=self.model.parameters(),
          grad_clip=clip,
      )
  
file_path: PARL/parl/algorithms/paddle/impala/impala.py
imports: import parl
  import paddle
  import paddle.nn.functional
  from paddle.distribution import Categorical
  from parl.algorithms.paddle.impala import vtrace
label_desc: Use image node_id 1 to create a new IMPALA object from inherited base classes: parl with example: obj = IMPALA(model, sample_batch_steps, gamma, vf_loss_coeff, clip_rho_threshold, clip_pg_rho_threshold)