SINGA-85 Add functions for extracting features and test new data

Make cpplint remove duplicated SINGA in header guard
Change checkpoint path in examples/cifar10/job.conf
All modified files passed cpplint


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

Branch: refs/heads/master
Commit: 288a2ab94b8d1d5c04932ad21fc940a1d9c9af5c
Parents: 584a849
Author: wang sheng <[email protected]>
Authored: Sun Oct 11 17:53:02 2015 +0800
Committer: wang sheng <[email protected]>
Committed: Sun Oct 11 18:00:38 2015 +0800

----------------------------------------------------------------------
 examples/cifar10/job.conf                              |  2 +-
 include/singa/neuralnet/input_layer/csv.h              |  6 ++++--
 include/singa/neuralnet/input_layer/deprecated.h       |  3 +++
 include/singa/neuralnet/input_layer/image_preprocess.h |  1 +
 include/singa/neuralnet/input_layer/prefetch.h         |  1 +
 include/singa/neuralnet/input_layer/record.h           | 10 ++++++----
 include/singa/neuralnet/input_layer/store.h            |  5 ++++-
 include/singa/neuralnet/output_layer/csv.h             |  7 +++++--
 include/singa/neuralnet/output_layer/record.h          |  6 +++++-
 include/singa/server.h                                 |  6 +++---
 include/singa/singa.h                                  |  6 +++---
 include/singa/stub.h                                   |  6 +++---
 include/singa/worker.h                                 |  6 +++---
 src/neuralnet/output_layer/csv.cc                      |  2 +-
 src/neuralnet/output_layer/record.cc                   |  4 ++--
 tool/cpplint.py                                        |  2 +-
 16 files changed, 46 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/examples/cifar10/job.conf
----------------------------------------------------------------------
diff --git a/examples/cifar10/job.conf b/examples/cifar10/job.conf
index 23f41f8..9ecb0c3 100644
--- a/examples/cifar10/job.conf
+++ b/examples/cifar10/job.conf
@@ -3,7 +3,7 @@ train_steps: 1000
 test_steps: 10
 test_freq: 300
 disp_freq: 30
-#checkpoint_path: "examples/cifar10/checkpoint/step50000-worker0"
+#checkpoint_path: "examples/cifar10/checkpoint/step1000-worker0"
 train_one_batch {
   alg: kBP
 }

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/input_layer/csv.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/input_layer/csv.h 
b/include/singa/neuralnet/input_layer/csv.h
index a6f19a6..32c0f76 100644
--- a/include/singa/neuralnet/input_layer/csv.h
+++ b/include/singa/neuralnet/input_layer/csv.h
@@ -22,7 +22,9 @@
 #ifndef SINGA_NEURALNET_INPUT_LAYER_CSV_H_
 #define SINGA_NEURALNET_INPUT_LAYER_CSV_H_
 
-#include "./store.h"
+#include <string>
+#include <vector>
+#include "singa/neuralnet/input_layer/store.h"
 
 namespace singa {
 
@@ -50,4 +52,4 @@ class CSVInputLayer : public SingleLabelRecordLayer {
 
 }  // namespace singa
 
-#endif  // SINGA_NEURALNET_INPUT_LAYER_CSV_RECORD_H_
+#endif  // SINGA_NEURALNET_INPUT_LAYER_CSV_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/input_layer/deprecated.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/input_layer/deprecated.h 
b/include/singa/neuralnet/input_layer/deprecated.h
index fdea8cf..2da590b 100644
--- a/include/singa/neuralnet/input_layer/deprecated.h
+++ b/include/singa/neuralnet/input_layer/deprecated.h
@@ -22,8 +22,11 @@
 #ifndef SINGA_NEURALNET_INPUT_LAYER_DEPRECATED_H_
 #define SINGA_NEURALNET_INPUT_LAYER_DEPRECATED_H_
 
+#include <string>
+#include <vector>
 #include "singa/neuralnet/layer.h"
 #include "singa/io/kvfile.h"
+
 namespace singa {
 /**
  * @deprecated please use the StoreInputLayer.

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/input_layer/image_preprocess.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/input_layer/image_preprocess.h 
b/include/singa/neuralnet/input_layer/image_preprocess.h
index f3bf90a..7f8a3a8 100644
--- a/include/singa/neuralnet/input_layer/image_preprocess.h
+++ b/include/singa/neuralnet/input_layer/image_preprocess.h
@@ -24,6 +24,7 @@
 
 #include <vector>
 #include "singa/neuralnet/layer.h"
+
 namespace singa {
 using std::vector;
 /**

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/input_layer/prefetch.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/input_layer/prefetch.h 
b/include/singa/neuralnet/input_layer/prefetch.h
index d30521d..d480618 100644
--- a/include/singa/neuralnet/input_layer/prefetch.h
+++ b/include/singa/neuralnet/input_layer/prefetch.h
@@ -26,6 +26,7 @@
 #include <vector>
 #include <thread>
 #include "singa/neuralnet/layer.h"
+
 namespace singa {
 using std::vector;
 /**

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/input_layer/record.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/input_layer/record.h 
b/include/singa/neuralnet/input_layer/record.h
index 5e1dce8..f4571ca 100644
--- a/include/singa/neuralnet/input_layer/record.h
+++ b/include/singa/neuralnet/input_layer/record.h
@@ -19,10 +19,12 @@
 *
 *************************************************************/
 
-#ifndef SINGA_NEURALNET_INPUT_LAYER_PROTO_H_
-#define SINGA_NEURALNET_INPUT_LAYER_PROTO_H_
+#ifndef SINGA_NEURALNET_INPUT_LAYER_RECORD_H_
+#define SINGA_NEURALNET_INPUT_LAYER_RECORD_H_
 
-#include "./store.h"
+#include <string>
+#include <vector>
+#include "singa/neuralnet/input_layer/store.h"
 
 namespace singa {
 
@@ -51,4 +53,4 @@ class RecordInputLayer : public SingleLabelRecordLayer {
 
 }  // namespace singa
 
-#endif  // SINGA_NEURALNET_INPUT_LAYER_PROTO_RECORD_H_
+#endif  // SINGA_NEURALNET_INPUT_LAYER_RECORD_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/input_layer/store.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/input_layer/store.h 
b/include/singa/neuralnet/input_layer/store.h
index 44d67c8..88e6ca4 100644
--- a/include/singa/neuralnet/input_layer/store.h
+++ b/include/singa/neuralnet/input_layer/store.h
@@ -22,8 +22,11 @@
 #ifndef SINGA_NEURALNET_INPUT_LAYER_STORE_H_
 #define SINGA_NEURALNET_INPUT_LAYER_STORE_H_
 
+#include <string>
+#include <vector>
 #include "singa/io/store.h"
 #include "singa/neuralnet/layer.h"
+
 namespace singa {
 
 /**
@@ -83,4 +86,4 @@ class SingleLabelRecordLayer : public StoreInputLayer {
 
 }  // namespace singa
 
-#endif  // SINGA_NEURALNET_INPUT_LAYER_STORE_INPUT_H_
+#endif  // SINGA_NEURALNET_INPUT_LAYER_STORE_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/output_layer/csv.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/output_layer/csv.h 
b/include/singa/neuralnet/output_layer/csv.h
index 974e9be..c43a578 100644
--- a/include/singa/neuralnet/output_layer/csv.h
+++ b/include/singa/neuralnet/output_layer/csv.h
@@ -18,11 +18,14 @@
 * under the License.
 *
 *************************************************************/
+
 #ifndef SINGA_NEURALNET_OUTPUT_LAYER_CSV_H_
 #define SINGA_NEURALNET_OUTPUT_LAYER_CSV_H_
 
+#include <vector>
 #include "singa/neuralnet/layer.h"
 #include "singa/io/store.h"
+
 namespace singa {
 /**
  * Output data (and label) for its source layer.
@@ -37,5 +40,5 @@ class CSVOutputLayer : public OutputLayer {
   int inst_ = 0;
   io::Store* store_;
 };
-} /* singa */
-#endif  // SINGA_NEURALNET_OUTPUT_LAYER_CSV_OUTPUT_H_
+}  // namespace singa
+#endif  // SINGA_NEURALNET_OUTPUT_LAYER_CSV_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/neuralnet/output_layer/record.h
----------------------------------------------------------------------
diff --git a/include/singa/neuralnet/output_layer/record.h 
b/include/singa/neuralnet/output_layer/record.h
index 3519ff5..ae1060e 100644
--- a/include/singa/neuralnet/output_layer/record.h
+++ b/include/singa/neuralnet/output_layer/record.h
@@ -18,10 +18,14 @@
 * under the License.
 *
 *************************************************************/
+
 #ifndef SINGA_NEURALNET_OUTPUT_LAYER_RECORD_H_
 #define SINGA_NEURALNET_OUTPUT_LAYER_RECORD_H_
+
+#include <vector>
 #include "singa/neuralnet/layer.h"
 #include "singa/io/store.h"
+
 namespace singa {
 
 class RecordOutputLayer : public OutputLayer {
@@ -34,5 +38,5 @@ class RecordOutputLayer : public OutputLayer {
   io::Store* store_;
   int inst_ = 0;  //!< instance No.
 };
-} /* singa */
+}  // namespace singa
 #endif  // SINGA_NEURALNET_OUTPUT_LAYER_RECORD_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/server.h
----------------------------------------------------------------------
diff --git a/include/singa/server.h b/include/singa/server.h
index 055820f..4bffeae 100644
--- a/include/singa/server.h
+++ b/include/singa/server.h
@@ -19,8 +19,8 @@
 *
 *************************************************************/
 
-#ifndef SINGA_SINGA_SERVER_H_
-#define SINGA_SINGA_SERVER_H_
+#ifndef SINGA_SERVER_H_
+#define SINGA_SERVER_H_
 
 #include <unordered_map>
 #include <vector>
@@ -130,4 +130,4 @@ class Server {
 
 }  // namespace singa
 
-#endif  // SINGA_SINGA_SERVER_H_
+#endif  // SINGA_SERVER_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/singa.h
----------------------------------------------------------------------
diff --git a/include/singa/singa.h b/include/singa/singa.h
index 3b8184f..9bc5ba5 100644
--- a/include/singa/singa.h
+++ b/include/singa/singa.h
@@ -19,8 +19,8 @@
 *
 *************************************************************/
 
-#ifndef SINGA_SINGA_SINGA_H_
-#define SINGA_SINGA_SINGA_H_
+#ifndef SINGA_SINGA_H_
+#define SINGA_SINGA_H_
 
 #include "singa/comm/socket.h"
 #include "singa/io/store.h"
@@ -34,4 +34,4 @@
 #include "singa/utils/factory.h"
 #include "singa/driver.h"
 
-#endif  // SINGA_SINGA_SINGA_H_
+#endif  // SINGA_SINGA_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/stub.h
----------------------------------------------------------------------
diff --git a/include/singa/stub.h b/include/singa/stub.h
index 730a516..0ab6fd4 100644
--- a/include/singa/stub.h
+++ b/include/singa/stub.h
@@ -19,8 +19,8 @@
 *
 *************************************************************/
 
-#ifndef SINGA_SINGA_STUB_H_
-#define SINGA_SINGA_STUB_H_
+#ifndef SINGA_STUB_H_
+#define SINGA_STUB_H_
 
 #include <queue>
 #include <unordered_map>
@@ -106,4 +106,4 @@ class Stub {
 
 }  // namespace singa
 
-#endif  // SINGA_SINGA_STUB_H_
+#endif  // SINGA_STUB_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/include/singa/worker.h
----------------------------------------------------------------------
diff --git a/include/singa/worker.h b/include/singa/worker.h
index 03cd7f7..1ed3642 100644
--- a/include/singa/worker.h
+++ b/include/singa/worker.h
@@ -19,8 +19,8 @@
 *
 *************************************************************/
 
-#ifndef SINGA_SINGA_WORKER_H_
-#define SINGA_SINGA_WORKER_H_
+#ifndef SINGA_WORKER_H_
+#define SINGA_WORKER_H_
 
 #include <string>
 #include <vector>
@@ -317,4 +317,4 @@ inline int BlobLayer(int blob_trgt) {
 
 }  // namespace singa
 
-#endif  // SINGA_SINGA_WORKER_H_
+#endif  // SINGA_WORKER_H_

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/src/neuralnet/output_layer/csv.cc
----------------------------------------------------------------------
diff --git a/src/neuralnet/output_layer/csv.cc 
b/src/neuralnet/output_layer/csv.cc
index 2f22727..ce3e002 100644
--- a/src/neuralnet/output_layer/csv.cc
+++ b/src/neuralnet/output_layer/csv.cc
@@ -55,4 +55,4 @@ void CSVOutputLayer::ComputeFeature(int flag, const 
vector<Layer*>& srclayers) {
     store_->Write(std::to_string(inst_++), record.str());
   }
 }
-} /* singa */
+}  // namespace singa

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/src/neuralnet/output_layer/record.cc
----------------------------------------------------------------------
diff --git a/src/neuralnet/output_layer/record.cc 
b/src/neuralnet/output_layer/record.cc
index 759a321..727f539 100644
--- a/src/neuralnet/output_layer/record.cc
+++ b/src/neuralnet/output_layer/record.cc
@@ -40,7 +40,7 @@ void RecordOutputLayer::ComputeFeature(int flag,
   int dim = data.count() / batchsize;
   if (label.size())
     CHECK_EQ(label.size(), batchsize);
-  for (int k = 0; k < batchsize; k++){
+  for (int k = 0; k < batchsize; k++) {
     SingleLabelImageRecord image;
     if (label.size())
       image.set_label(label[k]);
@@ -53,4 +53,4 @@ void RecordOutputLayer::ComputeFeature(int flag,
   }
   store_->Flush();
 }
-} /* singa */
+}  // namespace singa

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/288a2ab9/tool/cpplint.py
----------------------------------------------------------------------
diff --git a/tool/cpplint.py b/tool/cpplint.py
index edc64d1..7b29e90 100755
--- a/tool/cpplint.py
+++ b/tool/cpplint.py
@@ -1675,7 +1675,7 @@ def GetHeaderGuardCPPVariable(filename):
 
   # [email protected]: change INCLUDE to SINGA
   singa_path = re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_'
-  return singa_path.replace("INCLUDE", "SINGA")
+  return singa_path.replace("INCLUDE_", "")
 
 
 def CheckForHeaderGuard(filename, clean_lines, error):

Reply via email to