Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Types | Public Member Functions
torch::data::samplers::Sampler< BatchRequest > Class Template Referenceabstract

A Sampler is an object that yields an index with which to access a dataset. More...

#include <base.h>

Inheritance diagram for torch::data::samplers::Sampler< BatchRequest >:
torch::data::samplers::DistributedSampler< BatchRequest >

Public Types

using BatchRequestType = BatchRequest
 

Public Member Functions

virtual TORCH_API void reset (optional< size_t > new_size)=0
 Resets the Sampler's internal state. More...
 
virtual TORCH_API optional< BatchRequest > next (size_t batch_size)=0
 Returns the next index if possible, or an empty optional if the sampler is exhausted for this epoch. More...
 
virtual TORCH_API void save (serialize::OutputArchive &archive) const =0
 Serializes the Sampler to the archive.
 
virtual TORCH_API void load (serialize::InputArchive &archive)=0
 Deserializes the Sampler from the archive.
 

Detailed Description

template<typename BatchRequest = std::vector<size_t>>
class torch::data::samplers::Sampler< BatchRequest >

A Sampler is an object that yields an index with which to access a dataset.

Definition at line 23 of file base.h.

Member Function Documentation

template<typename BatchRequest = std::vector<size_t>>
virtual TORCH_API optional<BatchRequest> torch::data::samplers::Sampler< BatchRequest >::next ( size_t  batch_size)
pure virtual
template<typename BatchRequest = std::vector<size_t>>
virtual TORCH_API void torch::data::samplers::Sampler< BatchRequest >::reset ( optional< size_t >  new_size)
pure virtual

Resets the Sampler's internal state.

Typically called before a new epoch. Optionally, accepts a new size when reseting the sampler.

Implemented in TestIndexSampler, torch::data::samplers::DistributedSequentialSampler, torch::data::samplers::DistributedRandomSampler, torch::data::samplers::StreamSampler, torch::data::samplers::RandomSampler, and torch::data::samplers::SequentialSampler.


The documentation for this class was generated from the following file: