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

Function create_test_graph

internal/bin/test_power_op.cpp:92–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92graph_t create_test_graph(const char* test_node_name, int h, int w, int layout, int data_type)
93{
94 graph_t graph = create_graph(nullptr, nullptr, nullptr);
95
96 if(graph == nullptr)
97 {
98 std::cerr << "create failed: ERRNO: " << get_tengine_errno() << "\n";
99 return nullptr;
100 }
101
102 if(set_graph_layout(graph, layout) < 0)
103 {
104 std::cerr << "set layout failed: ERRNO: " << get_tengine_errno() << "\n";
105 return nullptr;
106 }
107
108 const char* input_name = "data";
109
110 if(create_input_node(graph, input_name, h, w, data_type) < 0)
111 {
112 std::cerr << "create input failed\n";
113 return nullptr;
114 }
115
116 if(create_test_node(graph, test_node_name, input_name) < 0)
117 {
118 std::cerr << "create test node failed\n";
119 return nullptr;
120 }
121
122 /* set input/output node */
123 const char* inputs[] = {input_name};
124 const char* outputs[] = {test_node_name};
125
126 if(set_graph_input_node(graph, inputs, sizeof(inputs) / sizeof(char*)) < 0)
127 {
128 std::cerr << "set inputs failed: ERRNO: " << get_tengine_errno() << "\n";
129 return nullptr;
130 }
131
132 if(set_graph_output_node(graph, outputs, sizeof(outputs) / sizeof(char*)) < 0)
133 {
134 std::cerr << "set outputs failed: ERRNO: " << get_tengine_errno() << "\n";
135 return nullptr;
136 }
137
138 return graph;
139}
140
141void* set_input_data(graph_t graph)
142{

Callers 1

mainFunction · 0.70

Calls 7

create_graphFunction · 0.85
get_tengine_errnoFunction · 0.85
set_graph_layoutFunction · 0.85
set_graph_input_nodeFunction · 0.85
set_graph_output_nodeFunction · 0.85
create_input_nodeFunction · 0.70
create_test_nodeFunction · 0.70

Tested by

no test coverage detected