Update sac.py

This commit is contained in:
Pranjal Tandon
2018-09-21 00:36:21 +05:30
committed by GitHub
parent ea6881895b
commit c8b987a7f3
+4 -2
View File
@@ -151,10 +151,12 @@ class SAC(object):
We update the target weights to match the current value function weights periodically
Update target parameter after every n(args.value_update) updates
"""
if updates % self.target_update_interval == 0 and self.deterministic == True:
if updates % self.value_update == 0 and self.deterministic == True:
soft_update(self.critic_target, self.critic, self.tau)
elif updates % self.target_update_interval == 0 and self.deterministic == False:
return 0, q1_value_loss.item(), q2_value_loss.item(), policy_loss.item()
elif updates % self.value_update == 0 and self.deterministic == False:
soft_update(self.value_target, self.value, self.tau)
return value_loss.item(), q1_value_loss.item(), q2_value_loss.item(), policy_loss.item()
# Save model parameters
def save_model(self, env_name, suffix="", actor_path=None, critic_path=None, value_path=None):