* Add per and modify etc

* Replace pre-commit-config.yaml and add pre-commit hook in .git

* Modify .gitignore

* Modify .gitignore

* Modify buffer and code

* Modify replay buffer and per

* Modify .gitignore
This commit is contained in:
Kyunghwan Kim
2019-02-16 17:30:12 +09:00
committed by GitHub
parent 7f4756a1d4
commit ecb42d30d2
13 changed files with 750 additions and 55 deletions
@@ -5,6 +5,10 @@
- Contact: curt.park@medipixel.io
"""
import random
import gym
import numpy as np
import torch
import torch.nn as nn
@@ -18,3 +22,11 @@ def soft_update(local: nn.Module, target: nn.Module, tau: float):
"""Soft-update: target = tau*local + (1-tau)*target."""
for t_param, l_param in zip(target.parameters(), local.parameters()):
t_param.data.copy_(tau * l_param.data + (1.0 - tau) * t_param.data)
def set_random_seed(seed: int, env: gym.Env):
"""Set random seed"""
env.seed(seed)
torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)