mxnet
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
mxnet::cpp::Monitor Class Reference

Monitor interface. More...

#include <monitor.h>

Collaboration diagram for mxnet::cpp::Monitor:
Collaboration graph

Public Types

typedef std::function< NDArray(const NDArray &)> StatFunc
 
typedef std::tuple< int, std::string, NDArrayStat
 

Public Member Functions

 Monitor (int interval, std::regex pattern=std::regex(".*"), StatFunc stat_func=_default_monitor_func)
 Monitor constructor. More...
 
void install (Executor *exe)
 install callback to executor. Supports installing to multiple executors. More...
 
void tic ()
 Start collecting stats for current batch. Call before calling forward. More...
 
std::vector< Stattoc ()
 End collecting for current batch and return results. Call after computation of current batch. More...
 
void toc_print ()
 End collecting and print results. More...
 

Static Protected Member Functions

static void executor_callback (const char *name, NDArrayHandle ndarray, void *monitor_ptr)
 

Protected Attributes

int interval
 
std::regex pattern
 
StatFunc stat_func
 
std::vector< Executor * > exes
 
int step
 
bool activated
 
std::vector< Statstats
 

Detailed Description

Monitor interface.

Member Typedef Documentation

typedef std::tuple<int, std::string, NDArray> mxnet::cpp::Monitor::Stat
typedef std::function<NDArray(const NDArray&)> mxnet::cpp::Monitor::StatFunc

Constructor & Destructor Documentation

mxnet::cpp::Monitor::Monitor ( int  interval,
std::regex  pattern = std::regex(".*"),
StatFunc  stat_func = _default_monitor_func 
)

Monitor constructor.

Parameters
intervalNumber of batches between printing.
patternA regular expression specifying which tensors to monitor.
stat_funcA function that computes statistics of tensors. Defaults to mean absolute value |x|/size(x).

Member Function Documentation

static void mxnet::cpp::Monitor::executor_callback ( const char *  name,
NDArrayHandle  ndarray,
void *  monitor_ptr 
)
staticprotected
void mxnet::cpp::Monitor::install ( Executor exe)

install callback to executor. Supports installing to multiple executors.

Parameters
exeThe executor to install to.
void mxnet::cpp::Monitor::tic ( )

Start collecting stats for current batch. Call before calling forward.

std::vector<Stat> mxnet::cpp::Monitor::toc ( )

End collecting for current batch and return results. Call after computation of current batch.

void mxnet::cpp::Monitor::toc_print ( )

End collecting and print results.

Member Data Documentation

bool mxnet::cpp::Monitor::activated
protected
std::vector<Executor*> mxnet::cpp::Monitor::exes
protected
int mxnet::cpp::Monitor::interval
protected
std::regex mxnet::cpp::Monitor::pattern
protected
StatFunc mxnet::cpp::Monitor::stat_func
protected
std::vector<Stat> mxnet::cpp::Monitor::stats
protected
int mxnet::cpp::Monitor::step
protected

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