chainer.training.extensions.PrintReport

class chainer.training.extensions.PrintReport(entries, log_report='LogReport', out=<open file '<stdout>', mode 'w'>)

Trainer extension to print the accumulated results.

This extension uses the log accumulated by a LogReport extension to print specified entries of the log in a human-readable format.

Parameters:
  • entries (list of str) – List of keys of observations to print.
  • log_report (str or LogReport) – Log report to accumulate the observations. This is either the name of a LogReport extensions registered to the trainer, or a LogReport instance to use internally.
  • out – Stream to print the bar. Standard output is used by default.

Methods

__call__(trainer)
finalize()

Finalizes the extension.

This method is called at the end of the training loop.

initialize(trainer)

Initializes up the trainer state.

This method is called before entering the training loop. An extension that modifies the state of Trainer can override this method to initialize it.

When the trainer has been restored from a snapshot, this method has to recover an appropriate part of the state of the trainer.

For example, ExponentialShift extension changes the optimizer’s hyperparameter at each invocation. Note that the hyperparameter is not saved to the snapshot; it is the responsibility of the extension to recover the hyperparameter. The ExponentialShift extension recovers it in its initialize method if it has been loaded from a snapshot, or just setting the initial value otherwise.

Parameters:trainer (Trainer) – Trainer object that runs the training loop.
serialize(serializer)

Attributes

default_name

Default name of the extension.

It is the name of the class by default. Implementation can override this property, or provide a class attribute to hide it.

priority = 100
trigger = (1, 'iteration')