MCPcopy Index your code
hub / github.com/pytorch/tutorials / SkipFrame

Class SkipFrame

intermediate_source/mario_rl_tutorial.py:152–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151
152class SkipFrame(gym.Wrapper):
153 def __init__(self, env, skip):
154 """Return only every `skip`-th frame"""
155 super().__init__(env)
156 self._skip = skip
157
158 def step(self, action):
159 """Repeat action, and sum reward"""
160 total_reward = 0.0
161 for i in range(self._skip):
162 # Accumulate reward and repeat the same action
163 obs, reward, done, trunk, info = self.env.step(action)
164 total_reward += reward
165 if done:
166 break
167 return obs, total_reward, done, trunk, info
168
169
170class GrayScaleObservation(gym.ObservationWrapper):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected