Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nov05/c3fab30859211facab3710a1b256e499 to your computer and use it in GitHub Desktop.
Save Nov05/c3fab30859211facab3710a1b256e499 to your computer and use it in GitHub Desktop.
20240322_reinforcement learning_neural network soft update

"deeprl/agent/DDPG_agent.py"

  • trg = trg*(1-τ) + src*τ
  • τ is stored in self.config.target_network_mix
    def soft_update(self, target, source):
        ## trg = trg*(1-τ) + src*τ
        ## τ is stored in self.config.target_network_mix
        for target_param, source_param in zip(target.parameters(), source.parameters()):
            target_param.detach_()
            target_param.copy_(target_param * (1.0 - self.config.target_network_mix) +
                               source_param * self.config.target_network_mix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment