Skip to content

LearnerTransferWorkspace ​

python
LearnerTransferWorkspace(train_batch_size: int, observation_shape: tuple[int, ...], observation_dtype: np.dtype, device: torch.device) -> None

Reusable host/device tensors for sampled learner batches.

Allocate the reusable transfer tensors.

Parameters:

  • train_batch_size (int) – Number of transitions per sampled batch.
  • observation_shape (tuple[int, ...]) – Shape of one observation.
  • observation_dtype (dtype) – Numpy dtype of one observation.
  • device (device) – The learner's compute device.

Source

Properties ​

host_batch_arrays ​

python
host_batch_arrays: HostBatchArrays

Get writable numpy views over the reusable host buffers.

Returns:

  • HostBatchArrays – Writable numpy views matching the learner batch layout.

Source

Methods ​

create_batch ​

python
create_batch(*, states: np.ndarray, actions: np.ndarray, rewards: np.ndarray, next_states: np.ndarray, dones: np.ndarray, n_steps: np.ndarray, weights: np.ndarray | None = None) -> LearnerBatch

Copy sampled replay data into the reusable device tensors.

Source

create_batch_from_loaded_host_buffers ​

python
create_batch_from_loaded_host_buffers(*, include_weights: bool) -> LearnerBatch

Create a learner batch after the host buffers have already been populated in-place.

Parameters:

  • include_weights (bool) – Whether the preloaded host buffers contain importance-sampling weights.

Returns:

  • LearnerBatch – A logical learner batch backed by the reusable device tensors.

Source

Values ​

device ​

python
device = device

Source

observation_dtype ​

python
observation_dtype = observation_dtype

Source

observation_shape ​

python
observation_shape = observation_shape

Source

train_batch_size ​

python
train_batch_size = train_batch_size

Source