This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 53e6dac
1 parent 5413860 commit 53e6dac Copy full SHA for 53e6dac
File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 7
7
#include " caffe/common.hpp"
8
8
#include " caffe/proto/caffe.pb.h"
9
9
10
+ #define CUDNN_VERSION_MIN (major, minor, patch ) \
11
+ (CUDNN_VERSION >= (major * 1000 + minor * 100 + patch))
12
+
10
13
#define CUDNN_CHECK (condition ) \
11
14
do { \
12
15
cudnnStatus_t status = condition; \
Original file line number Diff line number Diff line change @@ -30,11 +30,19 @@ void CuDNNConvolutionLayer<Dtype>::Forward_gpu(
30
30
// Bias.
31
31
if (this ->bias_term_ ) {
32
32
const Dtype* bias_data = this ->blobs_ [1 ]->gpu_data ();
33
+ #if CUDNN_VERSION_MIN(4, 0, 0)
34
+ CUDNN_CHECK (cudnnAddTensor (handle_[g],
35
+ cudnn::dataType<Dtype>::one,
36
+ bias_desc_, bias_data + bias_offset_ * g,
37
+ cudnn::dataType<Dtype>::one,
38
+ top_descs_[i], top_data + top_offset_ * g));
39
+ #else
33
40
CUDNN_CHECK (cudnnAddTensor (handle_[g], CUDNN_ADD_SAME_C,
34
41
cudnn::dataType<Dtype>::one,
35
42
bias_desc_, bias_data + bias_offset_ * g,
36
43
cudnn::dataType<Dtype>::one,
37
44
top_descs_[i], top_data + top_offset_ * g));
45
+ #endif
38
46
}
39
47
}
40
48
You can’t perform that action at this time.
0 commit comments