mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-07-23 19:32:28 +00:00
Bug fix for A2C
This commit is contained in:
parent
20ee8cb68d
commit
f159a4a9f2
1 changed files with 2 additions and 1 deletions
|
|
@ -97,8 +97,9 @@ class A2C(PPO):
|
|||
values = values.flatten()
|
||||
|
||||
# Normalize advantage (not present in the original implementation)
|
||||
advantages = rollout_data.advantages
|
||||
if self.normalize_advantage:
|
||||
advantages = (rollout_data.advantages - rollout_data.advantages.mean()) / (rollout_data.advantages.std() + 1e-8)
|
||||
advantages = (advantages - advantages.mean()) / (advantages.std() + 1e-8)
|
||||
|
||||
# Policy gradient loss
|
||||
policy_loss = -(advantages * log_prob).mean()
|
||||
|
|
|
|||
Loading…
Reference in a new issue