Spaces¶
Spaces describe the actions, observations and states of an environment. They are
returned by env.action_space(params), env.observation_space(params) and
env.state_space(params).
Space ¶
Abstract base class of all spaces.
Discrete ¶
Bases: Space
Space of the integers 0, ..., num_categories - 1.
Parameters:
-
num_categories(int) –Number of integer values in the space.
-
dtype(Any, default:int32) –Integer dtype of sampled elements.
int32by default;int64is available when JAX x64 mode is enabled.
Attributes:
-
n–Number of integer values in the space.
-
shape–Shape of an element, always
(). -
dtype–Integer dtype of sampled elements.
Box ¶
Bases: Space
Space of arrays with elementwise lower and upper bounds.
Parameters:
-
low(ndarray | float) –Lower bound, a scalar or an array broadcastable to
shape. -
high(ndarray | float) –Upper bound, a scalar or an array broadcastable to
shape. -
shape(Any) –Shape of an element.
-
dtype(dtype, default:float32) –Dtype of sampled elements.
Dict ¶
Bases: Space
Space of dictionaries whose values come from named subspaces.
Parameters:
-
spaces(Any) –Mapping from key to subspace.
Tuple ¶
Conversion¶
gymnax_space_to_gym_space ¶
Convert a Gymnax space to the equivalent Gymnasium space.
Parameters:
-
space(Space) –Gymnax space;
DictandTuplespaces are converted recursively.
Returns:
-
Space–The equivalent
gymnasium.spacesspace.
Raises:
-
NotImplementedError–If the space type has no Gymnasium equivalent.