diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc index c14710aedec73aac5aeaa5b4c5495d685e5cddf6..99eef1760e6aa1b5ff557526212499c2ada3e652 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_3x3_fp16.cc @@ -142,14 +142,14 @@ void Convolution3x3FP16CPUKernel::ConfigInputOutput() { } int Convolution3x3FP16CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc index 7aa6859a589bcc5ca4ac987f3d955ad2ff7c87c0..e229074f67a1c0ce34e949c33032db438a59629c 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_fp16.cc @@ -102,8 +102,8 @@ int ConvolutionFP16CPUKernel::InitTmpBuffer() { 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); if (nhwc4_input_ == nullptr) { MS_LOG(ERROR) << "malloc nhwc4_input_ failed."; @@ -132,14 +132,14 @@ void ConvolutionFP16CPUKernel::ConfigInputOutput() { } int ConvolutionFP16CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } ConfigInputOutput(); return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc index 27def2e8fb245e8b901d80f09573b441239b9650..eb06a05c564d94ff69175da879f60646559d2767 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_sw_fp16.cc @@ -126,14 +126,14 @@ void ConvolutionSWFP16CPUKernel::ConfigInputOutput() { } int ConvolutionSWFP16CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } ConfigInputOutput(); return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc index 834db8f80ade36b5ee20ea8ad073a2c73094e3e9..6ec07a0b7f840090e49413e674d0b4a2b0be3a5f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_winograd_fp16.cc @@ -277,19 +277,18 @@ int ConvolutionWinogradFP16CPUKernel::ConfigInputOutput() { } int ConvolutionWinogradFP16CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } kernel_unit_ = conv_param_->kernel_h_; input_unit_ = output_unit_ + kernel_unit_ - 1; conv_param_->input_unit_ = input_unit_; conv_param_->output_unit_ = output_unit_; - auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution.cc index e7af9e16d042acc3ccbb7c5311d983859f7a1e79..c5252fdc4780cb2f2cc863137639665ed85b67a4 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution.cc @@ -125,14 +125,14 @@ void ConvolutionCPUKernel::ConfigInputOutput() { } int ConvolutionCPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } ConfigInputOutput(); return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_3x3.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_3x3.cc index ba09d7404757c5cb190fa9b12036c446738e6121..a17a0853b0c9996a04cf1d58ad37d1b435967f1e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_3x3.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_3x3.cc @@ -155,14 +155,14 @@ void Convolution3x3CPUKernel::ConfigInputOutput() { } int Convolution3x3CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed.ret: " << ret; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } ConfigInputOutput(); return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_slidewindow.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_slidewindow.cc index 8489e8151c2ee1bb325e1001151065240e54debc..38a86cd63a8400675f018f8dcda0fadd873f6b10 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_slidewindow.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_slidewindow.cc @@ -96,14 +96,14 @@ void ConvolutionSWCPUKernel::ConfigInputOutput() { } int ConvolutionSWCPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } // config input output ConfigInputOutput(); return ReSize(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc index 8c009277ba7a8471827f059c83acad88e1e4d79c..40dcf4dd4b7f319ea6007b13c6ff2b18fa23962e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_winograd.cc @@ -270,19 +270,18 @@ int ConvolutionWinogradCPUKernel::ConfigInputOutput() { } int ConvolutionWinogradCPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } kernel_unit_ = conv_param_->kernel_h_; input_unit_ = output_unit_ + kernel_unit_ - 1; conv_param_->input_unit_ = input_unit_; conv_param_->output_unit_ = output_unit_; - auto ret = InitWeightBias(); if (ret != RET_OK) { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } + if (!InferShapeDone()) { + return RET_OK; + } return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc index 3054d22edc3c244a67a880459f6a0744f38ba2a6..188ec44d62efcabb4813b9b16bb643b7a04046f6 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_3x3_int8.cc @@ -154,9 +154,8 @@ void Convolution3x3Int8CPUKernel::ConfigInputOutput() { } int Convolution3x3Int8CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } + // config input output + ConfigInputOutput(); auto ret = SetQuantParam(); if (ret != RET_OK) { MS_LOG(ERROR) << "Set quant param failed."; @@ -167,8 +166,9 @@ int Convolution3x3Int8CPUKernel::Init() { MS_LOG(ERROR) << "Init weight bias failed."; return RET_ERROR; } - // config input output - ConfigInputOutput(); + if (!InferShapeDone()) { + return RET_OK; + } return ReSize(); } diff --git a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc index e3f670374103388e7e9cbd887b198fef01eb766b..7b94444ae491fa639e838872fe66ab97f1157f5f 100644 --- a/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc +++ b/mindspore/lite/src/runtime/kernel/arm/int8/convolution_int8.cc @@ -247,9 +247,6 @@ void ConvolutionInt8CPUKernel::ConfigInputOutput() { } int ConvolutionInt8CPUKernel::Init() { - if (!InferShapeDone()) { - return RET_OK; - } // config input output ConfigInputOutput(); CheckSupportOptimize(); @@ -273,7 +270,9 @@ int ConvolutionInt8CPUKernel::Init() { return RET_ERROR; } } - + if (!InferShapeDone()) { + return RET_OK; + } return ReSize(); }