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;
86 std::vector<Stat>
toc();
97 std::vector<Executor*>
exes;
108 #endif // MXNET_CPP_MONITOR_H_ std::regex pattern
Definition: monitor.h:95
void toc_print()
End collecting and print results.
int interval
Definition: monitor.h:94
std::function< NDArray(const NDArray &)> StatFunc
Definition: monitor.h:57
namespace of mxnet
Definition: base.h:89
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...
bool activated
Definition: monitor.h:100
void tic()
Start collecting stats for current batch. Call before calling forward.
int step
Definition: monitor.h:99
void install(Executor *exe, bool monitor_all=false)
install callback to executor. Supports installing to multiple executors.
std::vector< Stat > stats
Definition: monitor.h:101
Monitor interface.
Definition: monitor.h:55
void * NDArrayHandle
handle to NDArray
Definition: c_api.h:67
StatFunc stat_func
Definition: monitor.h:96
std::vector< Executor * > exes
Definition: monitor.h:97
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)