singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wang...@apache.org
Subject [2/4] incubator-singa git commit: SINGA-90 Miscellaneous trivial bug fixes
Date Thu, 15 Oct 2015 13:25:49 GMT
SINGA-90 Miscellaneous trivial bug fixes

Make CSVOutputLayer and TextFileStore flush the output.


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/021f41e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/021f41e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/021f41e4

Branch: refs/heads/master
Commit: 021f41e4831fa89f3cdfda40525e960cbbc11ad3
Parents: b1da6e6
Author: Yee Fan <yeefan80@yahoo.com.sg>
Authored: Thu Oct 15 15:08:11 2015 +0800
Committer: Yee Fan <yeefan80@yahoo.com.sg>
Committed: Thu Oct 15 21:06:42 2015 +0800

----------------------------------------------------------------------
 src/io/textfile_store.cc          | 2 ++
 src/neuralnet/output_layer/csv.cc | 1 +
 2 files changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/021f41e4/src/io/textfile_store.cc
----------------------------------------------------------------------
diff --git a/src/io/textfile_store.cc b/src/io/textfile_store.cc
index 7636f26..e203517 100644
--- a/src/io/textfile_store.cc
+++ b/src/io/textfile_store.cc
@@ -38,6 +38,8 @@ bool TextFileStore::Open(const std::string& source, Mode mode) {
 void TextFileStore::Close() {
   if (fs_ != nullptr) {
     if (fs_->is_open()) {
+      if (mode_ != kRead)
+        fs_->flush();
       fs_->close();
     }
     delete fs_;

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/021f41e4/src/neuralnet/output_layer/csv.cc
----------------------------------------------------------------------
diff --git a/src/neuralnet/output_layer/csv.cc b/src/neuralnet/output_layer/csv.cc
index ce3e002..856b95f 100644
--- a/src/neuralnet/output_layer/csv.cc
+++ b/src/neuralnet/output_layer/csv.cc
@@ -54,5 +54,6 @@ void CSVOutputLayer::ComputeFeature(int flag, const vector<Layer*>&
srclayers) {
     record << std::to_string(dptr[dim - 1]);
     store_->Write(std::to_string(inst_++), record.str());
   }
+  store_->Flush();
 }
 }  // namespace singa


Mime
View raw message