!12415 [MS][LITE][CPU]fix init time && ram increased problem

From: @fuzhiye
Reviewed-by: @zhanghaibo5,@ddwsky
Signed-off-by: @zhanghaibo5
This commit is contained in:
mindspore-ci-bot 2021-02-19 16:17:17 +08:00 committed by Gitee
commit 43b8c423d3
1 changed files with 8 additions and 1 deletions

View File

@ -61,6 +61,13 @@ int ArithmeticCPUKernel::InitBroadCastCase() {
return RET_OK;
}
if ((arithmeticParameter_->in_elements_num0_ == 1 || arithmeticParameter_->in_elements_num1_ == 1) &&
(arithmetic_opt_run_ != nullptr && arithmetic_opt_run_int_ != nullptr)) {
/* run opt function
* one of input is scalar */
return RET_OK;
}
FreeTmpPtr();
CalcMultiplesAndStrides(arithmeticParameter_);
@ -216,7 +223,7 @@ int ArithmeticCPUKernel::BroadcastRun(void *input0, void *input1, void *output,
}
bool ArithmeticCPUKernel::CanBatchScalar() { // 2 32 240 240, 2 32 1 1
if (input0_broadcast_ == true || input1_broadcast_ == true) {
if (input0_broadcast_ || input1_broadcast_) {
return false;
}
if (arithmeticParameter_->in_elements_num0_ == arithmeticParameter_->in_elements_num1_ ||