Fix typos in SAC and TD3 (#145)

This commit is contained in:
Antonin RAFFIN 2020-08-23 17:44:35 +02:00 committed by GitHub
parent 9003a09d5b
commit a1afc5e42f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -25,6 +25,7 @@ Others:
^^^^^^^ ^^^^^^^
- Improve typing coverage of the ``VecEnv`` - Improve typing coverage of the ``VecEnv``
- Removed ``AlreadySteppingError`` and ``NotSteppingError`` that were not used - Removed ``AlreadySteppingError`` and ``NotSteppingError`` that were not used
- Fixed typos in SAC and TD3
Documentation: Documentation:
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View file

@ -231,10 +231,10 @@ class SAC(OffPolicyAlgorithm):
# Get current Q estimates for each critic network # Get current Q estimates for each critic network
# using action from the replay buffer # using action from the replay buffer
current_q_esimates = self.critic(replay_data.observations, replay_data.actions) current_q_estimates = self.critic(replay_data.observations, replay_data.actions)
# Compute critic loss # Compute critic loss
critic_loss = 0.5 * sum([F.mse_loss(current_q, q_backup) for current_q in current_q_esimates]) critic_loss = 0.5 * sum([F.mse_loss(current_q, q_backup) for current_q in current_q_estimates])
critic_losses.append(critic_loss.item()) critic_losses.append(critic_loss.item())
# Optimize the critic # Optimize the critic

View file

@ -147,10 +147,10 @@ class TD3(OffPolicyAlgorithm):
target_q = replay_data.rewards + (1 - replay_data.dones) * self.gamma * target_q target_q = replay_data.rewards + (1 - replay_data.dones) * self.gamma * target_q
# Get current Q estimates for each critic network # Get current Q estimates for each critic network
current_q_esimates = self.critic(replay_data.observations, replay_data.actions) current_q_estimates = self.critic(replay_data.observations, replay_data.actions)
# Compute critic loss # Compute critic loss
critic_loss = sum([F.mse_loss(current_q, target_q) for current_q in current_q_esimates]) critic_loss = sum([F.mse_loss(current_q, target_q) for current_q in current_q_estimates])
# Optimize the critics # Optimize the critics
self.critic.optimizer.zero_grad() self.critic.optimizer.zero_grad()