Browse Source

release the subgraph output tensor when not training

tags/v1.1.0
zengxianglong 5 years ago
parent
commit
c21caa3039
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      mindspore/lite/src/executor.cc

+ 2
- 1
mindspore/lite/src/executor.cc View File

@@ -43,10 +43,11 @@ int Executor::Run(std::vector<Tensor *> &in_tensors, std::vector<Tensor *> &out_
return ret; return ret;
} }
kernel::LiteKernelUtil::InitTensorRefCount(kernels); kernel::LiteKernelUtil::InitTensorRefCount(kernels);
#ifdef SUPPORT_TRAIN
for (auto out_tensor : out_tensors) { // increase RefCount of output tensors, such that Run will not free them for (auto out_tensor : out_tensors) { // increase RefCount of output tensors, such that Run will not free them
out_tensor->set_ref_count(out_tensor->ref_count() + 1); out_tensor->set_ref_count(out_tensor->ref_count() + 1);
} }
#endif
for (auto *kernel : kernels) { for (auto *kernel : kernels) {
MS_ASSERT(nullptr != kernel); MS_ASSERT(nullptr != kernel);
ret = kernel->PreProcess(); ret = kernel->PreProcess();


Loading…
Cancel
Save