Class PKSampler
- Defined in File samplers.h 
Inheritance Relationships
Base Type
- public mindspore::dataset::Sampler(Class Sampler)
Class Documentation
- 
class PKSampler : public mindspore::dataset::Sampler
- A class to represent a PK Sampler in the data pipeline. - 说明 - Samples K elements for each P class in the dataset. This will sample all classes. - Public Functions - 
explicit PKSampler(int64_t num_val, bool shuffle = false, int64_t num_samples = 0)
- Constructor. - 参数
- num_val – [in] Number of elements to sample for each class. 
- shuffle – [in] If true, the class IDs are shuffled (default=false). 
- num_samples – [in] The number of samples to draw (default=0, return all samples). 
 样例
- /* creates a PKSampler that will get 3 samples from every class. */ std::string folder_path = "/path/to/image/folder"; std::shared_ptr<Dataset> ds = ImageFolder(folder_path, true, std::make_shared<PKSampler>(3)); 
 
 - 
~PKSampler() override = default
- Destructor. 
 
- 
explicit PKSampler(int64_t num_val, bool shuffle = false, int64_t num_samples = 0)