PPOActorStepBuffers
python
PPOActorStepBuffers(observations: np.ndarray, actions: np.ndarray, log_probs: np.ndarray, values: np.ndarray, rewards: np.ndarray, dones: np.ndarray, trainable: np.ndarray) -> NoneMutable per-step PPO actor arrays used for action selection and rollout writes.
Properties
stores_rollout_step
python
stores_rollout_step: boolReturn whether any environment in this step contributes learner data.
Returns:
bool–Truewhen PPO will consume at least one environment step.
Methods
add_to_rollout_buffer
python
add_to_rollout_buffer(rollout_buffer: RolloutBuffer) -> NoneAppend the current step buffers to the rollout buffer.
Parameters:
rollout_buffer(RolloutBuffer) – The rollout buffer being filled by the actor.
create
python
create(*, num_envs: int, observation_shape: tuple[int, ...], observation_dtype: np.dtype[Any]) -> PPOActorStepBuffersCreate the preallocated step buffers for one PPO actor.
Parameters:
num_envs(int) – Number of environments stepped in lockstep.observation_shape(tuple[int, ...]) – Observation shape stored in the rollout buffer.observation_dtype(dtype[Any]) – Observation dtype stored in the rollout buffer.
Returns:
PPOActorStepBuffers– The allocated step buffers.
record_action_bundle_for_env_ids
python
record_action_bundle_for_env_ids(action_bundle: PPOActionBundle, *, env_ids: list[int], trainable: list[bool]) -> NoneCopy one PPO action bundle into the step buffers for a subset of environments.
Parameters:
action_bundle(PPOActionBundle) – The action bundle produced by the actor model.env_ids(list[int]) – Environment IDs aligned with the batched action bundle.trainable(list[bool]) – Whether each environment should contribute PPO training data.
record_step_result
python
record_step_result(env_id: int, reward: float, *, done: bool) -> NoneCopy one environment result into the step buffers.
Parameters:
env_id(int) – The environment ID.reward(float) – The reward for the environment step.done(bool) – Whether the environment episode ended on this step.
reset_action_selection
python
reset_action_selection() -> NoneReset per-step policy-routing flags before selecting actions.
reset_step_results
python
reset_step_results() -> NoneClear per-step rewards and done flags.
Values
actions
python
actions: np.ndarraydones
python
dones: np.ndarraylog_probs
python
log_probs: np.ndarrayobservations
python
observations: np.ndarrayrewards
python
rewards: np.ndarraytrainable
python
trainable: np.ndarrayvalues
python
values: np.ndarray