MCPcopy Create free account
hub / github.com/YeWR/EfficientZero / observation

Method observation

core/utils.py:201–220  ·  view source on GitHub ↗
(self, obs)

Source from the content-addressed store, hash-verified

199 assert original_space.dtype == np.uint8 and len(original_space.shape) == 3
200
201 def observation(self, obs):
202 if self._key is None:
203 frame = obs
204 else:
205 frame = obs[self._key]
206
207 if self._grayscale:
208 frame = cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)
209 frame = cv2.resize(
210 frame, (self._width, self._height), interpolation=cv2.INTER_AREA
211 )
212 if self._grayscale:
213 frame = np.expand_dims(frame, -1)
214
215 if self._key is None:
216 obs = frame
217 else:
218 obs = obs.copy()
219 obs[self._key] = frame
220 return obs
221
222
223def make_atari(env_id, skip=4, max_episode_steps=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected