diff --git a/mindspore/lite/tools/anf_importer/import_from_meta_graphT.cc b/mindspore/lite/tools/anf_importer/import_from_meta_graphT.cc index cc3b1b6662244a73c5b550fa2e8d911097734ea4..39e6a3ab1eb78f97ccb7f4892b2fca505a223db7 100644 --- a/mindspore/lite/tools/anf_importer/import_from_meta_graphT.cc +++ b/mindspore/lite/tools/anf_importer/import_from_meta_graphT.cc @@ -87,12 +87,16 @@ ValueNodePtr AnfImporterFromMetaGraphT::ConvertPrimitive(const std::unique_ptr<s if (cNode->quantType == schema::QuantType_AwareTraining) { primTValue->SetQuantType(cNode->quantType); for (int index : cNode->inputIndex) { - std::vector<schema::QuantParamT> quant_params = {*(meta_graph_->allTensors[index]->quantParams[0])}; - primTValue->AddInputQuantParam(quant_params); + if (meta_graph_->allTensors[index]->quantParams.size() > 0) { + std::vector<schema::QuantParamT> quant_params = {*(meta_graph_->allTensors[index]->quantParams[0])}; + primTValue->AddInputQuantParam(quant_params); + } } for (int index : cNode->outputIndex) { - std::vector<schema::QuantParamT> quant_params = {*(meta_graph_->allTensors[index]->quantParams[0])}; - primTValue->AddOutputQuantParam(quant_params); + if (meta_graph_->allTensors[index]->quantParams.size() > 0) { + std::vector<schema::QuantParamT> quant_params = {*(meta_graph_->allTensors[index]->quantParams[0])}; + primTValue->AddOutputQuantParam(quant_params); + } } } auto value_node = NewValueNode(primTValue);