From 3493f5bd2456d70230a3b1cbad2f81f59bb2770c Mon Sep 17 00:00:00 2001 From: wangyang59 Date: Mon, 6 Mar 2017 13:51:29 -0800 Subject: [PATCH] consolidate CudnnConv and CudnnConvTrans files into one file --- paddle/gserver/layers/CudnnConvLayer.cpp | 29 +++++++++++-- paddle/gserver/layers/CudnnConvLayer.h | 41 ------------------- paddle/gserver/layers/CudnnConvTransLayer.cpp | 23 ----------- paddle/gserver/layers/CudnnConvTransLayer.h | 41 ------------------- 4 files changed, 26 insertions(+), 108 deletions(-) delete mode 100644 paddle/gserver/layers/CudnnConvLayer.h delete mode 100644 paddle/gserver/layers/CudnnConvTransLayer.cpp delete mode 100644 paddle/gserver/layers/CudnnConvTransLayer.h diff --git a/paddle/gserver/layers/CudnnConvLayer.cpp b/paddle/gserver/layers/CudnnConvLayer.cpp index cce82c16287..ed5eb2cb5ba 100644 --- a/paddle/gserver/layers/CudnnConvLayer.cpp +++ b/paddle/gserver/layers/CudnnConvLayer.cpp @@ -12,12 +12,35 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "CudnnConvLayer.h" -#include "paddle/utils/Logging.h" -#include "paddle/utils/Stat.h" +#include "CudnnConvBaseLayer.h" namespace paddle { +/** + * @brief A 2-dimension conv layer implemented by cuDNN. It only + * supports GPU mode. We automatic select CudnnConvLayer for GPU + * mode and ExpandConvLayer for CPU mode if you set type of "conv". + * User also can specfiy type of "exconv" or "cudnn_conv" for + * particular type. + * + * The config file api is img_conv_layer. + */ +class CudnnConvLayer : public CudnnConvBaseLayer { +public: + explicit CudnnConvLayer(const LayerConfig& config) + : CudnnConvBaseLayer(config) {} + + ~CudnnConvLayer() {} +}; REGISTER_LAYER(cudnn_conv, CudnnConvLayer); +class CudnnConvTransLayer : public CudnnConvBaseLayer { +public: + explicit CudnnConvTransLayer(const LayerConfig& config) + : CudnnConvBaseLayer(config) {} + + ~CudnnConvTransLayer() {} +}; + +REGISTER_LAYER(cudnn_convt, CudnnConvTransLayer); } // namespace paddle diff --git a/paddle/gserver/layers/CudnnConvLayer.h b/paddle/gserver/layers/CudnnConvLayer.h deleted file mode 100644 index b43ea7bffa1..00000000000 --- a/paddle/gserver/layers/CudnnConvLayer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#pragma once - -#include -#include "CudnnConvBaseLayer.h" -#include "Projection.h" -#include "paddle/math/Matrix.h" - -namespace paddle { - -/** - * @brief A 2-dimension conv layer implemented by cuDNN. It only - * supports GPU mode. We automatic select CudnnConvLayer for GPU - * mode and ExpandConvLayer for CPU mode if you set type of "conv". - * User also can specfiy type of "exconv" or "cudnn_conv" for - * particular type. - * - * The config file api is img_conv_layer. - */ -class CudnnConvLayer : public CudnnConvBaseLayer { -public: - explicit CudnnConvLayer(const LayerConfig& config) - : CudnnConvBaseLayer(config) {} - - ~CudnnConvLayer() {} -}; - -} // namespace paddle diff --git a/paddle/gserver/layers/CudnnConvTransLayer.cpp b/paddle/gserver/layers/CudnnConvTransLayer.cpp deleted file mode 100644 index 9cecb871e11..00000000000 --- a/paddle/gserver/layers/CudnnConvTransLayer.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#include "CudnnConvTransLayer.h" -#include "paddle/utils/Logging.h" -#include "paddle/utils/Stat.h" - -namespace paddle { - -REGISTER_LAYER(cudnn_convt, CudnnConvTransLayer); - -} // namespace paddle diff --git a/paddle/gserver/layers/CudnnConvTransLayer.h b/paddle/gserver/layers/CudnnConvTransLayer.h deleted file mode 100644 index c69dd9a344f..00000000000 --- a/paddle/gserver/layers/CudnnConvTransLayer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#pragma once - -#include -#include "CudnnConvBaseLayer.h" -#include "Projection.h" -#include "paddle/math/Matrix.h" - -namespace paddle { - -/** - * @brief A 2-dimension conv layer implemented by cuDNN. It only - * supports GPU mode. We automatic select CudnnConvLayer for GPU - * mode and ExpandConvLayer for CPU mode if you set type of "conv". - * User also can specfiy type of "exconv" or "cudnn_conv" for - * particular type. - * - * The config file api is img_conv_layer. - */ -class CudnnConvTransLayer : public CudnnConvBaseLayer { -public: - explicit CudnnConvTransLayer(const LayerConfig& config) - : CudnnConvBaseLayer(config) {} - - ~CudnnConvTransLayer() {} -}; - -} // namespace paddle -- GitLab