MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / _current_state

Method _current_state

examples/DeepQNetwork/atari.py:112–126  ·  view source on GitHub ↗

:returns: a gray-scale (h, w) uint8 image

(self)

Source from the content-addressed store, hash-verified

110 return m.reshape((self.height, self.width, 3))
111
112 def _current_state(self):
113 """
114 :returns: a gray-scale (h, w) uint8 image
115 """
116 ret = self._grab_raw_image()
117 # max-pooled over the last screen
118 ret = np.maximum(ret, self.last_raw_screen)
119 if self.viz:
120 if isinstance(self.viz, float):
121 cv2.imshow(self.windowname, ret)
122 cv2.waitKey(int(self.viz * 1000))
123 if self.grayscale:
124 # 0.299,0.587.0.114. same as rgb2y in torch/image
125 ret = cv2.cvtColor(ret, cv2.COLOR_RGB2GRAY)
126 return ret.astype('uint8') # to save some memory
127
128 def _restart_episode(self):
129 with _ALE_LOCK:

Callers 2

resetMethod · 0.95
stepMethod · 0.95

Calls 1

_grab_raw_imageMethod · 0.95

Tested by

no test coverage detected