提交 e0f883e6 编写于 作者: S sneaxiy

commit

上级 1eeb11ef
...@@ -156,15 +156,23 @@ def train(avg_loss, infer_prog, optimizer, train_reader, test_reader, batch_acc, ...@@ -156,15 +156,23 @@ def train(avg_loss, infer_prog, optimizer, train_reader, test_reader, batch_acc,
start_time = time.time() start_time = time.time()
num_samples = 0 num_samples = 0
if arg.profile and pass_id == 0 and batch_id == 5:
profiler.start_profiler("All")
elif args.profile and pass_id == 0 and batch_id == 10:
profiler.stop_profiler("total", "/tmp/profile")
if args.use_reader_op: if args.use_reader_op:
try: try:
loss = exe.run(train_prog, fetch_list=[avg_loss]) loss = exe.run(train_prog,
fetch_list=[avg_loss],
use_program_cache=True)
except fluid.core.EnforceNotMet as ex: except fluid.core.EnforceNotMet as ex:
break break
else: else:
loss = exe.run(train_prog, loss = exe.run(train_prog,
feed=feeder.feed(data), feed=feeder.feed(data),
fetch_list=[avg_loss]) fetch_list=[avg_loss],
use_program_cache=True)
iters += 1 iters += 1
batch_id += 1 batch_id += 1
# FIXME(wuyi): For use_reader_op, if the current # FIXME(wuyi): For use_reader_op, if the current
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册