class_docstr: TaskSampler where the environment can sample "task objects".
  
  This is used for environments that implement `sample_tasks` and `set_task`.
  For example, :py:class:`~HalfCheetahVelEnv`, as implemented in Garage.
  
  Args:
      env_constructor (type): Type of the environment.
      env (garage.Environment or None): Instance of env_constructor to sample
          from (will be constructed if not provided).
      wrapper (Callable[garage.Environment, garage.Environment] or None):
          Wrapper function to apply to environment.
class_docstr_tok: ["TaskSampler","where","the","environment","can","sample","``","task","objects","''",".","This","is","used","for","environments","that","implement","`","sample_tasks","`","and","`","set_task","`",".","For","example",",",":","py",":","class",":","`","~HalfCheetahVelEnv","`",",","as","implemented","in","Garage",".","Args",":","env_constructor","(","type",")",":","Type","of","the","environment",".","env","(","garage.Environment","or","None",")",":","Instance","of","env_constructor","to","sample","from","(","will","be","constructed","if","not","provided",")",".","wrapper","(","Callable","[","garage.Environment",",","garage.Environment","]","or","None",")",":","Wrapper","function","to","apply","to","environment","."]
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.
          Note that if more tasks are sampled than exist, then tasks may
          repeat, but only after every environment has been included at
          least once in this batch. Ignored for continuous task spaces.
  
  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",".","Note","that","if","more","tasks","are","sampled","than","exist",",","then","tasks","may","repeat",",","but","only","after","every","environment","has","been","included","at","least","once","in","this","batch",".","Ignored","for","continuous","task","spaces",".","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.
              Note that if more tasks are sampled than exist, then tasks may
              repeat, but only after every environment has been included at
              least once in this batch. Ignored for continuous task spaces.
  
      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.
  
      """
      return [
          SetTaskUpdate(self._env_constructor, task, self._wrapper)
          for task in self._env.sample_tasks(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 SetTaskSampler obj's underlying member method code with example usage: obj.sample(n_tasks, with_replacement) and returns: unknown