mirror of
https://github.com/wassname/DeepRL.git
synced 2026-09-10 11:40:58 +08:00
save normalizer and replay with ddpg agent
This commit is contained in:
@@ -25,6 +25,12 @@ class Normalizer:
|
||||
o = o.reshape(o_.shape)
|
||||
return o
|
||||
|
||||
def state_dict(self):
|
||||
return self.stats.state_dict()
|
||||
|
||||
def load_state_dict(self, saved):
|
||||
self.stats.load_state_dict(saved)
|
||||
|
||||
class StaticNormalizer:
|
||||
def __init__(self, o_size):
|
||||
self.offline_stats = SharedStats(o_size)
|
||||
@@ -47,6 +53,12 @@ class StaticNormalizer:
|
||||
o = o.reshape(o_.shape)
|
||||
return o
|
||||
|
||||
def state_dict(self):
|
||||
return self.offline_stats.state_dict()
|
||||
|
||||
def load_state_dict(self, saved):
|
||||
self.offline_stats.load_state_dict(saved)
|
||||
|
||||
class SharedStats:
|
||||
def __init__(self, o_size):
|
||||
self.m = torch.zeros(o_size)
|
||||
|
||||
Reference in New Issue
Block a user