Browse Source

!4980 [MS][LITE][Develop]benchmark mem check fixed

Merge pull request !4980 from wangchangkai/master
tags/v0.7.0-beta
mindspore-ci-bot Gitee 5 years ago
parent
commit
0f362bb158
2 changed files with 9 additions and 0 deletions
  1. +7
    -0
      mindspore/lite/src/lite_session.cc
  2. +2
    -0
      mindspore/lite/tools/benchmark/benchmark.cc

+ 7
- 0
mindspore/lite/src/lite_session.cc View File

@@ -287,6 +287,13 @@ LiteSession::~LiteSession() {
for (auto *kernel : kernels_) {
delete kernel;
}
for (auto *ms_tensor : input_vec_) {
if (ms_tensor != nullptr) {
((tensor::LiteTensor *)ms_tensor)->SetTensorImpl(nullptr);
delete ms_tensor;
}
}
input_vec_.clear();
delete this->context_;
delete this->executor;
this->executor = nullptr;


+ 2
- 0
mindspore/lite/tools/benchmark/benchmark.cc View File

@@ -102,10 +102,12 @@ int Benchmark::ReadInputFile() {
if (size != tensorDataSize) {
std::cerr << "Input binary file size error, required: %zu, in fact: %zu" << tensorDataSize << size << std::endl;
MS_LOG(ERROR) << "Input binary file size error, required: " << tensorDataSize << ", in fact: " << size;
delete binBuf;
return RET_ERROR;
}
auto inputData = cur_tensor->MutableData();
memcpy(inputData, binBuf, tensorDataSize);
delete binBuf;
}
}
return RET_OK;


Loading…
Cancel
Save