提交 0112c5d6 编写于 作者: S sweetsky0901

format code

上级 47bd0bb6
...@@ -69,7 +69,6 @@ public: ...@@ -69,7 +69,6 @@ public:
const int output_channels = output.dims()[1]; const int output_channels = output.dims()[1];
const int output_height = output.dims()[2]; const int output_height = output.dims()[2];
const int output_width = output.dims()[3]; const int output_width = output.dims()[3];
int input_feasize = input_height * input_width; int input_feasize = input_height * input_width;
int output_feasize = output_height * output_width; int output_feasize = output_height * output_width;
const T* indices_data = indices.data<T>(); const T* indices_data = indices.data<T>();
......
...@@ -29,21 +29,21 @@ __global__ void KernelUnpool2dMax(const int nthreads, ...@@ -29,21 +29,21 @@ __global__ void KernelUnpool2dMax(const int nthreads,
T* output_data, T* output_data,
const int output_height, const int output_height,
const int output_width) { const int output_width) {
int bsize = input_height * input_width * channels; int bsize = input_height * input_width * channels;
int csize = input_height * input_width; int csize = input_height * input_width;
int out_bsize = output_height * output_width * channels; int out_bsize = output_height * output_width * channels;
int out_csize = output_height * output_width; int out_csize = output_height * output_width;
int index = blockIdx.x * blockDim.x + threadIdx.x; int index = blockIdx.x * blockDim.x + threadIdx.x;
int offset = blockDim.x * gridDim.x; int offset = blockDim.x * gridDim.x;
for (int i = index; i < nthreads; i += offset) { for (int i = index; i < nthreads; i += offset) {
int bidx = i / bsize; int bidx = i / bsize;
int boffset = i % bsize; int boffset = i % bsize;
int cidx = boffset / csize; int cidx = boffset / csize;
int out_offset = bidx * out_bsize + cidx * out_csize; int out_offset = bidx * out_bsize + cidx * out_csize;
int out_index = indices_data[i]; int out_index = indices_data[i];
PADDLE_ASSERT(out_index < (output_height * output_width)); PADDLE_ASSERT(out_index < (output_height * output_width));
output_data[out_offset + out_index] = input_data[i]; output_data[out_offset + out_index] = input_data[i];
} }
} }
template <typename T> template <typename T>
__global__ void KernelUnpool2dMaxGrad(const int nthreads, __global__ void KernelUnpool2dMaxGrad(const int nthreads,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册