Class SubsetSampler
Defined in File samplers.h
Inheritance Relationships
Base Type
public mindspore::dataset::Sampler
(Class Sampler)
Derived Type
public mindspore::dataset::SubsetRandomSampler
(Class SubsetRandomSampler)
Class Documentation
-
class SubsetSampler : public mindspore::dataset::Sampler
A class to represent a Subset Sampler in the data pipeline.
Note
Samples the elements from a sequence of indices.
Subclassed by mindspore::dataset::SubsetRandomSampler
Public Functions
-
explicit SubsetSampler(const std::vector<int64_t> &indices, int64_t num_samples = 0)
Constructor.
- Example
/* creates a SubsetSampler, will sample from the provided indices */ std::string folder_path = "/path/to/image/folder"; std::shared_ptr<Dataset> ds = ImageFolder(folder_path, false, std::make_shared<SubsetSampler>({0, 2, 5}));
- Parameters
indices – [in] A vector sequence of indices.
num_samples – [in] The number of samples to draw (default=0, return all samples).
-
~SubsetSampler() = default
Destructor.
-
explicit SubsetSampler(const std::vector<int64_t> &indices, int64_t num_samples = 0)