!29338 [MS][LITE] check nullptr for train export file

Merge pull request !29338 from yefeng/203-fix_bug_code_check
This commit is contained in:
i-robot 2022-01-21 01:35:38 +00:00 committed by Gitee
commit 30ec060898
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 3 deletions

View File

@ -389,15 +389,15 @@ int TrainExport::ExportNet(const std::vector<mindspore::kernel::LiteKernel *> &k
QuantizationType quant_type) { QuantizationType quant_type) {
std::vector<std::pair<size_t, tensor_info>> map_index; std::vector<std::pair<size_t, tensor_info>> map_index;
std::set<size_t> out_set; std::set<size_t> out_set;
int offset = meta_graph_->allTensors.size();
int tensor_idx = offset;
quant_type_ = quant_type;
if (meta_graph_ == nullptr) { if (meta_graph_ == nullptr) {
int status = ExportInit(model->name_, model->version_); int status = ExportInit(model->name_, model->version_);
if (status != RET_OK) { if (status != RET_OK) {
return status; return status;
} }
} }
int offset = meta_graph_->allTensors.size();
int tensor_idx = offset;
quant_type_ = quant_type;
PrepareRemap(offset); PrepareRemap(offset);
for (const auto kernel : kernels) { for (const auto kernel : kernels) {