From 46d4c43e6a42b83faf3201678e61afc8e5a5d025 Mon Sep 17 00:00:00 2001 From: zhanyuan Date: Fri, 9 Apr 2021 18:10:04 +0800 Subject: [PATCH] [CPU] Fix the bug of concat op when the input shape's value is zero --- .../ccsrc/backend/kernel_compiler/cpu/concat_cpu_kernel.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/concat_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/concat_cpu_kernel.cc index 33852c8536..5d73a25bff 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/concat_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/concat_cpu_kernel.cc @@ -53,6 +53,9 @@ bool ConcatCPUKernel::Launch(const std::vector &inputs, auto before_axis = input_flat_shape_list[0][0]; for (size_t i = 0; i < before_axis; ++i) { for (size_t j = 0; j < input_num; ++j) { + if (input_flat_shape_list[j][1] == 0) { + continue; + } auto input_j_addr = reinterpret_cast(inputs[j]->addr); auto copy_num = input_flat_shape_list[j][1]; auto offset = copy_num * i;