[exo] Using ofstream with binary mode (#9393)
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Thu, 5 Dec 2019 02:21:56 +0000 (11:21 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 5 Dec 2019 02:21:56 +0000 (11:21 +0900)
Previously, there is no mode setting with dumpToFile, so it worked with text mode by default. This PR fixed the bug.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
compiler/exo/src/Circle/CircleExporter.cpp
compiler/exo/src/TFLite/TFLExporter.cpp

index c27bdd9..7977490 100644 (file)
@@ -42,7 +42,7 @@ void CircleExporter::dumpToFile(const char *path) const
   if (!ptr)
     INTERNAL_EXN("Graph was not serialized by FlatBuffer for some reason");
 
-  std::ofstream file(path);
+  std::ofstream file(path, std::ofstream::binary);
   file.write(ptr, size);
 }
 
index 2e0fb71..cf002b3 100644 (file)
@@ -42,7 +42,7 @@ void TFLExporter::dumpToFile(const char *path) const
   if (!ptr)
     INTERNAL_EXN("Graph was not serialized by FlatBuffer for some reason");
 
-  std::ofstream file(path);
+  std::ofstream file(path, std::ofstream::binary);
   file.write(ptr, size);
 }