Class SequentialSampler

Inheritance Relationships

Base Type

Class Documentation

class SequentialSampler : public mindspore::dataset::Sampler

A class to represent a Sequential Sampler in the data pipeline.

说明

Samples the dataset elements sequentially, same as not having a sampler.

Public Functions

explicit SequentialSampler(int64_t start_index = 0, int64_t num_samples = 0)

Constructor.

Example
/* creates a SequentialSampler that will get 2 samples sequentially in original dataset */
std::string folder_path = "/path/to/image/folder";
std::shared_ptr<Dataset> ds = ImageFolder(folder_path, false, std::make_shared<SequentialSampler>(0, 2));

参数
  • start_index[in] Index to start sampling at (default=0, start at first id).

  • num_samples[in] The number of samples to draw (default=0, return all samples).

~SequentialSampler() = default

Destructor.