]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/caffe-jacinto.git/blobdiff - src/caffe/vision_layers.hpp
data layer: using pthread
[jacinto-ai/caffe-jacinto.git] / src / caffe / vision_layers.hpp
index 23678bf47e434ecd929147c2c0c7b801cd6836c0..6f943a8e92caf15775e0848fc0a2e0ed8a6feed9 100644 (file)
@@ -4,6 +4,7 @@
 #define CAFFE_VISION_LAYERS_HPP_
 
 #include <leveldb/db.h>
+#include <pthread.h>
 
 #include <vector>
 
@@ -232,8 +233,14 @@ class ConvolutionLayer : public Layer<Dtype> {
   int N_;
 };
 
+template <typename Dtype>
+void* DataLayerPrefetch(void* layer_pointer);
+
 template <typename Dtype>
 class DataLayer : public Layer<Dtype> {
+  // The function used to perform prefetching.
+  friend void* DataLayerPrefetch<Dtype>(void*);
+
  public:
   explicit DataLayer(const LayerParameter& param)
       : Layer<Dtype>(param) {}
@@ -256,6 +263,9 @@ class DataLayer : public Layer<Dtype> {
   int datum_height_;
   int datum_width_;
   int datum_size_;
+  pthread_t thread_;
+  shared_ptr<Blob<Dtype> > prefetch_data_;
+  shared_ptr<Blob<Dtype> > prefetch_label_;
 };