From 19c19184f6f8c89b32e2a75758a1ed2204aa2e6c Mon Sep 17 00:00:00 2001 From: wanyiming Date: Tue, 20 Apr 2021 17:02:28 +0800 Subject: [PATCH] clean3 --- .../kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.cc | 7 ------- .../kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h | 1 - 2 files changed, 8 deletions(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.cc index e9a84068cf..2cafd72281 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.cc @@ -146,19 +146,15 @@ void MirrorPadGradCPUKernel::MirrorPadGrad_Width_Height(const size_t size, const paddings[i] = 0; // init all to 0 } extract_paddings_(paddings_arg, padd_dim, paddings); - // Create required anchor points for non-mirrored data inside new tensor int ap1_x = paddings[WIDTH + LEFT]; int ap2_x = paddings[WIDTH + LEFT] + dx_width - 1; int ap1_y = paddings[HEIGHT + TOP]; int ap2_y = paddings[HEIGHT + TOP] + dx_height - 1; - for (size_t pos = 0; pos < size; ++pos) { int dx_block_num = (pos / dx_width) / dx_height; const int grad_x = (pos % dx_width) + paddings[WIDTH + LEFT]; const int grad_y = ((pos / dx_width) % dx_height) + paddings[HEIGHT + TOP]; - // copy position's own value into output dx[pos] = interim_dy[(dx_block_num * dy_height + grad_y) * dy_width + grad_x]; - int x_dist_1 = (ap1_x - grad_x - mode); int y_dist_1 = (ap1_y - grad_y - mode); int x_dist_2 = (ap2_x - grad_x + mode); @@ -166,10 +162,8 @@ void MirrorPadGradCPUKernel::MirrorPadGrad_Width_Height(const size_t size, const int axis_dist[] = {x_dist_1, x_dist_2, y_dist_1, y_dist_2}; int anch_point[] = {ap1_x, ap2_x, ap1_y, ap2_y}; bool x_axis_check[] = {true, true, false, false}; // true - update X , false - update Y - int temp_x = 0; int temp_y = 0; - // mirroring in axis lines for (int x = 0; x < 4; x++) { if (axis_dist[x] != 0) { if (x_axis_check[x]) { @@ -184,7 +178,6 @@ void MirrorPadGradCPUKernel::MirrorPadGrad_Width_Height(const size_t size, const } } } - // mirroring at corners for (int x = 0; x < 2; x++) { for (int y = 2; y < 4; y++) { if ((axis_dist[x] != 0) && (axis_dist[y] != 0)) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h index 360e1074fb..41fb284b12 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mirror_pad_grad_cpu_kernel.h @@ -94,7 +94,6 @@ MS_REG_CPU_KERNEL( MirrorPadGrad, KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt64).AddOutputAttr(kNumberTypeInt32), MirrorPadGradCPUKernel); - } // namespace kernel } // namespace mindspore #endif // MINDSPORE_CCSRC_BACKEND_KERNEL_COMPILER_CPU_MIRROR_PAD_CPU_KERNEL_H_