From 70b1318c729a97272ee042997ee25b2c86ed1424 Mon Sep 17 00:00:00 2001 From: Dmitry Sorokin Date: Tue, 14 Dec 2021 13:22:21 +0300 Subject: [PATCH] rm redundant 0.5 --- a2c_ppo_acktr/algo/ppo.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/a2c_ppo_acktr/algo/ppo.py b/a2c_ppo_acktr/algo/ppo.py index 08534ba82..61d5fdde1 100644 --- a/a2c_ppo_acktr/algo/ppo.py +++ b/a2c_ppo_acktr/algo/ppo.py @@ -71,10 +71,9 @@ def update(self, rollouts): value_losses = (values - return_batch).pow(2) value_losses_clipped = ( value_pred_clipped - return_batch).pow(2) - value_loss = 0.5 * torch.max(value_losses, - value_losses_clipped).mean() + value_loss = torch.max(value_losses, value_losses_clipped).mean() else: - value_loss = 0.5 * (return_batch - values).pow(2).mean() + value_loss = (return_batch - values).pow(2).mean() self.optimizer.zero_grad() (value_loss * self.value_loss_coef + action_loss -