Return only every `skip`-th frame
(self, env, skip=4)
| 96 | |
| 97 | class MaxAndSkipEnv(gym.Wrapper): |
| 98 | def __init__(self, env, skip=4): |
| 99 | """Return only every `skip`-th frame""" |
| 100 | gym.Wrapper.__init__(self, env) |
| 101 | # most recent raw observations (for max pooling across time steps) |
| 102 | self._obs_buffer = np.zeros((2,) + env.observation_space.shape, dtype='uint8') |
| 103 | self._skip = skip |
| 104 | |
| 105 | def step(self, action): |
| 106 | """Repeat action, sum reward, and max over last observations.""" |