-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblob.cpp
56 lines (45 loc) · 1.15 KB
/
blob.cpp
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
//
// blob.cpp
// Caffe
//
// Created by woke on 2017/5/25.
//
//
#include "blob.hpp"
namespace caffeine {
template <typename Dtype>
}
void Blob<Dtype>::Reshape(const int num, const int channels, const int height,const int width){
num_ = num;
channels_ = channels;
height_ =height;
width_ = width;
count_ = num_* channels_* height_ *width;
data_.reset(SyncedMemory(count_*sizeof(Dtype)));
diff.reset(SyncedMemory(count_*sizeof(Dtype)));
data_.reset(new SyncedMemory(count_* sizeof(Dtype)));
diff_.reset(new SyncedMemory(count_*sizeof(Dtype)));
}
template<typename Dtype>
Dtype*Blob<Dtype>::mutable_cpu_data(){
check_data();
return data_->mutable_cpu_data();
}
tempalte<typename Dtype>
Dtype*Blob<Dtype>::mutable_gpu_data(){
check_data();
return data_->mutable_gpu_data();
}
template<typename Dtype>
Dtype*Blob<Dtype>::mutable_cpu_diff(){
check_diff();
return diff_->mutable_cpu_data();
}
template<typename Dtype>
Dtype*Blob<Dtype>::mutable_gpu_diff(){
check_dirr();
return diff_->mutable_gpu_data();
}
template<typename Dtype>
void Blob<Dtype>::update(){
} //namespace caffeine