From: @zoloft Reviewed-by: @wangchengyuan,@zhanghaibo5 Signed-off-by: @wangchengyuanpull/15948/MERGE
| @@ -93,7 +93,11 @@ int ArithmeticFP32Coder::ReSize(CoderContext *const context) { | |||||
| CalcMultiplesAndStrides(arithmetic_parameter_); | CalcMultiplesAndStrides(arithmetic_parameter_); | ||||
| if (arithmetic_parameter_->broadcasting_) { | if (arithmetic_parameter_->broadcasting_) { | ||||
| outside_ = 1; | outside_ = 1; | ||||
| for (auto i = arithmetic_parameter_->ndim_ - 1; i >= 0; --i) { | |||||
| int resize_n_index = static_cast<int>(arithmetic_parameter_->ndim_) - 1; | |||||
| if (resize_n_index < 0) { | |||||
| return RET_ERROR; | |||||
| } | |||||
| for (auto i = resize_n_index; i >= 0; --i) { | |||||
| if (arithmetic_parameter_->in_shape0_[i] != arithmetic_parameter_->in_shape1_[i]) { | if (arithmetic_parameter_->in_shape0_[i] != arithmetic_parameter_->in_shape1_[i]) { | ||||
| break_pos_ = i; | break_pos_ = i; | ||||
| break; | break; | ||||
| @@ -38,7 +38,7 @@ class AddInt8Coder final : public OperatorCoder { | |||||
| int Init(); | int Init(); | ||||
| int ReSize(); | int ReSize(); | ||||
| AddQuantParameter para_; | |||||
| AddQuantParameter para_{}; | |||||
| ArithmeticParameter *arith_para_{nullptr}; | ArithmeticParameter *arith_para_{nullptr}; | ||||
| Tensor *input0{nullptr}; | Tensor *input0{nullptr}; | ||||
| Tensor *input1{nullptr}; | Tensor *input1{nullptr}; | ||||
| @@ -54,7 +54,7 @@ int DivInt8Coder::DoCode(CoderContext *const context) { | |||||
| int element_num = output_tensor_->ElementsNum(); | int element_num = output_tensor_->ElementsNum(); | ||||
| code.CodeStruct("param", param_); | code.CodeStruct("param", param_); | ||||
| if (broadcast_) { | if (broadcast_) { | ||||
| ArithmeticParameter tile_para; | |||||
| ArithmeticParameter tile_para = {0}; | |||||
| tile_para.ndim_ = output_tensor_->shape().size(); | tile_para.ndim_ = output_tensor_->shape().size(); | ||||
| for (size_t i = 0; i < tile_para.ndim_; i++) { | for (size_t i = 0; i < tile_para.ndim_; i++) { | ||||
| tile_para.in_shape0_[i] = input0->DimensionSize(i); | tile_para.in_shape0_[i] = input0->DimensionSize(i); | ||||
| @@ -37,7 +37,7 @@ class DivInt8Coder final : public OperatorCoder { | |||||
| int DoCode(CoderContext *const context) override; | int DoCode(CoderContext *const context) override; | ||||
| private: | private: | ||||
| DivQuantArg param_; | |||||
| DivQuantArg param_{}; | |||||
| Tensor *input0{nullptr}; | Tensor *input0{nullptr}; | ||||
| Tensor *input1{nullptr}; | Tensor *input1{nullptr}; | ||||
| int8_t *tile0_data_{nullptr}; | int8_t *tile0_data_{nullptr}; | ||||
| @@ -39,10 +39,10 @@ class ReluxInt8Coder : public OperatorCoder { | |||||
| int DoCode(CoderContext *const context) override; | int DoCode(CoderContext *const context) override; | ||||
| protected: | protected: | ||||
| ReluXQuantArg quant_arg_; | |||||
| ReluXQuantArg quant_arg_{}; | |||||
| private: | private: | ||||
| int type_; | |||||
| int type_{0}; | |||||
| }; | }; | ||||
| class ReluInt8Coder final : public ReluxInt8Coder { | class ReluInt8Coder final : public ReluxInt8Coder { | ||||
| @@ -40,8 +40,16 @@ int ResizeInt8Coder::Prepare(CoderContext *const context) { | |||||
| quant_out_ = new (std::nothrow)::QuantArg; | quant_out_ = new (std::nothrow)::QuantArg; | ||||
| multiplier_ = new (std::nothrow) QuantMulArg; | multiplier_ = new (std::nothrow) QuantMulArg; | ||||
| MS_CHECK_PTR(quant_in_); | MS_CHECK_PTR(quant_in_); | ||||
| MS_CHECK_PTR(quant_out_); | |||||
| MS_CHECK_PTR(multiplier_); | |||||
| if (quant_out_ == nullptr) { | |||||
| delete quant_in_; | |||||
| quant_in_ = nullptr; | |||||
| } | |||||
| if (multiplier_ == nullptr) { | |||||
| delete quant_in_; | |||||
| quant_in_ = nullptr; | |||||
| delete quant_out_; | |||||
| quant_out_ = nullptr; | |||||
| } | |||||
| quant_in_->zp_ = input_tensor_->quant_params().at(0).zeroPoint; | quant_in_->zp_ = input_tensor_->quant_params().at(0).zeroPoint; | ||||
| quant_in_->scale_ = input_tensor_->quant_params().at(0).scale; | quant_in_->scale_ = input_tensor_->quant_params().at(0).scale; | ||||
| quant_out_->zp_ = output_tensor_->quant_params().at(0).zeroPoint; | quant_out_->zp_ = output_tensor_->quant_params().at(0).zeroPoint; | ||||
| @@ -29,7 +29,7 @@ class ResizeInt8Coder final : public ResizeBaseCoder { | |||||
| const Model::Node *node, size_t node_index, Target target) | const Model::Node *node, size_t node_index, Target target) | ||||
| : ResizeBaseCoder(in_tensors, out_tensors, node, node_index, target) {} | : ResizeBaseCoder(in_tensors, out_tensors, node, node_index, target) {} | ||||
| ~ResizeInt8Coder(); | |||||
| ~ResizeInt8Coder() override; | |||||
| int Prepare(CoderContext *const context) override; | int Prepare(CoderContext *const context) override; | ||||
| @@ -37,23 +37,10 @@ class ResizeInt8Coder final : public ResizeBaseCoder { | |||||
| private: | private: | ||||
| int ReSize(); | int ReSize(); | ||||
| int InitResizeBiLinear(); | |||||
| int InitFloatResizeBiLinear(); | |||||
| int InitResizeQuantArg(); | |||||
| int CalRatio(); | |||||
| int CalInterpolationRange(); | |||||
| void FreeResizeBiLinear(); | |||||
| int InitResizeFloatQuantArg(); | |||||
| int CalFloatRatio(); | |||||
| int CalFloatInterpolationRange(); | |||||
| void FreeFloatResizeBiLinear(); | |||||
| ResizeParameter *param_{nullptr}; | ResizeParameter *param_{nullptr}; | ||||
| ::QuantArg *quant_in_{nullptr}; | ::QuantArg *quant_in_{nullptr}; | ||||
| ::QuantArg *quant_out_{nullptr}; | ::QuantArg *quant_out_{nullptr}; | ||||
| QuantMulArg *multiplier_{nullptr}; | QuantMulArg *multiplier_{nullptr}; | ||||
| ResizeQuantArg resize_quant_arg_; | |||||
| ResizeFloatScaleQuantArg resize_float_quant_arg_; | |||||
| }; | }; | ||||
| } // namespace mindspore::lite::micro::nnacl | } // namespace mindspore::lite::micro::nnacl | ||||
| @@ -37,7 +37,7 @@ class SubInt8Coder final : public OperatorCoder { | |||||
| int DoCode(CoderContext *const context) override; | int DoCode(CoderContext *const context) override; | ||||
| private: | private: | ||||
| SubQuantArg param_; | |||||
| SubQuantArg param_{}; | |||||
| Tensor *input0{nullptr}; | Tensor *input0{nullptr}; | ||||
| Tensor *input1{nullptr}; | Tensor *input1{nullptr}; | ||||
| int8_t *tile0_data_{nullptr}; | int8_t *tile0_data_{nullptr}; | ||||
| @@ -15,7 +15,6 @@ | |||||
| */ | */ | ||||
| #include "wrapper/int8/conv1x1_init_int8_wrapper.h" | #include "wrapper/int8/conv1x1_init_int8_wrapper.h" | ||||
| #include <memory.h> | |||||
| #include "nnacl/int8/matmul_int8.h" | #include "nnacl/int8/matmul_int8.h" | ||||
| #include "nnacl/errorcode.h" | #include "nnacl/errorcode.h" | ||||