code: def reset(self, indices, 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)
docs: 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