gxm.spaces.Tree#
- class Tree(spaces)#
Bases:
SpaceSpace composed of multiple subspaces in a tree structure.
- __init__(spaces)#
Methods
__init__(spaces)contains(x)Check whether dimensions of object are within subspace.
sample(key[, shape])Sample random action from all subspaces, retaining the original structure.
Attributes
- contains(x)#
Check whether dimensions of object are within subspace.
- Parameters:
x (
Array) – Object to be checked.- Return type:
bool- Returns:
True if object is within all subspaces, False otherwise.
- property n: int#
- sample(key, shape=())#
Sample random action from all subspaces, retaining the original structure.
- Parameters:
key (
Array) – JAX random key.shape (
Tuple[int,...]) – Shape of the sample to be drawn from each subspace.
- Return type:
Any- Returns:
A tree-structured object with samples from each subspace.