27 #ifndef MXNET_CPP_MONITOR_H_ 28 #define MXNET_CPP_MONITOR_H_ 57 typedef std::function<NDArray(const NDArray&)>
StatFunc;
58 typedef std::tuple<int, std::string, NDArray>
Stat;
85 std::vector<Stat>
toc();
96 std::vector<Executor*>
exes;
107 #endif // MXNET_CPP_MONITOR_H_ std::regex pattern
Definition: monitor.h:94
void toc_print()
End collecting and print results.
int interval
Definition: monitor.h:93
std::function< NDArray(const NDArray &)> StatFunc
Definition: monitor.h:57
namespace of mxnet
Definition: base.h:118
Executor interface.
Definition: executor.h:45
Monitor(int interval, std::regex pattern=std::regex(".*"), StatFunc stat_func=_default_monitor_func)
Monitor constructor.
NDArray _default_monitor_func(const NDArray &x)
Default function for monitor that computes statistics of the input tensor, which is the mean absolute...
void install(Executor *exe)
install callback to executor. Supports installing to multiple executors.
bool activated
Definition: monitor.h:99
void tic()
Start collecting stats for current batch. Call before calling forward.
void * NDArrayHandle
handle to NDArray
Definition: c_api.h:67
int step
Definition: monitor.h:98
std::vector< Stat > stats
Definition: monitor.h:100
Monitor interface.
Definition: monitor.h:55
StatFunc stat_func
Definition: monitor.h:95
std::vector< Executor * > exes
Definition: monitor.h:96
std::tuple< int, std::string, NDArray > Stat
Definition: monitor.h:58
std::vector< Stat > toc()
End collecting for current batch and return results. Call after computation of current batch...
static void executor_callback(const char *name, NDArrayHandle ndarray, void *monitor_ptr)