Skip to content

Commit

Permalink
change some code style
Browse files Browse the repository at this point in the history
  • Loading branch information
kolinwei committed May 16, 2018
1 parent 2b63b03 commit 1d69b1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions benchmark/fluid/mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
4 changes: 3 additions & 1 deletion benchmark/fluid/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def test(exe):
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))
Expand Down

0 comments on commit 1d69b1f

Please sign in to comment.