From 75d8e8ca33a1281e0dcde16122db020141ebcd7d Mon Sep 17 00:00:00 2001 From: dzhwinter Date: Tue, 5 Jun 2018 23:35:04 -0700 Subject: [PATCH] "fix compiled in manylinux" --- paddle/fluid/platform/cudnn_helper.h | 40 +++++++++++++++++++--------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/paddle/fluid/platform/cudnn_helper.h b/paddle/fluid/platform/cudnn_helper.h index 3d230bd0d..2ca3d6e89 100644 --- a/paddle/fluid/platform/cudnn_helper.h +++ b/paddle/fluid/platform/cudnn_helper.h @@ -74,20 +74,20 @@ inline const char* cudnnGetErrorString(cudnnStatus_t status) { #pragma message "This message is intended to annoy you enough to update." #pragma message \ "please see https://docs.nvidia.com/deeplearning/sdk/cudnn-release-notes/" -#endif // CUDNN_VERSION < 6000 - -enum class DataLayout { // Not use - kNHWC, - kNCHW, - kNCDHW, - kNCHW_VECT_C, -}; -enum class PoolingMode { - kMaximum, - kAverage, - kMaximumDeterministic, -}; +inline cudnnPoolingMode_t GetPoolingMode(const PoolingMode& mode) { + switch (mode) { + case PoolingMode::kMaximumDeterministic: + return CUDNN_POOLING_MAX; + case PoolingMode::kAverage: + return CUDNN_POOLING_AVERAGE_COUNT_EXCLUDE_PADDING; + case PoolingMode::kMaximum: + return CUDNN_POOLING_MAX; + default: + PADDLE_THROW("Unexpected pooling mode."); + } +} +#else inline cudnnPoolingMode_t GetPoolingMode(const PoolingMode& mode) { switch (mode) { @@ -101,6 +101,20 @@ inline cudnnPoolingMode_t GetPoolingMode(const PoolingMode& mode) { PADDLE_THROW("Unexpected pooling mode."); } } +#endif // CUDNN_VERSION < 6000 + +enum class DataLayout { // Not use + kNHWC, + kNCHW, + kNCDHW, + kNCHW_VECT_C, +}; + +enum class PoolingMode { + kMaximum, + kAverage, + kMaximumDeterministic, +}; template class CudnnDataType; -- GitLab