diff --git a/parser/tensorflow/tensorflow_parser.cc b/parser/tensorflow/tensorflow_parser.cc index b5a22fe..170b58d 100644 --- a/parser/tensorflow/tensorflow_parser.cc +++ b/parser/tensorflow/tensorflow_parser.cc @@ -1237,9 +1237,6 @@ Status TensorFlowModelParser::ParseFromMemory(const char *data, uint32_t size, g // This function call affects the return value of prechecker::instance().Haserror() GE_RETURN_IF_ERROR(ClearFusionOpError(op_node_name_list)); - // Check the input validity of the node, the input attribute must have a corresponding node - GE_RETURN_IF_ERROR(CheckGraphDefValid(graph_def)); - // Building input and input relationships for all OP nodes GE_RETURN_IF_ERROR(GetOpNodesContextFromGraph(graph_def)); GELOGD("[TF ParseFromMemory] get op nodes context from graph success"); @@ -1472,10 +1469,6 @@ Status TensorFlowModelParser::ParseAllGraph(const google::protobuf::Message *pro // This function call affects the return value of prechecker::instance().Haserror() GE_RETURN_IF_ERROR(ClearFusionOpError(op_node_name_list)); - // Check the input validity of the node, the input attribute must have a corresponding node - GE_RETURN_IF_ERROR(CheckGraphDefValid(graph_def)); - GELOGD("[TF Parse] check graph success"); - // Building input and input relationships for all OP nodes GE_RETURN_IF_ERROR(GetOpNodesContextFromGraph(graph_def)); GELOGD("[TF Parse] get op nodes context from graph success"); @@ -1548,37 +1541,6 @@ Status TensorFlowModelParser::ParseAllGraph(const google::protobuf::Message *pro return SUCCESS; } -Status TensorFlowModelParser::CheckGraphDefValid(const domi::tensorflow::GraphDef &graph_def) const { - // Number of data nodes - uint32_t data_node_count = 0; - for (const domi::tensorflow::NodeDef &node_def : graph_def.node()) { - // Check that all input is valid - for (const string &node_name : node_def.input()) { - string tmp_node_name; - GE_RETURN_IF_ERROR(CheckInputNodeName(node_name, &tmp_node_name, nullptr, nullptr)); - - if (nodedef_map_.find(tmp_node_name) == nodedef_map_.end()) { - ErrorManager::GetInstance().ATCReportErrMessage("E12009", {"opname", "inputopname"}, - {node_def.name(), node_name}); - GELOGE(INTERNAL_ERROR, "Op[%s]'s input op[%s] is not exist in the graph_def.", node_def.name().c_str(), - node_name.c_str()); - return INTERNAL_ERROR; - } - } - - if (node_def.op() == TENSORFLOWF_NODE_OP_PLACEHOLDER || node_def.op() == ge::parser::ARG) { - data_node_count++; - } - } - if (data_node_count == 0) { - ErrorManager::GetInstance().ATCReportErrMessage("E12010"); - GELOGE(INTERNAL_ERROR, "Model has no Placeholder node."); - return INTERNAL_ERROR; - } - - return SUCCESS; -} - Status TensorFlowModelParser::GetOpNodesContextFromGraph(const domi::tensorflow::GraphDef &graph_def) { // Build the input relationship first for (auto &iter : op_node_context_map_) { diff --git a/parser/tensorflow/tensorflow_parser.h b/parser/tensorflow/tensorflow_parser.h index 6b196cd..a7a0ae6 100644 --- a/parser/tensorflow/tensorflow_parser.h +++ b/parser/tensorflow/tensorflow_parser.h @@ -241,15 +241,6 @@ class PARSER_FUNC_VISIBILITY TensorFlowModelParser : public domi::ModelParser { /** * @ingroup domi_omg - * @brief Verifying the validity of graphdef object parsed by pb - * @param [in] graph_def Parsed tensorflow:: graphdef object - * @return SUCCESS check successfully - * @return FAILED check failed - */ - Status CheckGraphDefValid(const domi::tensorflow::GraphDef &graph_def) const; - - /** - * @ingroup domi_omg * @brief whether const OP need to update context * @param const op name * @return true or false diff --git a/tests/st/testcase/test_tensorflow_parser.cc b/tests/st/testcase/test_tensorflow_parser.cc index 03b0dd7..1b1389c 100644 --- a/tests/st/testcase/test_tensorflow_parser.cc +++ b/tests/st/testcase/test_tensorflow_parser.cc @@ -1259,7 +1259,7 @@ TEST_F(STestTensorflowParser, tensorflow_parserAllGraph_failed) ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); TensorFlowModelParser tensorflow_parser; ret = tensorflow_parser.ParseAllGraph(reinterpret_cast(&graphDef), root_graph); - EXPECT_EQ(INTERNAL_ERROR, ret); + ASSERT_NE(ret, SUCCESS); } TEST_F(STestTensorflowParser, test_parse_acl_output_nodes) diff --git a/tests/ut/parser/testcase/tensorflow_parser_testcase/tensorflow_parser_unittest.cc b/tests/ut/parser/testcase/tensorflow_parser_testcase/tensorflow_parser_unittest.cc index 75450f6..8910a13 100644 --- a/tests/ut/parser/testcase/tensorflow_parser_testcase/tensorflow_parser_unittest.cc +++ b/tests/ut/parser/testcase/tensorflow_parser_testcase/tensorflow_parser_unittest.cc @@ -1419,7 +1419,7 @@ TEST_F(UtestTensorflowParser, tensorflow_parserAllGraph_failed) ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); TensorFlowModelParser tensorflow_parser; ret = tensorflow_parser.ParseAllGraph(reinterpret_cast(&graphDef), root_graph); - EXPECT_EQ(INTERNAL_ERROR, ret); + ASSERT_NE(ret, SUCCESS); } TEST_F(UtestTensorflowParser, test_parse_acl_output_nodes)