stable_gym.common.max_episode_steps_injection_wrapper
This file contains a small gymnasium wrapper that injects the max_episode_steps argument of a potentially nested TimeLimit wrapper into the base environment under the _time_limit_max_episode_steps attribute.
Classes
A gymnasium wrapper that injects the |
Functions
Returns the |
|
|
Injects the |
Module Contents
- stable_gym.common.max_episode_steps_injection_wrapper.get_time_limit_wrapper_max_episode_steps(env)[source]
Returns the
max_episode_stepsattribute of a potentially nestedTimeLimitwrapper.- Parameters:
env (gym.Env) – The gymnasium environment.
- Returns:
- The value of the
max_episode_stepsattribute of a potentially nested TimeLimitwrapper. If the environment is not wrapped in aTimeLimitwrapper, then this function returnsNone.
- The value of the
- Return type:
- stable_gym.common.max_episode_steps_injection_wrapper.inject_attribute_into_base_env(env, attribute_name, attribute_value)[source]
Injects the
max_episode_stepsargument into the base environment under the _time_limit_max_episode_steps attribute.
- class stable_gym.common.max_episode_steps_injection_wrapper.MaxEpisodeStepsInjectionWrapper(env)[source]
Bases:
gymnasium.WrapperA gymnasium wrapper that injects the
max_episode_stepsattribute of theTimeLimitwrapper into the base environment as the_time_limit_max_episode_stepsattribute. If the environment is not wrapped in aTimeLimitwrapper, then the_time_limit_max_episode_stepsattribute is set toNone.Wrap a gymnasium environment. :param env: The gymnasium environment. :type env: gym.Env