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)
| 60 | |
| 61 | class NoopResetEnv(gym.Wrapper): |
| 62 | def __init__(self, env, noop_max=30): |
| 63 | """Sample initial states by taking random number of no-ops on reset. |
| 64 | No-op is assumed to be action 0. |
| 65 | """ |
| 66 | gym.Wrapper.__init__(self, env) |
| 67 | self.noop_max = noop_max |
| 68 | self.override_num_noops = None |
| 69 | self.noop_action = 0 |
| 70 | assert env.unwrapped.get_action_meanings()[0] == 'NOOP' |
| 71 | |
| 72 | def reset(self, **kwargs): |
| 73 | """ Do no-op action for a number of steps in [1, noop_max].""" |