code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def from_env_step(cls, env_step, last_observation, agent_info, episode_info): """Create a TimeStep from a EnvStep. Args: env_step (EnvStep): the env step returned by the environment. last_observation (numpy.ndarray): A numpy array of shape :...
Create a TimeStep from a EnvStep. Args: env_step (EnvStep): the env step returned by the environment. last_observation (numpy.ndarray): A numpy array of shape :math:`(O^*)` containing the observation for this time step in the environment. These must confo...
from_env_step
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def concatenate(cls, *batches): """Concatenate two or more :class:`TimeStepBatch`s. Args: batches (list[TimeStepBatch]): Batches to concatenate. Returns: TimeStepBatch: The concatenation of the batches. Raises: ValueError: If no TimeStepBatches are ...
Concatenate two or more :class:`TimeStepBatch`s. Args: batches (list[TimeStepBatch]): Batches to concatenate. Returns: TimeStepBatch: The concatenation of the batches. Raises: ValueError: If no TimeStepBatches are provided.
concatenate
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def split(self) -> List['TimeStepBatch']: """Split a :class:`~TimeStepBatch` into a list of :class:`~TimeStepBatch`s. The opposite of concatenate. Returns: list[TimeStepBatch]: A list of :class:`TimeStepBatch`s, with one :class:`~TimeStep` per :class:`~TimeStepBatch...
Split a :class:`~TimeStepBatch` into a list of :class:`~TimeStepBatch`s. The opposite of concatenate. Returns: list[TimeStepBatch]: A list of :class:`TimeStepBatch`s, with one :class:`~TimeStep` per :class:`~TimeStepBatch`.
split
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def to_time_step_list(self) -> List[Dict[str, np.ndarray]]: """Convert the batch into a list of dictionaries. Breaks the :class:`~TimeStepBatch` into a list of single time step sample dictionaries. len(rewards) (or the number of discrete time step) dictionaries are returned Ret...
Convert the batch into a list of dictionaries. Breaks the :class:`~TimeStepBatch` into a list of single time step sample dictionaries. len(rewards) (or the number of discrete time step) dictionaries are returned Returns: list[dict[str, np.ndarray or dict[str, np.ndarray]]]:...
to_time_step_list
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def from_time_step_list(cls, env_spec, ts_samples): """Create a :class:`~TimeStepBatch` from a list of time step dictionaries. Args: env_spec (EnvSpec): Specification for the environment from which this data was sampled. ts_samples (list[dict[str, np.ndarray or d...
Create a :class:`~TimeStepBatch` from a list of time step dictionaries. Args: env_spec (EnvSpec): Specification for the environment from which this data was sampled. ts_samples (list[dict[str, np.ndarray or dict[str, np.ndarray]]]): keys: ...
from_time_step_list
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def concatenate(cls, *batches): """Create a EpisodeBatch by concatenating EpisodeBatches. Args: batches (list[EpisodeBatch]): Batches to concatenate. Returns: EpisodeBatch: The concatenation of the batches. """ if __debug__: for b in batches...
Create a EpisodeBatch by concatenating EpisodeBatches. Args: batches (list[EpisodeBatch]): Batches to concatenate. Returns: EpisodeBatch: The concatenation of the batches.
concatenate
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def _episode_ranges(self): """Iterate through start and stop indices for each episode. Yields: tuple[int, int]: Start index (inclusive) and stop index (exclusive). """ start = 0 for length in self.lengths: stop = start + length ...
Iterate through start and stop indices for each episode. Yields: tuple[int, int]: Start index (inclusive) and stop index (exclusive).
_episode_ranges
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def split(self): """Split an EpisodeBatch into a list of EpisodeBatches. The opposite of concatenate. Returns: list[EpisodeBatch]: A list of EpisodeBatches, with one episode per batch. """ episodes = [] for i, (start, stop) in enumerate(self...
Split an EpisodeBatch into a list of EpisodeBatches. The opposite of concatenate. Returns: list[EpisodeBatch]: A list of EpisodeBatches, with one episode per batch.
split
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def to_list(self): """Convert the batch into a list of dictionaries. Returns: list[dict[str, np.ndarray or dict[str, np.ndarray]]]: Keys: * observations (np.ndarray): Non-flattened array of observations. Has shape (T, S^*) (the unflattened state ...
Convert the batch into a list of dictionaries. Returns: list[dict[str, np.ndarray or dict[str, np.ndarray]]]: Keys: * observations (np.ndarray): Non-flattened array of observations. Has shape (T, S^*) (the unflattened state space of the curren...
to_list
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def from_list(cls, env_spec, paths): """Create a EpisodeBatch from a list of episodes. Args: env_spec (EnvSpec): Specification for the environment from which this data was sampled. paths (list[dict[str, np.ndarray or dict[str, np.ndarray]]]): Keys: ...
Create a EpisodeBatch from a list of episodes. Args: env_spec (EnvSpec): Specification for the environment from which this data was sampled. paths (list[dict[str, np.ndarray or dict[str, np.ndarray]]]): Keys: * episode_infos (dict[str, np.ndarray]): Dicti...
from_list
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def next_observations(self): r"""Get the observations seen after actions are performed. In an :class:`~EpisodeBatch`, next_observations don't need to be stored explicitly, since the next observation is already stored in the batch. Returns: np.ndarray: The "next_obse...
Get the observations seen after actions are performed. In an :class:`~EpisodeBatch`, next_observations don't need to be stored explicitly, since the next observation is already stored in the batch. Returns: np.ndarray: The "next_observations" with shape :mat...
next_observations
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def episode_infos(self): r"""Get the episode_infos. In an :class:`~EpisodeBatch`, episode_infos only need to be stored once per episode. However, the episode_infos field of :class:`~TimeStepBatch` has shape :math:`(N \bullet [T])`. This method expands episode_infos_by_episode (w...
Get the episode_infos. In an :class:`~EpisodeBatch`, episode_infos only need to be stored once per episode. However, the episode_infos field of :class:`~TimeStepBatch` has shape :math:`(N \bullet [T])`. This method expands episode_infos_by_episode (which have shape :math:`(N)`) to ...
episode_infos
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def observations_list(self): """Split observations into a list. Returns: list[np.ndarray]: Splitted list. """ obs_list = [] for start, stop in self._episode_ranges(): obs_list.append(self.observations[start:stop]) return obs_list
Split observations into a list. Returns: list[np.ndarray]: Splitted list.
observations_list
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def actions_list(self): """Split actions into a list. Returns: list[np.ndarray]: Splitted list. """ acts_list = [] for start, stop in self._episode_ranges(): acts_list.append(self.actions[start:stop]) return acts_list
Split actions into a list. Returns: list[np.ndarray]: Splitted list.
actions_list
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def padded_agent_infos(self): """Padded agent infos. Returns: dict[str, np.ndarray]: Padded agent infos. Each value must have shape with :math:`(N, max_episode_length)` or :math:`(N, max_episode_length, S^*)`. """ return { k: pad_...
Padded agent infos. Returns: dict[str, np.ndarray]: Padded agent infos. Each value must have shape with :math:`(N, max_episode_length)` or :math:`(N, max_episode_length, S^*)`.
padded_agent_infos
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def padded_env_infos(self): """Padded env infos. Returns: dict[str, np.ndarray]: Padded env infos. Each value must have shape with :math:`(N, max_episode_length)` or :math:`(N, max_episode_length, S^*)`. """ return { k: pad_batch_...
Padded env infos. Returns: dict[str, np.ndarray]: Padded env infos. Each value must have shape with :math:`(N, max_episode_length)` or :math:`(N, max_episode_length, S^*)`.
padded_env_infos
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def _space_soft_contains(space, element): """Check that a space has the same dimensionality as an element. If the space's dimensionality is not available, check that the space contains the element. Args: space (akro.Space or gym.Space): Space to check element (object): Element to check...
Check that a space has the same dimensionality as an element. If the space's dimensionality is not available, check that the space contains the element. Args: space (akro.Space or gym.Space): Space to check element (object): Element to check in space. Returns: bool: True iff t...
_space_soft_contains
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def check_timestep_batch(batch, array_type, ignored_fields=()): """Check a TimeStepBatch of any array type that has .shape. Args: batch (TimeStepBatch): Batch of timesteps. array_type (type): Array type. ignored_fields (set[str]): Set of fields to ignore checking on. Raises: ...
Check a TimeStepBatch of any array type that has .shape. Args: batch (TimeStepBatch): Batch of timesteps. array_type (type): Array type. ignored_fields (set[str]): Set of fields to ignore checking on. Raises: ValueError: If an invariant of TimeStepBatch is broken.
check_timestep_batch
python
rlworkgroup/garage
src/garage/_dtypes.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_dtypes.py
MIT
def render_modes(self): """list: A list of string representing the supported render modes. See render() for a list of modes. """
list: A list of string representing the supported render modes. See render() for a list of modes.
render_modes
python
rlworkgroup/garage
src/garage/_environment.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_environment.py
MIT
def step(self, action): """Steps the environment with the action and returns a `EnvStep`. If the environment returned the last `EnvStep` of a sequence (either of type TERMINAL or TIMEOUT) at the previous step, this call to `step()` will start a new sequence and `action` will be ignored....
Steps the environment with the action and returns a `EnvStep`. If the environment returned the last `EnvStep` of a sequence (either of type TERMINAL or TIMEOUT) at the previous step, this call to `step()` will start a new sequence and `action` will be ignored. If `spec.max_episode_leng...
step
python
rlworkgroup/garage
src/garage/_environment.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_environment.py
MIT
def render(self, mode): """Renders the environment. The set of supported modes varies per environment. By convention, if mode is: * rgb_array: Return an `numpy.ndarray` with shape (x, y, 3) and type uint8, representing RGB values for an x-by-y pixel image, suitable ...
Renders the environment. The set of supported modes varies per environment. By convention, if mode is: * rgb_array: Return an `numpy.ndarray` with shape (x, y, 3) and type uint8, representing RGB values for an x-by-y pixel image, suitable for turning into a video. ...
render
python
rlworkgroup/garage
src/garage/_environment.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_environment.py
MIT
def visualize(self): """Creates a visualization of the environment. This function should be called **only once** after `reset()` to set up the visualization display. The visualization should be updated when the environment is changed (i.e. when `step()` is called.) Calling `clo...
Creates a visualization of the environment. This function should be called **only once** after `reset()` to set up the visualization display. The visualization should be updated when the environment is changed (i.e. when `step()` is called.) Calling `close()` will deallocate any resour...
visualize
python
rlworkgroup/garage
src/garage/_environment.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_environment.py
MIT
def close(self): """Closes the environment. This method should close all windows invoked by `visualize()`. Override this function in your subclass to perform any necessary cleanup. Environments will automatically `close()` themselves when they are garbage collected or ...
Closes the environment. This method should close all windows invoked by `visualize()`. Override this function in your subclass to perform any necessary cleanup. Environments will automatically `close()` themselves when they are garbage collected or when the program exits. ...
close
python
rlworkgroup/garage
src/garage/_environment.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_environment.py
MIT
def __getattr__(self, name): """Forward getattr request to wrapped environment. Args: name (str): attr (str): attribute name Returns: object: the wrapped attribute. Raises: AttributeError: if the requested attribute is a private attribute, ...
Forward getattr request to wrapped environment. Args: name (str): attr (str): attribute name Returns: object: the wrapped attribute. Raises: AttributeError: if the requested attribute is a private attribute, or if the requested attribute is not...
__getattr__
python
rlworkgroup/garage
src/garage/_environment.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_environment.py
MIT
def make_optimizer(optimizer_type, module=None, **kwargs): """Create an optimizer for pyTorch & tensorflow algos. Args: optimizer_type (Union[type, tuple[type, dict]]): Type of optimizer. This can be an optimizer type such as 'torch.optim.Adam' or a tuple of type and dictionary,...
Create an optimizer for pyTorch & tensorflow algos. Args: optimizer_type (Union[type, tuple[type, dict]]): Type of optimizer. This can be an optimizer type such as 'torch.optim.Adam' or a tuple of type and dictionary, where dictionary contains arguments to initialize the...
make_optimizer
python
rlworkgroup/garage
src/garage/_functions.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_functions.py
MIT
def rollout(env, agent, *, max_episode_length=np.inf, animated=False, pause_per_frame=None, deterministic=False): """Sample a single episode of the agent in the environment. Args: agent (Policy): Policy used to select actions. ...
Sample a single episode of the agent in the environment. Args: agent (Policy): Policy used to select actions. env (Environment): Environment to perform actions in. max_episode_length (int): If the episode reaches this many timesteps, it is truncated. animated (bool): If ...
rollout
python
rlworkgroup/garage
src/garage/_functions.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_functions.py
MIT
def obtain_evaluation_episodes(policy, env, max_episode_length=1000, num_eps=100, deterministic=True): """Sample the policy for num_eps episodes and return average values. Args: p...
Sample the policy for num_eps episodes and return average values. Args: policy (Policy): Policy to use as the actor when gathering samples. env (Environment): The environement used to obtain episodes. max_episode_length (int): Maximum episode length. The episode will truncated w...
obtain_evaluation_episodes
python
rlworkgroup/garage
src/garage/_functions.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_functions.py
MIT
def log_multitask_performance(itr, batch, discount, name_map=None): r"""Log performance of episodes from multiple tasks. Args: itr (int): Iteration number to be logged. batch (EpisodeBatch): Batch of episodes. The episodes should have either the "task_name" or "task_id" `env_infos`....
Log performance of episodes from multiple tasks. Args: itr (int): Iteration number to be logged. batch (EpisodeBatch): Batch of episodes. The episodes should have either the "task_name" or "task_id" `env_infos`. If the "task_name" is not present, then `name_map` is required,...
log_multitask_performance
python
rlworkgroup/garage
src/garage/_functions.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_functions.py
MIT
def log_performance(itr, batch, discount, prefix='Evaluation'): """Evaluate the performance of an algorithm on a batch of episodes. Args: itr (int): Iteration number. batch (EpisodeBatch): The episodes to evaluate with. discount (float): Discount value, from algorithm's property. ...
Evaluate the performance of an algorithm on a batch of episodes. Args: itr (int): Iteration number. batch (EpisodeBatch): The episodes to evaluate with. discount (float): Discount value, from algorithm's property. prefix (str): Prefix to add to all logged keys. Returns: ...
log_performance
python
rlworkgroup/garage
src/garage/_functions.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/_functions.py
MIT
def __init__(self, desc='4x4', max_episode_length=None): """Initialize the environment. Args: desc (str): grid configuration key. max_episode_length (int): The maximum steps allowed for an episode. """ if isinstance(desc, str): desc = MAPS[desc] ...
Initialize the environment. Args: desc (str): grid configuration key. max_episode_length (int): The maximum steps allowed for an episode.
__init__
python
rlworkgroup/garage
src/garage/envs/grid_world_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/grid_world_env.py
MIT
def step(self, action): """Steps the environment. action map: 0: left 1: down 2: right 3: up Args: action (int): an int encoding the action Returns: EnvStep: The environment step resulting from the action. Raises: ...
Steps the environment. action map: 0: left 1: down 2: right 3: up Args: action (int): an int encoding the action Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is ...
step
python
rlworkgroup/garage
src/garage/envs/grid_world_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/grid_world_env.py
MIT
def render(self, mode): """Renders the environment. Args: mode (str): the mode to render with. The string must be present in `Environment.render_modes`. """
Renders the environment. Args: mode (str): the mode to render with. The string must be present in `Environment.render_modes`.
render
python
rlworkgroup/garage
src/garage/envs/grid_world_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/grid_world_env.py
MIT
def _get_possible_next_states(self, state, action): """Return possible next states and their probabilities. Only next states with nonzero probabilities will be returned. Args: state (list): start state action (int): action Returns: list: a list of p...
Return possible next states and their probabilities. Only next states with nonzero probabilities will be returned. Args: state (list): start state action (int): action Returns: list: a list of pairs (s', p(s'|s,a))
_get_possible_next_states
python
rlworkgroup/garage
src/garage/envs/grid_world_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/grid_world_env.py
MIT
def __new__(cls, *args, **kwargs): """Returns environment specific wrapper based on input environment type. Args: *args: Positional arguments **kwargs: Keyword arguments Returns: garage.envs.bullet.BulletEnv: if the environment is a bullet-based ...
Returns environment specific wrapper based on input environment type. Args: *args: Positional arguments **kwargs: Keyword arguments Returns: garage.envs.bullet.BulletEnv: if the environment is a bullet-based environment. Else returns a garage.envs.G...
__new__
python
rlworkgroup/garage
src/garage/envs/gym_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/gym_env.py
MIT
def step(self, action): """Call step on wrapped env. Args: action (np.ndarray): An action provided by the agent. Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment has ...
Call step on wrapped env. Args: action (np.ndarray): An action provided by the agent. Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment has been constructed an...
step
python
rlworkgroup/garage
src/garage/envs/gym_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/gym_env.py
MIT
def _close_viewer_window(self): """Close viewer window. Unfortunately, some gym environments don't close the viewer windows properly, which leads to "out of memory" issues when several of these environments are tested one after the other. This method searches for the viewer obje...
Close viewer window. Unfortunately, some gym environments don't close the viewer windows properly, which leads to "out of memory" issues when several of these environments are tested one after the other. This method searches for the viewer object of type MjViewer, Viewer or Simp...
_close_viewer_window
python
rlworkgroup/garage
src/garage/envs/gym_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/gym_env.py
MIT
def __getattr__(self, name): """Handle function calls wrapped environment. Args: name (str): attribute name Returns: object: the wrapped attribute. Raises: AttributeError: if the requested attribute is a private attribute, or if the requ...
Handle function calls wrapped environment. Args: name (str): attribute name Returns: object: the wrapped attribute. Raises: AttributeError: if the requested attribute is a private attribute, or if the requested attribute is not found in the ...
__getattr__
python
rlworkgroup/garage
src/garage/envs/gym_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/gym_env.py
MIT
def sample_tasks(self, n_tasks): """Samples n_tasks tasks. Part of the set_task environment protocol. To call this method, a benchmark must have been passed in at environment construction. Args: n_tasks (int): Number of tasks to sample. Returns: dict[st...
Samples n_tasks tasks. Part of the set_task environment protocol. To call this method, a benchmark must have been passed in at environment construction. Args: n_tasks (int): Number of tasks to sample. Returns: dict[str,object]: Task object to pass back to `set_...
sample_tasks
python
rlworkgroup/garage
src/garage/envs/metaworld_set_task_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/metaworld_set_task_env.py
MIT
def set_task(self, task): """Set the task. Part of the set_task environment protocol. Args: task (dict[str,object]): Task object from `sample_tasks`. """ # Mixing train and test is probably a mistake assert self._kind is None or self._kind == task['kind'] ...
Set the task. Part of the set_task environment protocol. Args: task (dict[str,object]): Task object from `sample_tasks`.
set_task
python
rlworkgroup/garage
src/garage/envs/metaworld_set_task_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/metaworld_set_task_env.py
MIT
def _fill_tasks(self): """Fill out _tasks after the benchmark is set. Raises: ValueError: If kind is not set to "train" or "test" """ if self._add_env_onehot: if (self._kind == 'test' or 'metaworld.ML' in repr(type(self._benchmark))): ...
Fill out _tasks after the benchmark is set. Raises: ValueError: If kind is not set to "train" or "test"
_fill_tasks
python
rlworkgroup/garage
src/garage/envs/metaworld_set_task_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/metaworld_set_task_env.py
MIT
def round_robin_strategy(num_tasks, last_task=None): """A function for sampling tasks in round robin fashion. Args: num_tasks (int): Total number of tasks. last_task (int): Previously sampled task. Returns: int: task id. """ if last_task is None: return 0 retu...
A function for sampling tasks in round robin fashion. Args: num_tasks (int): Total number of tasks. last_task (int): Previously sampled task. Returns: int: task id.
round_robin_strategy
python
rlworkgroup/garage
src/garage/envs/multi_env_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/multi_env_wrapper.py
MIT
def observation_space(self): """Observation space. Returns: akro.Box: Observation space. """ if self._mode == 'vanilla': return self._env.observation_space elif self._mode == 'add-onehot': task_lb, task_ub = self.task_space.bounds ...
Observation space. Returns: akro.Box: Observation space.
observation_space
python
rlworkgroup/garage
src/garage/envs/multi_env_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/multi_env_wrapper.py
MIT
def task_space(self): """Task Space. Returns: akro.Box: Task space. """ one_hot_ub = np.ones(self.num_tasks) one_hot_lb = np.zeros(self.num_tasks) return akro.Box(one_hot_lb, one_hot_ub)
Task Space. Returns: akro.Box: Task space.
task_space
python
rlworkgroup/garage
src/garage/envs/multi_env_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/multi_env_wrapper.py
MIT
def active_task_index(self): """Index of active task env. Returns: int: Index of active task. """ if hasattr(self._env, 'active_task_index'): return self._env.active_task_index else: return self._active_task_index
Index of active task env. Returns: int: Index of active task.
active_task_index
python
rlworkgroup/garage
src/garage/envs/multi_env_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/multi_env_wrapper.py
MIT
def step(self, action): """Step the active task env. Args: action (object): object to be passed in Environment.reset(action) Returns: EnvStep: The environment step resulting from the action. """ es = self._env.step(action) if self._mode == 'add...
Step the active task env. Args: action (object): object to be passed in Environment.reset(action) Returns: EnvStep: The environment step resulting from the action.
step
python
rlworkgroup/garage
src/garage/envs/multi_env_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/multi_env_wrapper.py
MIT
def _active_task_one_hot(self): """One-hot representation of active task. Returns: numpy.ndarray: one-hot representation of active task """ one_hot = np.zeros(self.task_space.shape) index = self.active_task_index or 0 one_hot[index] = self.task_space.high[in...
One-hot representation of active task. Returns: numpy.ndarray: one-hot representation of active task
_active_task_one_hot
python
rlworkgroup/garage
src/garage/envs/multi_env_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/multi_env_wrapper.py
MIT
def step(self, action): """Call step on wrapped env. Args: action (np.ndarray): An action provided by the agent. Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment has ...
Call step on wrapped env. Args: action (np.ndarray): An action provided by the agent. Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment has been constructed an...
step
python
rlworkgroup/garage
src/garage/envs/normalized_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/normalized_env.py
MIT
def _apply_normalize_obs(self, obs): """Compute normalized observation. Args: obs (np.ndarray): Observation. Returns: np.ndarray: Normalized observation. """ self._update_obs_estimate(obs) flat_obs = self._env.observation_space.flatten(obs) ...
Compute normalized observation. Args: obs (np.ndarray): Observation. Returns: np.ndarray: Normalized observation.
_apply_normalize_obs
python
rlworkgroup/garage
src/garage/envs/normalized_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/normalized_env.py
MIT
def _apply_normalize_reward(self, reward): """Compute normalized reward. Args: reward (float): Reward. Returns: float: Normalized reward. """ self._update_reward_estimate(reward) return reward / (np.sqrt(self._reward_var) + 1e-8)
Compute normalized reward. Args: reward (float): Reward. Returns: float: Normalized reward.
_apply_normalize_reward
python
rlworkgroup/garage
src/garage/envs/normalized_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/normalized_env.py
MIT
def step(self, action): """Step the environment. Args: action (np.ndarray): An action provided by the agent. Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment ...
Step the environment. Args: action (np.ndarray): An action provided by the agent. Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment has been constr...
step
python
rlworkgroup/garage
src/garage/envs/point_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/point_env.py
MIT
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, np.ndarray]]: A list of "tasks", where each task is a dictionary containing a single key, "goal", mapping ...
Sample a list of `num_tasks` tasks. Args: num_tasks (int): Number of tasks to sample. Returns: list[dict[str, np.ndarray]]: A list of "tasks", where each task is a dictionary containing a single key, "goal", mapping to a point in 2D space. ...
sample_tasks
python
rlworkgroup/garage
src/garage/envs/point_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/point_env.py
MIT
def set_task(self, task): """Reset with a task. Args: task (dict[str, np.ndarray]): A task (a dictionary containing a single key, "goal", which should be a point in 2D space). """ self._task = task self._goal = task['goal']
Reset with a task. Args: task (dict[str, np.ndarray]): A task (a dictionary containing a single key, "goal", which should be a point in 2D space).
set_task
python
rlworkgroup/garage
src/garage/envs/point_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/point_env.py
MIT
def step(self, action): """gym.Env step for the active task env. Args: action (np.ndarray): Action performed by the agent in the environment. Returns: tuple: np.ndarray: Agent's observation of the current environment. floa...
gym.Env step for the active task env. Args: action (np.ndarray): Action performed by the agent in the environment. Returns: tuple: np.ndarray: Agent's observation of the current environment. float: Amount of reward yielded by prev...
step
python
rlworkgroup/garage
src/garage/envs/task_name_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/task_name_wrapper.py
MIT
def step(self, action): """Environment step for the active task env. Args: action (np.ndarray): Action performed by the agent in the environment. Returns: EnvStep: The environment step resulting from the action. """ es = self._env.step(a...
Environment step for the active task env. Args: action (np.ndarray): Action performed by the agent in the environment. Returns: EnvStep: The environment step resulting from the action.
step
python
rlworkgroup/garage
src/garage/envs/task_onehot_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/task_onehot_wrapper.py
MIT
def _obs_with_one_hot(self, obs): """Concatenate observation and task one-hot. Args: obs (numpy.ndarray): observation Returns: numpy.ndarray: observation + task one-hot. """ one_hot = np.zeros(self._n_total_tasks) one_hot[self._task_index] = 1.0...
Concatenate observation and task one-hot. Args: obs (numpy.ndarray): observation Returns: numpy.ndarray: observation + task one-hot.
_obs_with_one_hot
python
rlworkgroup/garage
src/garage/envs/task_onehot_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/task_onehot_wrapper.py
MIT
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: ''' ...
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 ...
wrap_env_list
python
rlworkgroup/garage
src/garage/envs/task_onehot_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/task_onehot_wrapper.py
MIT
def wrap_env_cons_list(cls, env_cons): """Wrap a list of environment constructors, giving each a one-hot. This function is useful if you want to avoid constructing any environments in the main experiment process, and are using a multi-task aware remote sampler (i.e. `~RaySampler`). ...
Wrap a list of environment constructors, giving each a one-hot. This function is useful if you want to avoid constructing any environments in the main experiment process, and are using a multi-task aware remote sampler (i.e. `~RaySampler`). For example: ''' .. code-bloc...
wrap_env_cons_list
python
rlworkgroup/garage
src/garage/envs/task_onehot_wrapper.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/task_onehot_wrapper.py
MIT
def __init__(self, env, name=None): """Create a DMControlEnv. Args: env (dm_control.suite.Task): The wrapped dm_control environment. name (str): Name of the environment. """ self._env = env self._name = name or type(env.task).__name__ self._viewe...
Create a DMControlEnv. Args: env (dm_control.suite.Task): The wrapped dm_control environment. name (str): Name of the environment.
__init__
python
rlworkgroup/garage
src/garage/envs/dm_control/dm_control_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/dm_control/dm_control_env.py
MIT
def step(self, action): """Steps the environment with the action and returns a `EnvStep`. Args: action (object): input action Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the env...
Steps the environment with the action and returns a `EnvStep`. Args: action (object): input action Returns: EnvStep: The environment step resulting from the action. Raises: RuntimeError: if `step()` is called after the environment has been c...
step
python
rlworkgroup/garage
src/garage/envs/dm_control/dm_control_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/dm_control/dm_control_env.py
MIT
def render(self, mode): """Render the environment. Args: mode (str): render mode. Returns: np.ndarray: if mode is 'rgb_array', else return None. Raises: ValueError: if mode is not supported. """ self._validate_render_mode(mode) ...
Render the environment. Args: mode (str): render mode. Returns: np.ndarray: if mode is 'rgb_array', else return None. Raises: ValueError: if mode is not supported.
render
python
rlworkgroup/garage
src/garage/envs/dm_control/dm_control_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/dm_control/dm_control_env.py
MIT
def __getstate__(self): """See `Object.__getstate__`. Returns: dict: dict of the class. """ d = self.__dict__.copy() d['_viewer'] = None return d
See `Object.__getstate__`. Returns: dict: dict of the class.
__getstate__
python
rlworkgroup/garage
src/garage/envs/dm_control/dm_control_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/dm_control/dm_control_env.py
MIT
def step(self, action): """Take one step in the environment. Equivalent to step in HalfCheetahEnv, but with different rewards. Args: action (np.ndarray): The action to take in the environment. Raises: ValueError: If the current direction is not 1.0 or -1.0. ...
Take one step in the environment. Equivalent to step in HalfCheetahEnv, but with different rewards. Args: action (np.ndarray): The action to take in the environment. Raises: ValueError: If the current direction is not 1.0 or -1.0. Returns: tuple: ...
step
python
rlworkgroup/garage
src/garage/envs/mujoco/half_cheetah_dir_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/mujoco/half_cheetah_dir_env.py
MIT
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 ...
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.
sample_tasks
python
rlworkgroup/garage
src/garage/envs/mujoco/half_cheetah_dir_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/mujoco/half_cheetah_dir_env.py
MIT
def _get_obs(self): """Get a low-dimensional observation of the state. Returns: np.ndarray: Contains the flattened angle quaternion, angular velocity quaternion, and cartesian position. """ return np.concatenate([ self.sim.data.qpos.flat[1:], ...
Get a low-dimensional observation of the state. Returns: np.ndarray: Contains the flattened angle quaternion, angular velocity quaternion, and cartesian position.
_get_obs
python
rlworkgroup/garage
src/garage/envs/mujoco/half_cheetah_env_meta_base.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/mujoco/half_cheetah_env_meta_base.py
MIT
def step(self, action): """Take one step in the environment. Equivalent to step in HalfCheetahEnv, but with different rewards. Args: action (np.ndarray): The action to take in the environment. Returns: tuple: * observation (np.ndarray): The obse...
Take one step in the environment. Equivalent to step in HalfCheetahEnv, but with different rewards. Args: action (np.ndarray): The action to take in the environment. Returns: tuple: * observation (np.ndarray): The observation of the environment. ...
step
python
rlworkgroup/garage
src/garage/envs/mujoco/half_cheetah_vel_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/mujoco/half_cheetah_vel_env.py
MIT
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, "velocity", mapping t...
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, "velocity", mapping to a value between 0 and 2. ...
sample_tasks
python
rlworkgroup/garage
src/garage/envs/mujoco/half_cheetah_vel_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/mujoco/half_cheetah_vel_env.py
MIT
def reset(self, **kwargs): """ gym.Env reset function. Reset only when lives are lost. """ if self._was_real_done: obs = self.env.reset(**kwargs) else: # no-op step obs, _, _, _ = self.env.step(0) self._lives = self.env.unwrapp...
gym.Env reset function. Reset only when lives are lost.
reset
python
rlworkgroup/garage
src/garage/envs/wrappers/episodic_life.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/episodic_life.py
MIT
def reset(self, **kwargs): """gym.Env reset function. Args: kwargs (dict): extra arguments passed to gym.Env.reset() Returns: np.ndarray: next observation. """ self.env.reset(**kwargs) obs, _, done, _ = self.env.step(1) if done: ...
gym.Env reset function. Args: kwargs (dict): extra arguments passed to gym.Env.reset() Returns: np.ndarray: next observation.
reset
python
rlworkgroup/garage
src/garage/envs/wrappers/fire_reset.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/fire_reset.py
MIT
def step(self, action): """See gym.Env. Args: action (np.ndarray): Action conforming to action_space Returns: np.ndarray: Observation conforming to observation_space float: Reward for this step bool: Termination signal dict: Extra inf...
See gym.Env. Args: action (np.ndarray): Action conforming to action_space Returns: np.ndarray: Observation conforming to observation_space float: Reward for this step bool: Termination signal dict: Extra information from the environment. ...
step
python
rlworkgroup/garage
src/garage/envs/wrappers/grayscale.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/grayscale.py
MIT
def _color_to_grayscale(obs): """Convert a 3-channel color observation image to grayscale and uint8. Args: obs (np.ndarray): Observation array, conforming to observation_space Returns: np.ndarray: 1-channel grayscale version of obs, represented as uint8 """ with warnings.catch_warni...
Convert a 3-channel color observation image to grayscale and uint8. Args: obs (np.ndarray): Observation array, conforming to observation_space Returns: np.ndarray: 1-channel grayscale version of obs, represented as uint8
_color_to_grayscale
python
rlworkgroup/garage
src/garage/envs/wrappers/grayscale.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/grayscale.py
MIT
def step(self, action): """Repeat action, sum reward, and max over last two observations. Args: action (int): action to take in the atari environment. Returns: np.ndarray: observation of shape :math:`(O*,)` representating the max values over the last two...
Repeat action, sum reward, and max over last two observations. Args: action (int): action to take in the atari environment. Returns: np.ndarray: observation of shape :math:`(O*,)` representating the max values over the last two oservations. float: Re...
step
python
rlworkgroup/garage
src/garage/envs/wrappers/max_and_skip.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/max_and_skip.py
MIT
def step(self, action): """gym.Env step function. Performs one action step in the enviornment. Args: action (np.ndarray): Action of shape :math:`(A*, )` to pass to the environment. Returns: np.ndarray: Pixel observation of shape :math:`(O*, )` ...
gym.Env step function. Performs one action step in the enviornment. Args: action (np.ndarray): Action of shape :math:`(A*, )` to pass to the environment. Returns: np.ndarray: Pixel observation of shape :math:`(O*, )` from the wrapped env...
step
python
rlworkgroup/garage
src/garage/envs/wrappers/pixel_observation.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/pixel_observation.py
MIT
def reset(self): """gym.Env reset function. Returns: np.ndarray: Observation conforming to observation_space float: Reward for this step bool: Termination signal dict: Extra information from the environment. """ observation = self.env.rese...
gym.Env reset function. Returns: np.ndarray: Observation conforming to observation_space float: Reward for this step bool: Termination signal dict: Extra information from the environment.
reset
python
rlworkgroup/garage
src/garage/envs/wrappers/stack_frames.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/stack_frames.py
MIT
def step(self, action): """gym.Env step function. Args: action (int): index of the action to take. Returns: np.ndarray: Observation conforming to observation_space float: Reward for this step bool: Termination signal dict: Extra infor...
gym.Env step function. Args: action (int): index of the action to take. Returns: np.ndarray: Observation conforming to observation_space float: Reward for this step bool: Termination signal dict: Extra information from the environment. ...
step
python
rlworkgroup/garage
src/garage/envs/wrappers/stack_frames.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/envs/wrappers/stack_frames.py
MIT
def query_yes_no(question, default='yes'): """Ask a yes/no question via raw_input() and return their answer. Args: question (str): Printed to user. default (str or None): Default if user just hits enter. Raises: ValueError: If the provided default is invalid. Returns: ...
Ask a yes/no question via raw_input() and return their answer. Args: question (str): Printed to user. default (str or None): Default if user just hits enter. Raises: ValueError: If the provided default is invalid. Returns: bool: True for "yes"y answers, False for "no". ...
query_yes_no
python
rlworkgroup/garage
src/garage/examples/sim_policy.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/sim_policy.py
MIT
def step_bullet_kuka_env(n_steps=1000): """Load, step, and visualize a Bullet Kuka environment. Args: n_steps (int): number of steps to run. """ # Construct the environment env = GymEnv(gym.make('KukaBulletEnv-v0', renders=True, isDiscrete=True)) # Reset the environment and launch the...
Load, step, and visualize a Bullet Kuka environment. Args: n_steps (int): number of steps to run.
step_bullet_kuka_env
python
rlworkgroup/garage
src/garage/examples/step_bullet_kuka_env.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/step_bullet_kuka_env.py
MIT
def cem_cartpole(ctxt=None, seed=1): """Train CEM with Cartpole-v1 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce deter...
Train CEM with Cartpole-v1 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
cem_cartpole
python
rlworkgroup/garage
src/garage/examples/np/cem_cartpole.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/np/cem_cartpole.py
MIT
def cma_es_cartpole(ctxt=None, seed=1): """Train CMA_ES with Cartpole-v1 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train CMA_ES with Cartpole-v1 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
cma_es_cartpole
python
rlworkgroup/garage
src/garage/examples/np/cma_es_cartpole.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/np/cma_es_cartpole.py
MIT
def train(self, trainer): """Get samples and train the policy. Args: trainer (Trainer): Trainer. """ for epoch in trainer.step_epochs(): samples = trainer.obtain_samples(epoch) log_performance(epoch, EpisodeBatch.from_list...
Get samples and train the policy. Args: trainer (Trainer): Trainer.
train
python
rlworkgroup/garage
src/garage/examples/np/tutorial_cem.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/np/tutorial_cem.py
MIT
def _train_once(self, epoch, paths): """Perform one step of policy optimization given one batch of samples. Args: epoch (int): Iteration number. paths (list[dict]): A list of collected paths. Returns: float: The average return of epoch cycle. """ ...
Perform one step of policy optimization given one batch of samples. Args: epoch (int): Iteration number. paths (list[dict]): A list of collected paths. Returns: float: The average return of epoch cycle.
_train_once
python
rlworkgroup/garage
src/garage/examples/np/tutorial_cem.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/np/tutorial_cem.py
MIT
def _sample_params(self, epoch): """Return sample parameters. Args: epoch (int): Epoch number. Returns: np.ndarray: A numpy array of parameter values. """ extra_var_mult = max(1.0 - epoch / self._extra_decay_time, 0) sample_std = np.sqrt( ...
Return sample parameters. Args: epoch (int): Epoch number. Returns: np.ndarray: A numpy array of parameter values.
_sample_params
python
rlworkgroup/garage
src/garage/examples/np/tutorial_cem.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/np/tutorial_cem.py
MIT
def tutorial_cem(ctxt=None): """Train CEM with Cartpole-v1 environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. """ set_seed(100) with TFTrainer(ctxt) as trainer: env = GymEnv('CartPole-...
Train CEM with Cartpole-v1 environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`.
tutorial_cem
python
rlworkgroup/garage
src/garage/examples/np/tutorial_cem.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/np/tutorial_cem.py
MIT
def ddpg_pendulum(ctxt=None, seed=1): """Train DDPG with InvertedDoublePendulum-v2 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train DDPG with InvertedDoublePendulum-v2 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
ddpg_pendulum
python
rlworkgroup/garage
src/garage/examples/tf/ddpg_pendulum.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/ddpg_pendulum.py
MIT
def dqn_cartpole(ctxt=None, seed=1): """Train TRPO with CubeCrash-v0 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce det...
Train TRPO with CubeCrash-v0 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
dqn_cartpole
python
rlworkgroup/garage
src/garage/examples/tf/dqn_cartpole.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/dqn_cartpole.py
MIT
def dqn_pong(ctxt=None, seed=1, buffer_size=int(5e4), max_episode_length=500): """Train DQN on PongNoFrameskip-v4 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the rando...
Train DQN on PongNoFrameskip-v4 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism. buffer_size (int): Numb...
dqn_pong
python
rlworkgroup/garage
src/garage/examples/tf/dqn_pong.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/dqn_pong.py
MIT
def erwr_cartpole(ctxt=None, seed=1): """Train with ERWR on CartPole-v1 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train with ERWR on CartPole-v1 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
erwr_cartpole
python
rlworkgroup/garage
src/garage/examples/tf/erwr_cartpole.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/erwr_cartpole.py
MIT
def her_ddpg_fetchreach(ctxt=None, seed=1): """Train DDPG + HER on the goal-conditioned FetchReach env. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to p...
Train DDPG + HER on the goal-conditioned FetchReach env. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
her_ddpg_fetchreach
python
rlworkgroup/garage
src/garage/examples/tf/her_ddpg_fetchreach.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/her_ddpg_fetchreach.py
MIT
def multi_env_ppo(ctxt=None, seed=1): """Train PPO on two Atari environments simultaneously. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train PPO on two Atari environments simultaneously. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
multi_env_ppo
python
rlworkgroup/garage
src/garage/examples/tf/multi_env_ppo.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/multi_env_ppo.py
MIT
def multi_env_trpo(ctxt=None, seed=1): """Train TRPO on two different PointEnv instances. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train TRPO on two different PointEnv instances. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
multi_env_trpo
python
rlworkgroup/garage
src/garage/examples/tf/multi_env_trpo.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/multi_env_trpo.py
MIT
def ppo_memorize_digits(ctxt=None, seed=1, batch_size=4000, max_episode_length=100): """Train PPO on MemorizeDigits-v0 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by ...
Train PPO on MemorizeDigits-v0 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism. batch_size (int): Number...
ppo_memorize_digits
python
rlworkgroup/garage
src/garage/examples/tf/ppo_memorize_digits.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/ppo_memorize_digits.py
MIT
def ppo_pendulum(ctxt=None, seed=1): """Train PPO with InvertedDoublePendulum-v2 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train PPO with InvertedDoublePendulum-v2 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
ppo_pendulum
python
rlworkgroup/garage
src/garage/examples/tf/ppo_pendulum.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/ppo_pendulum.py
MIT
def reps_gym_cartpole(ctxt=None, seed=1): """Train REPS with CartPole-v0 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Train REPS with CartPole-v0 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
reps_gym_cartpole
python
rlworkgroup/garage
src/garage/examples/tf/reps_gym_cartpole.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/reps_gym_cartpole.py
MIT
def rl2_ppo_halfcheetah(ctxt, seed, max_episode_length, meta_batch_size, n_epochs, episode_per_task): """Train PPO with HalfCheetah environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the snapshotter. ...
Train PPO with HalfCheetah environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism. max_episode_length (int): Maximum le...
rl2_ppo_halfcheetah
python
rlworkgroup/garage
src/garage/examples/tf/rl2_ppo_halfcheetah.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_ppo_halfcheetah.py
MIT
def rl2_ppo_halfcheetah_meta_test(ctxt, seed, meta_batch_size, n_epochs, episode_per_task): """Perform meta-testing on RL2PPO with HalfCheetah environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the ...
Perform meta-testing on RL2PPO with HalfCheetah environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int): Used to seed the random number generator to produce determinism. meta_...
rl2_ppo_halfcheetah_meta_test
python
rlworkgroup/garage
src/garage/examples/tf/rl2_ppo_halfcheetah_meta_test.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_ppo_halfcheetah_meta_test.py
MIT
def rl2_ppo_metaworld_ml10(ctxt, seed, meta_batch_size, n_epochs, episode_per_task): """Train RL2 PPO with ML10 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int...
Train RL2 PPO with ML10 environment. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism. meta_batch_size (int): Meta bat...
rl2_ppo_metaworld_ml10
python
rlworkgroup/garage
src/garage/examples/tf/rl2_ppo_metaworld_ml10.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_ppo_metaworld_ml10.py
MIT
def rl2_ppo_metaworld_ml1_push(ctxt, seed, meta_batch_size, n_epochs, episode_per_task): """Train RL2 PPO with ML1 environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. ...
Train RL2 PPO with ML1 environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int): Used to seed the random number generator to produce determinism. meta_batch_size (int): Meta ba...
rl2_ppo_metaworld_ml1_push
python
rlworkgroup/garage
src/garage/examples/tf/rl2_ppo_metaworld_ml1_push.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_ppo_metaworld_ml1_push.py
MIT
def rl2_ppo_metaworld_ml45(ctxt, seed, meta_batch_size, n_epochs, episode_per_task): """Train PPO with ML45 environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int):...
Train PPO with ML45 environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int): Used to seed the random number generator to produce determinism. meta_batch_size (int): Meta batch...
rl2_ppo_metaworld_ml45
python
rlworkgroup/garage
src/garage/examples/tf/rl2_ppo_metaworld_ml45.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_ppo_metaworld_ml45.py
MIT
def rl2_trpo_halfcheetah(ctxt, seed, max_episode_length, meta_batch_size, n_epochs, episode_per_task): """Train TRPO with HalfCheetah environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshott...
Train TRPO with HalfCheetah environment. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int): Used to seed the random number generator to produce determinism. max_episode_length (int):...
rl2_trpo_halfcheetah
python
rlworkgroup/garage
src/garage/examples/tf/rl2_trpo_halfcheetah.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/rl2_trpo_halfcheetah.py
MIT
def td3_pendulum(ctxt=None, seed=1): """Wrap TD3 training task in the run_task function. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce ...
Wrap TD3 training task in the run_task function. Args: ctxt (garage.experiment.ExperimentContext): The experiment configuration used by Trainer to create the snapshotter. seed (int): Used to seed the random number generator to produce determinism.
td3_pendulum
python
rlworkgroup/garage
src/garage/examples/tf/td3_pendulum.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/td3_pendulum.py
MIT
def te_ppo_mt10(ctxt, seed, n_epochs, batch_size_per_task, n_tasks): """Train Task Embedding PPO with PointEnv. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int): Used to seed the random number gene...
Train Task Embedding PPO with PointEnv. Args: ctxt (ExperimentContext): The experiment configuration used by :class:`~Trainer` to create the :class:`~Snapshotter`. seed (int): Used to seed the random number generator to produce determinism. n_epochs (int): Total numb...
te_ppo_mt10
python
rlworkgroup/garage
src/garage/examples/tf/te_ppo_metaworld_mt10.py
https://github.com/rlworkgroup/garage/blob/master/src/garage/examples/tf/te_ppo_metaworld_mt10.py
MIT