Skip to content

sample_and_transfer_batch ​

python
sample_and_transfer_batch(*, replay_buffer: ReplayBuffer, prioritized_config: PrioritizedExperienceReplayBufferConfiguration | None, train_batch_size: int, env_steps: int, workspace: LearnerTransferWorkspace) -> tuple[LearnerBatch, dict[str, torch.Tensor] | None, np.ndarray | None, np.ndarray | None]

Sample replay data and transfer it into preallocated tensors.

Parameters:

  • replay_buffer (ReplayBuffer) – Replay buffer to sample from.
  • prioritized_config (PrioritizedExperienceReplayBufferConfiguration | None) – Prioritized replay configuration when PER is enabled.
  • train_batch_size (int) – Batch size to sample.
  • env_steps (int) – Current actor step for schedule lookup.
  • workspace (LearnerTransferWorkspace) – Reusable host/device tensors used for transfer.

Returns:

  • tuple[LearnerBatch, dict[str, Tensor] | None, ndarray | None, ndarray | None] – (batch, reward_shaping_metadata, indices, versions) where the latter two are only populated for PER.

Source