layer_factory, and misc update
authorYangqing Jia <jiayq84@gmail.com>
Mon, 23 Sep 2013 22:16:46 +0000 (15:16 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Mon, 23 Sep 2013 22:16:46 +0000 (15:16 -0700)
src/caffe/blob.hpp
src/caffe/common.hpp
src/caffe/layer.hpp
src/caffe/syncedmem.hpp

index 3320d07..57ced66 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef CAFFE_BLOB_HPP
-#define CAFFE_BLOB_HPP
+#ifndef CAFFE_BLOB_HPP_
+#define CAFFE_BLOB_HPP_
 
 #include "caffe/common.hpp"
 #include "caffe/syncedmem.hpp"
@@ -50,6 +50,7 @@ class Blob {
   void Update();
   void FromProto(const BlobProto& proto);
   void ToProto(BlobProto* proto);
+
  private:
   shared_ptr<SyncedMemory> data_;
   shared_ptr<SyncedMemory> diff_;
index be0797f..95fd73a 100644 (file)
@@ -26,6 +26,7 @@
 
 #define NOT_IMPLEMENTED LOG(FATAL) << "Not Implemented Yet"
 
+
 namespace caffe {
 
 // We will use the boost shared_ptr instead of the new C++11 one mainly
@@ -46,20 +47,32 @@ class Caffe {
   ~Caffe();
   static Caffe& Get();
   enum Brew { CPU, GPU };
-  enum Phase { TRAIN, TEST};
+  enum Phase { TRAIN, TEST };
 
-  // The getters for the variables. 
+  // The getters for the variables.
+  // Returns the cublas handle.
   static cublasHandle_t cublas_handle();
+  // Returns the curand generator.
   static curandGenerator_t curand_generator();
+  // Returns the MKL random stream.
   static VSLStreamStatePtr vsl_stream();
+  // Returns the mode: running on CPU or GPU.
   static Brew mode();
+  // Returns the phase: TRAIN or TEST.
   static Phase phase();
   // The setters for the variables
+  // Sets the mode.
   static void set_mode(Brew mode);
+  // Sets the phase.
   static void set_phase(Phase phase);
+  // Sets the random seed of both MKL and curand
   static void set_random_seed(const unsigned int seed);
+
  private:
+  // The private constructor to avoid duplicate instantiation.
   Caffe();
+
+ protected:
   static shared_ptr<Caffe> singleton_;
   cublasHandle_t cublas_handle_;
   curandGenerator_t curand_generator_;
@@ -68,6 +81,7 @@ class Caffe {
   Phase phase_;
 };
 
+
 }  // namespace caffe
 
 #endif  // CAFFE_COMMON_HPP_
index d86ccdc..7772130 100644 (file)
@@ -97,6 +97,7 @@ inline Dtype Layer<Dtype>::Backward(const vector<Blob<Dtype>*>& top,
   }
 };
 
+
 }  // namespace caffe
 
 #endif  // CAFFE_LAYER_H_
index c217691..0d9fdd3 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef CAFFE_SYNCEDMEM_HPP
-#define CAFFE_SYNCEDMEM_HPP
+#ifndef CAFFE_SYNCEDMEM_HPP_
+#define CAFFE_SYNCEDMEM_HPP_
 
 namespace caffe {