Class SequentialSampler¶
Defined in File sequential.h
Page Contents
Inheritance Relationships¶
Base Type¶
public torch::data::samplers::Sampler<>
(Template Class Sampler)
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 range0...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 thearchive
.
-
virtual void load(serialize::InputArchive &archive) override¶
Deserializes the
SequentialSampler
from thearchive
.
-
size_t index() const noexcept¶
Returns the current index of the
SequentialSampler
.
-
explicit SequentialSampler(size_t size)¶