class_docstr: Append a one-hot task representation to an environment.
  
  See TaskOnehotWrapper.wrap_env_list for the recommended way of creating
  this class.
  
  Args:
      env (Environment): The environment to wrap.
      task_index (int): The index of this task among the tasks.
      n_total_tasks (int): The number of total tasks.
class_docstr_tok: ["Append","a","one-hot","task","representation","to","an","environment",".","See","TaskOnehotWrapper.wrap_env_list","for","the","recommended","way","of","creating","this","class",".","Args",":","env","(","Environment",")",":","The","environment","to","wrap",".","task_index","(","int",")",":","The","index","of","this","task","among","the","tasks",".","n_total_tasks","(","int",")",":","The","number","of","total","tasks","."]
docstr: Wrap a list of environments, giving each environment a one-hot.
  
  This is the primary way of constructing instances of this class.
  It's mostly useful when training multi-task algorithms using a
  multi-task aware sampler.
  
  For example:
  '''
  .. code-block:: python
  
      envs = get_mt10_envs()
      wrapped = TaskOnehotWrapper.wrap_env_list(envs)
      sampler = trainer.make_sampler(LocalSampler, env=wrapped)
  '''
  
  Args:
      envs (list[Environment]): List of environments to wrap. Note
      that the
          order these environments are passed in determines the value of
          their one-hot encoding. It is essential that this list is
          always in the same order, or the resulting encodings will be
          inconsistent.
  
  Returns:
      list[TaskOnehotWrapper]: The wrapped environments.
docstr_tok: ["Wrap","a","list","of","environments",",","giving","each","environment","a","one-hot",".","This","is","the","primary","way","of","constructing","instances","of","this","class",".","It","'s","mostly","useful","when","training","multi-task","algorithms","using","a","multi-task","aware","sampler",".","For","example",":","''","'","..","code-block",":",":","python","envs","=","get_mt10_envs","(",")","wrapped","=","TaskOnehotWrapper.wrap_env_list","(","envs",")","sampler","=","trainer.make_sampler","(","LocalSampler",",","env=wrapped",")","''","'","Args",":","envs","(","list","[","Environment","]",")",":","List","of","environments","to","wrap",".","Note","that","the","order","these","environments","are","passed","in","determines","the","value","of","their","one-hot","encoding",".","It","is","essential","that","this","list","is","always","in","the","same","order",",","or","the","resulting","encodings","will","be","inconsistent",".","Returns",":","list","[","TaskOnehotWrapper","]",":","The","wrapped","environments","."]
code: def wrap_env_list(cls, envs):
      """Wrap a list of environments, giving each environment a one-hot.
  
      This is the primary way of constructing instances of this class.
      It's mostly useful when training multi-task algorithms using a
      multi-task aware sampler.
  
      For example:
      '''
      .. code-block:: python
  
          envs = get_mt10_envs()
          wrapped = TaskOnehotWrapper.wrap_env_list(envs)
          sampler = trainer.make_sampler(LocalSampler, env=wrapped)
      '''
  
      Args:
          envs (list[Environment]): List of environments to wrap. Note
          that the
              order these environments are passed in determines the value of
              their one-hot encoding. It is essential that this list is
              always in the same order, or the resulting encodings will be
              inconsistent.
  
      Returns:
          list[TaskOnehotWrapper]: The wrapped environments.
  
      """
      n_total_tasks = len(envs)
      wrapped = []
      for i, env in enumerate(envs):
          wrapped.append(
              cls(env, task_index=i, n_total_tasks=n_total_tasks)
          )
      return wrapped
  
file_path: garage/src/garage/envs/task_onehot_wrapper.py
imports: import akro
  import numpy
  from garage import EnvSpec, EnvStep, Wrapper
label_desc: Use image node_id 7 for calling the TaskOnehotWrapper obj's underlying member method code with example usage: obj.wrap_env_list(cls, envs) and returns: wrapped