From 1d69b1ffe37c2356710c63e611931afa026ecfd2 Mon Sep 17 00:00:00 2001 From: kolinwei <331911734@qq.com> Date: Wed, 16 May 2018 16:06:33 +0800 Subject: [PATCH] change some code style --- benchmark/fluid/mnist.py | 8 ++++++-- benchmark/fluid/resnet.py | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/benchmark/fluid/mnist.py b/benchmark/fluid/mnist.py index 3574c1c0e..1cb4314fb 100644 --- a/benchmark/fluid/mnist.py +++ b/benchmark/fluid/mnist.py @@ -179,9 +179,13 @@ def run_benchmark(model, args): outs = train_exe.run( feed={"pixel": img_data, "label": y_data}, - fetch_list=[avg_cost.name, batch_acc.name, batch_size_tensor.name] + fetch_list=[ + avg_cost.name, batch_acc.name, batch_size_tensor.name + ] ) # The accuracy is the accumulation of batches, but not the current batch. - accuracy.update(value=np.array(np.mean(outs[1])), weight=np.mean(np.array(outs[2]))) + accuracy.update( + value=np.array(np.mean(outs[1])), + weight=np.mean(np.array(outs[2]))) iters += 1 num_samples += len(y_data) loss = np.mean(np.array(outs[0])) diff --git a/benchmark/fluid/resnet.py b/benchmark/fluid/resnet.py index 5f60f806f..0fd7258a8 100644 --- a/benchmark/fluid/resnet.py +++ b/benchmark/fluid/resnet.py @@ -268,7 +268,9 @@ def run_benchmark(model, args): loss, acc, weight = train_exe.run( feed={'data': image, 'label': label}, - fetch_list=[avg_cost.name, batch_acc.name, batch_size_tensor.name]) + fetch_list=[ + avg_cost.name, batch_acc.name, batch_size_tensor.name + ]) iters += 1 num_samples += len(label) accuracy.add(value=np.array(np.mean(acc)), weight=np.mean(weight)) -- GitLab