forked from AmIRong/Caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblob.hpp
58 lines (49 loc) · 1.27 KB
/
blob.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// blob.hpp
// Caffe
//
// Created by woke on 2017/5/25.
//
//
#ifndef blob_hpp
#define blob_hpp
#include <stdio.h>
#endif /* blob_hpp */
namespace caffeine{
template<typename Dtype>
class Blob{
public:
Blob()
:num_(0),channels_(0),height_(0),width_(0),count_(0),data_(),diff_(){};
explicit Blob(const int num, const int channels,const int height,const int width){
Reshape(num,channels,height,width);
}
};
~Blob(){};
void Reshape(const int num,const int channels,const int height,cosnt int width);
inline int num(){return num_;}
inline int channels(){return channels_;}
inline int height(){return height_;}
inline int width(){return width_;}
const Dtype* cpu_data();
const Dtype* gpu_data();
const Dtype* cpu_diff();
const Dtype* gpu_diff();
Dtype*mutable_cpu_data();
Dtype*mutable_gpu_data();
Dtype*mutalble_cpu_diff();
Dtype*mutalble_gpu_diff();
Dtype*mutalble_gpu_diff();
void update();
private:
void check_data();
void check_diff();
shared_ptr<SyncedMemory> data_;
shared_ptr<SyncedMemory> diff_;
int num_;
int channels_;
int height_;
int width_;
int count_;
}; //class Blob
endif() //CAFFEINE_BLOB_HPP_