pulsatrix
Loading...
Searching...
No Matches
pulsatrix::Sampler Class Referenceabstract

Produces the order in which a DataLoader visits a Dataset's indices for one epoch. More...

#include <sampler.hpp>

Inheritance diagram for pulsatrix::Sampler:

Public Member Functions

virtual ~Sampler ()=default
 
virtual void reset (int64_t dataset_size)=0
 Begins a new epoch over a dataset of the given size.
 
virtual std::optional< int64_t > next ()=0
 Fetches the next index in this epoch's order.
 

Detailed Description

Produces the order in which a DataLoader visits a Dataset's indices for one epoch.

Note
reset(dataset_size) is called once per epoch (DataLoader::reset_epoch()); next() is called once per sample within that epoch, returning std::nullopt once every index has been produced.

Constructor & Destructor Documentation

◆ ~Sampler()

virtual pulsatrix::Sampler::~Sampler ( )
virtualdefault

Member Function Documentation

◆ next()

virtual std::optional< int64_t > pulsatrix::Sampler::next ( )
pure virtual

Fetches the next index in this epoch's order.

Returns
The next index, or std::nullopt once every index has been produced.

Implemented in pulsatrix::SequentialSampler, and pulsatrix::ShuffleSampler.

◆ reset()

virtual void pulsatrix::Sampler::reset ( int64_t  dataset_size)
pure virtual

Begins a new epoch over a dataset of the given size.

Parameters
dataset_sizeNumber of samples to produce indices for. Must be >= 0 – internal invariant (PULSATRIX_ASSERT, not throw): DataLoader always calls this with Dataset::size()'s return value directly, never unvalidated external input.

Implemented in pulsatrix::SequentialSampler, and pulsatrix::ShuffleSampler.


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