class_docstr: Defines a configuration class from which an APPO Algorithm can be built.
  
  .. testcode::
  
      from ray.rllib.algorithms.appo import APPOConfig
      config = APPOConfig().training(lr=0.01, grad_clip=30.0, train_batch_size=50)
      config = config.resources(num_gpus=0)
      config = config.rollouts(num_rollout_workers=1)
      config = config.environment("CartPole-v1")
  
      # Build an Algorithm object from the config and run 1 training iteration.
      algo = config.build()
      algo.train()
      del algo
  
  .. testcode::
  
      from ray.rllib.algorithms.appo import APPOConfig
      from ray import air
      from ray import tune
  
      config = APPOConfig()
      # Update the config object.
      config = config.training(lr=tune.grid_search([0.001,]))
      # Set the config object's env.
      config = config.environment(env="CartPole-v1")
      # Use to_dict() to get the old-style python config dict
      # when running with tune.
      tune.Tuner(
          "APPO",
          run_config=air.RunConfig(stop={"training_iteration": 1},
                                   verbose=0),
          param_space=config.to_dict(),
  
      ).fit()
  
  .. testoutput::
      :hide:
  
      ...
class_docstr_tok: ["Defines","a","configuration","class","from","which","an","APPO","Algorithm","can","be","built",".","..","testcode",":",":","from","ray.rllib.algorithms.appo","import","APPOConfig","config","=","APPOConfig","(",")",".training","(","lr=0.01",",","grad_clip=30.0",",","train_batch_size=50",")","config","=","config.resources","(","num_gpus=0",")","config","=","config.rollouts","(","num_rollout_workers=1",")","config","=","config.environment","(","``","CartPole-v1","''",")","#","Build","an","Algorithm","object","from","the","config","and","run","1","training","iteration",".","algo","=","config.build","(",")","algo.train","(",")","del","algo","..","testcode",":",":","from","ray.rllib.algorithms.appo","import","APPOConfig","from","ray","import","air","from","ray","import","tune","config","=","APPOConfig","(",")","#","Update","the","config","object",".","config","=","config.training","(","lr=tune.grid_search","(","[","0.001",",","]",")",")","#","Set","the","config","object","'s","env",".","config","=","config.environment","(","env=","''","CartPole-v1","''",")","#","Use","to_dict","(",")","to","get","the","old-style","python","config","dict","#","when","running","with","tune",".","tune.Tuner","(","``","APPO","''",",","run_config=air.RunConfig","(","stop=","{","``","training_iteration","''",":","1","}",",","verbose=0",")",",","param_space=config.to_dict","(",")",",",")",".fit","(",")","..","testoutput",":",":",":","hide",":","..."]
docstr: Sets the training related configuration.
  
  Args:
      vtrace: Whether to use V-trace weighted advantages. If false, PPO GAE
          advantages will be used instead.
      use_critic: Should use a critic as a baseline (otherwise don't use value
          baseline; required for using GAE). Only applies if vtrace=False.
      use_gae: If true, use the Generalized Advantage Estimator (GAE)
          with a value function, see https://arxiv.org/pdf/1506.02438.pdf.
          Only applies if vtrace=False.
      lambda_: GAE (lambda) parameter.
      clip_param: PPO surrogate slipping parameter.
      use_kl_loss: Whether to use the KL-term in the loss function.
      kl_coeff: Coefficient for weighting the KL-loss term.
      kl_target: Target term for the KL-term to reach (via adjusting the
          `kl_coeff` automatically).
      tau: The factor by which to update the target policy network towards
          the current policy network. Can range between 0 and 1.
          e.g. updated_param = tau * current_param + (1 - tau) * target_param
      target_update_frequency: The frequency to update the target policy and
          tune the kl loss coefficients that are used during training. After
          setting this parameter, the algorithm waits for at least
          `target_update_frequency * minibatch_size * num_sgd_iter` number of
          samples to be trained on by the learner group before updating the target
          networks and tuned the kl loss coefficients that are used during
          training.
          NOTE: This parameter is only applicable when using the Learner API
          (_enable_new_api_stack=True).
  
  
  Returns:
      This updated AlgorithmConfig object.
docstr_tok: ["Sets","the","training","related","configuration",".","Args",":","vtrace",":","Whether","to","use","V-trace","weighted","advantages",".","If","false",",","PPO","GAE","advantages","will","be","used","instead",".","use_critic",":","Should","use","a","critic","as","a","baseline","(","otherwise","do","n't","use","value","baseline",";","required","for","using","GAE",")",".","Only","applies","if","vtrace=False",".","use_gae",":","If","true",",","use","the","Generalized","Advantage","Estimator","(","GAE",")","with","a","value","function",",","see","https",":","\/\/arxiv.org\/pdf\/1506.02438.pdf",".","Only","applies","if","vtrace=False",".","lambda_",":","GAE","(","lambda",")","parameter",".","clip_param",":","PPO","surrogate","slipping","parameter",".","use_kl_loss",":","Whether","to","use","the","KL-term","in","the","loss","function",".","kl_coeff",":","Coefficient","for","weighting","the","KL-loss","term",".","kl_target",":","Target","term","for","the","KL-term","to","reach","(","via","adjusting","the","`","kl_coeff","`","automatically",")",".","tau",":","The","factor","by","which","to","update","the","target","policy","network","towards","the","current","policy","network",".","Can","range","between","0","and","1.","e.g",".","updated_param","=","tau","*","current_param","+","(","1","-","tau",")","*","target_param","target_update_frequency",":","The","frequency","to","update","the","target","policy","and","tune","the","kl","loss","coefficients","that","are","used","during","training",".","After","setting","this","parameter",",","the","algorithm","waits","for","at","least","`","target_update_frequency","*","minibatch_size","*","num_sgd_iter","`","number","of","samples","to","be","trained","on","by","the","learner","group","before","updating","the","target","networks","and","tuned","the","kl","loss","coefficients","that","are","used","during","training",".","NOTE",":","This","parameter","is","only","applicable","when","using","the","Learner","API","(","_enable_new_api_stack=True",")",".","Returns",":","This","updated","AlgorithmConfig","object","."]
code: def training(
      self,
      *,
      vtrace: Optional[bool] = NotProvided,
      use_critic: Optional[bool] = NotProvided,
      use_gae: Optional[bool] = NotProvided,
      lambda_: Optional[float] = NotProvided,
      clip_param: Optional[float] = NotProvided,
      use_kl_loss: Optional[bool] = NotProvided,
      kl_coeff: Optional[float] = NotProvided,
      kl_target: Optional[float] = NotProvided,
      tau: Optional[float] = NotProvided,
      target_update_frequency: Optional[int] = NotProvided,
      **kwargs,
  ) -> "APPOConfig":
      """Sets the training related configuration.
  
      Args:
          vtrace: Whether to use V-trace weighted advantages. If false, PPO GAE
              advantages will be used instead.
          use_critic: Should use a critic as a baseline (otherwise don't use value
              baseline; required for using GAE). Only applies if vtrace=False.
          use_gae: If true, use the Generalized Advantage Estimator (GAE)
              with a value function, see https://arxiv.org/pdf/1506.02438.pdf.
              Only applies if vtrace=False.
          lambda_: GAE (lambda) parameter.
          clip_param: PPO surrogate slipping parameter.
          use_kl_loss: Whether to use the KL-term in the loss function.
          kl_coeff: Coefficient for weighting the KL-loss term.
          kl_target: Target term for the KL-term to reach (via adjusting the
              `kl_coeff` automatically).
          tau: The factor by which to update the target policy network towards
              the current policy network. Can range between 0 and 1.
              e.g. updated_param = tau * current_param + (1 - tau) * target_param
          target_update_frequency: The frequency to update the target policy and
              tune the kl loss coefficients that are used during training. After
              setting this parameter, the algorithm waits for at least
              `target_update_frequency * minibatch_size * num_sgd_iter` number of
              samples to be trained on by the learner group before updating the target
              networks and tuned the kl loss coefficients that are used during
              training.
              NOTE: This parameter is only applicable when using the Learner API
              (_enable_new_api_stack=True).
  
  
      Returns:
          This updated AlgorithmConfig object.
      """
      # Pass kwargs onto super's `training()` method.
      super().training(**kwargs)
  
      if vtrace is not NotProvided:
          self.vtrace = vtrace
      if use_critic is not NotProvided:
          self.use_critic = use_critic
      if use_gae is not NotProvided:
          self.use_gae = use_gae
      if lambda_ is not NotProvided:
          self.lambda_ = lambda_
      if clip_param is not NotProvided:
          self.clip_param = clip_param
      if use_kl_loss is not NotProvided:
          self.use_kl_loss = use_kl_loss
      if kl_coeff is not NotProvided:
          self.kl_coeff = kl_coeff
      if kl_target is not NotProvided:
          self.kl_target = kl_target
      if tau is not NotProvided:
          self.tau = tau
      if target_update_frequency is not NotProvided:
          self.target_update_frequency = target_update_frequency
  
      return self
  
imports: from typing import Optional, Type
  import logging
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig, NotProvided
  from ray.rllib.algorithms.impala.impala import Impala, ImpalaConfig
  from ray.rllib.core.rl_module.rl_module import SingleAgentRLModuleSpec
  from ray.rllib.policy.policy import Policy
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.metrics import LAST_TARGET_UPDATE_TS, NUM_AGENT_STEPS_SAMPLED, NUM_ENV_STEPS_SAMPLED, NUM_TARGET_UPDATES
  from ray.rllib.utils.metrics import ALL_MODULES, LEARNER_STATS_KEY
  from ray.rllib.utils.typing import ResultDict
label_desc: Use image node_id 2 for calling the APPOConfig obj's underlying member method code with example usage: obj.training() and returns: self