未验证 提交 30717a6c 编写于 作者: P Pei Yang 提交者: GitHub

fix trt serialization on windows (#31438)

上级 1321c479
...@@ -244,7 +244,7 @@ static std::string GetTrtEngineSerializedData( ...@@ -244,7 +244,7 @@ static std::string GetTrtEngineSerializedData(
if (FileExists(trt_serialized_path)) { if (FileExists(trt_serialized_path)) {
VLOG(3) << "Trt serialized file: " << trt_serialized_path VLOG(3) << "Trt serialized file: " << trt_serialized_path
<< "is found here"; << "is found here";
std::ifstream infile(trt_serialized_path, std::ios::in); std::ifstream infile(trt_serialized_path, std::ios::binary);
std::stringstream buffer; std::stringstream buffer;
buffer << infile.rdbuf(); buffer << infile.rdbuf();
std::string trt_engine_serialized_data(buffer.str()); std::string trt_engine_serialized_data(buffer.str());
...@@ -256,7 +256,7 @@ static std::string GetTrtEngineSerializedData( ...@@ -256,7 +256,7 @@ static std::string GetTrtEngineSerializedData(
static void SaveTrtEngineSerializedDataToFile( static void SaveTrtEngineSerializedDataToFile(
const std::string &trt_serialized_path, const std::string &trt_serialized_path,
const std::string &engine_serialized_data) { const std::string &engine_serialized_data) {
std::ofstream outfile(trt_serialized_path); std::ofstream outfile(trt_serialized_path, std::ios::binary);
outfile << engine_serialized_data; outfile << engine_serialized_data;
outfile.close(); outfile.close();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册