def clear_completed_trajectories(self, num=None):
    """Clear the first `num` completed trajectories, or all if num is None."""
    if num is None:
      self._completed_trajectories = []
    else:
      self._completed_trajectories = self._completed_trajectories[num:]
Clear the first `num` completed trajectories, or all if num is None.
tensor2tensor/envs/trajectory.py