Skip to content

Commit cd9374f

Browse files
Update plotlog.py
1 parent 41b75ad commit cd9374f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

benchmark/paddle/image/plotlog.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,18 @@ def sample(metric, sample_rate):
7070
return metric_sample
7171

7272

73-
def plot_metric(metric, batch_id, graph_title, line_style='b-',
74-
line_label='y',
75-
line_num=1):
73+
def plot_metric(metric,
74+
batch_id,
75+
graph_title,
76+
line_style='b-',
77+
line_label='y',
78+
line_num=1):
7679
plt.figure()
7780
plt.title(graph_title)
7881
if line_num == 1:
7982
plt.plot(batch_id, metric, line_style, line_label)
8083
else:
81-
for i in line_num:
84+
for i in range(line_num):
8285
plt.plot(batch_id, metric[i], line_style[i], line_label[i])
8386
plt.xlabel('batch')
8487
plt.ylabel(graph_title)
@@ -99,7 +102,11 @@ def main():
99102
accuracy_sample = sample(accuracy, args.sample_rate)
100103

101104
plot_metric(loss_sample, batch_sample, 'loss', line_label='loss')
102-
plot_metric(accuracy_sample, batch_sample, 'accuracy', line_style='g-', line_label='accuracy')
105+
plot_metric(accuracy_sample,
106+
batch_sample,
107+
'accuracy',
108+
line_style='g-',
109+
line_label='accuracy')
103110

104111

105112
if __name__ == '__main__':

0 commit comments

Comments
 (0)