diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index 241ca0b2..465ae749 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -108,6 +108,7 @@ #include "common/formats/utils/formats_trans_utils.h" #include "register/custom_pass_helper.h" #include "external/graph/types.h" +#include "common/util/error_manager/error_manager.h" namespace { const char *const kSummary = "Summary"; @@ -492,7 +493,9 @@ Status GraphManager::ModifyDataIndex(const Graph &graph, const std::mapsecond.empty()) { // If data inputs shape range is set, user must set valid data index. - REPORT_INNER_ERROR("E19999", "Input data index is invalid when data shape range enabled, please check!"); + std::string failed_reason = "Data index must be set continuous from 0 when data shape range enabled!"; + REPORT_INPUT_ERROR("E10003", std::vector({"parameter", "value", "reason"}), + std::vector({"--data_index", "-", failed_reason})); GELOGE(GRAPH_PARAM_INVALID, "[COMP][AddGraph]Input data index is invalid when data shape range enabled."); return GRAPH_PARAM_INVALID; } diff --git a/tests/ut/ge/graph/manager/graph_manager_unittest.cc b/tests/ut/ge/graph/manager/graph_manager_unittest.cc index fafd7168..96a0fa64 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -221,6 +221,21 @@ TEST_F(UtestGraphManagerTest, test_add_graph_4) { EXPECT_NE(status, ge::SUCCESS); } +TEST_F(UtestGraphManagerTest, test_add_graph_5) { + Graph graph("test_graph"); + auto data = op::Data("Data").set_attr_index(1); + auto flatten = op::Flatten("Flatten").set_input_x(data, data.name_out_out()); + std::vector inputs{data}; + std::vector outputs{flatten}; + graph.SetInputs(inputs).SetOutputs(outputs); + + std::map options = {{"ge.exec.dataInputsShapeRange", "0:[-1]"}}; + OmgContext context; + GraphId graph_id = 1; + GraphManager graph_manager; + EXPECT_EQ(graph_manager.AddGraph(graph_id, graph, options, context), GRAPH_PARAM_INVALID); +} + TEST_F(UtestGraphManagerTest, test_add_graph_with_copy_1) { GraphId graph_id = 1; GraphManager graph_manager;