未验证 提交 1f262f9f 编写于 作者: J Jiaying Zhao 提交者: GitHub

[Mobile][ARM]Fix memory leaks when using input tensor created with external...

[Mobile][ARM]Fix memory leaks when using input tensor created with external pointer in lod_mode. (#2681)
上级 19c08de2
...@@ -363,7 +363,10 @@ void Executor<Device, T>::InitNoPersistableMemory(const Tensor &input_tensor) { ...@@ -363,7 +363,10 @@ void Executor<Device, T>::InitNoPersistableMemory(const Tensor &input_tensor) {
DLOG << "InitNoPersistableMemory var " << var_desc->Name(); DLOG << "InitNoPersistableMemory var " << var_desc->Name();
auto tensor = var->template GetMutable<LoDTensor>(); auto tensor = var->template GetMutable<LoDTensor>();
if (tensor->IsInitialized() && tensor->dims().size() == 4) { if (tensor->IsInitialized() && tensor->dims().size() == 4) {
DLOG << "var's tensor is Initialized or dims size != 4"; // don't change user's input and avoid memory leaks
if (feed_indices_.find(var_desc->Name()) != feed_indices_.end()) {
break;
}
DDim tensor_dim = tensor->dims(); DDim tensor_dim = tensor->dims();
DDim new_dim = DDim new_dim =
make_ddim({tensor_dim[0], tensor_dim[1], input_tensor.dims()[2], make_ddim({tensor_dim[0], tensor_dim[1], input_tensor.dims()[2],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册