File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77#include " caffe/common.hpp"
88#include " caffe/proto/caffe.pb.h"
99
10+ #define CUDNN_VERSION_MIN (major, minor, patch ) \
11+ (CUDNN_VERSION >= (major * 1000 + minor * 100 + patch))
12+
1013#define CUDNN_CHECK (condition ) \
1114 do { \
1215 cudnnStatus_t status = condition; \
Original file line number Diff line number Diff line change @@ -30,11 +30,19 @@ void CuDNNConvolutionLayer<Dtype>::Forward_gpu(
3030 // Bias.
3131 if (this ->bias_term_ ) {
3232 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
3340 CUDNN_CHECK (cudnnAddTensor (handle_[g], CUDNN_ADD_SAME_C ,
3441 cudnn::dataType<Dtype>::one,
3542 bias_desc_, bias_data + bias_offset_ * g,
3643 cudnn::dataType<Dtype>::one,
3744 top_descs_[i], top_data + top_offset_ * g));
45+ #endif
3846 }
3947 }
4048
You can’t perform that action at this time.
0 commit comments