evorl.envs.wrappers.action_wrapper

Module Contents

Classes

ActionRepeatWrapper

Repeat action for a number of steps.

ActionSquashWrapper

Convert continuous action space from [-1, 1] to [low, high].

API

class evorl.envs.wrappers.action_wrapper.ActionRepeatWrapper(env: evorl.envs.env.Env, action_repeat: int)[source]

Bases: evorl.envs.wrappers.wrapper.Wrapper

Repeat action for a number of steps.

Note

This wrapper only accumulates state.reward and state.info.ori_reward. It is safe to use ActionRepeatWrapper(RewardScaleWrapper(EpisodeWrapper(env))). However, if you want accumulate other metrics, inherit this class and add your own logic.

Caution

When using rollout functions like rollout, eval_rollout_episode with rollout_length argument, users should use math.ceil(env.max_episode_steps/action_repeat) to match the real rollout_length.

step(state: evorl.envs.env.EnvState, action: evorl.types.Action) evorl.envs.env.EnvState[source]
class evorl.envs.wrappers.action_wrapper.ActionSquashWrapper(env: evorl.envs.env.Env)[source]

Bases: evorl.envs.wrappers.wrapper.Wrapper

Convert continuous action space from [-1, 1] to [low, high].

property action_space: evorl.envs.space.Space
step(state: evorl.envs.env.EnvState, action: evorl.types.Action) evorl.envs.env.EnvState[source]