docs: def end_episode(self, agent_indices):
      """Add episodes to the memory and perform update steps if memory is full.
  
      During training, add the collected episodes of the batch indices that
      finished their episode to the memory. If the memory is full, train on it,
      and then clear the memory. A summary string is returned if requested at
      this step.
  
      Args:
        agent_indices: Tensor containing current batch indices.
  
      Returns:
         Summary tensor.
      """
      with tf.name_scope('end_episode/'):
        return tf.cond(
            self._is_training,
            lambda: self._define_end_episode(agent_indices), str)