| @@ -54,6 +54,7 @@ | |||
| #include "register/register_fmk_types.h" | |||
| #include "mmpa/mmpa_api.h" | |||
| #include "parser/common/parser_utils.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| using domi::caffe::ConvolutionParameter; | |||
| using domi::caffe::InnerProductParameter; | |||
| @@ -98,7 +99,7 @@ graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmpGraph"); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::CAFFE); | |||
| GE_CHECK_NOTNULL(model_parser); | |||
| @@ -162,7 +163,7 @@ graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>(graph_name); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::CAFFE); | |||
| GE_CHECK_NOTNULL(model_parser); | |||
| @@ -1373,7 +1374,7 @@ Status CaffeModelParser::ParseFromMemory(const char *data, uint32_t size, ge::Co | |||
| Status CaffeModelParser::Parse(const char *model_path, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_path); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| Status ret = Parse(model_path, compute_graph); | |||
| @@ -1702,7 +1703,7 @@ Status CaffeWeightsParser::ParseFromMemory(const char *data, uint32_t size, ge:: | |||
| Status CaffeWeightsParser::Parse(const char *file, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(file); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| Status ret = Parse(file, compute_graph); | |||
| @@ -40,6 +40,7 @@ | |||
| #include "parser/common/register_tbe.h" | |||
| #include "tbe_plugin_loader.h" | |||
| #include "mmpa/mmpa_api.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| using google::protobuf::io::CodedInputStream; | |||
| using google::protobuf::io::FileInputStream; | |||
| @@ -559,7 +560,7 @@ domi::Status AclGrphParseUtil::GetDefaultOutInfo(ge::ComputeGraphPtr &compute_gr | |||
| domi::Status AclGrphParseUtil::SetOutputNodeInfo(ge::Graph &graph, | |||
| const std::map<AscendString, AscendString> &parser_params) { | |||
| (void)parser_params; | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| std::vector<std::pair<std::string, int32_t>> user_out_nodes = ge::GetParserContext().user_out_nodes; | |||
| @@ -691,7 +692,7 @@ domi::Status AclGrphParseUtil::ParseParamsBeforeGraph(const std::map<AscendStrin | |||
| domi::Status AclGrphParseUtil::ParseParamsAfterGraph(ge::Graph &graph, | |||
| const std::map<AscendString, AscendString> &parser_params) const { | |||
| // support paragrams: input_fp16_nodes, is_input_adjust_hw_layout, | |||
| ComputeGraphPtr compute_graph = GraphUtils::GetComputeGraph(graph); | |||
| ComputeGraphPtr compute_graph = OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| string input_fp16_nodes; | |||
| @@ -27,6 +27,7 @@ | |||
| #include "register/register_fmk_types.h" | |||
| #include "framework/common/debug/ge_log.h" | |||
| #include "framework/common/util.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| namespace ge { | |||
| namespace { | |||
| @@ -126,7 +127,7 @@ Status AutoMappingSubgraphIndexByDataNodeAndOutputNodesInfo( | |||
| const std::function<Status(int netoutput_index, int &parent_output_index)> &output) { | |||
| GE_CHECK_NOTNULL(input); | |||
| GE_CHECK_NOTNULL(output); | |||
| auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| auto compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| auto ret = AutoMappingSubgraphIndexByDataNode(compute_graph, input); | |||
| @@ -26,6 +26,7 @@ | |||
| #include "graph/utils/node_adapter.h" | |||
| #include "graph/utils/op_desc_utils.h" | |||
| #include "register/op_registry.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| namespace ge { | |||
| namespace { | |||
| @@ -109,9 +110,9 @@ Status ParserUtils::ExpandOneToManyGraph(const Graph &graph, OutputMapping &outp | |||
| Status ParserUtils::ExpandNodeToSubgraph(const Graph &subgraph, const NodePtr &node, const Graph &graph, | |||
| OutputMapping &output_mapping) { | |||
| ComputeGraphPtr sub_compute_graph = GraphUtils::GetComputeGraph(subgraph); | |||
| ComputeGraphPtr sub_compute_graph = OperUtils::GetComputeGraph(subgraph); | |||
| GE_CHECK_NOTNULL(sub_compute_graph); | |||
| ComputeGraphPtr compute_graph = GraphUtils::GetComputeGraph(graph); | |||
| ComputeGraphPtr compute_graph = OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| // add subgraph node to graph. | |||
| @@ -15,36 +15,27 @@ | |||
| */ | |||
| #include "onnx_parser.h" | |||
| #include <algorithm> | |||
| #include <iostream> | |||
| #include <queue> | |||
| #include "common/convert/message2operator.h" | |||
| #include "common/convert/pb2json.h" | |||
| #include "common/util.h" | |||
| #include "common/util/error_manager/error_manager.h" | |||
| #include "external/graph/operator_factory.h" | |||
| #include "external/register/register_error_codes.h" | |||
| #include "external/parser/onnx_parser.h" | |||
| #include "external/ge/ge_api_types.h" | |||
| #include "framework/omg/parser/parser_inner_ctx.h" | |||
| #include "framework/omg/parser/parser_types.h" | |||
| #include "omg/parser/parser_factory.h" | |||
| #include "onnx_op_parser.h" | |||
| #include "onnx_util.h" | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "parser/common/acl_graph_parser_util.h" | |||
| #include "parser/common/model_saver.h" | |||
| #include "parser/common/parser_utils.h" | |||
| #include "parser/common/prototype_pass_manager.h" | |||
| #include "parser/onnx/onnx_custom_parser_adapter.h" | |||
| #include "parser/onnx/onnx_util.h" | |||
| #include "register/op_registry.h" | |||
| #include "register/register_fmk_types.h" | |||
| #include "graph/utils/graph_utils.h" | |||
| #include "graph/utils/node_utils.h" | |||
| #include "graph/utils/type_utils.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "subgraph_adapter/subgraph_adapter_factory.h" | |||
| #include "framework/common/types.h" | |||
| #include "mmpa/mmpa_api.h" | |||
| namespace { | |||
| @@ -76,7 +67,7 @@ graphStatus PrepareBeforeParse(AclGrphParseUtil &acl_graph_parse_util, | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>(graph_name); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::ONNX); | |||
| GE_CHECK_NOTNULL(model_parser); | |||
| return ge::SUCCESS; | |||
| @@ -250,7 +241,7 @@ Status PostOpProcessForSubgraph(const ParseArg &arg, ge::ComputeGraphPtr sub_gra | |||
| node->GetOpDesc()->SetName(OnnxUtil::GenUniqueNodeName(sub_graph->GetName(), node->GetName())); | |||
| } | |||
| auto graph = ge::GraphUtils::CreateGraphFromComputeGraph(sub_graph); | |||
| auto graph = ge::OperUtils::CreateGraphFromComputeGraph(sub_graph); | |||
| Status ret = FAILED; | |||
| if (post_func != nullptr) { | |||
| ret = post_func(arg.graph_name, graph); | |||
| @@ -909,7 +900,7 @@ Status OnnxModelParser::ModelParseToGraph(const ge::onnx::ModelProto &onnx_model | |||
| root_graph = tmp_graph; | |||
| } | |||
| ge::ComputeGraphPtr cur_compute_graph = ge::GraphUtils::GetComputeGraph(tmp_graph); | |||
| ge::ComputeGraphPtr cur_compute_graph = ge::OperUtils::GetComputeGraph(tmp_graph); | |||
| GE_CHECK_NOTNULL(cur_compute_graph); | |||
| ret = PostOpProcessForSubgraph(arg, cur_compute_graph); | |||
| @@ -54,6 +54,7 @@ | |||
| #include "register/scope/scope_pass_registry_impl.h" | |||
| #include "parser/common/auto_mapping_subgraph_io_index_func.h" | |||
| #include "graph/def_types.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| using ge::OpParserFactory; | |||
| using ge::Pb2Json; | |||
| @@ -109,7 +110,7 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, ge::Graph &graph) { | |||
| return FAILED; | |||
| } | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::TENSORFLOW); | |||
| if (model_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No Model Parser for tensorflow, check invalid"); | |||
| @@ -164,7 +165,7 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, const std::map<Ascend | |||
| return FAILED; | |||
| } | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::TENSORFLOW); | |||
| if (model_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No Model Parser for tensorflow, check invalid"); | |||
| @@ -305,7 +306,7 @@ Status PostOpProcessForSubgraph(const ParseArg &arg) { | |||
| node->GetOpDesc()->SetName(node->GetOwnerComputeGraph()->GetName() + "/" + node->GetName()); | |||
| } | |||
| auto graph = ge::GraphUtils::CreateGraphFromComputeGraph(arg.graph); | |||
| auto graph = ge::OperUtils::CreateGraphFromComputeGraph(arg.graph); | |||
| Status ret = FAILED; | |||
| if (post_func != nullptr) { | |||
| ret = post_func(arg.subgraph_name, graph); | |||
| @@ -349,7 +350,7 @@ Status MappingAndAddSubGraph(const NodePtr &node, const Graph &graph, const Comp | |||
| return INTERNAL_ERROR; | |||
| } | |||
| ComputeGraphPtr compute_graph = GraphUtils::GetComputeGraph(graph); | |||
| ComputeGraphPtr compute_graph = OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| // Inner function, GetOpDesc has been checked by caller | |||
| (void)node->GetOpDesc()->AddSubgraphName("f"); | |||
| @@ -1371,7 +1372,7 @@ Status TensorFlowModelParser::GetFunctionProto(const string &file, | |||
| Status TensorFlowModelParser::Parse(const char *file, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(file); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(root_graph); | |||
| Status ret = Parse(file, root_graph); | |||
| @@ -1591,7 +1592,7 @@ Status TensorFlowModelParser::ParseAllGraph(const google::protobuf::Message *pro | |||
| DeleteFuisonNodeDef(); | |||
| GE_RETURN_IF_ERROR(AddEdges(graph)); | |||
| Graph dest_graph = GraphUtils::CreateGraphFromComputeGraph(graph); | |||
| Graph dest_graph = OperUtils::CreateGraphFromComputeGraph(graph); | |||
| ParserUtils::OutputMapping final_output_nodes; | |||
| GE_RETURN_IF_ERROR(ParserUtils::ExpandOneToManyGraph(dest_graph, final_output_nodes)); | |||
| GE_RETURN_IF_ERROR(UpdateOutputsInfo(final_output_nodes)); | |||
| @@ -2336,7 +2337,7 @@ Status TensorFlowModelParser::ParseProto(const google::protobuf::Message *proto, | |||
| ret = AddEdges(graph); | |||
| Graph dest_graph = GraphUtils::CreateGraphFromComputeGraph(graph); | |||
| Graph dest_graph = OperUtils::CreateGraphFromComputeGraph(graph); | |||
| ParserUtils::OutputMapping final_output_nodes; | |||
| GE_RETURN_IF_ERROR(ParserUtils::ExpandOneToManyGraph(dest_graph, final_output_nodes)); | |||
| GE_RETURN_IF_ERROR(UpdateOutputsInfo(final_output_nodes)); | |||
| @@ -4023,7 +4024,7 @@ Status TensorFlowModelParser::AddExternalGraph(const ComputeGraphPtr &root_graph | |||
| REPORT_CALL_ERROR("E19999", "Failed to parse external model, node:%s.", node->GetName().c_str()); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| Graph graph = model.GetGraph(); | |||
| Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(model.GetGraph()); | |||
| GELOGD("Get subgraph[%s] from model[%s].", ParserUtils::GetGraphName(graph).c_str(), node->GetName().c_str()); | |||
| Status ret = MappingAndAddSubGraph(node, graph, root_graph); | |||
| if (ret != SUCCESS) { | |||
| @@ -127,6 +127,7 @@ set(MATEDEF_SRC_FILES | |||
| "${PARSER_DIR}/metadef/graph/utils/graph_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/node_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/op_desc_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/oper_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/tensor_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/transformer_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/tuning_utils.cc" | |||
| @@ -20,6 +20,7 @@ | |||
| #define private public | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "graph/operator_reg.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "register/op_registry.h" | |||
| #include "parser/common/register_tbe.h" | |||
| #include "framework/omg/parser/model_parser.h" | |||
| @@ -188,7 +189,7 @@ TEST_F(STestCaffeParser, caffe_parser_user_output_with_default) { | |||
| ASSERT_NE(model_parser, nullptr); | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmp_graph"); | |||
| ASSERT_NE(compute_graph, nullptr); | |||
| ge::Graph graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto ret = model_parser->Parse(model_file.c_str(), graph); | |||
| ASSERT_EQ(ret, GRAPH_SUCCESS); | |||
| AclGrphParseUtil acl_graph_parse_util; | |||
| @@ -258,7 +259,7 @@ TEST_F(STestCaffeParser, modelparser_parsefrommemory_success) | |||
| const char* tmp_tf_pb_model = modelFile.c_str(); | |||
| ge::Graph graph; | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| CaffeModelParser modelParser; | |||
| MemBuffer* memBuffer = ParerSTestsUtils::MemBufferFromFile(tmp_tf_pb_model); | |||
| auto ret = modelParser.ParseFromMemory((char*)memBuffer->data, memBuffer->size, compute_graph); | |||
| @@ -672,7 +673,7 @@ TEST_F(STestCaffeParser, CaffeWeightsParser_ParseGraph_test) | |||
| { | |||
| CaffeWeightsParser weightParser; | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmp_graph"); | |||
| ge::Graph graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| std::string case_dir = __FILE__; | |||
| case_dir = case_dir.substr(0, case_dir.find_last_of("/")); | |||
| @@ -18,6 +18,7 @@ | |||
| #include <iostream> | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "graph/operator_reg.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "register/op_registry.h" | |||
| #include "parser/common/register_tbe.h" | |||
| #include "external/parser/onnx_parser.h" | |||
| @@ -111,7 +112,7 @@ TEST_F(STestOnnxParser, onnx_parser_user_output_with_default) { | |||
| ge::Graph graph; | |||
| auto ret = ge::aclgrphParseONNX(model_file.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, GRAPH_SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto output_nodes_info = compute_graph->GetGraphOutNodesInfo(); | |||
| ASSERT_EQ(output_nodes_info.size(), 1); | |||
| EXPECT_EQ((output_nodes_info.at(0).first->GetName()), "Conv_0"); | |||
| @@ -21,6 +21,7 @@ | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "parser/tensorflow/tensorflow_parser.h" | |||
| #include "graph/operator_reg.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "register/op_registry.h" | |||
| #include "external/register/register.h" | |||
| #include "parser/common/register_tbe.h" | |||
| @@ -1036,7 +1037,7 @@ TEST_F(STestTensorflowParser, tensorflow_parser_success) { | |||
| ge::Graph graph; | |||
| auto ret = ge::aclgrphParseTensorFlow(model_file.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto output_nodes_info = compute_graph->GetGraphOutNodesInfo(); | |||
| ASSERT_EQ(output_nodes_info.size(), 1); | |||
| EXPECT_EQ((output_nodes_info.at(0).first->GetName()), "add_test_1"); | |||
| @@ -1154,7 +1155,7 @@ TEST_F(STestTensorflowParser, tensorflow_parserfrommemory_failed) | |||
| modelFile = caseDir + "/origin_models/tf_add.pb"; | |||
| parser_params = {{AscendString(ge::ir_option::OUT_NODES), AscendString("Placeholder:0;Placeholder_1:0")}}; | |||
| ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| ret = modelParser.ParseFromMemory(data, size, compute_graph); | |||
| EXPECT_NE(ret, SUCCESS); | |||
| } | |||
| @@ -1171,7 +1172,7 @@ TEST_F(STestTensorflowParser, modelparser_parsefrommemory_success) | |||
| Status ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| TensorFlowModelParser modelParser; | |||
| MemBuffer* memBuffer = MemBufferFromFile(tmp_tf_pb_model); | |||
| PreChecker::Instance().HasError() == false; | |||
| @@ -1192,7 +1193,7 @@ TEST_F(STestTensorflowParser, weightsparser_parsefrommemory_success) | |||
| Status ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto weights_parser = domi::WeightsParserFactory::Instance()->CreateWeightsParser(domi::TENSORFLOW); | |||
| MemBuffer* memBuffer = MemBufferFromFile(tmp_tf_pb_model); | |||
| ret = weights_parser->ParseFromMemory((char*)memBuffer->data, memBuffer->size, compute_graph); | |||
| @@ -1221,7 +1222,7 @@ TEST_F(STestTensorflowParser, parser_ParseProtoWithSubgraphV2) | |||
| Status ret = ge::aclgrphParseTensorFlow(root_proto.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| domi::GetGraphCallbackV2 callback(&getGraphCallbackV2); | |||
| TensorFlowModelParser parser; | |||
| ret = parser.ParseProtoWithSubgraph(root_proto, callback, root_graph); | |||
| @@ -1315,7 +1316,7 @@ TEST_F(STestTensorflowParser, tensorflow_ParserProto_failed) | |||
| Status ret = ge::aclgrphParseTensorFlow(root_proto.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| TensorFlowModelParser tensorflow_parser; | |||
| ret = tensorflow_parser.ParseProto(reinterpret_cast<google::protobuf::Message *>(&graphDef), root_graph); | |||
| EXPECT_EQ(PARAM_INVALID, ret); | |||
| @@ -1351,7 +1352,7 @@ TEST_F(STestTensorflowParser, tensorflow_parserAllGraph_failed) | |||
| Status ret = ge::aclgrphParseTensorFlow(root_proto.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| TensorFlowModelParser tensorflow_parser; | |||
| ret = tensorflow_parser.ParseAllGraph(reinterpret_cast<google::protobuf::Message *>(&graphDef), root_graph); | |||
| ASSERT_NE(ret, SUCCESS); | |||
| @@ -1596,7 +1597,7 @@ TEST_F(STestTensorflowParser, parse_AddScopeInnerNode) | |||
| std::string modelFile = caseDir + "/origin_models/tf_add.pb"; | |||
| std::string op_name = "ge_ascend_irgraph"; | |||
| ge::Graph graph(op_name); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| std::map<ge::AscendString, ge::AscendString> parser_params = { | |||
| {AscendString(ge::ir_option::OUT_NODES), AscendString("Placeholder:0;Placeholder_1:0")}}; | |||
| Status ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| @@ -128,6 +128,7 @@ set(MATEDEF_SRC_FILES | |||
| "${PARSER_DIR}/metadef/graph/utils/cycle_detector.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/node_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/op_desc_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/oper_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/tensor_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/transformer_utils.cc" | |||
| "${PARSER_DIR}/metadef/graph/utils/tuning_utils.cc" | |||
| @@ -21,6 +21,7 @@ | |||
| #include <iostream> | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "graph/operator_reg.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "external/graph/types.h" | |||
| #include "register/op_registry.h" | |||
| #include "parser/common/register_tbe.h" | |||
| @@ -184,7 +185,7 @@ TEST_F(UtestCaffeParser, caffe_parser_user_output_with_name_and_index) { | |||
| ASSERT_NE(model_parser, nullptr); | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmpGraph"); | |||
| ASSERT_NE(compute_graph, nullptr); | |||
| ge::Graph graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::GetParserContext().user_out_nodes.push_back({"abs", 0}); | |||
| auto ret = model_parser->Parse(model_file.c_str(), graph); | |||
| @@ -211,7 +212,7 @@ TEST_F(UtestCaffeParser, caffe_parser_user_output_with_top_name) { | |||
| ASSERT_NE(model_parser, nullptr); | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmpGraph"); | |||
| ASSERT_NE(compute_graph, nullptr); | |||
| ge::Graph graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::GetParserContext().user_out_tensors.push_back("abs_out"); | |||
| auto ret = model_parser->Parse(model_file.c_str(), graph); | |||
| @@ -238,7 +239,7 @@ TEST_F(UtestCaffeParser, caffe_parser_user_output_with_default) { | |||
| ASSERT_NE(model_parser, nullptr); | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmpGraph"); | |||
| ASSERT_NE(compute_graph, nullptr); | |||
| ge::Graph graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto ret = model_parser->Parse(model_file.c_str(), graph); | |||
| ASSERT_EQ(ret, GRAPH_SUCCESS); | |||
| AclGrphParseUtil acl_graph_parse_util; | |||
| @@ -312,7 +313,7 @@ TEST_F(UtestCaffeParser, ParseFromMemory_success) | |||
| ge::Graph graph; | |||
| Status ret = ge::aclgrphParseCaffe(modelFile.c_str(), weight_file.c_str(), graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| CaffeModelParser modelParser; | |||
| MemBuffer* memBuffer1 = ParerUTestsUtils::MemBufferFromFile(tmp_tf_pb_model); | |||
| ret = modelParser.ParseFromMemory((char*)memBuffer1->data, memBuffer1->size, compute_graph); | |||
| @@ -754,7 +755,7 @@ TEST_F(UtestCaffeParser, CaffeWeightsParser_ParseGraph_test) | |||
| { | |||
| CaffeWeightsParser weightParser; | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmp_graph"); | |||
| ge::Graph graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| ge::Graph graph = ge::OperUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| std::string case_dir = __FILE__; | |||
| case_dir = case_dir.substr(0, case_dir.find_last_of("/")); | |||
| @@ -18,6 +18,7 @@ | |||
| #include <iostream> | |||
| #include "parser/common/op_parser_factory.h" | |||
| #include "graph/operator_reg.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "external/graph/types.h" | |||
| #include "register/op_registry.h" | |||
| #include "parser/common/register_tbe.h" | |||
| @@ -130,7 +131,7 @@ TEST_F(UtestOnnxParser, onnx_parser_user_output_with_name_and_index) { | |||
| ge::Graph graph; | |||
| auto ret = ge::aclgrphParseONNX(model_file.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, GRAPH_SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto output_nodes_info = compute_graph->GetGraphOutNodesInfo(); | |||
| ASSERT_EQ(output_nodes_info.size(), 1); | |||
| EXPECT_EQ((output_nodes_info.at(0).first->GetName()), "Conv_0"); | |||
| @@ -149,7 +150,7 @@ TEST_F(UtestOnnxParser, onnx_parser_user_output_with_tensor) { | |||
| ge::Graph graph; | |||
| auto ret = ge::aclgrphParseONNX(model_file.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, GRAPH_SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto output_nodes_info = compute_graph->GetGraphOutNodesInfo(); | |||
| ASSERT_EQ(output_nodes_info.size(), 1); | |||
| EXPECT_EQ((output_nodes_info.at(0).first->GetName()), "Conv_0"); | |||
| @@ -167,7 +168,7 @@ TEST_F(UtestOnnxParser, onnx_parser_user_output_with_default) { | |||
| ge::Graph graph; | |||
| auto ret = ge::aclgrphParseONNX(model_file.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, GRAPH_SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto output_nodes_info = compute_graph->GetGraphOutNodesInfo(); | |||
| ASSERT_EQ(output_nodes_info.size(), 1); | |||
| EXPECT_EQ((output_nodes_info.at(0).first->GetName()), "Conv_0"); | |||
| @@ -22,6 +22,7 @@ | |||
| #include "parser/tensorflow/tensorflow_parser.h" | |||
| #include "framework/omg/parser/parser_factory.h" | |||
| #include "graph/operator_reg.h" | |||
| #include "graph/utils/oper_utils.h" | |||
| #include "external/graph/types.h" | |||
| #include "register/op_registry.h" | |||
| #include "external/register/register.h" | |||
| @@ -1038,7 +1039,7 @@ TEST_F(UtestTensorflowParser, tensorflow_parser_success) { | |||
| ge::Graph graph; | |||
| auto ret = ge::aclgrphParseTensorFlow(model_file.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto output_nodes_info = compute_graph->GetGraphOutNodesInfo(); | |||
| ASSERT_EQ(output_nodes_info.size(), 1); | |||
| EXPECT_EQ((output_nodes_info.at(0).first->GetName()), "add_test_1"); | |||
| @@ -1190,7 +1191,7 @@ TEST_F(UtestTensorflowParser, tensorflow_parser_with_external_graph) { | |||
| // 3. Serialize ONNX graph to string | |||
| // 3.1 normal | |||
| ge::Model model("model", ""); | |||
| model.SetGraph(GraphUtils::CreateGraphFromComputeGraph(sub_graph)); | |||
| model.SetGraph(sub_graph); | |||
| Buffer buffer; | |||
| graphStatus save_ret = model.Save(buffer, false); | |||
| ASSERT_EQ(save_ret, GRAPH_SUCCESS); | |||
| @@ -1198,7 +1199,7 @@ TEST_F(UtestTensorflowParser, tensorflow_parser_with_external_graph) { | |||
| // model will failed | |||
| input1->GetOpDesc()->DelAttr(ATTR_NAME_INDEX); | |||
| ge::Model model_will_fail("model_will_fail", ""); | |||
| model_will_fail.SetGraph(GraphUtils::CreateGraphFromComputeGraph(sub_graph)); | |||
| model_will_fail.SetGraph(sub_graph); | |||
| Buffer buffer_fail; | |||
| save_ret = model_will_fail.Save(buffer_fail, false); | |||
| ASSERT_EQ(save_ret, GRAPH_SUCCESS); | |||
| @@ -1305,7 +1306,7 @@ TEST_F(UtestTensorflowParser, tensorflow_parserfrommemory_failed) | |||
| modelFile = caseDir + "/tensorflow_model/tf_add.pb"; | |||
| parser_params = {{AscendString(ge::ir_option::OUT_NODES), AscendString("Placeholder:0;Placeholder_1:0")}}; | |||
| ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| ret = modelParser.ParseFromMemory(data, size, compute_graph); | |||
| EXPECT_NE(ret, SUCCESS); | |||
| } | |||
| @@ -1322,7 +1323,7 @@ TEST_F(UtestTensorflowParser, modelparser_parsefrommemory_success) | |||
| Status ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| TensorFlowModelParser modelParser; | |||
| MemBuffer* memBuffer = MemBufferFromFile(tmp_tf_pb_model); | |||
| PreChecker::Instance().HasError() == false; | |||
| @@ -1343,7 +1344,7 @@ TEST_F(UtestTensorflowParser, weightsparser_parsefrommemory_success) | |||
| Status ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| auto weights_parser = domi::WeightsParserFactory::Instance()->CreateWeightsParser(domi::TENSORFLOW); | |||
| MemBuffer* memBuffer = MemBufferFromFile(tmp_tf_pb_model); | |||
| ret = weights_parser->ParseFromMemory((char*)memBuffer->data, memBuffer->size, compute_graph); | |||
| @@ -1372,7 +1373,7 @@ TEST_F(UtestTensorflowParser, parser_ParseProtoWithSubgraphV2) | |||
| Status ret = ge::aclgrphParseTensorFlow(root_proto.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| domi::GetGraphCallbackV2 callback(&getGraphCallbackV2); | |||
| TensorFlowModelParser parser; | |||
| ret = parser.ParseProtoWithSubgraph(root_proto, callback, root_graph); | |||
| @@ -1403,7 +1404,7 @@ TEST_F(UtestTensorflowParser, tensorflow_ParserProto_failed) | |||
| Status ret = ge::aclgrphParseTensorFlow(root_proto.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| TensorFlowModelParser tensorflow_parser; | |||
| ret = tensorflow_parser.ParseProto(reinterpret_cast<google::protobuf::Message *>(&graphDef), root_graph); | |||
| EXPECT_EQ(PARAM_INVALID, ret); | |||
| @@ -1442,7 +1443,7 @@ TEST_F(UtestTensorflowParser, tensorflow_parserAllGraph_failed) | |||
| Status ret = ge::aclgrphParseTensorFlow(root_proto.c_str(), parser_params, graph); | |||
| ASSERT_EQ(ret, SUCCESS); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr root_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| TensorFlowModelParser tensorflow_parser; | |||
| ret = tensorflow_parser.ParseAllGraph(reinterpret_cast<google::protobuf::Message *>(&graphDef), root_graph); | |||
| ASSERT_NE(ret, SUCCESS); | |||
| @@ -1694,7 +1695,7 @@ TEST_F(UtestTensorflowParser, parse_AddScopeInnerNode) | |||
| std::string modelFile = caseDir + "/tensorflow_model/tf_add.pb"; | |||
| std::string op_name = "ge_ascend_irgraph"; | |||
| ge::Graph graph(op_name); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| ge::ComputeGraphPtr compute_graph = ge::OperUtils::GetComputeGraph(graph); | |||
| std::map<ge::AscendString, ge::AscendString> parser_params = { | |||
| {AscendString(ge::ir_option::OUT_NODES), AscendString("Placeholder:0;Placeholder_1:0")}}; | |||
| Status ret = ge::aclgrphParseTensorFlow(modelFile.c_str(), parser_params, graph); | |||