Class RandomSampler
Defined in File samplers.h
Inheritance Relationships
Base Type
public mindspore::dataset::Sampler
(Class Sampler)
Class Documentation
-
class RandomSampler : public mindspore::dataset::Sampler
A class to represent a Random Sampler in the data pipeline.
说明
Samples the elements randomly.
Public Functions
-
explicit RandomSampler(bool replacement = false, int64_t num_samples = 0)
Constructor.
- Example
/* creates a RandomSampler that will get 10 samples randomly */ std::string folder_path = "/path/to/image/folder"; std::shared_ptr<Dataset> ds = ImageFolder(folder_path, true, std::make_shared<RandomSampler>(false, 10));
- 参数
replacement – [in] If true, put the sample ID back for the next draw (default=false).
num_samples – [in] The number of samples to draw (default=0, return all samples).
-
~RandomSampler() = default
Destructor.
-
explicit RandomSampler(bool replacement = false, int64_t num_samples = 0)