提交 57ce8e2f 编写于 作者: L Lizhengo 提交者: Yibing Liu

修正第一步的loss为nan的bug (#4140)

上级 25b1a507
......@@ -239,6 +239,7 @@ def train(conf_dict, args):
global_step += 1
fetch_list = [avg_cost.name]
avg_loss = train_exe.run(program=train_program, fetch_list = fetch_list)
losses.append(np.mean(avg_loss[0]))
if args.do_valid and global_step % args.validation_steps == 0:
get_valid_examples = simnet_process.get_reader("valid")
valid_result = valid_and_test(test_prog,test_pyreader,get_valid_examples,simnet_process,"valid",exe,[pred.name])
......@@ -271,7 +272,6 @@ def train(conf_dict, args):
target_vars, exe,
test_prog)
logging.info("saving infer model in %s" % model_path)
losses.append(np.mean(avg_loss[0]))
except fluid.core.EOFException:
train_pyreader.reset()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册