class_docstr: Basically a batch of active trajectories and a list of completed ones.
class_docstr_tok: ["Basically","a","batch","of","active","trajectories","and","a","list","of","completed","ones","."]
docstr: Truncate trajectories at specified indices.
  
   This puts the truncated trajectories in the completed list and makes new
   trajectories with the observation from the trajectory that was truncated at
   the same index.
  
  Args:
      indices: iterable with the indices to truncate.
      num_to_keep: int, number of last time-steps to keep while truncating.
code: def truncate_trajectories(self, indices, num_to_keep=1):
      """Truncate trajectories at specified indices.
  
       This puts the truncated trajectories in the completed list and makes new
       trajectories with the observation from the trajectory that was truncated at
       the same index.
  
      Args:
          indices: iterable with the indices to truncate.
          num_to_keep: int, number of last time-steps to keep while truncating.
      """
      for index in indices:
          trajectory = self._trajectories[index]
          assert (
              trajectory.is_active
          ), "Trajectory to truncate can't be inactive."
  
          # Now `trajectory` just consists of the last `num_to_keep` observations
          # and actions. Rewards are zeroed out.
          # The old data is placed in `old_trajectory`.
          old_trajectory = trajectory.truncate(num_to_keep=num_to_keep)
  
          # We put the old data in _completed_trajectories.
          self._completed_trajectories.append(old_trajectory)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import pickle
  import re
  import sys
  import time
  from absl import logging
  import cloudpickle
  import numpy
  from tensor2tensor.envs import time_step
  import tensorflow.compat.v1
label_desc: Use image node_id 8 for calling the BatchTrajectory obj's underlying member method code with example usage: obj.truncate_trajectories(indices, num_to_keep) without return types