class_docstr: Worker with a single policy and multiple environments.
  
  Alternates between taking a single step in all environments and asking the
  policy for an action for every environment. This allows computing a batch
  of actions, which is generally much more efficient than computing a single
  action when using neural networks.
  
  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.
      worker_number (int): The number of the worker this update is
          occurring in. This argument is used  set a different seed for
          each worker.
      n_envs (int): Number of environment copies to use.
class_docstr_tok: ["Worker","with","a","single","policy","and","multiple","environments",".","Alternates","between","taking","a","single","step","in","all","environments","and","asking","the","policy","for","an","action","for","every","environment",".","This","allows","computing","a","batch","of","actions",",","which","is","generally","much","more","efficient","than","computing","a","single","action","when","using","neural","networks",".","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",".","worker_number","(","int",")",":","The","number","of","the","worker","this","update","is","occurring","in",".","This","argument","is","used","set","a","different","seed","for","each","worker",".","n_envs","(","int",")",":","Number","of","environment","copies","to","use","."]
docstr: Begin a new episode.
docstr_tok: ["Begin","a","new","episode","."]
code: def start_episode(self):
      """Begin a new episode."""
      if self._needs_agent_reset or self._needs_env_reset:
          n = len(self._envs)
          self.agent.reset([True] * n)
          if self._needs_env_reset:
              obs_list, episode_infos_list = [], []
              for env in self._envs:
                  obs, episode_info = env.reset()
                  obs_list.append(obs)
                  episode_infos_list.append(episode_info)
  
              self._prev_obs = np.asarray(obs_list)
              self._episode_infos = np.array(episode_infos_list)
          else:
              # Avoid calling reset on environments that are already at the
              # start of an episode.
              for i, env in enumerate(self._envs):
                  if self._episode_lengths[i] > 0:
                      (
                          self._prev_obs[i],
                          self._episode_infos[i],
                      ) = env.reset()
          self._episode_lengths = [0 for _ in range(n)]
          self._observations = [[] for _ in range(n)]
          self._actions = [[] for _ in range(n)]
          self._rewards = [[] for _ in range(n)]
          self._step_types = [[] for _ in range(n)]
          self._env_infos = [
              collections.defaultdict(list) for _ in range(n)
          ]
          self._agent_infos = [
              collections.defaultdict(list) for _ in range(n)
          ]
          self._needs_agent_reset = False
          self._needs_env_reset = False
  
file_path: garage/src/garage/sampler/vec_worker.py
imports: import collections
  import copy
  import numpy
  from garage import EpisodeBatch, StepType
  from garage.sampler import _apply_env_update
  from garage.sampler.default_worker import DefaultWorker
label_desc: Use image node_id 4 for calling the VecWorker obj's underlying member method code with example usage: obj.start_episode() without return types