diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_gard_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_grad_cpu_kernel.cc similarity index 92% rename from mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_gard_cpu_kernel.cc rename to mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_grad_cpu_kernel.cc index 71f2e7b45f7..f299558696e 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_gard_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_grad_cpu_kernel.cc @@ -13,8 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "backend/kernel_compiler/cpu/mkldnn/batch_norm_gard_cpu_kernel.h" - +#include "backend/kernel_compiler/cpu/mkldnn/batch_norm_grad_cpu_kernel.h" #include #include "backend/kernel_compiler/cpu/mkldnn/mkl_kernel_engine.h" #include "runtime/device/cpu/cpu_device_address.h" @@ -83,11 +82,13 @@ bool BatchNormGradCPUKernel::Launch(const std::vector &input } auto wksp_in = reinterpret_cast(workspace[0]->addr); auto scale_ret = memcpy_s(wksp_in, workspace[0]->size, inputs[2]->addr, inputs[2]->size); + if (scale_ret != 0) { + MS_LOG(EXCEPTION) << "Scale memcpy error!"; + } auto max_size = workspace[0]->size - inputs[2]->size; auto bias_ret = memset_s(wksp_in + (inputs[2]->size / sizeof(float)), max_size, 0, max_size); - if (scale_ret != 0 && bias_ret != 0) { - MS_LOG(EXCEPTION) << "Memcpy_s error."; - return false; + if (bias_ret != 0) { + MS_LOG(EXCEPTION) << "Bias memset 0 error."; } SetArgumentHandle(DNNL_ARG_DIFF_DST, inputs[0]->addr); @@ -101,11 +102,13 @@ bool BatchNormGradCPUKernel::Launch(const std::vector &input auto wksp_out = reinterpret_cast(workspace[1]->addr); auto diff_scale_ret = memcpy_s(outputs[1]->addr, outputs[1]->size, wksp_out, inputs[2]->size); + if (diff_scale_ret != 0) { + MS_LOG(EXCEPTION) << "Diff_scale memcpy to output[1] error."; + } auto diff_bias_ret = memcpy_s(outputs[2]->addr, outputs[2]->size, wksp_out + (outputs[1]->size / sizeof(float)), outputs[2]->size); - if (diff_scale_ret != 0 || diff_bias_ret != 0) { - MS_LOG(EXCEPTION) << "Memcpy_s error."; - return false; + if (diff_bias_ret != 0) { + MS_LOG(EXCEPTION) << "Diff_bias memcpy to to output[2] error."; } return true; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_gard_cpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_grad_cpu_kernel.h similarity index 100% rename from mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_gard_cpu_kernel.h rename to mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/batch_norm_grad_cpu_kernel.h diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.cc index 15781f6a071..8b322f29dbf 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_filter_cpu_kernel.cc @@ -32,7 +32,7 @@ void Conv2dGradFilterCPUKernel::InitKernel(const CNodePtr &kernel_node) { } std::vector kernel_size({weight_shape[2], weight_shape[3]}); size_t group = LongToSize(AnfAlgo::GetNodeAttr(kernel_node, GROUP)); - if (group != 1) { + if (group > 1) { if (src_shape[1] % group != 0) { MS_LOG(EXCEPTION) << "Conv2d channels should be divided by group!"; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_input_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_input_cpu_kernel.cc index c432f8dc477..a5c40b833b3 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_input_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv2d_grad_input_cpu_kernel.cc @@ -34,7 +34,7 @@ void Conv2dGradInputCPUKernel::InitKernel(const CNodePtr &kernel_node) { } std::vector kernel_size({weight_shape[2], weight_shape[3]}); size_t group = LongToSize(AnfAlgo::GetNodeAttr(kernel_node, GROUP)); - if (group != 1) { + if (group > 1) { if (src_shape[1] % group != 0) { MS_LOG(EXCEPTION) << "Conv2d channels should be divided by group!"; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv_cpu_kernel.cc index 798a55b0a60..8d0187465ac 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/mkldnn/conv_cpu_kernel.cc @@ -42,7 +42,7 @@ void ConvCPUKernel::InitKernel(const CNodePtr &kernel_node) { kernel_size.emplace_back(weight_shape[i]); } size_t group = LongToSize(AnfAlgo::GetNodeAttr(kernel_node, GROUP)); - if (group != 1) { + if (group > 1) { if (src_shape[1] % group != 0) { MS_LOG(EXCEPTION) << "Conv channels should be divided by group!"; }