pytorch_pfn_extras.training.extensions.PrintReport#
- class pytorch_pfn_extras.training.extensions.PrintReport(entries=None, log_report='LogReport', out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)#
Bases:
Extension
An 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 or None) – List of keys of observations to print. If None is passed, automatically infer keys from reported dict.
log_report (str or LogReport) – Log report to accumulate the observations. This is either the name of a LogReport extensions registered to the manager, or a LogReport instance to use internally.
out (IO[Any]) – Stream to print the bar. Standard output is used by default.
Methods
__init__
([entries, log_report, out])finalize
(manager)Finalizes the extension.
get_log_report
(manager)initialize
(manager)Initializes up the manager state.
load_state_dict
(to_load)on_error
(manager, exc, tb)Handles the error raised during training before finalization.
Serializes the extension state.
Attributes
default_name
Default name of the extension.
is_async
name
needs_model_state
priority
trigger
- __call__(manager)#
Invokes the extension.
Implementations should override this operator. This method is called at iterations which the corresponding trigger accepts.
- Parameters:
manager (ExtensionsManager) – Manager object to call this operator.
- Return type:
None
- __init__(entries=None, log_report='LogReport', out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)#
- get_log_report(manager)#
- Parameters:
manager (ExtensionsManagerProtocol) –
- Return type:
- initialize(manager)#
Initializes up the manager state.
This method is called before entering the training loop. An extension modifying the state of
ExtensionsManager
can override this method to initialize it.When the manager has been restored from a snapshot, this method has to recover an appropriate part of the state of the manager.
- Parameters:
manager (ExtensionsManager) – Manager object to call this extension.
- Return type:
None
- load_state_dict(to_load)#
- Parameters:
to_load (Dict[str, Any]) –
- Return type:
None
- state_dict()#
Serializes the extension state.
It is called when a manager that owns this extension is serialized. It serializes nothing by default.
- Return type:
Dict[str, Any]