SamplerEnsemble¶
- class torchrl.data.replay_buffers.SamplerEnsemble(*samplers, p=None, sample_from_all=False, num_buffer_sampled=None)[源代码]¶
采样器集合。
此类旨在与
ReplayBufferEnsemble
配合使用。它包含采样器以及采样策略的超参数。- 参数:
samplers (sequence of Sampler) – 用于构建复合采样器的采样器。
- 关键字参数:
p (list 或 tensor of probabilities, optional) – 如果提供,则表示采样过程中每个数据集的权重。
sample_from_all (bool, optional) – 如果为
True
,则将从每个数据集中进行采样。这与p
参数不兼容。默认为False
。num_buffer_sampled (int, optional) – 要采样的缓冲区数量。如果
sample_from_all=True
,则此参数无效,因为它默认为缓冲区数量。如果sample_from_all=False
,将根据概率p
对缓冲区进行采样。
警告
信息字典中提供的索引被放置在
TensorDict
中,键为index
和buffer_ids
,允许上层的ReplayBufferEnsemble
和StorageEnsemble
对象检索数据。此格式与其他采样器不同,后者通常将索引作为常规张量返回。