NEML2 2.0.0
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
FixedSizeWorkGenerator< T > Class Template Referenceabstract

Interface for work generators that generate a fixed number of batches, i.e., the total amount of work is known at construction time. More...

Detailed Description

template<typename T>
class neml2::FixedSizeWorkGenerator< T >

Interface for work generators that generate a fixed number of batches, i.e., the total amount of work is known at construction time.

#include <FixedSizeWorkGenerator.h>

Inheritance diagram for FixedSizeWorkGenerator< T >:

Public Member Functions

bool has_more () const override
 Whether the generator has more work to generate.
 
virtual std::size_t total () const =0
 Total (fixed) number of batches that will be generated.
 
- Public Member Functions inherited from WorkGenerator< T >
 WorkGenerator ()=default
 
 WorkGenerator (WorkGenerator &&) noexcept=default
 
 WorkGenerator (const WorkGenerator &)=default
 
WorkGeneratoroperator= (WorkGenerator &&) noexcept=default
 
WorkGeneratoroperator= (const WorkGenerator &)=default
 
virtual ~WorkGenerator ()=default
 
std::pair< std::size_t, T > next (std::size_t n)
 Generate the next n batches of work.
 
std::size_t offset () const
 Return the current offset, i.e., the number of batches that have been generated.
 

Additional Inherited Members

- Protected Member Functions inherited from WorkGenerator< T >
virtual std::pair< std::size_t, T > generate (std::size_t n)=0
 Generate the next n batches of work.
 

Member Function Documentation

◆ has_more()

template<typename T>
bool has_more ( ) const
inlineoverridevirtual

Whether the generator has more work to generate.

Implements WorkGenerator< T >.

◆ total()

template<typename T>
virtual std::size_t total ( ) const
pure virtual

Total (fixed) number of batches that will be generated.

Implemented in SliceGenerator, TensorLoader, and ValueMapLoader.