mindelec.solver.LossAndTimeMonitor

class mindelec.solver.LossAndTimeMonitor(data_size, per_print_times=1)[source]

Monitor the loss in training.

If the loss is NAN or INF, it will terminate training.

Note

If per_print_times is 0, do not print loss.

Parameters
  • data_size (int) – number of batches of each epoch dataset

  • per_print_times (int) – Print the loss each every seconds. Default: 1.

Raises
  • ValueError – If data_size is not an integer or less than zero.

  • ValueError – If per_print_times is not an integer or less than zero.

Supported Platforms:

Ascend

epoch_begin(run_context)[source]

Set begin time at the beginning of epoch.

Parameters

run_context (RunContext) – Context of the train running.

epoch_end(run_context)[source]

Get loss at the end of epoch.

Parameters

run_context (RunContext) – Context of the train running.