mindspore.dataset.MappableDataset.add_sampler
- MappableDataset.add_sampler(new_sampler)[source]
Add a child sampler for the current dataset.
- Parameters
new_sampler (Sampler) – The child sampler to be added.
Examples
>>> import mindspore.dataset as ds >>> dataset = ds.GeneratorDataset([i for i in range(10)], "column1") >>> >>> new_sampler = ds.DistributedSampler(10, 2) >>> dataset.add_sampler(new_sampler)