LearnerTransferWorkspace
python
LearnerTransferWorkspace(train_batch_size: int, observation_shape: tuple[int, ...], observation_dtype: np.dtype, device: torch.device) -> NoneReusable 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.
Properties
host_batch_arrays
python
host_batch_arrays: HostBatchArraysGet writable numpy views over the reusable host buffers.
Returns:
HostBatchArrays– Writable numpy views matching the learner batch layout.
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) -> LearnerBatchCopy sampled replay data into the reusable device tensors.
create_batch_from_loaded_host_buffers
python
create_batch_from_loaded_host_buffers(*, include_weights: bool) -> LearnerBatchCreate 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.
Values
device
python
device = deviceobservation_dtype
python
observation_dtype = observation_dtypeobservation_shape
python
observation_shape = observation_shapetrain_batch_size
python
train_batch_size = train_batch_size