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

Function create_test_graph

internal/bin/test_interp.cpp:123–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123graph_t create_test_graph(const char* test_node_name, int c, int h, int w, int layout, int data_type, int resize_type)
124{
125 graph_t graph = create_graph(nullptr, nullptr, nullptr);
126
127 if(graph == nullptr)
128 {
129 std::cerr << "create failed: ERRNO: " << get_tengine_errno() << "\n";
130 return nullptr;
131 }
132
133 if(set_graph_layout(graph, layout) < 0)
134 {
135 std::cerr << "set layout failed: ERRNO: " << get_tengine_errno() << "\n";
136 return nullptr;
137 }
138
139 const char* input_name = "data";
140
141 if(create_input_node(graph, input_name, c, h, w, data_type) < 0)
142 {
143 std::cerr << "create input failed\n";
144 return nullptr;
145 }
146
147 if(create_test_node(graph, test_node_name, input_name, data_type, resize_type) < 0)
148 {
149 std::cerr << "create test node failed\n";
150 return nullptr;
151 }
152
153 /* set input/output node */
154 const char* inputs[] = {input_name};
155 const char* outputs[] = {test_node_name};
156
157 if(set_graph_input_node(graph, inputs, sizeof(inputs) / sizeof(char*)) < 0)
158 {
159 std::cerr << "set inputs failed: ERRNO: " << get_tengine_errno() << "\n";
160 return nullptr;
161 }
162
163 if(set_graph_output_node(graph, outputs, sizeof(outputs) / sizeof(char*)) < 0)
164 {
165 std::cerr << "set outputs failed: ERRNO: " << get_tengine_errno() << "\n";
166 return nullptr;
167 }
168
169 return graph;
170}
171
172
173

Callers 1

test_castFunction · 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