From f21e326178a1abfd2633a4f35ead05328f43306c Mon Sep 17 00:00:00 2001 From: wuxuejian Date: Sat, 26 Dec 2020 10:04:33 +0800 Subject: [PATCH] fix pooling max grad --- .../cpu/mkldnn/pooling_max_grad_cpu_kernel.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/pooling_max_grad_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/pooling_max_grad_cpu_kernel.cc index f795b7c181..3684de887d 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/pooling_max_grad_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/pooling_max_grad_cpu_kernel.cc @@ -117,15 +117,12 @@ bool MaxPoolingGradCPUKernel::Launch(const std::vector &inpu size_t src_wh = src_shape_[2] * src_shape_[3]; size_t dst_wh = dst_shape_[2] * dst_shape_[3]; for (size_t n = 0; n < src_shape_[0]; ++n) { - auto task = [&](size_t start, size_t end) { - for (size_t c = start; c < end; ++c) { - ChannelPoolingGrad(input, diff, output); - input = input + src_wh; - output = output + src_wh; - diff = diff + dst_wh; - } - }; - CPUKernelUtils::ParallelFor(task, src_shape_[1]); + for (size_t c = 0; c < src_shape_[1]; ++c) { + ChannelPoolingGrad(input, diff, output); + input = input + src_wh; + output = output + src_wh; + diff = diff + dst_wh; + } } return true; }