mani_skill.utils.gym_utils#
various gymnasium/gym utilities used in ManiSkill, mostly to handle observation/action spaces and noramlization
Attributes#
Functions#
|
Clip action to [-1, 1] and scale according to a range [low, high]. |
|
Convert observation to OpenAI gym observation space (recursively). |
|
Recursively extract scalar metrics from an info dict returned by env.step. |
Finds the max episode steps parameter given by user or registered in the environment. |
|
|
Gets the min and max values of a given numpy type |
|
Inverse of clip_and_scale_action. |
|
Inverse of clip_and_scale_action without clipping. |
|
Module Contents#
- mani_skill.utils.gym_utils.clip_and_scale_action(action, low, high)[source]#
Clip action to [-1, 1] and scale according to a range [low, high].
- mani_skill.utils.gym_utils.convert_observation_to_space(observation, prefix='', unbatched=False)[source]#
Convert observation to OpenAI gym observation space (recursively). Modified from gym.envs.mujoco_env
- mani_skill.utils.gym_utils.extract_scalars_from_info(info, blacklist=(), batch_size=1)[source]#
Recursively extract scalar metrics from an info dict returned by env.step.
- Parameters:
info (dict) – info dict
blacklist (tuple, optional) – keys to exclude.
- Returns:
scalar metrics
- Return type:
dict[str, float]
- mani_skill.utils.gym_utils.find_max_episode_steps_value(env)[source]#
Finds the max episode steps parameter given by user or registered in the environment.
This is a useful utility as not all specs may include max episode steps and some wrappers may need access to this in order to implement e.g. TimeLimits correctly on the GPU sim.
- mani_skill.utils.gym_utils.get_dtype_bounds(dtype)[source]#
Gets the min and max values of a given numpy type
- Parameters:
dtype (numpy.dtype) –
- mani_skill.utils.gym_utils.inv_clip_and_scale_action(action, low, high)[source]#
Inverse of clip_and_scale_action.
- mani_skill.utils.gym_utils.inv_scale_action(action, low, high)[source]#
Inverse of clip_and_scale_action without clipping.
- mani_skill.utils.gym_utils.normalize_action_space(action_space)[source]#
- Parameters:
action_space (gymnasium.spaces.Box) –