gxm.spaces.Discrete#
- class Discrete(n)#
Bases:
SpaceA discrete space consiting of \(\{0, 1, ..., n-1\}\).
- __init__(n)#
Methods
__init__(n)contains(x)Check whether specific object is within space.
sample(key[, shape])Sample random action uniformly from \(\{0, 1, ..., n-1\}\).
Attributes
- contains(x)#
Check whether specific object is within space.
- Parameters:
x (
Any) – The object to be checked.- Return type:
Array- Returns:
Whether the object is contained in the space.
- property n: int#
- sample(key, shape=())#
Sample random action uniformly from \(\{0, 1, ..., n-1\}\).
- Parameters:
key (
Array) – A JAX random key used for sampling.shape (
Tuple[int,...]) – The shape of the returned sample.
- Return type:
Array- Returns:
The sampled value.