A2C

class A2C(model, vf_loss_coeff=None)[source]

Bases: parl.core.paddle.algorithm.Algorithm

__init__(model, vf_loss_coeff=None)[source]

A2C algorithm

Parameters
  • model (parl.Model) – forward network of policy and value

  • vf_loss_coeff (float) – coefficient of the value function loss

learn(obs, actions, advantages, target_values, learning_rate, entropy_coeff)[source]
Parameters
  • obs – An float32 tensor of shape ([B] + observation_space). E.g. [B, C, H, W] in atari.

  • actions – An int64 tensor of shape [B].

  • advantages – A float32 tensor of shape [B].

  • target_values – A float32 tensor of shape [B].

  • learning_rate – float scalar of leanring rate.

  • entropy_coeff – float scalar of entropy coefficient.

predict(obs)[source]
Parameters

obs – An float32 tensor of shape ([B] + observation_space). E.g. [B, C, H, W] in atari.

prob_and_value(obs)[source]
Parameters

obs – An float32 tensor of shape ([B] + observation_space). E.g. [B, C, H, W] in atari.

value(obs)[source]
Parameters

obs – An float32 tensor of shape ([B] + observation_space). E.g. [B, C, H, W] in atari.