MCPcopy Create free account
hub / github.com/OAID/Tengine / CreateGraph

Method CreateGraph

core/lib/graph_executor.cpp:37–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35namespace TEngine {
36
37bool GraphExecutor::CreateGraph(void* exec_context, const char* graph_name, const char* model_name)
38{
39 StaticGraphPtr static_graph;
40 Graph* graph = nullptr;
41
42 /* create empty graph */
43 if(model_name == nullptr)
44 {
45 graph = new Graph(graph_name);
46 graph->SetModelFormat(MODEL_FORMAT_TENGINE);
47 graph->SetLayout(TENGINE_LAYOUT_NCHW);
48 graph->SetModelLayout(TENGINE_LAYOUT_NCHW);
49 }
50 else
51 {
52 if(!StaticGraphManager::SafeGet(model_name, static_graph))
53 {
54 set_tengine_errno(ENOENT);
55 return false;
56 }
57
58 graph = Graph::CreateFromStatic(graph_name, static_graph);
59
60 if(graph == nullptr)
61 return false;
62
63 model_name_ = model_name;
64 }
65
66 graph_ = graph;
67
68 return PrepareExec(exec_context, graph_, static_graph.get());
69}
70
71bool GraphExecutor::PrepareExec(void* exec_context, Graph* graph, StaticGraph* static_graph)
72{

Callers 4

create_graph_in_contextFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 5

set_tengine_errnoFunction · 0.85
SetModelFormatMethod · 0.80
SetLayoutMethod · 0.80
SetModelLayoutMethod · 0.80
getMethod · 0.80

Tested by 3

mainFunction · 0.64
mainFunction · 0.64
mainFunction · 0.64