remove tensorflow dependency from VecEnv

This commit is contained in:
Oleg Klimov
2019-03-18 10:58:23 -07:00
committed by Jacob Hilton
parent f2654082b2
commit cc88c8e4c0

View File

@@ -1,8 +1,6 @@
from . import VecEnvWrapper
from baselines.common.running_mean_std import RunningMeanStd
import numpy as np
class VecNormalize(VecEnvWrapper):
"""
A vectorized wrapper that normalizes the observations
@@ -11,6 +9,7 @@ class VecNormalize(VecEnvWrapper):
def __init__(self, venv, ob=True, ret=True, clipob=10., cliprew=10., gamma=0.99, epsilon=1e-8):
VecEnvWrapper.__init__(self, venv)
from baselines.common.running_mean_std import RunningMeanStd
self.ob_rms = RunningMeanStd(shape=self.observation_space.shape) if ob else None
self.ret_rms = RunningMeanStd(shape=()) if ret else None
self.clipob = clipob