Merge pull request !7979 from zhaozhenlong/lite/issue/arithmetic_parameter_free_if_neededtags/v1.1.0
| @@ -107,7 +107,16 @@ int ArithmeticFP16CPUKernel::PreProcess() { | |||||
| MS_LOG(ERROR) << "InferShape fail!"; | MS_LOG(ERROR) << "InferShape fail!"; | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| param_ = reinterpret_cast<ArithmeticParameter *>(PopulateArithmetic(primitive_)); | |||||
| if (op_parameter_ != nullptr) { | |||||
| free(op_parameter_); | |||||
| op_parameter_ = nullptr; | |||||
| } | |||||
| op_parameter_ = PopulateArithmetic(primitive_); | |||||
| if (op_parameter_ == nullptr) { | |||||
| MS_LOG(ERROR) << "Malloc parameter failed"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| param_ = reinterpret_cast<ArithmeticParameter *>(op_parameter_); | |||||
| ret = ReSize(); | ret = ReSize(); | ||||
| if (ret != 0) { | if (ret != 0) { | ||||
| MS_LOG(ERROR) << "ReSize fail!ret: " << ret; | MS_LOG(ERROR) << "ReSize fail!ret: " << ret; | ||||
| @@ -48,7 +48,16 @@ int ArithmeticCPUKernel::PreProcess() { | |||||
| MS_LOG(ERROR) << "InferShape fail!"; | MS_LOG(ERROR) << "InferShape fail!"; | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| arithmeticParameter_ = reinterpret_cast<ArithmeticParameter *>(PopulateArithmetic(primitive_)); | |||||
| if (op_parameter_ != nullptr) { | |||||
| free(op_parameter_); | |||||
| op_parameter_ = nullptr; | |||||
| } | |||||
| op_parameter_ = PopulateArithmetic(primitive_); | |||||
| if (op_parameter_ == nullptr) { | |||||
| MS_LOG(ERROR) << "Malloc parameter failed"; | |||||
| return RET_ERROR; | |||||
| } | |||||
| arithmeticParameter_ = reinterpret_cast<ArithmeticParameter *>(op_parameter_); | |||||
| ret = ReSize(); | ret = ReSize(); | ||||
| if (ret != 0) { | if (ret != 0) { | ||||
| MS_LOG(ERROR) << "ReSize fail!ret: " << ret; | MS_LOG(ERROR) << "ReSize fail!ret: " << ret; | ||||