Shortcuts

Class DistributedRandomSampler

Inheritance Relationships

Base Type

Class Documentation

class torch::data::samplers::DistributedRandomSampler : public torch::data::samplers::DistributedSampler<>

Select samples randomly.

The sampling order is shuffled at each reset() call.

Public Functions

DistributedRandomSampler(size_t size, size_t num_replicas = 1, size_t rank = 0, bool allow_duplicates = true)
void reset(optional<size_t> new_size = nullopt) override

Resets the DistributedRandomSampler to a new set of indices.

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 DistributedRandomSampler to the archive.

void load(serialize::InputArchive &archive) override

Deserializes the DistributedRandomSampler from the archive.

size_t index() const noexcept

Returns the current index of the DistributedRandomSampler.

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