From 0112c5d640d7e311f99fab553d7da9ee6653865c Mon Sep 17 00:00:00 2001 From: sweetsky0901 Date: Wed, 22 Nov 2017 15:51:52 +0800 Subject: [PATCH] format code --- paddle/operators/math/unpooling.cc | 1 - paddle/operators/math/unpooling.cu | 30 +++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/paddle/operators/math/unpooling.cc b/paddle/operators/math/unpooling.cc index 1622dcca8..a3a24a689 100644 --- a/paddle/operators/math/unpooling.cc +++ b/paddle/operators/math/unpooling.cc @@ -69,7 +69,6 @@ public: const int output_channels = output.dims()[1]; const int output_height = output.dims()[2]; const int output_width = output.dims()[3]; - int input_feasize = input_height * input_width; int output_feasize = output_height * output_width; const T* indices_data = indices.data(); diff --git a/paddle/operators/math/unpooling.cu b/paddle/operators/math/unpooling.cu index bb8489fb9..358847b31 100644 --- a/paddle/operators/math/unpooling.cu +++ b/paddle/operators/math/unpooling.cu @@ -29,21 +29,21 @@ __global__ void KernelUnpool2dMax(const int nthreads, T* output_data, const int output_height, const int output_width) { - int bsize = input_height * input_width * channels; - int csize = input_height * input_width; - int out_bsize = output_height * output_width * channels; - int out_csize = output_height * output_width; - int index = blockIdx.x * blockDim.x + threadIdx.x; - int offset = blockDim.x * gridDim.x; - for (int i = index; i < nthreads; i += offset) { - int bidx = i / bsize; - int boffset = i % bsize; - int cidx = boffset / csize; - int out_offset = bidx * out_bsize + cidx * out_csize; - int out_index = indices_data[i]; - PADDLE_ASSERT(out_index < (output_height * output_width)); - output_data[out_offset + out_index] = input_data[i]; - } + int bsize = input_height * input_width * channels; + int csize = input_height * input_width; + int out_bsize = output_height * output_width * channels; + int out_csize = output_height * output_width; + int index = blockIdx.x * blockDim.x + threadIdx.x; + int offset = blockDim.x * gridDim.x; + for (int i = index; i < nthreads; i += offset) { + int bidx = i / bsize; + int boffset = i % bsize; + int cidx = boffset / csize; + int out_offset = bidx * out_bsize + cidx * out_csize; + int out_index = indices_data[i]; + PADDLE_ASSERT(out_index < (output_height * output_width)); + output_data[out_offset + out_index] = input_data[i]; + } } template __global__ void KernelUnpool2dMaxGrad(const int nthreads, -- GitLab