forked from mindspore-Ecosystem/mindspore
!9945 fix bit unpack may cause memory leak
From: @xutianchun Reviewed-by: @hangangqiang,@HilbertDavid,@HilbertDavid Signed-off-by: @hangangqiang,@HilbertDavid
This commit is contained in:
commit
e22e66fa8d
|
@ -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<unsigned char *>(src_tensor->data()->data()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue