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","."]
code: def __init__(self, env, task_index, n_total_tasks):
      assert 0 <= task_index < n_total_tasks
      super().__init__(env)
      self._task_index = task_index
      self._n_total_tasks = n_total_tasks
      env_lb = self._env.observation_space.low
      env_ub = self._env.observation_space.high
      one_hot_ub = np.ones(self._n_total_tasks)
      one_hot_lb = np.zeros(self._n_total_tasks)
  
      self._observation_space = akro.Box(
          np.concatenate([env_lb, one_hot_lb]),
          np.concatenate([env_ub, one_hot_ub]),
      )
      self._spec = EnvSpec(
          action_space=self.action_space,
          observation_space=self.observation_space,
          max_episode_length=self._env.spec.max_episode_length,
      )
  
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 1 to create a new TaskOnehotWrapper object from inherited base classes: Wrapper with example: obj = TaskOnehotWrapper(env, task_index, n_total_tasks)