class_docstr: Vectorized Worker that collects partial episodes.
  
  Useful for off-policy RL.
  
  Args:
      seed (int): The seed to use to intialize random number generators.
      max_episode_length (int or float): The maximum length of episodes which
          will be sampled. Can be (floating point) infinity.
      length of fragments before they're transmitted out of
      worker_number (int): The number of the worker this update is
          occurring in. This argument is used to set a different seed for
          each worker.
      n_envs (int): Number of environment copies to use.
      timesteps_per_call (int): Maximum number of timesteps to gather per env
          per call to the worker. Defaults to 1 (i.e. gather 1 timestep per
          env each call, or n_envs timesteps in total each call).
docstr: Gather fragments from all in-progress episodes.
  
  Returns:
      EpisodeBatch: A batch of the episode fragments.
docstr_tok: ["Gather","fragments","from","all","in-progress","episodes",".","Returns",":","EpisodeBatch",":","A","batch","of","the","episode","fragments","."]
code: def collect_episode(self):
      """Gather fragments from all in-progress episodes.
  
      Returns:
          EpisodeBatch: A batch of the episode fragments.
  
      """
      for i, frag in enumerate(self._fragments):
          assert frag.env is self._envs[i]
          if len(frag.rewards) > 0:
              complete_frag = frag.to_batch()
              self._complete_fragments.append(complete_frag)
              self._fragments[i] = InProgressEpisode(
                  frag.env, frag.last_obs, frag.episode_info
              )
      assert len(self._complete_fragments) > 0
      result = EpisodeBatch.concatenate(*self._complete_fragments)
      self._complete_fragments = []
      return result
  
file_path: garage/src/garage/sampler/fragment_worker.py
imports: import copy
  import numpy
  from garage import EpisodeBatch, StepType
  from garage.sampler import _apply_env_update, InProgressEpisode
  from garage.sampler.default_worker import DefaultWorker
label_desc: Use image node_id 5 for calling the FragmentWorker obj's underlying member method code with example usage: obj.collect_episode() and returns: result