From 124a7a4b3a98851f44e54b933fe0157fb6244141 Mon Sep 17 00:00:00 2001 From: xutianchun Date: Mon, 14 Dec 2020 22:05:14 +0800 Subject: [PATCH] fix bit unpack may cause memory leak --- mindspore/lite/src/lite_session.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindspore/lite/src/lite_session.cc b/mindspore/lite/src/lite_session.cc index 81c6cbd53c3..58e019336ce 100644 --- a/mindspore/lite/src/lite_session.cc +++ b/mindspore/lite/src/lite_session.cc @@ -99,7 +99,6 @@ int LiteSession::ConvertTensorsData(const lite::Model *model, size_t tensor_inde return RET_ERROR; } } else { - MS_ASSERT(dst_tensor->Size() == src_tensor->data()->size()); if (WeightTensorNeedCopy(model, tensor_index)) { auto dst_data = dst_tensor->MutableData(); if (dst_data == nullptr) { @@ -118,6 +117,7 @@ int LiteSession::ConvertTensorsData(const lite::Model *model, size_t tensor_inde return RET_ERROR; } kernel::DequantUtil::UnPackToInt(src_tensor, dst_tensor->MutableData()); + copyed_tensor_idxes_.emplace_back(tensor_index); } else { dst_tensor->set_data(const_cast(src_tensor->data()->data())); }