lit_sb3.buffers.maskable.rollout
source module lit_sb3.buffers.maskable.rollout
Classes
-
MaskableRolloutBuffer — Rollout buffer that also stores the invalid action masks associated with each observation.
source class MaskableRolloutBufferSamples()
Bases : NamedTuple
source class MaskableRolloutBuffer(buffer_size: int, observation_space: spaces.Space, action_space: spaces.Space, device: torch.device | str = 'auto', gae_lambda: float = 1, gamma: float = 0.99, n_envs: int = 1)
Bases : RolloutBuffer
Rollout buffer that also stores the invalid action masks associated with each observation.
Parameters
-
buffer_size : int — Max number of element in the buffer
-
observation_space : spaces.Space — Observation space
-
action_space : spaces.Space — Action space
-
device : torch.device | str — PyTorch device
-
gae_lambda : float — Factor for trade-off of bias vs variance for Generalized Advantage Estimator Equivalent to classic advantage when set to 1.
-
gamma : float — Discount factor
-
n_envs : int — Number of parallel environments
Methods
source method MaskableRolloutBuffer.reset() → None
Raises
-
TypeError
source method MaskableRolloutBuffer.add(*args, action_masks: np.ndarray | None = None, **kwargs) → None
Add transition to buffer.
Parameters
-
*args — Positional arguments forwarded to parent
add. -
action_masks : np.ndarray | None — Masks applied to constrain the choice of possible actions.
-
**kwargs — Keyword arguments forwarded to parent
add.
source method MaskableRolloutBuffer.get(batch_size: int | None = None) → Generator[MaskableRolloutBufferSamples, None, None]