Skip to content

Commit 9ce8bcd

Browse files
committed
Fix comments
1 parent 7ff3855 commit 9ce8bcd

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

python/paddle/v2/fluid/evaluator.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,12 @@ class EditDistance(Evaluator):
226226
for epoch in PASS_NUM:
227227
distance_evaluator.reset(exe)
228228
for data in batches:
229-
loss, sum_distance = exe.run(fetch_list=[cost] + distance_evaluator.metrics)
230-
avg_distance = distance_evaluator.eval(exe)
231-
pass_distance = distance_evaluator.eval(exe)
229+
loss = exe.run(fetch_list=[cost])
230+
distance, sequence_error = distance_evaluator.eval(exe)
232231
233232
In the above example:
234-
'sum_distance' is the sum of the batch's edit distance.
235-
'avg_distance' is the average of edit distance from the firt batch to the current batch.
236-
'pass_distance' is the average of edit distance from all the pass.
233+
'distance' is the average of the edit distance rate in a pass.
234+
'sequence_error' is the sequence error rate in a pass.
237235
238236
"""
239237

@@ -257,7 +255,6 @@ def __init__(self, input, label, ignored_tokens=None, **kwargs):
257255
compare_result_int = layers.cast(x=compare_result, dtype='int')
258256
seq_right_count = layers.reduce_sum(compare_result_int)
259257
seq_error_count = layers.elementwise_sub(x=seq_num, y=seq_right_count)
260-
#error = layers.cast(x=error, dtype='float32')
261258
total_distance = layers.reduce_sum(distances)
262259
layers.sums(
263260
input=[self.total_distance, total_distance],

python/paddle/v2/fluid/layers/nn.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,10 +2392,7 @@ def __check_input(x, y):
23922392
return out
23932393

23942394

2395-
def edit_distance(input,
2396-
label,
2397-
normalized=False,
2398-
ignored_tokens=None,
2395+
def edit_distance(input, label, normalized=True, ignored_tokens=None,
23992396
name=None):
24002397
"""
24012398
EditDistance operator computes the edit distances between a batch of

0 commit comments

Comments
 (0)