Rate this Page

Class SequentialSampler#

Inheritance Relationships#

Base Type#

Class Documentation#

class SequentialSampler : public torch::data::samplers::Sampler<>#

A Sampler that returns indices sequentially.

Public Functions

explicit SequentialSampler(size_t size)#

Creates a SequentialSampler that will return indices in the range 0...size - 1.

virtual void reset(std::optional<size_t> new_size = std::nullopt) override#

Resets the SequentialSampler to zero.

virtual std::optional<std::vector<size_t>> next(size_t batch_size) override#

Returns the next batch of indices.

virtual void save(serialize::OutputArchive &archive) const override#

Serializes the SequentialSampler to the archive.

virtual void load(serialize::InputArchive &archive) override#

Deserializes the SequentialSampler from the archive.

size_t index() const noexcept#

Returns the current index of the SequentialSampler.