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: Resets trajectories at given indices and populates observations.
  
  Reset can either be called right at the beginning, when there are no
  time-steps, or to reset a currently active trajectory.
  
  If resetting a currently active trajectory then we save it in
  self._completed_trajectories.
  
  Args:
    indices: 1-D np.ndarray stating the indices to reset.
    observations: np.ndarray of shape (indices len, obs.shape) of observations
code: def reset(self, indices, observations):
      """Resets trajectories at given indices and populates observations.
  
      Reset can either be called right at the beginning, when there are no
      time-steps, or to reset a currently active trajectory.
  
      If resetting a currently active trajectory then we save it in
      self._completed_trajectories.
  
      Args:
        indices: 1-D np.ndarray stating the indices to reset.
        observations: np.ndarray of shape (indices len, obs.shape) of observations
      """
  
      # Pre-conditions: indices, observations are np arrays.
      #               : indices is one-dimensional.
      #               : their first dimension (batch) is the same.
      assert isinstance(indices, np.ndarray)
      assert len(indices.shape) == 1
      assert isinstance(observations, np.ndarray)
      assert indices.shape[0] == observations.shape[0]
  
      for index, observation in zip(indices, observations):
          trajectory = self._trajectories[index]
  
          # Are we starting a new trajectory at the given index?
          if not trajectory.is_active:
              # Then create a new time-step here with the given observation.
              trajectory.add_time_step(observation=observation)
              # That's all we need to do here.
              continue
  
          # If however we are resetting a currently active trajectory then we need
          # to put that in self._completed_trajectories and make a new trajectory
          # with the current observation.
  
          # TODO(afrozm): Should we mark these are done? Or is the done=False and
          # this being the last time-step in the trajectory good enough to recognize
          # that this was reset?
  
          # Mark trajectory as completed and move into completed_trajectories.
          self._complete_trajectory(trajectory, index)
  
          # Put the observation in the newly created trajectory.
          # TODO(afrozm): Add 0 reward.
          self._trajectories[index].add_time_step(
              observation=observation
          )
  
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 9 for calling the BatchTrajectory obj's underlying member method code with example usage: obj.reset(indices, observations) without return types