Caffe
data_layer.hpp
1 #ifndef CAFFE_DATA_LAYER_HPP_
2 #define CAFFE_DATA_LAYER_HPP_
3 
4 #include <vector>
5 
6 #include "caffe/blob.hpp"
7 #include "caffe/data_transformer.hpp"
8 #include "caffe/internal_thread.hpp"
9 #include "caffe/layer.hpp"
10 #include "caffe/layers/base_data_layer.hpp"
11 #include "caffe/proto/caffe.pb.h"
12 #include "caffe/util/db.hpp"
13 
14 namespace caffe {
15 
16 template <typename Dtype>
17 class DataLayer : public BasePrefetchingDataLayer<Dtype> {
18  public:
19  explicit DataLayer(const LayerParameter& param);
20  virtual ~DataLayer();
21  virtual void DataLayerSetUp(const vector<Blob<Dtype>*>& bottom,
22  const vector<Blob<Dtype>*>& top);
23  virtual inline const char* type() const { return "Data"; }
24  virtual inline int ExactNumBottomBlobs() const { return 0; }
25  virtual inline int MinTopBlobs() const { return 1; }
26  virtual inline int MaxTopBlobs() const { return 2; }
27 
28  protected:
29  void Next();
30  bool Skip();
31  virtual void load_batch(Batch<Dtype>* batch);
32 
33  shared_ptr<db::DB> db_;
34  shared_ptr<db::Cursor> cursor_;
35  uint64_t offset_;
36 };
37 
38 } // namespace caffe
39 
40 #endif // CAFFE_DATA_LAYER_HPP_
Definition: base_data_layer.hpp:47
Definition: base_data_layer.hpp:53
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14
Definition: data_layer.hpp:17
virtual int ExactNumBottomBlobs() const
Returns the exact number of bottom blobs required by the layer, or -1 if no exact number is required...
Definition: data_layer.hpp:24
virtual const char * type() const
Returns the layer type.
Definition: data_layer.hpp:23
virtual int MaxTopBlobs() const
Returns the maximum number of top blobs required by the layer, or -1 if no maximum number is required...
Definition: data_layer.hpp:26
virtual int MinTopBlobs() const
Returns the minimum number of top blobs required by the layer, or -1 if no minimum number is required...
Definition: data_layer.hpp:25
A wrapper around SyncedMemory holders serving as the basic computational unit through which Layers...
Definition: blob.hpp:24