diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/arithmetic_cpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/cpu/arithmetic_cpu_kernel.cc index 2a8a174a16..6b6375bce3 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/arithmetic_cpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/arithmetic_cpu_kernel.cc @@ -32,7 +32,9 @@ void ArithmeticCPUKernel::AssignAdd(T *input1, const T *input2, T *out, size_t s template void ArithmeticCPUKernel::Add(const T *input1, const T *input2, T *out, size_t start, size_t end) { for (size_t i = start; i < end; i++) { - out[i] = input1[i] + input2[i]; + std::vector idx; + GenIndex(i, &idx); + out[i] = input1[idx[0]] + input2[idx[1]]; } } @@ -48,7 +50,9 @@ void ArithmeticCPUKernel::Sub(const T *input1, const T *input2, T *out, size_t s template void ArithmeticCPUKernel::Mul(const T *input1, const T *input2, T *out, size_t start, size_t end) { for (size_t i = start; i < end; i++) { - out[i] = input1[i] * input2[i]; + std::vector idx; + GenIndex(i, &idx); + out[i] = input1[idx[0]] * input2[idx[1]]; } }