Browse Source

add onnx model & dpp memory leak check and use const input data

tags/v1.1.0
wangzhe 5 years ago
parent
commit
02f3c47ef6
4 changed files with 14 additions and 3 deletions
  1. +10
    -0
      mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc
  2. +2
    -2
      mindspore/lite/src/runtime/kernel/arm/fp32/detection_post_process_fp32.cc
  3. +1
    -1
      mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc
  4. +1
    -0
      mindspore/lite/test/models_with_several_inputs_or_without_outputs.cfg

+ 10
- 0
mindspore/lite/src/runtime/kernel/arm/base/detection_post_process_base.cc View File

@@ -133,6 +133,16 @@ void DetectionPostProcessBaseCPUKernel::FreeAllocatedBuffer() {
context_->allocator->Free(params_->selected_);
params_->selected_ = nullptr;
}
if (desc_.data_type == kNumberTypeInt8) {
if (input_boxes_ != nullptr) {
context_->allocator->Free(input_boxes_);
input_boxes_ = nullptr;
}
if (input_scores_ != nullptr) {
context_->allocator->Free(input_scores_);
input_scores_ = nullptr;
}
}
}

int DetectionPostProcessBaseCPUKernel::Run() {


+ 2
- 2
mindspore/lite/src/runtime/kernel/arm/fp32/detection_post_process_fp32.cc View File

@@ -33,8 +33,8 @@ int DetectionPostProcessCPUKernel::GetInputData() {
MS_LOG(ERROR) << "Input data type error";
return RET_ERROR;
}
input_boxes_ = reinterpret_cast<float *>(in_tensors_.at(0)->MutableData());
input_scores_ = reinterpret_cast<float *>(in_tensors_.at(1)->MutableData());
input_boxes_ = reinterpret_cast<float *>(in_tensors_.at(0)->data_c());
input_scores_ = reinterpret_cast<float *>(in_tensors_.at(1)->data_c());
return RET_OK;
}



+ 1
- 1
mindspore/lite/src/runtime/kernel/arm/int8/detection_post_process_int8.cc View File

@@ -50,7 +50,7 @@ int DequantizeInt8ToFp32Run(void *cdata, int task_id) {
}

int DetectionPostProcessInt8CPUKernel::Dequantize(lite::Tensor *tensor, float **data) {
data_int8_ = reinterpret_cast<int8_t *>(tensor->MutableData());
data_int8_ = reinterpret_cast<int8_t *>(tensor->data_c());
*data = reinterpret_cast<float *>(context_->allocator->Malloc(tensor->ElementsNum() * sizeof(float)));
if (*data == nullptr) {
MS_LOG(ERROR) << "Malloc data failed.";


+ 1
- 0
mindspore/lite/test/models_with_several_inputs_or_without_outputs.cfg View File

@@ -24,3 +24,4 @@ efficientnet_lite3_int8_2.tflite
efficientnet_lite4_int8_2.tflite
mtk_transformer_encoder.tflite
mtk_transformer_decoder_joint.tflite
ml_ei_facedetection.onnx

Loading…
Cancel
Save