Evaluator

Evaluator

class paddle.v2.fluid.evaluator.Evaluator(name, **kwargs)

Base Class for all evaluators

参数:
  • name (str) – The name of evaluator. such as, “accuracy”. Used for generate temporary variable name.
  • main_program (Program, optional) – The evaluator should be added to this main_program. Default default_main_program()
  • startup_program (Program, optional) – The parameter should be added to this startup_program. Default default_startup_program()
states

list – The list of state variables. states will be reset to zero when reset is invoked.

metrics

list – The list of metrics variables. They will be calculate every mini-batch

reset(executor, reset_program=None)

reset metric states at the begin of each pass/user specified batch

eval(executor, eval_program=None)

Evaluate the statistics merged by multiple mini-batches.

create_state(suffix, dtype, shape)

Create state variable.

NOTE: It is not a public API.

参数:
  • suffix (str) – the state suffix.
  • dtype (str|core.DataType) – the state data type
  • shape (tuple|list) – the shape of state

Returns: State variable