Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
batch< SAMPLEDLOSSFUNC > Struct Template Reference

#include <batch.h>

Public Member Functions

 BBM_IMPORT_CONFIG (SAMPLEDLOSSFUNC)
 
 batch (size_t batchsize, const SAMPLEDLOSSFUNC &sampledlossfunc, seed_t seed=default_seed)
 Constructor.
 
void update (void)
 Init the list of random indices.
 
Size_t samples (void) const
 Returns the number of samples.
 
Value operator() (Size_t idx, Mask mask=true) const
 Compute the loss over the I-th sample.
 
Value operator() (Mask mask=true) const
 Compute loss over all samples.
 

Private Attributes

bbm::rng< Size_t > _rng
 
bbm::vector< Size_t > _index
 
SAMPLEDLOSSFUNC _sampledlossfunc
 

Constructor & Destructor Documentation

◆ batch()

batch ( size_t  batchsize,
const SAMPLEDLOSSFUNC &  sampledlossfunc,
seed_t  seed = default_seed 
)
inline

Constructor.

Wrapper around sampled loss functions that only evaluates the loss for a subset of the samples. Each update re-randomizes the subset.

Parameters
batchsize= size of the batch (same batch size for all packets)
sampedlosfunc= any sampled loss function (to be subsampled).

Member Function Documentation

◆ BBM_IMPORT_CONFIG()

BBM_IMPORT_CONFIG ( SAMPLEDLOSSFUNC  )

◆ operator()() [1/2]

Value operator() ( Mask  mask = true) const
inline

Compute loss over all samples.

◆ operator()() [2/2]

Value operator() ( Size_t  idx,
Mask  mask = true 
) const
inline

Compute the loss over the I-th sample.

◆ samples()

Size_t samples ( void  ) const
inline

Returns the number of samples.

◆ update()

void update ( void  )
inline

Init the list of random indices.

Member Data Documentation

◆ _index

bbm::vector<Size_t> _index
private

◆ _rng

bbm::rng<Size_t> _rng
private

◆ _sampledlossfunc

SAMPLEDLOSSFUNC _sampledlossfunc
private

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