提交 9ce8bcde 编写于 作者: W wanghaoshuang

Fix comments

上级 7ff3855d
......@@ -226,14 +226,12 @@ class EditDistance(Evaluator):
for epoch in PASS_NUM:
distance_evaluator.reset(exe)
for data in batches:
loss, sum_distance = exe.run(fetch_list=[cost] + distance_evaluator.metrics)
avg_distance = distance_evaluator.eval(exe)
pass_distance = distance_evaluator.eval(exe)
loss = exe.run(fetch_list=[cost])
distance, sequence_error = distance_evaluator.eval(exe)
In the above example:
'sum_distance' is the sum of the batch's edit distance.
'avg_distance' is the average of edit distance from the firt batch to the current batch.
'pass_distance' is the average of edit distance from all the pass.
'distance' is the average of the edit distance rate in a pass.
'sequence_error' is the sequence error rate in a pass.
"""
......@@ -257,7 +255,6 @@ class EditDistance(Evaluator):
compare_result_int = layers.cast(x=compare_result, dtype='int')
seq_right_count = layers.reduce_sum(compare_result_int)
seq_error_count = layers.elementwise_sub(x=seq_num, y=seq_right_count)
#error = layers.cast(x=error, dtype='float32')
total_distance = layers.reduce_sum(distances)
layers.sums(
input=[self.total_distance, total_distance],
......
......@@ -2392,10 +2392,7 @@ def matmul(x, y, transpose_x=False, transpose_y=False, name=None):
return out
def edit_distance(input,
label,
normalized=False,
ignored_tokens=None,
def edit_distance(input, label, normalized=True, ignored_tokens=None,
name=None):
"""
EditDistance operator computes the edit distances between a batch of
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册