Class DistributedRandomSampler¶
Defined in File distributed.h
Page Contents
Inheritance Relationships¶
Base Type¶
public torch::data::samplers::DistributedSampler<>(Template Class DistributedSampler)
Class Documentation¶
-
class 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)¶
-
virtual void reset(optional<size_t> new_size = nullopt) override¶
Resets the
DistributedRandomSamplerto a new set of indices.
-
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
DistributedRandomSamplerto thearchive.
-
virtual void load(serialize::InputArchive &archive) override¶
Deserializes the
DistributedRandomSamplerfrom thearchive.
-
size_t index() const noexcept¶
Returns the current index of the
DistributedRandomSampler.
-
DistributedRandomSampler(size_t size, size_t num_replicas = 1, size_t rank = 0, bool allow_duplicates = true)¶