From 4ffb73fd3b353c3d2acfcea3106bfd1a4d4202ee Mon Sep 17 00:00:00 2001 From: sweetsky0901 Date: Wed, 29 Nov 2017 15:51:28 +0800 Subject: [PATCH] format .. --- paddle/operators/math/unpooling.cu | 25 ++++++++++++------------- paddle/operators/unpool_op.cc | 8 +++----- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/paddle/operators/math/unpooling.cu b/paddle/operators/math/unpooling.cu index 058b82d9d2..37c3c8b689 100644 --- a/paddle/operators/math/unpooling.cu +++ b/paddle/operators/math/unpooling.cu @@ -21,8 +21,7 @@ namespace math { template __global__ void KernelUnpool2dMax(const int nthreads, const T* input_data, const int* indices_data, - const int input_height, - const int input_width, + const int input_height, const int input_width, const int channels, T* output_data, const int output_height, const int output_width) { @@ -71,8 +70,8 @@ template class Unpool2dMaxFunctor { public: void operator()(const platform::DeviceContext& context, - const framework::Tensor& input, - const framework::Tensor& indices, framework::Tensor* output) { + const framework::Tensor& input, + const framework::Tensor& indices, framework::Tensor* output) { const int batch_size = input.dims()[0]; const int input_height = input.dims()[2]; const int input_width = input.dims()[3]; @@ -86,10 +85,10 @@ class Unpool2dMaxFunctor { int grid = (input.numel() + threads - 1) / threads; KernelUnpool2dMax< T><<(context) - .stream()>>>(input.numel(), input_data, indices_data, - input_height, input_width, output_channels, - output_data, output_height, output_width); + reinterpret_cast(context) + .stream()>>>(input.numel(), input_data, indices_data, + input_height, input_width, output_channels, + output_data, output_height, output_width); } }; /* @@ -119,11 +118,11 @@ class Unpool2dMaxGradFunctor { int grid = (input.numel() + threads - 1) / threads; KernelUnpool2dMaxGrad< T><<(context) - .stream()>>>(input.numel(), input_data, indices_data, - input_height, input_width, output_channels, - output_data, output_grad_data, output_height, - output_width, input_grad_data); + reinterpret_cast(context) + .stream()>>>(input.numel(), input_data, indices_data, + input_height, input_width, output_channels, + output_data, output_grad_data, output_height, + output_width, input_grad_data); } }; template class Unpool2dMaxGradFunctor; diff --git a/paddle/operators/unpool_op.cc b/paddle/operators/unpool_op.cc index 8bd596dbb0..89c48e071c 100644 --- a/paddle/operators/unpool_op.cc +++ b/paddle/operators/unpool_op.cc @@ -94,12 +94,11 @@ class UnpoolOp : public framework::OperatorWithKernel { "Output(Out) of UnpoolOp should not be null."); auto in_x_dims = ctx->GetInputDim("X"); auto in_y_dims = ctx->GetInputDim("Indices"); - std::string unpooling_type = ctx->Attrs() - .Get("unpooling_type"); + std::string unpooling_type = + ctx->Attrs().Get("unpooling_type"); std::vector ksize = ctx->Attrs().Get>("ksize"); std::vector strides = ctx->Attrs().Get>("strides"); - std::vector paddings = - ctx->Attrs().Get>("paddings"); + std::vector paddings = ctx->Attrs().Get>("paddings"); PADDLE_ENFORCE(in_x_dims.size() == 4, "Unpooling intput must be of 4-dimensional."); PADDLE_ENFORCE_EQ(in_x_dims, in_y_dims); @@ -142,4 +141,3 @@ REGISTER_OP_CPU_KERNEL(unpool, REGISTER_OP_CPU_KERNEL( unpool_grad, ops::UnpoolGradKernel, ops::UnpoolGradKernel); - -- GitLab