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

>>> new_sampler = ds.DistributedSampler(10, 2)
>>> dataset.add_sampler(new_sampler)  # dataset is an instance of Dataset