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.
-
reset
(self)¶ 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
(self, 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.
-
property
action_space
(self)¶ akro.Space: The action space specification.
-
property
observation_space
(self)¶ akro.Space: The observation space specification.
-
property
spec
(self)¶ EnvSpec: The environment specification.
-
property
render_modes
(self)¶ list: A list of string representing the supported render modes.
-
render
(self, mode)¶ Render the wrapped environment.
-
visualize
(self)¶ Creates a visualization of the wrapped environment.
-
close
(self)¶ Close the wrapped env.
-
property
unwrapped
(self)¶ garage.Environment: The inner environment.
-
normalize
¶