class_docstr: Half-cheetah environment with target direction, as described in [1].
  
  The code is adapted from
  https://github.com/cbfinn/maml_rl/blob/9c8e2ebd741cb0c7b8bf2d040c4caeeb8e06cc95/rllab/envs/mujoco/half_cheetah_env_rand_direc.py
  
  The half-cheetah follows the dynamics from MuJoCo [2], and receives at each
  time step a reward composed of a control cost and a reward equal to its
  velocity in the target direction. The tasks are generated by sampling the
  target directions from a Bernoulli distribution on {-1, 1} with parameter
  0.5 (-1: backward, +1: forward).
  
  [1] Chelsea Finn, Pieter Abbeel, Sergey Levine, "Model-Agnostic
      Meta-Learning for Fast Adaptation of Deep Networks", 2017
      (https://arxiv.org/abs/1703.03400)
  [2] Emanuel Todorov, Tom Erez, Yuval Tassa, "MuJoCo: A physics engine for
      model-based control", 2012
      (https://homes.cs.washington.edu/~todorov/papers/TodorovIROS12.pdf)
  
  Args:
      task (dict or None):
          direction (float): Target direction, either -1 or 1.
docstr: Sample a list of `num_tasks` tasks.
  
  Args:
      num_tasks (int): Number of tasks to sample.
  
  Returns:
      list[dict[str, float]]: A list of "tasks," where each task is a
          dictionary containing a single key, "direction", mapping to -1
          or 1.
docstr_tok: ["Sample","a","list","of","`","num_tasks","`","tasks",".","Args",":","num_tasks","(","int",")",":","Number","of","tasks","to","sample",".","Returns",":","list","[","dict","[","str",",","float","]","]",":","A","list","of","``","tasks",",","''","where","each","task","is","a","dictionary","containing","a","single","key",",","``","direction","''",",","mapping","to","-1","or","1","."]
code: def sample_tasks(self, num_tasks):
      """Sample a list of `num_tasks` tasks.
  
      Args:
          num_tasks (int): Number of tasks to sample.
  
      Returns:
          list[dict[str, float]]: A list of "tasks," where each task is a
              dictionary containing a single key, "direction", mapping to -1
              or 1.
  
      """
      directions = (
          2 * self.np_random.binomial(1, p=0.5, size=(num_tasks,)) - 1
      )
      tasks = [{"direction": direction} for direction in directions]
      return tasks
  
imports: import numpy
  from garage.envs.mujoco.half_cheetah_env_meta_base import HalfCheetahEnvMetaBase
label_desc: Use image node_id 3 for calling the HalfCheetahDirEnv obj's underlying member method code with example usage: obj.sample_tasks(num_tasks) and returns: tasks