garage.envs.normalized_env
¶
An environment wrapper that normalizes action, observation and reward.
- class NormalizedEnv(env, scale_reward=1.0, normalize_obs=False, normalize_reward=False, expected_action_scale=1.0, flatten_obs=True, obs_alpha=0.001, reward_alpha=0.001)¶
Bases:
garage.Wrapper
An environment wrapper for normalization.
This wrapper normalizes action, and optionally observation and reward.
- Parameters
env (Environment) – An environment instance.
scale_reward (float) – Scale of environment reward.
normalize_obs (bool) – If True, normalize observation.
normalize_reward (bool) – If True, normalize reward. scale_reward is applied after normalization.
expected_action_scale (float) – Assuming action falls in the range of [-expected_action_scale, expected_action_scale] when normalize it.
flatten_obs (bool) – Flatten observation if True.
obs_alpha (float) – Update rate of moving average when estimating the mean and variance of observations.
reward_alpha (float) – Update rate of moving average when estimating the mean and variance of rewards.
- property action_space¶
The action space specification.
- Type
akro.Space
- property observation_space¶
The observation space specification.
- Type
akro.Space
- property unwrapped¶
The inner environment.
- Type
- reset()¶
Call reset on wrapped env.
- Returns
- The first observation conforming to
observation_space.
- dict: The episode-level information.
Note that this is not part of env_info provided in step(). It contains information of he entire episode, which could be needed to determine the first action (e.g. in the case of goal-conditioned or MTRL.)
- Return type
numpy.ndarray
- step(action)¶
Call step on wrapped env.
- Parameters
action (np.ndarray) – An action provided by the agent.
- Returns
The environment step resulting from the action.
- Return type
- Raises
RuntimeError – if step() is called after the environment has been constructed and reset() has not been called.
- render(mode)¶
Render the wrapped environment.
- visualize()¶
Creates a visualization of the wrapped environment.
- close()¶
Close the wrapped env.
- normalize¶