class paddle.fluid.evaluator. EditDistance ( input, label, ignored_tokens=None, **kwargs ) [source]

Warning: This would be deprecated in the future. Please use fluid.metrics.EditDistance instead. Accumulate edit distance sum and sequence number from mini-batches and compute the average edit_distance and instance error of all batches.

  • input – the sequences predicted by network.

  • label – the target sequences which must have same sequence count

  • input. (with) –

  • ignored_tokens (list of int) – Tokens that should be removed before

  • distance. (calculating edit) –


exe = fluid.executor(place)
distance_evaluator = fluid.Evaluator.EditDistance(input, label)
for epoch in PASS_NUM:
    for data in batches:
        loss = exe.run(fetch_list=[cost])
    distance, instance_error = distance_evaluator.eval(exe)

In the above example: ‘distance’ is the average of the edit distance in a pass. ‘instance_error’ is the instance error rate in a pass.

eval ( executor, eval_program=None )


Evaluate the statistics merged by multiple mini-batches. :param executor: a executor for executing the eval_program :type executor: Executor|ParallelExecutor :param eval_program: a single Program for eval process :type eval_program: Program

reset ( executor, reset_program=None )


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

  • executor (Executor|ParallelExecutor) – a executor for executing the reset_program

  • reset_program (Program) – a single Program for reset process