diff --git a/src/caffe/layer_factory.cpp b/src/caffe/layer_factory.cpp index 2237175daa8..33b128f4e7d 100644 --- a/src/caffe/layer_factory.cpp +++ b/src/caffe/layer_factory.cpp @@ -79,13 +79,14 @@ shared_ptr > GetPoolingLayer(const LayerParameter& param) { } else if (engine == PoolingParameter_Engine_CUDNN) { PoolingParameter p_param = param.pooling_param(); -// FIXME We assume that precision issue will be fixed in cuDNN v5.0 -#if CUDNN_VERSION >= 5000 - return shared_ptr >(new CuDNNPoolingLayer(param)); -#else - return shared_ptr >(new PoolingLayer(param)); -#endif - +// CuDNN handles tie breaks differently than Caffe for MaxPooling. +// Until there is a workaround in Caffe (index management) or cuDNN, +// use Caffe layer to max pooling + if (param.pooling_param().pool() == PoolingParameter_PoolMethod_MAX) { + return shared_ptr >(new PoolingLayer(param)); + } else { + return shared_ptr >(new CuDNNPoolingLayer(param)); + } #endif } else { LOG(FATAL) << "Layer " << param.name() << " has unknown engine.";