December 2019
Intermediate to advanced
368 pages
11h 10m
English
This function obtains the current game state from the Atari environment as a game screen buffer. This function is implemented as follows:
def observation(self, indices=None, name=None): if indices is None: indices = np.arange(self.batch_size) with tf.variable_scope(name, default_name='AtariObservation'): with tf.device('/cpu:0'): obs = gym_tensorflow_module.environment_observation( self.instances, indices, T=tf.uint8) obs = tf.gather(tf.constant(self.color_pallete), tf.cast(obs,tf.int32)) obs = tf.reduce_max(obs, axis=1) obs = tf.image.resize_bilinear(obs, self.warp_size, align_corners=True) obs.set_shape((None,) + self.warp_size + (1,)) return obs
This function acquires a screengrab from the Atari environment ...
Read now
Unlock full access