My Project
Public Member Functions | List of all members
IterationRecorder< CpuBackend > Class Reference

CPU recorder that stores loss/gradient history on host. More...

#include <iteration_recorder.hpp>

Public Member Functions

void init (int capacity)
 Allocate buffers for up to capacity iterations. More...
 
void reset ()
 Reset recorded size without releasing memory. More...
 
void record (int idx, double loss, double grad_norm, double time_ms=0.0)
 Record a loss/grad/time entry at iteration index. More...
 
void copy_to_host (std::vector< double > &loss_out, std::vector< double > &grad_norm_out) const
 Copy recorded loss and gradient norm to output vectors. More...
 
void copy_to_host (std::vector< double > &loss_out, std::vector< double > &grad_norm_out, std::vector< double > &time_ms_out) const
 Copy recorded loss, gradient norm, and time to output vectors. More...
 
int size () const
 Current number of recorded entries. More...
 

Detailed Description

CPU recorder that stores loss/gradient history on host.

Member Function Documentation

◆ copy_to_host() [1/2]

void IterationRecorder< CpuBackend >::copy_to_host ( std::vector< double > &  loss_out,
std::vector< double > &  grad_norm_out 
) const
inline

Copy recorded loss and gradient norm to output vectors.

Here is the caller graph for this function:

◆ copy_to_host() [2/2]

void IterationRecorder< CpuBackend >::copy_to_host ( std::vector< double > &  loss_out,
std::vector< double > &  grad_norm_out,
std::vector< double > &  time_ms_out 
) const
inline

Copy recorded loss, gradient norm, and time to output vectors.

◆ init()

void IterationRecorder< CpuBackend >::init ( int  capacity)
inline

Allocate buffers for up to capacity iterations.

Here is the caller graph for this function:

◆ record()

void IterationRecorder< CpuBackend >::record ( int  idx,
double  loss,
double  grad_norm,
double  time_ms = 0.0 
)
inline

Record a loss/grad/time entry at iteration index.

Parameters
idxIteration index.
lossLoss value.
grad_normGradient norm value.
time_msCumulative time in ms.
Here is the caller graph for this function:

◆ reset()

void IterationRecorder< CpuBackend >::reset ( )
inline

Reset recorded size without releasing memory.

Here is the caller graph for this function:

◆ size()

int IterationRecorder< CpuBackend >::size ( ) const
inline

Current number of recorded entries.


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