| @@ -142,14 +142,14 @@ void Convolution3x3FP16CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int Convolution3x3FP16CPUKernel::Init() { | int Convolution3x3FP16CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -102,8 +102,8 @@ int ConvolutionFP16CPUKernel::InitTmpBuffer() { | |||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| size_t nhwc4_input_size = channel_block * C4NUM * in_batch * conv_param_->input_h_ * | |||||
| conv_param_->input_w_ * sizeof(float16_t); | |||||
| size_t nhwc4_input_size = | |||||
| channel_block * C4NUM * in_batch * conv_param_->input_h_ * conv_param_->input_w_ * sizeof(float16_t); | |||||
| nhwc4_input_ = ctx_->allocator->Malloc(nhwc4_input_size); | nhwc4_input_ = ctx_->allocator->Malloc(nhwc4_input_size); | ||||
| if (nhwc4_input_ == nullptr) { | if (nhwc4_input_ == nullptr) { | ||||
| MS_LOG(ERROR) << "malloc nhwc4_input_ failed."; | MS_LOG(ERROR) << "malloc nhwc4_input_ failed."; | ||||
| @@ -132,14 +132,14 @@ void ConvolutionFP16CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionFP16CPUKernel::Init() { | int ConvolutionFP16CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| ConfigInputOutput(); | ConfigInputOutput(); | ||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -126,14 +126,14 @@ void ConvolutionSWFP16CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionSWFP16CPUKernel::Init() { | int ConvolutionSWFP16CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| ConfigInputOutput(); | ConfigInputOutput(); | ||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -277,19 +277,18 @@ int ConvolutionWinogradFP16CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionWinogradFP16CPUKernel::Init() { | int ConvolutionWinogradFP16CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| kernel_unit_ = conv_param_->kernel_h_; | kernel_unit_ = conv_param_->kernel_h_; | ||||
| input_unit_ = output_unit_ + kernel_unit_ - 1; | input_unit_ = output_unit_ + kernel_unit_ - 1; | ||||
| conv_param_->input_unit_ = input_unit_; | conv_param_->input_unit_ = input_unit_; | ||||
| conv_param_->output_unit_ = output_unit_; | conv_param_->output_unit_ = output_unit_; | ||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -125,14 +125,14 @@ void ConvolutionCPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionCPUKernel::Init() { | int ConvolutionCPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| ConfigInputOutput(); | ConfigInputOutput(); | ||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -155,14 +155,14 @@ void Convolution3x3CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int Convolution3x3CPUKernel::Init() { | int Convolution3x3CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed.ret: " << ret; | MS_LOG(ERROR) << "Init weight bias failed.ret: " << ret; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| ConfigInputOutput(); | ConfigInputOutput(); | ||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -96,14 +96,14 @@ void ConvolutionSWCPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionSWCPUKernel::Init() { | int ConvolutionSWCPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| // config input output | // config input output | ||||
| ConfigInputOutput(); | ConfigInputOutput(); | ||||
| return ReSize(); | return ReSize(); | ||||
| @@ -270,19 +270,18 @@ int ConvolutionWinogradCPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionWinogradCPUKernel::Init() { | int ConvolutionWinogradCPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| kernel_unit_ = conv_param_->kernel_h_; | kernel_unit_ = conv_param_->kernel_h_; | ||||
| input_unit_ = output_unit_ + kernel_unit_ - 1; | input_unit_ = output_unit_ + kernel_unit_ - 1; | ||||
| conv_param_->input_unit_ = input_unit_; | conv_param_->input_unit_ = input_unit_; | ||||
| conv_param_->output_unit_ = output_unit_; | conv_param_->output_unit_ = output_unit_; | ||||
| auto ret = InitWeightBias(); | auto ret = InitWeightBias(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -154,9 +154,8 @@ void Convolution3x3Int8CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int Convolution3x3Int8CPUKernel::Init() { | int Convolution3x3Int8CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| // config input output | |||||
| ConfigInputOutput(); | |||||
| auto ret = SetQuantParam(); | auto ret = SetQuantParam(); | ||||
| if (ret != RET_OK) { | if (ret != RET_OK) { | ||||
| MS_LOG(ERROR) << "Set quant param failed."; | MS_LOG(ERROR) << "Set quant param failed."; | ||||
| @@ -167,8 +166,9 @@ int Convolution3x3Int8CPUKernel::Init() { | |||||
| MS_LOG(ERROR) << "Init weight bias failed."; | MS_LOG(ERROR) << "Init weight bias failed."; | ||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| // config input output | |||||
| ConfigInputOutput(); | |||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||
| @@ -247,9 +247,6 @@ void ConvolutionInt8CPUKernel::ConfigInputOutput() { | |||||
| } | } | ||||
| int ConvolutionInt8CPUKernel::Init() { | int ConvolutionInt8CPUKernel::Init() { | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| // config input output | // config input output | ||||
| ConfigInputOutput(); | ConfigInputOutput(); | ||||
| CheckSupportOptimize(); | CheckSupportOptimize(); | ||||
| @@ -273,7 +270,9 @@ int ConvolutionInt8CPUKernel::Init() { | |||||
| return RET_ERROR; | return RET_ERROR; | ||||
| } | } | ||||
| } | } | ||||
| if (!InferShapeDone()) { | |||||
| return RET_OK; | |||||
| } | |||||
| return ReSize(); | return ReSize(); | ||||
| } | } | ||||