提交 6fcef381 编写于 作者: S SunAhong1993 提交者: Macrobull

Update convert.py

上级 d21215c4
...@@ -41,8 +41,12 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path, ...@@ -41,8 +41,12 @@ def convert(def_path, caffemodel_path, data_output_path, code_output_path,
np.save(data_out, data) np.save(data_out, data)
if code_output_path: if code_output_path:
print_stderr('Saving source...') print_stderr('Saving source...')
s = sys.version
with open(code_output_path, 'wb') as src_out: with open(code_output_path, 'wb') as src_out:
src_out.write(str.encode(transformer.transform_source())) if s.startswith('2'):
src_out.write(transformer.transform_source())
else:
src_out.write(str.encode(transformer.transform_source()))
print_stderr('set env variable before using converted model '\ print_stderr('set env variable before using converted model '\
'if used custom_layers:') 'if used custom_layers:')
custom_pk_path = os.path.dirname(os.path.abspath(__file__)) custom_pk_path = os.path.dirname(os.path.abspath(__file__))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册