space_info#
Source code: tianshou/utils/space_info.py
- class ActionSpaceInfo(*, action_shape: int | Sequence[int], min_action: float, max_action: float)[source]#
A data structure for storing the different attributes of the action space.
- property action_dim: int#
Return the number of distinct actions (must be greater than zero) an agent can take it its action space.
- action_shape: int | Sequence[int]#
The shape of the action space.
- classmethod from_space(space: Space) Self [source]#
Instantiate the ActionSpaceInfo object from a Space, supported spaces are Box and Discrete.
- max_action: float#
The largest allowable action or in the continuous case the upper bound for allowable action value.
- min_action: float#
The smallest allowable action or in the continuous case the lower bound for allowable action value.
- class ObservationSpaceInfo(*, obs_shape: int | Sequence[int])[source]#
A data structure for storing the different attributes of the observation space.
- classmethod from_space(space: Space) Self [source]#
Instantiate the ObservationSpaceInfo object from a Space, supported spaces are Box and Discrete.
- property obs_dim: int#
Return the number of distinct features (must be greater than zero) or dimensions in the observation space.
- obs_shape: int | Sequence[int]#
The shape of the observation space.
- class SpaceInfo(*, action_info: ActionSpaceInfo, observation_info: ObservationSpaceInfo)[source]#
A data structure for storing the attributes of both the action and observation space.
- action_info: ActionSpaceInfo#
Stores the attributes of the action space.
- classmethod from_env(env: Env) Self [source]#
Instantiate the SpaceInfo object from gym.Env.action_space and gym.Env.observation_space.
- classmethod from_spaces(action_space: Space, observation_space: Space) Self [source]#
Instantiate the SpaceInfo object from ActionSpaceInfo and ObservationSpaceInfo.
- observation_info: ObservationSpaceInfo#
Stores the attributes of the observation space.