diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 6dd9f95d..ff7e4b3a 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -466,7 +466,7 @@ Status GraphManager::SetStagesOptions(uint32_t graph_id, const GraphManagerOptio return SUCCESS; } -Status GraphManager::ModifyDataIndex(const Graph &graph) { +Status GraphManager::ModifyDataIndex(const Graph &graph, const std::map &graph_option) { vector data_desc; set indexes; auto compute_graph = GraphUtils::GetComputeGraph(graph); @@ -489,6 +489,13 @@ Status GraphManager::ModifyDataIndex(const Graph &graph) { auto data_size = static_cast(data_desc.size()); // The valid index starts with 0 and increases by 1, and num is equal to data_node. if (indexes.size() != data_desc.size() || *first_iter != 0 || *end_iter != data_size - 1) { + auto iter = graph_option.find(OPTION_EXEC_DATA_INPUTS_SHAPE_RANGE); + bool enable_input_shape_range = (iter != graph_option.end()) && (!iter->second.empty()); + if (enable_input_shape_range) { + REPORT_INNER_ERROR("E19999", "Input data index is invalid when data shape range enabled, please check!"); + GELOGE(GRAPH_PARAM_INVALID, "Input data index is invalid when data shape range enabled."); + return GRAPH_PARAM_INVALID; + } GELOGI("Graph[%s] input data index is invalid, set data index by topo order.", compute_graph->GetName().c_str()); int64_t index = 0; for (auto &op : data_desc) { @@ -532,7 +539,7 @@ Status GraphManager::AddGraph(const GraphId &graph_id, const Graph &graph, GELOGE(FAILED, "AddGraph failed."); return FAILED; } - GE_CHK_STATUS_RET(ModifyDataIndex(graph)); + GE_CHK_STATUS_RET(ModifyDataIndex(graph, options)); auto compute_graph = GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); (void)AttrUtils::SetBool(*compute_graph, ATTR_NAME_GRAPH_HAS_BEEN_ADDED, true); diff --git a/ge/graph/manager/graph_manager.h b/ge/graph/manager/graph_manager.h index 1cf60eef..945a5e5d 100644 --- a/ge/graph/manager/graph_manager.h +++ b/ge/graph/manager/graph_manager.h @@ -427,7 +427,7 @@ class GraphManager { void SetSessionGraphId(ComputeGraphPtr compute_graph, uint32_t graph_id); - Status ModifyDataIndex(const Graph &graph); + Status ModifyDataIndex(const Graph &graph, const std::map &graph_option); static Status CheckGraphAdded(const GraphId &graph_id, const Graph &graph);