unienv_interface.wrapper.gym_compat¶
Classes:
| Name | Description |
|---|---|
ToGymnasiumEnv |
|
FromGymnasiumEnv |
|
ToGymnasiumEnv
¶
ToGymnasiumEnv(
env: Env[
BArrayType,
ContextType,
ObsType,
ActType,
RenderFrame,
BDeviceType,
BDtypeType,
BRNGType,
],
)
Bases: Env[Any, Any], Generic[BArrayType, ContextType, ObsType, ActType, RenderFrame, BDeviceType, BDtypeType, BRNGType]
Methods:
| Name | Description |
|---|---|
combine_context_obs_space |
|
combine_context_obs |
|
step |
|
reset |
|
render |
|
close |
|
Attributes:
| Name | Type | Description |
|---|---|---|
env |
|
|
action_space |
|
|
observation_space |
|
|
metadata |
Dict[str, Any]
|
|
render_mode |
Optional[str]
|
|
np_random |
Generator
|
|
observation_space
instance-attribute
¶
observation_space = gym_utils.to_gym_space(self._unienv_combined_space)
combine_context_obs_space
staticmethod
¶
combine_context_obs_space(
context_space: Space[ContextType, BDeviceType, BDeviceType, BRNGType],
observation_space: Space[ObsType, BDeviceType, BDtypeType, BRNGType],
) -> Space[Union[ContextType, ObsType], BDeviceType, BDtypeType, BRNGType]
combine_context_obs
staticmethod
¶
combine_context_obs(context: ContextType, observation: ObsType) -> Dict[str, Any]
FromGymnasiumEnv
¶
Bases: Env[ndarray, None, ObsType, ActType, RenderFrame, Any, dtype, Generator], Generic[ObsType, ActType, RenderFrame]
Methods:
| Name | Description |
|---|---|
step |
|
reset |
|
render |
|
close |
|
has_wrapper_attr |
|
get_wrapper_attr |
|
set_wrapper_attr |
|
sample_space |
Sample from |
sample_action |
Sample one action from |
sample_observation |
Sample one observation from |
sample_context |
Sample one context value if |
update_observation_post_reset |
Merge masked reset observations back into a full batched observation. |
update_context_post_reset |
Merge masked reset contexts back into a full batched context. |
Attributes:
| Name | Type | Description |
|---|---|---|
env |
|
|
backend |
|
|
device |
|
|
batch_size |
|
|
action_space |
|
|
observation_space |
|
|
context_space |
|
|
metadata |
Dict[str, Any]
|
|
render_mode |
Optional[str]
|
|
render_fps |
Optional[int]
|
|
rng |
Generator
|
|
unwrapped |
Env
|
|
prev_wrapper_layer |
Optional[Env]
|
|
action_space
instance-attribute
¶
action_space = gym_utils.from_gym_space(env.action_space, self.backend)
observation_space
instance-attribute
¶
observation_space = gym_utils.from_gym_space(env.observation_space, self.backend)
reset
¶
reset(
*args, mask: Optional[ndarray] = None, seed: Optional[int] = None, **kwargs
) -> Tuple[None, ObsType, Dict[str, Any]]
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.