put filters and running_stat files in common instead of acktr (#389)

This commit is contained in:
pzhokhov
2018-05-02 18:42:48 -07:00
committed by GitHub
parent 69f25c6028
commit 8b781038cc
3 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
import numpy as np
from abc import ABC, abstractmethod
class AbstractEnvRunner(ABC):
def __init__(self, *, env, model, nsteps):
self.env = env
self.model = model
nenv = env.num_envs
self.batch_ob_shape = (nenv*nsteps,) + env.observation_space.shape
self.obs = np.zeros((nenv,) + env.observation_space.shape, dtype=model.train_model.X.dtype.name)
self.obs[:] = env.reset()
self.nsteps = nsteps
self.states = model.initial_state
self.dones = [False for _ in range(nenv)]
@abstractmethod
def run(self):
raise NotImplementedError