Stack k last frames. Returns lazy array, which is much more memory efficient. See Also -------- baselines.common.atari_wrappers.LazyFrames
(self, env, k)
| 168 | |
| 169 | class FrameStack(gym.Wrapper): |
| 170 | def __init__(self, env, k): |
| 171 | """Stack k last frames. |
| 172 | |
| 173 | Returns lazy array, which is much more memory efficient. |
| 174 | |
| 175 | See Also |
| 176 | -------- |
| 177 | baselines.common.atari_wrappers.LazyFrames |
| 178 | """ |
| 179 | gym.Wrapper.__init__(self, env) |
| 180 | self.k = k |
| 181 | self.frames = deque([], maxlen=k) |
| 182 | shp = env.observation_space.shape |
| 183 | self.observation_space = spaces.Box(low=0, high=255, shape=(shp[0], shp[1], shp[2] * k)) |
| 184 | |
| 185 | def reset(self): |
| 186 | ob = self.env.reset() |