Select samples randomly. More...
#include <distributed.h>
Public Member Functions | |
TORCH_API | DistributedRandomSampler (size_t size, size_t num_replicas=1, size_t rank=0, bool allow_duplicates=true) |
TORCH_API void | reset (optional< size_t > new_size=nullopt) override |
Resets the DistributedRandomSampler to a new set of indices. | |
TORCH_API optional< std::vector< size_t > > | next (size_t batch_size) override |
Returns the next batch of indices. | |
TORCH_API void | save (serialize::OutputArchive &archive) const override |
Serializes the DistributedRandomSampler to the archive . | |
TORCH_API void | load (serialize::InputArchive &archive) override |
Deserializes the DistributedRandomSampler from the archive . | |
TORCH_API size_t | index () const noexcept |
Returns the current index of the DistributedRandomSampler . | |
Public Member Functions inherited from torch::data::samplers::DistributedSampler<> | |
TORCH_API | DistributedSampler (size_t size, size_t num_replicas=1, size_t rank=0, bool allow_duplicates=true) |
void | set_epoch (size_t epoch) |
Set the epoch for the current enumeration. More... | |
size_t | epoch () const |
Additional Inherited Members | |
Public Types inherited from torch::data::samplers::Sampler< std::vector< size_t > > | |
using | BatchRequestType = std::vector< size_t > |
Protected Member Functions inherited from torch::data::samplers::DistributedSampler<> | |
size_t | local_sample_count () |
Protected Attributes inherited from torch::data::samplers::DistributedSampler<> | |
size_t | size_ |
size_t | num_replicas_ |
size_t | rank_ |
size_t | epoch_ |
bool | allow_duplicates_ |
Select samples randomly.
The sampling order is shuffled at each reset()
call.
Definition at line 67 of file distributed.h.