lit_sb3.wrappers.history
source module lit_sb3.wrappers.history
Classes
-
HistoryWrapper — Stack past observations and actions to give a history to the agent.
-
HistoryWrapperObsDict — History Wrapper for dict observation spaces.
source class HistoryWrapper(env: gym.Env, horizon: int = 2)
Bases : gym.Wrapper[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
Stack past observations and actions to give a history to the agent.
:param env: Gym environment. :param horizon: Number of past steps to include in the observation.
Attributes
-
metadata : dict[str, Any] — attr:
Env:attr:metadata. -
render_mode : str | None — attr:
Env:attr:render_mode. -
spec : EnvSpec | None — attr:
Env:attr:specattribute with theWrapperSpecif the wrapper inherits fromEzPickle. -
action_space : spaces.Space[ActType] | spaces.Space[WrapperActType] — attr:
Env:attr:action_spaceunless overwritten then the wrapper :attr:action_spaceis used. -
observation_space : spaces.Space[ObsType] | spaces.Space[WrapperObsType] — attr:
Env:attr:observation_spaceunless overwritten then the wrapper :attr:observation_spaceis used. -
unwrapped : Env[ObsType, ActType] — Returns the base environment of the wrapper.
-
np_random_seed : int | None — attr:
np_random_seed. -
np_random : np.random.Generator — attr:
Env:attr:np_randomattribute.
Methods
source method HistoryWrapper.reset(seed: int | None = None, options: dict | None = None) → tuple[np.ndarray, dict]
source method HistoryWrapper.step(action: np.ndarray) → tuple[np.ndarray, SupportsFloat, bool, bool, dict]
source class HistoryWrapperObsDict(env: gym.Env, horizon: int = 2)
Bases : gym.Wrapper
History Wrapper for dict observation spaces.
:param env: Gym environment with a dict observation space. :param horizon: Number of past steps to include.
Attributes
-
metadata : dict[str, Any] — attr:
Env:attr:metadata. -
render_mode : str | None — attr:
Env:attr:render_mode. -
spec : EnvSpec | None — attr:
Env:attr:specattribute with theWrapperSpecif the wrapper inherits fromEzPickle. -
action_space : spaces.Space[ActType] | spaces.Space[WrapperActType] — attr:
Env:attr:action_spaceunless overwritten then the wrapper :attr:action_spaceis used. -
observation_space : spaces.Space[ObsType] | spaces.Space[WrapperObsType] — attr:
Env:attr:observation_spaceunless overwritten then the wrapper :attr:observation_spaceis used. -
unwrapped : Env[ObsType, ActType] — Returns the base environment of the wrapper.
-
np_random_seed : int | None — attr:
np_random_seed. -
np_random : np.random.Generator — attr:
Env:attr:np_randomattribute.
Methods
source method HistoryWrapperObsDict.reset(seed: int | None = None, options: dict | None = None) → tuple[dict[str, np.ndarray], dict]
source method HistoryWrapperObsDict.step(action: np.ndarray) → tuple[dict[str, np.ndarray], SupportsFloat, bool, bool, dict]