From 02f9fa02bb4bcd7bcb24dbd695978fff1e351256 Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sun, 16 May 2021 22:15:08 +0800 Subject: [PATCH 1/2] Update error report. --- ge/graph/manager/graph_manager.cc | 5 ++- .../graph/manager/graph_manager_unittest.cc | 35 +++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) 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..70eea3d9 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -194,16 +194,16 @@ TEST_F(UtestGraphManagerTest, test_add_graph_3) { std::map options; OmgContext context; - std::future fut1 = std::async(std::launch::async, - &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); - std::future fut2 = std::async(std::launch::async, - &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); - fut1.wait(); - fut2.wait(); - Status status1 = fut1.get(); - Status status2 = fut2.get(); - EXPECT_EQ(status1, ge::SUCCESS); - EXPECT_EQ(status2, ge::SUCCESS); + // std::future fut1 = std::async(std::launch::async, + // &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); + // std::future fut2 = std::async(std::launch::async, + // &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); + // fut1.wait(); + // fut2.wait(); + // Status status1 = fut1.get(); + // Status status2 = fut2.get(); + // EXPECT_EQ(status1, ge::SUCCESS); + // EXPECT_EQ(status2, ge::SUCCESS); } TEST_F(UtestGraphManagerTest, test_add_graph_4) { @@ -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; From 03b9afcee91d7e63d1f6f103c06a04431eaeca9f Mon Sep 17 00:00:00 2001 From: zhaozhixuan Date: Sun, 16 May 2021 22:17:03 +0800 Subject: [PATCH 2/2] Update error report. --- .../graph/manager/graph_manager_unittest.cc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/ut/ge/graph/manager/graph_manager_unittest.cc b/tests/ut/ge/graph/manager/graph_manager_unittest.cc index 70eea3d9..96a0fa64 100644 --- a/tests/ut/ge/graph/manager/graph_manager_unittest.cc +++ b/tests/ut/ge/graph/manager/graph_manager_unittest.cc @@ -194,16 +194,16 @@ TEST_F(UtestGraphManagerTest, test_add_graph_3) { std::map options; OmgContext context; - // std::future fut1 = std::async(std::launch::async, - // &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); - // std::future fut2 = std::async(std::launch::async, - // &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); - // fut1.wait(); - // fut2.wait(); - // Status status1 = fut1.get(); - // Status status2 = fut2.get(); - // EXPECT_EQ(status1, ge::SUCCESS); - // EXPECT_EQ(status2, ge::SUCCESS); + std::future fut1 = std::async(std::launch::async, + &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); + std::future fut2 = std::async(std::launch::async, + &GraphManager::AddGraph, &graph_manager, graph_id, graph, options, context); + fut1.wait(); + fut2.wait(); + Status status1 = fut1.get(); + Status status2 = fut2.get(); + EXPECT_EQ(status1, ge::SUCCESS); + EXPECT_EQ(status2, ge::SUCCESS); } TEST_F(UtestGraphManagerTest, test_add_graph_4) {