mirror of
https://github.com/wassname/DeepRL.git
synced 2026-10-28 12:30:38 +08:00
Refactor DDPG
This commit is contained in:
1 parent
8b9fd8d24f
commit
c5cbc10f94
7 files changed
+167
-110
No files matched your search
@@ -5,6 +5,17 @@
|
||||
#######################################################################
|
||||
import torch
|
||||
|
||||
class Normalizer:
|
||||
def __init__(self, o_size):
|
||||
self.stats = SharedStats(o_size)
|
||||
|
||||
def __call__(self, o_):
|
||||
o = torch.FloatTensor(o_)
|
||||
self.stats.feed(o)
|
||||
std = (self.stats.v + 1e-6) ** .5
|
||||
o = (o - self.stats.m) / std
|
||||
return o.numpy().reshape(o_.shape)
|
||||
|
||||
class StaticNormalizer:
|
||||
def __init__(self, o_size):
|
||||
self.offline_stats = SharedStats(o_size)
|
||||
|
||||
Reference in new issue
Block a user