pytorch_pfn_extras.training.extensions.IgniteEvaluator#

class pytorch_pfn_extras.training.extensions.IgniteEvaluator(evaluator, iterator, target, **kwargs)#

Bases: Evaluator

Methods

__init__(evaluator, iterator, target, **kwargs)

add_metric(metric_fn)

Adds a custom metric to the evaluator.

eval_func(*args, **kwargs)

evaluate()

Evaluates the model and returns a result dictionary.

finalize(manager)

Finalizes the extension.

get_all_iterators()

Returns a dictionary of all iterators.

get_all_targets()

Returns a dictionary of all target links.

get_iterator(name)

Returns the iterator of the given name.

get_target(name)

Returns the target link of the given name.

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.

set_evaluator_handlers()

state_dict()

Serializes the extension state.

Attributes

default_name

is_async

name

needs_model_state

priority

trigger

Parameters:
  • evaluator (Engine) –

  • iterator (Union[DataLoader[Any], Dict[str, DataLoader[Any]]]) –

  • target (Union[Module, Dict[str, Module]]) –

  • kwargs (Any) –

__init__(evaluator, iterator, target, **kwargs)#
Parameters:
  • evaluator (Engine) –

  • iterator (Union[DataLoader[Any], Dict[str, DataLoader[Any]]]) –

  • target (Union[Module, Dict[str, Module]]) –

  • kwargs (Any) –

evaluate()#

Evaluates the model and returns a result dictionary.

This method runs the evaluation loop over the validation dataset. It accumulates the reported values to DictSummary and returns a dictionary whose values are means computed by the summary.

Users can override this method to customize the evaluation routine.

Returns:

Result dictionary. This dictionary is further reported via report() without specifying any observer.

Return type:

dict

set_evaluator_handlers()#
Return type:

None