26 #ifndef MXNET_CPP_MONITOR_H_ 27 #define MXNET_CPP_MONITOR_H_ 56 typedef std::function<NDArray(const NDArray&)>
StatFunc;
57 typedef std::tuple<int, std::string, NDArray>
Stat;
84 std::vector<Stat>
toc();
95 std::vector<Executor*>
exes;
106 #endif // MXNET_CPP_MONITOR_H_ std::regex pattern
Definition: monitor.h:93
void toc_print()
End collecting and print results.
int interval
Definition: monitor.h:92
std::function< NDArray(const NDArray &)> StatFunc
Definition: monitor.h:56
namespace of mxnet
Definition: base.h:126
Executor interface.
Definition: executor.h:44
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:98
void tic()
Start collecting stats for current batch. Call before calling forward.
void * NDArrayHandle
handle to NDArray
Definition: c_api.h:64
int step
Definition: monitor.h:97
std::vector< Stat > stats
Definition: monitor.h:99
Monitor interface.
Definition: monitor.h:54
StatFunc stat_func
Definition: monitor.h:94
std::vector< Executor * > exes
Definition: monitor.h:95
std::tuple< int, std::string, NDArray > Stat
Definition: monitor.h:57
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)