Return only every `skip`-th frame
(self, env, skip=4)
| 127 | |
| 128 | class MaxAndSkipEnv(gym.Wrapper): |
| 129 | def __init__(self, env, skip=4): |
| 130 | """Return only every `skip`-th frame""" |
| 131 | gym.Wrapper.__init__(self, env) |
| 132 | # most recent raw observations (for max pooling across time steps) |
| 133 | self._obs_buffer = np.zeros((2,)+env.observation_space.shape, dtype=np.uint8) |
| 134 | self._skip = skip |
| 135 | self.max_frame = np.zeros(env.observation_space.shape, dtype=np.uint8) |
| 136 | |
| 137 | def step(self, action): |
| 138 | """Repeat action, sum reward, and max over last observations.""" |