You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2015/10/15 15:25:49 UTC
[2/4] incubator-singa git commit: SINGA-90 Miscellaneous trivial bug
fixes
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 <ye...@yahoo.com.sg>
Authored: Thu Oct 15 15:08:11 2015 +0800
Committer: Yee Fan <ye...@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