提交 b6506624 编写于 作者: J jingqinghe

fix bug in py3

上级 f9455bdd
...@@ -209,12 +209,12 @@ class JobGenerator(object): ...@@ -209,12 +209,12 @@ class JobGenerator(object):
program_desc_str = fin.read() program_desc_str = fin.read()
new_main = fluid.Program.parse_from_string(program_desc_str) new_main = fluid.Program.parse_from_string(program_desc_str)
para_list = [] para_list = []
with open(program_input + '/para_info', 'rb') as fin: with open(program_input + '/para_info', 'r') as fin:
for line in fin: for line in fin:
current_para = line[:-1] current_para = line[:-1]
para_list.append(current_para) para_list.append(current_para)
with open(program_input + '/loss_name', 'rb') as fin: with open(program_input + '/loss_name', 'r') as fin:
loss_name = fin.read() loss_name = fin.read()
for item in para_list: for item in para_list:
......
...@@ -39,14 +39,14 @@ def save_program(program_path): ...@@ -39,14 +39,14 @@ def save_program(program_path):
para_info = [] para_info = []
for pa in params: for pa in params:
para_info.append(pa.name) para_info.append(pa.name)
with open(program_path + '/para_info', 'wb') as fout: with open(program_path + '/para_info', 'w') as fout:
for item in para_info: for item in para_info:
fout.write("%s\n" % item) fout.write("%s\n" % item)
with open(program_path + '/startup_program', "wb") as fout: with open(program_path + '/startup_program', "wb") as fout:
fout.write(startup_program_str) fout.write(startup_program_str)
with open(program_path + '/main_program', "wb") as fout: with open(program_path + '/main_program', "wb") as fout:
fout.write(main_program_str) fout.write(main_program_str)
with open(program_path + '/loss_name', 'wb') as fout: with open(program_path + '/loss_name', 'w') as fout:
fout.write(avg_cost.name) fout.write(avg_cost.name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册