Sponsoring The Perl Toolchain Summit 2025: Help make this important event another success Learn more

NAME

AI::MXNet::Monitor - Monitor outputs, weights, and gradients for debugging.

DESCRIPTION

Monitor outputs, weights, and gradients for debugging.
Parameters
----------
interval : Int
Number of batches between printing.
stat_func : CodeRef
a function that computes statistics of tensors.
Takes a NDArray and returns a NDArray. defaults to mean
absolute value |x|/size(x).
pattern : Str
A regular expression specifying which tensors to monitor.
Only tensors with names that match name_pattern will be included.
For example, '.*weight|.*output' will print all weights and outputs;
'.*backward.*' will print all gradients.

install

install callback to executor.
Supports installing to multiple exes.
Parameters
----------
$exe : AI::MXNet::Executor
the Executor (returned by $symbol->bind) to install to.

tic

start collecting stats for current batch.
Call before forward

toc

End collecting for current batch and return results.
Call after computation of current batch.
Returns
-------
res : array ref of array refs with debug info

toc_print

End collecting and print results