mindspore.dataset.SequentialSampler

View Source On AtomGit
class mindspore.dataset.SequentialSampler(start_index=None, num_samples=None)[source]

Samples the dataset elements sequentially that is equivalent to not using a sampler.

Parameters:
  • start_index (int, optional) – Index to start sampling at. Default: None , start at first ID.

  • num_samples (int, optional) – Number of elements to sample. Default: None , which means sample all elements.

Raises:
  • TypeError – If start_index is not of type int.

  • TypeError – If num_samples is not of type int.

  • RuntimeError – If start_index is a negative value.

  • ValueError – If num_samples is a negative value.

Examples

>>> import mindspore.dataset as ds
>>> # creates a SequentialSampler
>>> sampler = ds.SequentialSampler()
>>> dataset = ds.ImageFolderDataset(image_folder_dataset_dir,
...                                 num_parallel_workers=8,
...                                 sampler=sampler)