mtrl.env package

Subpackages

Submodules

mtrl.env.builder module

mtrl.env.builder.build_dmcontrol_vec_env(domain_name: str, task_name: str, prefix: str, make_kwargs: omegaconf.dictconfig.DictConfig, env_id_list: List[int], seed_list: List[int], mode_list: List[str])mtrl.env.vec_env.VecEnv[source]
mtrl.env.builder.build_metaworld_vec_env(config: omegaconf.dictconfig.DictConfig, benchmark: metaworld.Benchmark, mode: str, env_id_to_task_map: Optional[Dict[str, metaworld.Task]]) → Tuple[gym.vector.async_vector_env.AsyncVectorEnv, Optional[Dict[str, Any]]][source]

mtrl.env.types module

Collection of types used in the env.

mtrl.env.vec_env module

class mtrl.env.vec_env.MetaWorldVecEnv(env_metadata: Dict[str, Any], env_fns, observation_space=None, action_space=None, shared_memory=True, copy=True, context=None, daemon=True, worker=None)[source]

Bases: gym.vector.async_vector_env.AsyncVectorEnv

Return only every skip-th frame

create_multitask_obs(env_obs)[source]
property ids
property mode
reset()[source]

Reset all sub-environments and return a batch of initial observations.

Returns

observations – A batch of observations from the vectorized environment.

Return type

sample from observation_space

step(actions)[source]

Take an action for each sub-environments.

Parameters

actions (iterable of samples from action_space) – List of actions.

Returns

  • observations (sample from observation_space) – A batch of observations from the vectorized environment.

  • rewards (np.ndarray instance (dtype np.float_)) – A vector of rewards from the vectorized environment.

  • dones (np.ndarray instance (dtype np.bool_)) – A vector whose entries indicate whether the episode has ended.

  • infos (list of dict) – A list of auxiliary diagnostic information dicts from sub-environments.

class mtrl.env.vec_env.VecEnv(env_metadata: Dict[str, Any], env_fns, observation_space=None, action_space=None, shared_memory=True, copy=True, context=None, daemon=True, worker=None)[source]

Bases: gym.vector.async_vector_env.AsyncVectorEnv

Return only every skip-th frame

property ids
property mode
reset()[source]

Reset all sub-environments and return a batch of initial observations.

Returns

observations – A batch of observations from the vectorized environment.

Return type

sample from observation_space

step(actions)[source]

Take an action for each sub-environments.

Parameters

actions (iterable of samples from action_space) – List of actions.

Returns

  • observations (sample from observation_space) – A batch of observations from the vectorized environment.

  • rewards (np.ndarray instance (dtype np.float_)) – A vector of rewards from the vectorized environment.

  • dones (np.ndarray instance (dtype np.bool_)) – A vector whose entries indicate whether the episode has ended.

  • infos (list of dict) – A list of auxiliary diagnostic information dicts from sub-environments.

Module contents

mtrl.env.register_once(id, entry_point, **kwargs)[source]