diff --git a/paddle/operators/math/unpooling.cc b/paddle/operators/math/unpooling.cc index 1622dcca872fc1bd1be658c9726a9944964c6c29..a3a24a68929755b0769e6e1c65b34564a6fac850 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 bb8489fb95f25a9a11f900eff2a28f8c921fc18a..358847b315c69df5d1df84d8c912dbf532b4add9 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,