MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / step

Method step

rl3/a2c/atari_wrappers.py:105–122  ·  view source on GitHub ↗

Repeat action, sum reward, and max over last observations.

(self, action)

Source from the content-addressed store, hash-verified

103 self._skip = skip
104
105 def step(self, action):
106 """Repeat action, sum reward, and max over last observations."""
107 total_reward = 0.0
108 done = None
109 for i in range(self._skip):
110 obs, reward, done, info = self.env.step(action)
111 if i == self._skip - 2:
112 self._obs_buffer[0] = obs
113 if i == self._skip - 1:
114 self._obs_buffer[1] = obs
115 total_reward += reward
116 if done:
117 break
118 # Note that the observation on the done=True frame
119 # doesn't matter
120 max_frame = self._obs_buffer.max(axis=0)
121
122 return max_frame, total_reward, done, info
123
124 def reset(self, **kwargs):
125 return self.env.reset(**kwargs)

Callers

nothing calls this directly

Calls 1

stepMethod · 0.45

Tested by

no test coverage detected