mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-17 20:39:12 +00:00
2.2 KiB
2.2 KiB
Spaces
:hidden:
spaces/fundamental
spaces/composite
spaces/utils
.. autoclass:: gymnasium.spaces.Space
General Functions
Each space implements the following functions:
.. autofunction:: gymnasium.spaces.Space.sample
.. autofunction:: gymnasium.spaces.Space.contains
.. autoproperty:: gymnasium.spaces.Space.shape
.. property:: gymnasium.spaces.Space.dtype
Return the data type of this space.
.. autofunction:: gymnasium.spaces.Space.seed
.. autofunction:: gymnasium.spaces.Space.to_jsonable
.. autofunction:: gymnasium.spaces.Space.from_jsonable
Fundamental Spaces
.. currentmodule:: gymnasium.spaces
* :py:class:`Box` - Supports continuous (and discrete) vectors or matrices, used for vector observations, images, etc
* :py:class:`Discrete` - Supports a single discrete number of values with an optional start for the values
* :py:class:`MultiDiscrete` - Supports single or matrices of binary values, used for holding down a button or if an agent has an object
* :py:class:`MultiBinary` - Supports multiple discrete values with multiple axes, used for controller actions
* :py:class:`Text` - Supports strings, used for passing agent messages, mission details, etc
Composite Spaces
* :py:class:`Dict` - Supports a dictionary of keys and subspaces, used for a fixed number of unordered spaces
* :py:class:`Tuple` - Supports a tuple of subspaces, used for multiple for a fixed number of ordered spaces
* :py:class:`Sequence` - Supports a variable number of instances of a single subspace, used for entities spaces or selecting a variable number of actions
* :py:class:`Graph` - Supports graph based actions or observations with discrete or continuous nodes and edge values.
Utils
* :py:class:`utils.flatdim` - The number of dimensions the flattened space will contain
* :py:class:`utils.flatten_space` - Flattens a space for which the `flattened` space instances will contain
* :py:class:`utils.flatten` - Flattens an instance of a space that is contained within the flattened version of the space
* :py:class:`utils.unflatten` - The reverse of the `flatten_space` function