mindspore.dataset.MappableDataset.use_sampler
- mindspore.dataset.MappableDataset.use_sampler(new_sampler)[源代码]
替换当前数据集的最末子采样器,保持父采样器不变。
- 参数:
new_sampler (Sampler) - 用于替换的新采样器。
样例:
>>> import mindspore.dataset as ds >>> dataset = ds.GeneratorDataset([i for i in range(10)], "column1") >>> >>> # use a DistributedSampler instead >>> new_sampler = ds.DistributedSampler(10, 2) >>> dataset.use_sampler(new_sampler)