Defined in File stream.h
StreamSampler: public torch::data::samplers::Sampler<BatchSize>¶
A sampler for (potentially infinite) streams of data.
The major feature of the
StreamSampleris that it does not return particular indices, but instead only the number of elements to fetch from the dataset. The dataset has to decide how to produce those elements.
StreamSamplerwith the number of individual examples that should be fetched until the sampler is exhausted.
reset(optional<size_t> new_size = nullopt) override¶
Resets the internal state of the sampler.
next(size_t batch_size) override¶
BatchSizeobject with the number of elements to fetch in the next batch.
This number is the minimum of the supplied
batch_sizeand the difference between the
epoch_sizeand the current index. If the
epoch_sizehas been reached, returns an empty optional.
save(serialize::OutputArchive &archive) const override¶