Expand description
Rollout buffer for storing and processing trajectories
This module implements experience storage for PPO training, including:
- Trajectory storage (observations, actions, rewards, etc.)
- Generalized Advantage Estimation (GAE) computation
- Efficient sampling for minibatch training
§Buffer Layout
The buffer uses a [num_steps, num_envs] layout where:
num_steps: Number of timesteps per rollout (typically 128-2048)num_envs: Number of parallel environments
This layout provides good cache locality for forward passes and efficient computation of advantages.
Structs§
- Minibatch
- Minibatch data for training
- Minibatch
Iterator - Iterator for generating minibatches from a rollout buffer
- Recurrent
Minibatch Iterator - Env-major minibatch iterator over whole env-trajectories (full-sequence, Strategy A).
- Recurrent
Rollout Batch - A rank-3 batch of recurrent rollout data, ready to feed
LstmBurnPolicy::evaluate_sequenceswith no shape adapters. - Recurrent
Rollout Buffer - Rollout buffer that preserves temporal order for a recurrent policy.
- Rollout
Batch - Batch of rollout data for training
- Rollout
Buffer - Rollout buffer for storing trajectories
- Rollout
Burn Tensors - Bundle of Burn tensors produced by
RolloutBatch::to_burn_tensors.
Functions§
- compute_
advantages - Compute Generalized Advantage Estimation (GAE)
- compute_
advantages_ multi_ agent - Compute Generalized Advantage Estimation (GAE) over a flat, interleaved multi-agent rollout buffer.
- compute_
advantages_ partial - Compute Generalized Advantage Estimation (GAE) over the first
valid_stepsrows of the buffer. - compute_
mc_ returns - Compute Monte Carlo returns (full episode returns)
- compute_
nstep_ returns - Compute n-step returns (simpler alternative to GAE)
- compute_
vtrace_ advantages - Compute V-trace targets and advantages for all environments in the buffer.
- generate_
minibatch_ indices - Generate minibatch indices for PPO training
- normalize_
advantages - Normalize advantages across the entire buffer
- sample_
minibatch - Sample a minibatch from the rollout buffer
- shuffle_
indices - Create a shuffled sequence of indices for experience replay
- train_
val_ split - Split buffer into train/validation sets