!5451 remove parameter destruction in subgraph

Merge pull request !5451 from wandongdong/master
This commit is contained in:
mindspore-ci-bot 2020-08-28 22:00:22 +08:00 committed by Gitee
commit ad638d69de
2 changed files with 7 additions and 9 deletions

View File

@ -74,7 +74,10 @@ class LiteKernel {
}
virtual ~LiteKernel() {
free(op_parameter_);
if (op_parameter_ != nullptr) {
free(op_parameter_);
op_parameter_ = nullptr;
}
}
virtual int Prepare();

View File

@ -261,26 +261,21 @@ int SubGraphOpenCLKernel::GetKernelFromToTensor(const std::vector<lite::tensor::
}
int SubGraphOpenCLKernel::UnInit() {
for (const auto tensor : in_convert_tensors_) {
for (const auto &tensor : in_convert_tensors_) {
if (tensor != nullptr) {
delete tensor;
}
}
for (const auto tensor : out_convert_tensors_) {
for (const auto &tensor : out_convert_tensors_) {
if (tensor != nullptr) {
delete tensor;
}
}
for (const auto op : in_convert_ops_) {
for (const auto &op : in_convert_ops_) {
if (op != nullptr) {
delete op;
}
}
for (const auto parameter : in_parameters_) {
if (parameter != nullptr) {
delete parameter;
}
}
return RET_OK;
}