jaxdem.rl.action_spaces.blockwise_space#
Apply action-space bijectors to contiguous parts of one action vector.
Classes
|
Apply separate constraints to explicit slices of a flat action vector. |
- class jaxdem.rl.action_spaces.blockwise_space.BlockwiseSpace(*args, **kwargs)[source]#
Bases:
Bijector,ActionSpaceApply separate constraints to explicit slices of a flat action vector.
- Parameters:
blocks (sequence of (int, ActionSpace)) – Positive block sizes and their scalar or vector bijectors, in order. Sizes must sum to the input vector’s length. Each child must preserve its event shape and implement
ActionSpace.log_det_expectationto support Gaussian policy entropy. Blocks may themselves beBlockwiseSpaceinstances.diagonal (The Jacobian is block)
the (so its log-determinant is the sum of)
likewise (children's log-determinants. The Gaussian entropy correction is)
Gaussians. (the sum of their expectations over the corresponding marginal)
preserved. (Leading sample and batch axes are)
Example
Constrain force and torque separately, followed by two bounded scalars:
BlockwiseSpace(blocks=( (3, MaxNormSpace(max_norm=force_limit)), (3, MaxNormSpace(max_norm=torque_limit)), (2, BoxSpace(-1.0, 1.0)), ))
- property blocks: tuple[tuple[int, ActionSpace], ...][source]#
Block sizes and original children, retained for factory serialization.
- forward_and_log_det(x: Array | ndarray | bool | number) tuple[Array, Array][source]#
Computes y = f(x) and log|det J(f)(x)|.