mirror of
https://github.com/wassname/pytorch-soft-actor-critic.git
synced 2026-08-15 12:45:26 +08:00
Update sac.py
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user