gxm.wrappers.Wrapper#
- class Wrapper(env, unwrap=True)#
Bases:
Generic[TWrapperState],Environment[TWrapperState]Base class for environment wrappers in gxm.
- __init__(env, unwrap=True)#
Methods
__init__(env[, unwrap])get_wrapper(wrapper_type)Retrieve the first wrapper of a specific type from the environment.
has_wrapper(wrapper_type)Check if the environment or any of its wrappers is of a specific type.
init(key)Initialize the environment and return the initial state.
reset(key, env_state)Reset the environment to its initial state.
step(key, env_state, action)Perform a step in the environment given an action.
Attributes
Retrieve the base environment by unwrapping all wrappers.
The unique identifier of the environment.
The action space of the environment.
The observation space of the environment.
- action_space: Space#
The action space of the environment.
-
env:
Environment#
- get_wrapper(wrapper_type)#
Retrieve the first wrapper of a specific type from the environment.
- Parameters:
wrapper_type (
type[Environment]) – The type of the wrapper to retrieve.- Return type:
- Returns:
The first wrapper of the specified type.
- Raises:
ValueError – If no wrapper of the specified type is found.
- has_wrapper(wrapper_type)#
Check if the environment or any of its wrappers is of a specific type.
- Parameters:
wrapper_type (
type[Environment]) – The type to check for.- Return type:
bool- Returns:
True if the environment or any of its wrappers is of the specified type, False otherwise.
- id: str#
The unique identifier of the environment.
- observation_space: Space#
The observation space of the environment.
-
unwrap:
bool= True#
- property unwrapped: Environment#
Retrieve the base environment by unwrapping all wrappers.
- Returns:
The base environment without any wrappers.