A Sampler
is an object that yields an index with which to access a dataset.
More...
#include <base.h>
Public Types | |
using | BatchRequestType = BatchRequest |
Public Member Functions | |
virtual TORCH_API void | reset (optional< size_t > new_size)=0 |
Resets the Sampler 's internal state. More... | |
virtual TORCH_API optional< BatchRequest > | next (size_t batch_size)=0 |
Returns the next index if possible, or an empty optional if the sampler is exhausted for this epoch. More... | |
virtual TORCH_API void | save (serialize::OutputArchive &archive) const =0 |
Serializes the Sampler to the archive . | |
virtual TORCH_API void | load (serialize::InputArchive &archive)=0 |
Deserializes the Sampler from the archive . | |
A Sampler
is an object that yields an index with which to access a dataset.
|
pure virtual |
Returns the next index if possible, or an empty optional if the sampler is exhausted for this epoch.
Implemented in TestIndexSampler, torch::data::samplers::DistributedSequentialSampler, torch::data::samplers::DistributedRandomSampler, torch::data::samplers::StreamSampler, torch::data::samplers::RandomSampler, and torch::data::samplers::SequentialSampler.
|
pure virtual |
Resets the Sampler
's internal state.
Typically called before a new epoch. Optionally, accepts a new size when reseting the sampler.
Implemented in TestIndexSampler, torch::data::samplers::DistributedSequentialSampler, torch::data::samplers::DistributedRandomSampler, torch::data::samplers::StreamSampler, torch::data::samplers::RandomSampler, and torch::data::samplers::SequentialSampler.