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

Function create_test_graph

internal/bin/test_generic.cpp:148–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148graph_t create_test_graph(int c, int h, int w)
149{
150 graph_t graph = create_graph(nullptr, nullptr, nullptr);
151
152 if(graph == nullptr)
153 {
154 std::cerr << "ERRNO: " << get_tengine_errno() << "\n";
155 return nullptr;
156 }
157
158 const char* input_name = "data";
159 const char* conv_name = "conv";
160 const char* generic_name = "generic";
161
162 if(create_input_node(graph, input_name, c, h, w) < 0)
163 {
164 std::cerr << "create input failed\n";
165 return nullptr;
166 }
167
168 if(create_conv_node(graph, conv_name, input_name, 3, 1, 1, c, 64, 1) < 0)
169 {
170 std::cerr << "create conv node failed\n";
171 return nullptr;
172 }
173
174 /* add the generic node */
175
176 if(create_generic_node(graph, generic_name, conv_name))
177 {
178 std::cerr << "create generic node failed\n";
179 return nullptr;
180 }
181
182 /* set input/output node */
183 const char* inputs[] = {input_name};
184 const char* outputs[] = {generic_name};
185
186 if(set_graph_input_node(graph, inputs, sizeof(inputs) / sizeof(char*)) < 0)
187 {
188 std::cerr << "set inputs failed: ERRNO: " << get_tengine_errno() << "\n";
189 return nullptr;
190 }
191
192 if(set_graph_output_node(graph, outputs, sizeof(outputs) / sizeof(char*)) < 0)
193 {
194 std::cerr << "set outputs failed: ERRNO: " << get_tengine_errno() << "\n";
195 return nullptr;
196 }
197
198 return graph;
199}
200
201/* custom kernel impl */
202static struct custom_kernel_ops generic_custom_kernel;

Callers 1

mainFunction · 0.70

Calls 7

create_graphFunction · 0.85
get_tengine_errnoFunction · 0.85
create_generic_nodeFunction · 0.85
set_graph_input_nodeFunction · 0.85
set_graph_output_nodeFunction · 0.85
create_input_nodeFunction · 0.70
create_conv_nodeFunction · 0.70

Tested by

no test coverage detected