summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEvan Shelhamer <shelhamer@imaginarynumber.net>2014-03-17 23:24:54 -0700
committerEvan Shelhamer <shelhamer@imaginarynumber.net>2014-03-17 23:24:54 -0700
commit114731806358df4650c9126297e94fcd53a65da3 (patch)
tree24e150de2601cf83e92151111cf0283c903b4b9c /include
parent974215d98285001565f3711f79453d091a9c52c3 (diff)
parent12783d07bfea15ffeb894512a311dabc1f7c45cf (diff)
downloadcaffeonacl-114731806358df4650c9126297e94fcd53a65da3.tar.gz
caffeonacl-114731806358df4650c9126297e94fcd53a65da3.tar.bz2
caffeonacl-114731806358df4650c9126297e94fcd53a65da3.zip
Back-merge documentation and historical PRs to master
Diffstat (limited to 'include')
-rw-r--r--include/caffe/vision_layers.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/caffe/vision_layers.hpp b/include/caffe/vision_layers.hpp
index 51f5eae6..cb26c980 100644
--- a/include/caffe/vision_layers.hpp
+++ b/include/caffe/vision_layers.hpp
@@ -407,6 +407,44 @@ class DataLayer : public Layer<Dtype> {
Blob<Dtype> data_mean_;
};
+// This function is used to create a pthread that prefetches the data.
+template <typename Dtype>
+void* ImagesLayerPrefetch(void* layer_pointer);
+
+template <typename Dtype>
+class ImagesLayer : public Layer<Dtype> {
+ // The function used to perform prefetching.
+ friend void* ImagesLayerPrefetch<Dtype>(void* layer_pointer);
+
+ public:
+ explicit ImagesLayer(const LayerParameter& param)
+ : Layer<Dtype>(param) {}
+ virtual ~ImagesLayer();
+ virtual void SetUp(const vector<Blob<Dtype>*>& bottom,
+ vector<Blob<Dtype>*>* top);
+
+ protected:
+ virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
+ vector<Blob<Dtype>*>* top);
+ virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
+ vector<Blob<Dtype>*>* top);
+ virtual Dtype Backward_cpu(const vector<Blob<Dtype>*>& top,
+ const bool propagate_down, vector<Blob<Dtype>*>* bottom);
+ virtual Dtype Backward_gpu(const vector<Blob<Dtype>*>& top,
+ const bool propagate_down, vector<Blob<Dtype>*>* bottom);
+
+ vector<std::pair<std::string, int> > lines_;
+ int lines_id_;
+ int datum_channels_;
+ int datum_height_;
+ int datum_width_;
+ int datum_size_;
+ pthread_t thread_;
+ shared_ptr<Blob<Dtype> > prefetch_data_;
+ shared_ptr<Blob<Dtype> > prefetch_label_;
+ Blob<Dtype> data_mean_;
+};
+
template <typename Dtype>
class HDF5DataLayer : public Layer<Dtype> {