SamplerEnsemble¶
- class torchrl.data.replay_buffers.SamplerEnsemble(*samplers, p=None, sample_from_all=False, num_buffer_sampled=None)[source]¶
An ensemble of samplers.
This class is designed to work with
ReplayBufferEnsemble
. It contains the samplers as well as the sampling strategy hyperparameters.- Parameters:
samplers (sequence of Sampler) – the samplers to make the composite sampler.
- Keyword Arguments:
p (list or tensor of probabilities, optional) – if provided, indicates the weights of each dataset during sampling.
sample_from_all (bool, optional) – if
True
, each dataset will be sampled from. This is not compatible with thep
argument. Defaults toFalse
.num_buffer_sampled (int, optional) – the number of buffers to sample. if
sample_from_all=True
, this has no effect, as it defaults to the number of buffers. Ifsample_from_all=False
, buffers will be sampled according to the probabilitiesp
.
Warning
The indices provided in the info dictionary are placed in a
TensorDict
with keysindex
andbuffer_ids
that allow the upperReplayBufferEnsemble
andStorageEnsemble
objects to retrieve the data. This format is different from with other samplers which usually return indices as regular tensors.