From 0954fff29bd65f8987a5c5d481b424c8d062cb2b Mon Sep 17 00:00:00 2001 From: lichun Date: Mon, 29 Mar 2021 15:01:38 +0800 Subject: [PATCH] Bugfix:fix error of get null subgraph --- ge/hybrid/model/hybrid_model_builder.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ge/hybrid/model/hybrid_model_builder.cc b/ge/hybrid/model/hybrid_model_builder.cc index 34224fe5..b09d5d3f 100755 --- a/ge/hybrid/model/hybrid_model_builder.cc +++ b/ge/hybrid/model/hybrid_model_builder.cc @@ -1039,9 +1039,13 @@ Status HybridModelBuilder::InitWeights() { GELOGI("Init weight mem successfully, weight base %p, weight size = %zu", weight_base, sub_weight_buffer->GetSize()); - auto root_graph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); - hybrid_model_.weight_buffer_map_.emplace(root_graph->GetName(), std::move(sub_weight_buffer)); - for (auto &node : root_graph->GetDirectNode()) { + auto subgraph = GraphUtils::GetComputeGraph(subgraph_model.second->GetGraph()); + if (subgraph != ge_root_model_->GetRootGraph()) { + subgraph = ge_root_model_->GetRootGraph()->GetSubgraph(subgraph_model.first); + } + GE_CHECK_NOTNULL(subgraph); + hybrid_model_.weight_buffer_map_.emplace(subgraph->GetName(), std::move(sub_weight_buffer)); + for (auto &node : subgraph->GetDirectNode()) { if (node->GetType() != CONSTANT) { continue; }