File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -122,13 +122,20 @@ shared_ptr<Layer<Dtype> > GetConvolutionLayer(
122122 use_dilation = true ;
123123 }
124124 }
125+ bool asym_pad = false ;
126+ if (conv_param.pad_type () != 0 ) asym_pad = true ;
125127#endif
126128 if (engine == ConvolutionParameter_Engine_DEFAULT) {
127129 engine = ConvolutionParameter_Engine_CAFFE;
128130#ifdef USE_CUDNN
129- if (!use_dilation) {
131+ if (!use_dilation && !asym_pad ) {
130132 engine = ConvolutionParameter_Engine_CUDNN;
131133 }
134+ if (asym_pad) {
135+ LOG (INFO) << " CuDNN doesn't support the asymmetric padding at Layer "
136+ << param.name () << " , using Caffe's own convolution layer instead." ;
137+ engine = ConvolutionParameter_Engine_CAFFE;
138+ }
132139#endif
133140 }
134141 if (engine == ConvolutionParameter_Engine_CAFFE) {
@@ -222,7 +229,15 @@ shared_ptr<Layer<Dtype> > GetPoolingLayer(const LayerParameter& param) {
222229 if (engine == PoolingParameter_Engine_DEFAULT) {
223230 engine = PoolingParameter_Engine_CAFFE;
224231#ifdef USE_CUDNN
225- engine = PoolingParameter_Engine_CUDNN;
232+ bool asym_pad = false ;
233+ if (param.pooling_param ().pad_type () != 0 ) asym_pad = true ;
234+ if (!asym_pad)
235+ engine = PoolingParameter_Engine_CUDNN;
236+ else {
237+ LOG (INFO) << " cuDNN does not support the asymmetric padding at Layer "
238+ << param.name () << " ,using Caffe's own pooling layer instead." ;
239+ engine = PoolingParameter_Engine_CAFFE;
240+ }
226241#endif
227242 }
228243 if (engine == PoolingParameter_Engine_CAFFE) {
You can’t perform that action at this time.
0 commit comments