def begin_episode(self, agent_indices): """Reset the recurrent states and stored episode. Args: agent_indices: 1D tensor of batch indices for agents starting an episode. Returns: Summary tensor. """ with tf.name_scope('begin_episode/'): reset_state = utility.reinit_nested_vars(self._last_state, agent_indices) reset_buffer = self._episodes.clear(agent_indices) with tf.control_dependencies([reset_state, reset_buffer]): return tf.constant('')
def begin_episode(self, agent_indices): """Reset the recurrent states and stored episode. Args: agent_indices: 1D tensor of batch indices for agents starting an episode. Returns: Summary tensor. """ with tf.name_scope('begin_episode/'): reset_state = utility.reinit_nested_vars(self._last_state, agent_indices) # At the beginning of episodes, first empty the self._episodes on the rows # specified by agent_indices, because self._episodes can store only one episode # per environments. reset_buffer = self._episodes.clear(agent_indices) with tf.control_dependencies([reset_state, reset_buffer]): return tf.constant('')
def begin_episode(self, agent_indices): """Reset the recurrent states and stored episode. Args: agent_indices: Tensor containing current batch indices. Returns: Summary tensor. """ with tf.name_scope('begin_episode/'): if self._last_state is None: reset_state = tf.no_op() else: reset_state = utility.reinit_nested_vars( self._last_state, agent_indices) reset_buffer = self._episodes.clear(agent_indices) with tf.control_dependencies([reset_state, reset_buffer]): return tf.constant('')