提交 f9e7cfb0 编写于 作者: W wanghaoshuang

save binary file

上级 804dd7da
...@@ -51,11 +51,18 @@ function(copy TARGET) ...@@ -51,11 +51,18 @@ function(copy TARGET)
COMMAND ${CMAKE_COMMAND} -E copy "${src_file}" "${dst}" COMMAND ${CMAKE_COMMAND} -E copy "${src_file}" "${dst}"
COMMENT "copying ${src_file} -> ${dst}") COMMENT "copying ${src_file} -> ${dst}")
endforeach() endforeach()
else() # not windows else(WIN32) # not windows
add_custom_command(TARGET ${TARGET} PRE_BUILD add_custom_command(TARGET ${TARGET} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${dst}" COMMAND mkdir -p "${dst}"
COMMAND ${CMAKE_COMMAND} -E copy "${src_files}" "${dst}" COMMAND cp -r "${src}" "${dst}"
COMMENT "copying ${src} -> ${dst}") COMMENT "copying ${src} -> ${dst}")
#add_custom_command(TARGET ${TARGET} PRE_BUILD
# COMMAND ${CMAKE_COMMAND} -E make_directory "${dst}")
#message("mkdir " ${TARGET})
#add_custom_command(TARGET ${TARGET} PRE_BUILD
# COMMAND ${CMAKE_COMMAND} -E make_directory "${dst}"
# COMMAND ${CMAKE_COMMAND} -E copy_directory "${src_files}" "${dst}"
# COMMENT "copying ${src} -> ${dst}")
endif(WIN32) endif(WIN32)
endforeach() endforeach()
endfunction() endfunction()
......
...@@ -49,7 +49,7 @@ class SaveCombineOp : public framework::OperatorBase { ...@@ -49,7 +49,7 @@ class SaveCombineOp : public framework::OperatorBase {
} }
MkDirRecursively(DirName(filename).c_str()); MkDirRecursively(DirName(filename).c_str());
std::ofstream fout(filename); std::ofstream fout(filename, std::ios_base::out | std::ios_base::binary);
PADDLE_ENFORCE(static_cast<bool>(fout), "Cannot open %s to write", PADDLE_ENFORCE(static_cast<bool>(fout), "Cannot open %s to write",
filename); filename);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册