class_docstr: A replay buffer that stores and can sample whole episodes.
  
  This buffer only stores valid steps, and doesn't require paths to
  have a maximum length.
  
  Args:
      capacity_in_transitions (int): Total memory allocated for the buffer.
      env_spec (EnvSpec): Environment specification.
class_docstr_tok: ["A","replay","buffer","that","stores","and","can","sample","whole","episodes",".","This","buffer","only","stores","valid","steps",",","and","does","n't","require","paths","to","have","a","maximum","length",".","Args",":","capacity_in_transitions","(","int",")",":","Total","memory","allocated","for","the","buffer",".","env_spec","(","EnvSpec",")",":","Environment","specification","."]
docstr: Sample a batch of timesteps from the buffer.
  
  Args:
      batch_size (int): Number of timesteps to sample.
  
  Returns:
      TimeStepBatch: The batch of timesteps.
docstr_tok: ["Sample","a","batch","of","timesteps","from","the","buffer",".","Args",":","batch_size","(","int",")",":","Number","of","timesteps","to","sample",".","Returns",":","TimeStepBatch",":","The","batch","of","timesteps","."]
code: def sample_timesteps(self, batch_size):
      """Sample a batch of timesteps from the buffer.
  
      Args:
          batch_size (int): Number of timesteps to sample.
  
      Returns:
          TimeStepBatch: The batch of timesteps.
  
      """
      samples = self.sample_transitions(batch_size)
      step_types = np.array(
          [
              StepType.TERMINAL if terminal else StepType.MID
              for terminal in samples["terminals"].reshape(-1)
          ],
          dtype=StepType,
      )
      return TimeStepBatch(
          env_spec=self._env_spec,
          episode_infos={},
          observations=samples["observations"],
          actions=samples["actions"],
          rewards=samples["rewards"].flatten(),
          next_observations=samples["next_observations"],
          step_types=step_types,
          env_infos={},
          agent_infos={},
      )
  
file_path: garage/src/garage/replay_buffer/path_buffer.py
imports: import collections
  import numpy
  from garage import StepType, TimeStepBatch
label_desc: Use image node_id 6 for calling the PathBuffer obj's underlying member method code with example usage: obj.sample_timesteps(batch_size) and returns: TimeStepBatch