From d7674f8b3ba336d44b39a2dfd510afcb94ddafb1 Mon Sep 17 00:00:00 2001 From: yankai Date: Fri, 13 Nov 2020 14:55:37 +0800 Subject: [PATCH] fix compare shape judge --- .../src/runtime/kernel/arm/fp32/arithmetic_compare_fp32.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_compare_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_compare_fp32.cc index 3b6a68e5ac..6f52c3bb5b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_compare_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/arithmetic_compare_fp32.cc @@ -58,6 +58,10 @@ int ArithmeticCompareCPUKernel::Init() { int ArithmeticCompareCPUKernel::ReSize() { return RET_OK; } int ArithmeticCompareCPUKernel::DoExecute(int task_id) { + if (in_tensors_.at(0)->shape() != in_tensors_.at(1)->shape()) { + MS_LOG(ERROR) << "Compare op must inputs have the same shape, support broadcast later! "; + return RET_ERROR; + } int elements_num = in_tensors_.at(0)->ElementsNum(); int stride = UP_DIV(elements_num, op_parameter_->thread_num_); int offset = task_id * stride;