Browse Source

!10283 [MSLITE][DEVELOP] fix bug of npu benchmark

From: @yangruoqi713
Reviewed-by: @zhang_xue_tong,@hangangqiang
Signed-off-by: @zhang_xue_tong,@hangangqiang
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
c5a165fa6e
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      mindspore/lite/src/runtime/agent/npu/npu_executor.cc

+ 8
- 0
mindspore/lite/src/runtime/agent/npu/npu_executor.cc View File

@@ -42,6 +42,14 @@ int NPUExecutor::Run(const std::vector<Tensor *> &in_tensors, const std::vector<
return RET_ERROR; return RET_ERROR;
} }
memcpy(npu_input_tensors_[i]->GetBuffer(), data, in_tensors[i]->Size()); memcpy(npu_input_tensors_[i]->GetBuffer(), data, in_tensors[i]->Size());
in_tensors[i]->set_ref_count(in_tensors[i]->ref_count() - 1);
if (in_tensors[i]->ref_count() <= 0) {
auto ret = in_tensors[i]->FreeData();
if (ret != RET_OK) {
MS_LOG(ERROR) << "Free tensor data failed";
return RET_ERROR;
}
}
} }
context.AddPara("model_name", model_name_); context.AddPara("model_name", model_name_);
if (this->client_ == nullptr) { if (this->client_ == nullptr) {


Loading…
Cancel
Save