Skip to content

unienv_interface.wrapper.frame_stack

FrameStackWrapper

FrameStackWrapper(env: Env[BArrayType, ContextType, ObsType, ActType, RenderFrame, BDeviceType, BDtypeType, BRNGType], obs_stack_size: int = 0, action_stack_size: int = 0, action_default_value: Optional[ActType] = None)

Bases: ContextObservationWrapper[ContextType, Union[Dict[str, Any], Any], BArrayType, ContextType, ObsType, ActType, RenderFrame, BDeviceType, BDtypeType, BRNGType]

action_stack_size instance-attribute

action_stack_size = action_stack_size

obs_stack_size instance-attribute

obs_stack_size = obs_stack_size

action_deque instance-attribute

action_deque = SpaceDataQueue(action_space, batch_size, action_stack_size)

action_default_value instance-attribute

action_default_value = action_default_value

obs_deque instance-attribute

obs_deque = None

observation_space instance-attribute

observation_space = new_obs_space

metadata property writable

metadata: Dict[str, Any]

Returns the :attr:Env :attr:metadata.

render_mode property

render_mode: Optional[WrapperRenderFrame]

render_fps property

render_fps: Optional[int]

backend property

backend: ComputeBackend[Any, WrapperBDeviceT, Any, WrapperBRngT]

device property

device: Optional[WrapperBDeviceT]

batch_size property

batch_size: Optional[int]

action_space property writable

action_space: Space[WrapperActT, WrapperBDeviceT, Any, WrapperBRngT]

context_space property writable

context_space: Optional[Space[WrapperContextT, WrapperBDeviceT, Any, WrapperBRngT]]

rng property writable

rng: WrapperBRngT

Returns the :attr:Env :attr:rng attribute.

unwrapped property

unwrapped: Env

Returns the base environment of the wrapper.

This will be the bare :class:gymnasium.Env environment, underneath all layers of wrappers.

prev_wrapper_layer property

prev_wrapper_layer: Env[BArrayType, ContextType, ObsType, ActType, RenderFrame, BDeviceType, BDtypeType, BRNGType]

env instance-attribute

env = env

reverse_map_context

reverse_map_context(context: ContextType) -> ContextType

map_observation

map_observation(observation: ObsType) -> Union[Dict[str, Any], Any]

reverse_map_observation

reverse_map_observation(observation: Union[Dict[str, Any], Any]) -> ObsType

reset

reset(*args, mask: Optional[BArrayType] = None, seed: Optional[int] = None, **kwargs) -> Tuple[ContextType, Union[Dict[str, Any], Any], Dict[str, Any]]

step

step(action: ActType) -> Tuple[Union[Dict[str, Any], Any], Union[SupportsFloat, BArrayType], Union[bool, BArrayType], Union[bool, BArrayType], Dict[str, Any]]

render

render() -> RenderFrame | Sequence[RenderFrame] | None

close

close()

sample_space

sample_space(space: Space) -> Any

Sample from space using and updating self.rng.

sample_action

sample_action() -> ActType

Sample one action from action_space.

sample_observation

sample_observation() -> ObsType

Sample one observation from observation_space.

sample_context

sample_context() -> Optional[ContextType]

Sample one context value if context_space is defined.

update_observation_post_reset

update_observation_post_reset(old_obs: ObsType, newobs_masked: ObsType, mask: BArrayType) -> ObsType

Merge masked reset observations back into a full batched observation.

update_context_post_reset

update_context_post_reset(old_context: ContextType, new_context: ContextType, mask: BArrayType) -> ContextType

Merge masked reset contexts back into a full batched context.

has_wrapper_attr

has_wrapper_attr(name: str) -> bool

Checks if the given attribute is within the wrapper or its environment.

get_wrapper_attr

get_wrapper_attr(name: str) -> Any

Gets an attribute from the wrapper and lower environments if name doesn't exist in this object.

Parameters:

Name Type Description Default
name str

The variable name to get

required

Returns:

Type Description
Any

The variable with name in wrapper or lower environments

set_wrapper_attr

set_wrapper_attr(name: str, value: Any)

Sets an attribute on this wrapper or lower environment if name is already defined.

Parameters:

Name Type Description Default
name str

The variable name

required
value Any

The new variable value

required

map_context

map_context(context: WrapperContextT) -> ContextType

Convert wrapped context into the wrapper-facing representation.