lit_sb3.buffers.recurrent.dict_rollout
source module lit_sb3.buffers.recurrent.dict_rollout
Classes
-
RecurrentDictRolloutBuffer — Dict Rollout buffer used in on-policy algorithms like A2C/PPO.
source class RecurrentDictRolloutBufferSamples()
Bases : NamedTuple
source class RecurrentDictRolloutBuffer(buffer_size: int, observation_space: spaces.Space, action_space: spaces.Space, hidden_state_shape: tuple[int, int, int, int], device: torch.device | str = 'auto', gae_lambda: float = 1, gamma: float = 0.99, n_envs: int = 1)
Bases : DictRolloutBuffer
Dict Rollout buffer used in on-policy algorithms like A2C/PPO.
Extends the RecurrentRolloutBuffer to use dictionary observations.
Parameters
-
buffer_size : int — Max number of element in the buffer
-
observation_space : spaces.Space — Observation space
-
action_space : spaces.Space — Action space
-
hidden_state_shape : tuple[int, int, int, int] — Shape of the buffer that will collect lstm states
-
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 RecurrentDictRolloutBuffer.reset() → None
source method RecurrentDictRolloutBuffer.add(*args, lstm_states: RNNStates, **kwargs) → None
Args.
hidden_states: LSTM cell and hidden state.
source method RecurrentDictRolloutBuffer.get(batch_size: int | None = None) → Generator[RecurrentDictRolloutBufferSamples, None, None]