class_docstr: TaskSampler that samples from a finite pool of environments.
  
  This can be used with any environments, but is generally best when using
  in-process samplers with environments that are expensive to construct.
  
  Args:
      envs (list[Environment]): List of environments to use as a pool.
class_docstr_tok: ["TaskSampler","that","samples","from","a","finite","pool","of","environments",".","This","can","be","used","with","any","environments",",","but","is","generally","best","when","using","in-process","samplers","with","environments","that","are","expensive","to","construct",".","Args",":","envs","(","list","[","Environment","]",")",":","List","of","environments","to","use","as","a","pool","."]
docstr: Sample a list of environment updates.
  
  Args:
      n_tasks (int): Number of updates to sample.
      with_replacement (bool): Whether tasks can repeat when sampled.
          Since this cannot be easily implemented for an object pool,
          setting this to True results in ValueError.
  
  Raises:
      ValueError: If the number of requested tasks is larger than the
          pool, or with_replacement is set.
  
  Returns:
      list[EnvUpdate]: Batch of sampled environment updates, which, when
          invoked on environments, will configure them with new tasks.
          See :py:class:`~EnvUpdate` for more information.
docstr_tok: ["Sample","a","list","of","environment","updates",".","Args",":","n_tasks","(","int",")",":","Number","of","updates","to","sample",".","with_replacement","(","bool",")",":","Whether","tasks","can","repeat","when","sampled",".","Since","this","can","not","be","easily","implemented","for","an","object","pool",",","setting","this","to","True","results","in","ValueError",".","Raises",":","ValueError",":","If","the","number","of","requested","tasks","is","larger","than","the","pool",",","or","with_replacement","is","set",".","Returns",":","list","[","EnvUpdate","]",":","Batch","of","sampled","environment","updates",",","which",",","when","invoked","on","environments",",","will","configure","them","with","new","tasks",".","See",":","py",":","class",":","`","~EnvUpdate","`","for","more","information","."]
code: def sample(self, n_tasks, with_replacement=False):
      """Sample a list of environment updates.
  
      Args:
          n_tasks (int): Number of updates to sample.
          with_replacement (bool): Whether tasks can repeat when sampled.
              Since this cannot be easily implemented for an object pool,
              setting this to True results in ValueError.
  
      Raises:
          ValueError: If the number of requested tasks is larger than the
              pool, or with_replacement is set.
  
      Returns:
          list[EnvUpdate]: Batch of sampled environment updates, which, when
              invoked on environments, will configure them with new tasks.
              See :py:class:`~EnvUpdate` for more information.
  
      """
      if n_tasks > len(self._envs):
          raise ValueError(
              "Cannot sample more environments than are "
              "present in the pool. If more tasks are needed, "
              "call grow_pool to copy random existing tasks."
          )
      if with_replacement:
          raise ValueError(
              "EnvPoolSampler cannot meaningfully sample with "
              "replacement."
          )
      envs = list(self._envs)
      np.random.shuffle(envs)
      return [ExistingEnvUpdate(env) for env in envs[:n_tasks]]
  
imports: import abc
  import copy
  import math
  import numpy
  from garage.envs import GymEnv, TaskNameWrapper, TaskOnehotWrapper
  from garage.sampler.env_update import ExistingEnvUpdate, NewEnvUpdate, SetTaskUpdate
label_desc: Use image node_id 3 for calling the EnvPoolSampler obj's underlying member method code with example usage: obj.sample(n_tasks, with_replacement) and returns: unknown