From b720f282b10fbb0baec226b841374c377eaba7f5 Mon Sep 17 00:00:00 2001 From: zchen0211 Date: Wed, 1 Nov 2017 00:05:49 -0700 Subject: [PATCH] deconv modify --- paddle/operators/conv2dtranspose_cudnn_op.cc | 8 ++++---- paddle/operators/conv2dtranspose_cudnn_op.cu | 8 +++----- .../paddle/v2/framework/tests/test_conv2dtranspose_op.py | 5 ++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/paddle/operators/conv2dtranspose_cudnn_op.cc b/paddle/operators/conv2dtranspose_cudnn_op.cc index 72c470389cb..4f05364550d 100644 --- a/paddle/operators/conv2dtranspose_cudnn_op.cc +++ b/paddle/operators/conv2dtranspose_cudnn_op.cc @@ -38,13 +38,13 @@ class CudnnConv2DTransposeOpMaker : public Conv2DTransposeOpMaker { } // namespace paddle namespace ops = paddle::operators; -REGISTER_OP(conv2dtranspose_cudnn, ops::Conv2DTransposeOp, - ops::CudnnConv2DTransposeOpMaker, conv2dtranspose_cudnn_grad, +REGISTER_OP(conv2d_transpose_cudnn, ops::Conv2DTransposeOp, + ops::CudnnConv2DTransposeOpMaker, conv2d_transpose_cudnn_grad, ops::Conv2DTransposeOpGrad); REGISTER_OP_CPU_KERNEL( - conv2dtranspose_cudnn, + conv2d_transpose_cudnn, ops::GemmConv2DTransposeKernel); REGISTER_OP_CPU_KERNEL( - conv2dtranspose_cudnn_grad, + conv2d_transpose_cudnn_grad, ops::GemmConv2DTransposeGradKernel); diff --git a/paddle/operators/conv2dtranspose_cudnn_op.cu b/paddle/operators/conv2dtranspose_cudnn_op.cu index 8485bc65eb5..1ec370a556c 100644 --- a/paddle/operators/conv2dtranspose_cudnn_op.cu +++ b/paddle/operators/conv2dtranspose_cudnn_op.cu @@ -15,7 +15,7 @@ #include "paddle/framework/eigen.h" #include "paddle/framework/op_registry.h" #include "paddle/memory/memory.h" -#include "paddle/operators/conv2d_op.h" +#include "paddle/operators/conv2dtranspose_op.h" #include "paddle/platform/assert.h" #include "paddle/platform/cudnn_helper.h" @@ -76,7 +76,6 @@ class CudnnConvTransposeOpKernel : public framework::OpKernel { workspace_size_limit = user_workspace_size * 1024 * 1024; } // ------------------- cudnn conv algorithm --------------------- - // cudnnConvolutionBwdAlgo_t algo; cudnnConvolutionBwdDataAlgo_t algo; auto handle = ctx.cuda_device_context().cudnn_handle(); // Get the algorithm @@ -92,7 +91,6 @@ class CudnnConvTransposeOpKernel : public framework::OpKernel { platform::dynload::cudnnGetConvolutionBackwardDataWorkspaceSize( handle, cudnn_filter_desc, cudnn_input_desc, cudnn_conv_desc, cudnn_output_desc, algo, &workspace_size_in_bytes)); - // workspace_size_in_bytes = std::max(workspace_size_in_bytes, tmp_size); // Allocate on GPU memory platform::GPUPlace gpu = boost::get(ctx.GetPlace()); @@ -234,7 +232,7 @@ class CudnnConvTransposeGradOpKernel : public framework::OpKernel { namespace ops = paddle::operators; -REGISTER_OP_GPU_KERNEL(conv2dtranspose_cudnn, +REGISTER_OP_GPU_KERNEL(conv2d_transpose_cudnn, ops::CudnnConvTransposeOpKernel); -REGISTER_OP_GPU_KERNEL(conv2dtranspose_cudnn_grad, +REGISTER_OP_GPU_KERNEL(conv2d_transpose_cudnn_grad, ops::CudnnConvTransposeGradOpKernel); diff --git a/python/paddle/v2/framework/tests/test_conv2dtranspose_op.py b/python/paddle/v2/framework/tests/test_conv2dtranspose_op.py index 4ed6e0bcc45..07443708133 100644 --- a/python/paddle/v2/framework/tests/test_conv2dtranspose_op.py +++ b/python/paddle/v2/framework/tests/test_conv2dtranspose_op.py @@ -45,13 +45,12 @@ class TestConv2dTransposeOp(OpTest): filter_ = np.random.random(self.filter_size).astype("float32") output = conv2dtranspose_forward_naive( input_, filter_, conv2dtranspose_param).astype('float32') - # print 'deconv output py', output, output.shape self.inputs = {'Input': input_, 'Filter': filter_} self.attrs = { 'strides': self.stride, 'paddings': self.pad, - # 'dilations': self.dilations + 'dilations': self.dilations } self.outputs = {'Output': output} @@ -91,7 +90,7 @@ class TestConv2dTransposeOp(OpTest): class TestCudnn(TestConv2dTransposeOp): def init_op_type(self): - self.op_type = "conv2dtranspose_cudnn" + self.op_type = "conv2d_transpose_cudnn" if __name__ == '__main__': -- GitLab