Sample initial states by taking random number of no-ops on reset. No-op is assumed to be action 0.
(self, env, noop_max=30)
| 8 | |
| 9 | class NoopResetEnv(gym.Wrapper): |
| 10 | def __init__(self, env, noop_max=30): |
| 11 | """Sample initial states by taking random number of no-ops on reset. |
| 12 | No-op is assumed to be action 0. |
| 13 | """ |
| 14 | gym.Wrapper.__init__(self, env) |
| 15 | self.noop_max = noop_max |
| 16 | self.override_num_noops = None |
| 17 | self.noop_action = 0 |
| 18 | assert env.unwrapped.get_action_meanings()[0] == 'NOOP' |
| 19 | |
| 20 | def reset(self, **kwargs): |
| 21 | """ Do no-op action for a number of steps in [1, noop_max].""" |