Skip to content

Commit 6ada5f4

Browse files
authored
Merge pull request #11184 from luotao1/benchmark1
fix test error in fluid_benchmark.py
2 parents d74838b + 9630aa0 commit 6ada5f4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

benchmark/fluid/fluid_benchmark.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def parse_args():
8585
help='If set, use nvprof for CUDA.')
8686
parser.add_argument(
8787
'--no_test',
88-
action='store_false',
89-
help='If set, test the testset during training.')
88+
action='store_true',
89+
help='If set, do not test the testset during training.')
9090
parser.add_argument(
9191
'--memory_optimize',
9292
action='store_true',
@@ -229,9 +229,9 @@ def train(avg_loss, infer_prog, optimizer, train_reader, test_reader, batch_acc,
229229
print("Pass: %d, Iter: %d, Loss: %f\n" %
230230
(pass_id, iters, np.mean(train_losses)))
231231
print_train_time(start_time, time.time(), num_samples)
232-
print("Pass: %d, Loss: %f" % (pass_id, np.mean(train_losses)))
232+
print("Pass: %d, Loss: %f" % (pass_id, np.mean(train_losses))),
233233
# evaluation
234-
if not args.no_test and batch_acc != None:
234+
if not args.no_test and batch_acc:
235235
pass_test_acc = test(exe, infer_prog, test_reader, feeder,
236236
batch_acc)
237237
print(", Test Accuracy: %f" % pass_test_acc)
@@ -310,7 +310,7 @@ def train_parallel(avg_loss, infer_prog, optimizer, train_reader, test_reader,
310310
print("Pass %d, batch %d, loss %s" %
311311
(pass_id, batch_id, np.array(loss)))
312312
print_train_time(start_time, time.time(), num_samples)
313-
if not args.no_test and batch_acc != None:
313+
if not args.no_test and batch_acc:
314314
test_acc = test(startup_exe, infer_prog, test_reader, feeder,
315315
batch_acc)
316316
print("Pass: %d, Test Accuracy: %f\n" % (pass_id, test_acc))

0 commit comments

Comments
 (0)