Shortcuts

Class SequentialSampler

Inheritance Relationships

Base Type

Class Documentation

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

A Sampler that returns indices sequentially.

Public Functions

SequentialSampler(size_t size)

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

void reset(optional<size_t> new_size = nullopt) override

Resets the SequentialSampler to zero.

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

Returns the next batch of indices.

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

Serializes the SequentialSampler to the archive.

void load(serialize::InputArchive &archive) override

Deserializes the SequentialSampler from the archive.

size_t index() const noexcept

Returns the current index of the SequentialSampler.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources