Vector Environment Wrappers#
- class gymnasium.experimental.vector.VectorWrapper(env: VectorEnv)#
Wraps the vectorized environment to allow a modular transformation.
This class is the base class for all wrappers for vectorized environments. The subclass could override some methods to change the behavior of the original vectorized environment without touching the original code.
Note
Don’t forget to call
super().__init__(env)
if the subclass overrides__init__()
.Initialize the vectorized environment wrapper.
Vector Lambda Observation Wrappers#
Vector Lambda Action Wrappers#
Vector Lambda Reward Wrappers#
Vector Common Wrappers#
- class gymnasium.experimental.wrappers.vector.VectorRecordEpisodeStatistics(env: VectorEnv, deque_size: int = 100)#
wrapped_env.return_queue
andwrapped_env.length_queue
respectively.- Variables:
return_queue – The cumulative rewards of the last
deque_size
-many episodeslength_queue – The lengths of the last
deque_size
-many episodes
- Parameters:
env (Env) – The environment to apply the wrapper
deque_size – The size of the buffers
return_queue
andlength_queue
Vector Only Wrappers#
- class gymnasium.experimental.wrappers.vector.VectorListInfo(env: VectorEnv)#
Converts infos of vectorized environments from dict to List[dict].
This wrapper converts the info format of a vector environment from a dictionary to a list of dictionaries. This wrapper is intended to be used around vectorized environments. If using other wrappers that perform operation on info like RecordEpisodeStatistics this need to be the outermost wrapper.
i.e. VectorListInfo(RecordEpisodeStatistics(envs))
Example:
>>> # actual >>> { ... "k": np.array([0., 0., 0.5, 0.3]), ... "_k": np.array([False, False, True, True]) ... } >>> # classic >>> [{}, {}, {k: 0.5}, {k: 0.3}]
- Parameters:
env (Env) – The environment to apply the wrapper