# Environment Wrappers¶

This page contains the reference documentation for environment wrappers. Here you can find a more extensive write up on how to work with these.

## Interfaces and Utilities¶

These are the wrapper interfaces, base classes and interfaces:

 Wrapper A transparent environment Wrapper that works with any manifestation of BaseEnv.

Types of Wrappers:

 ObservationWrapper A Wrapper with typing support modifying the environments observation. ActionWrapper A Wrapper with typing support modifying the agents action. RewardWrapper A Wrapper with typing support modifying the reward before passed to the agent. WrapperFactory Handles dynamic registration of Wrapper sub-classes.

## Built-in Wrappers¶

Below you find the reference documentation for environment wrappers.

General Wrappers:

 LogStatsWrapper A statistics logging wrapper for BaseEnv. MazeEnvMonitoringWrapper A MazeEnv monitoring wrapper logging events for observations, actions and rewards. ObservationVisualizationWrapper An observation visualization wrapper allows to apply custom observation visualization functions which are then shown in Tensorboard. TimeLimitWrapper Wrapper to limit the environment step count, equivalent to gym.wrappers.time_limit. RandomResetWrapper A wrapper skipping the first few steps by taking random actions. SortedSpacesWrapper This class wraps a given StructuredEnvSpacesMixin env to ensure that all observation- and action-spaces are sorted alphabetically. NoDictSpacesWrapper Wraps observations and actions by replacing dictionary spaces with the sole contained sub-space.

ObservationWrappers:

 DictObservationWrapper Wraps a single observation into a dictionary space. ObservationStackWrapper An wrapper stacking the observations of multiple subsequent time steps. NoDictObservationWrapper Wraps observations by replacing the dictionary observation space with the sole contained sub-space.

ActionWrappers:

 DictActionWrapper Wraps either a single action space or a tuple action space into dictionary space. NoDictActionWrapper Wraps actions by replacing the dictionary action space with the sole contained sub-space. SplitActionsWrapper Splits an actions into separate ones. DiscretizeActionsWrapper The DiscretizeActionsWrapper provides functionality for discretizing individual continuous actions into discrete

RewardWrappers:

 RewardScalingWrapper Scales original step reward by a multiplicative scaling factor. RewardClippingWrapper Clips original step reward to range [min, max]. ReturnNormalizationRewardWrapper Normalizes step reward by dividing through the standard deviation of the discounted return.

## Observation Pre-Processing Wrapper¶

Below you find the reference documentation for observation pre-processing. Here you can find a more extensive write up on how to work with the observation pre-processing package.

These are interfaces and components required for observation pre-processing:

 PreProcessingWrapper An observation pre-processing wrapper. PreProcessor Interface for observation pre-processors.

These are the available built-in maze.pre_processors compatible with the PreProcessingWrapper:

 FlattenPreProcessor An array flattening pre-processor. OneHotPreProcessor An one-hot encoding pre-processor for categorical features. ResizeImgPreProcessor An image resizing pre-processor. TransposePreProcessor An array transposition pre-processor. UnSqueezePreProcessor An un-squeeze pre-processor. Rgb2GrayPreProcessor An rgb-to-gray-scale conversion pre-processor.

## Observation Normalization Wrapper¶

Below you find the reference documentation for observation normalization. Here you can find a more extensive write up on how to work with the observation normalization package.

These are interfaces and utility functions required for observation normalization:

 ObservationNormalizationWrapper An observation normalization wrapper. ObservationNormalizationStrategy Abstract base class for normalization strategies. obtain_normalization_statistics Obtain the normalization statistics of a given environment. estimate_observation_normalization_statistics Helper function estimating normalization statistics. make_normalized_env_factory Wrap an existing env factory to assign the passed normalization statistics.

These are the available built-in maze.normalization_strategies compatible with the ObservationNormalizationWrapper:

 MeanZeroStdOneObservationNormalizationStrategy Normalizes observations to have zero mean and standard deviation one. RangeZeroOneObservationNormalizationStrategy Normalizes observations to value range [0, 1].

## Gym Environment Wrapper¶

Below you find the reference documentation for wrapping gym environments. Here you can find a more extensive write up on how to integrate Gym environments within Maze.

These are the contained components:

 GymMazeEnv Wraps a Gym env into a Maze environment. make_gym_maze_env Initializes a GymMazeEnv by registered Gym env name (id). GymCoreEnv Wraps a Gym environment into a maze core environment. GymRenderer A Maze-style Gym renderer. GymObservationConversion A dummy conversion interface asserting that the observation is packed into a dictionary space. GymActionConversion A dummy conversion interface asserting that the action is packed into a dictionary space.