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

Function test

internal/bin/test_split.cpp:289–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 }
288}
289int test(const char* test_node_name, int c, int h, int w, int layout, int axis, int number_split, int dim0, int dim1,
290 int dim2, int data_type)
291{
292 std::cout << "\n\n-----------------------------------------axis: " << axis << " number_split: " << number_split
293 << " data_type: " << data_type << " splitdims: " << dim0 << "," << dim1 << "," << dim2
294 << "----------------------------------\n\n";
295 graph_t graph = create_test_graph(test_node_name, axis, number_split, dim0, dim1, dim2, c, h, w, layout, data_type);
296
297 if(graph == nullptr)
298 return 1;
299
300 /* set input */
301 void* i_buf = set_input_data(graph);
302 // void * s_buf=set_input_slope_data(graph);
303 // if(data_type == 3)
304 // {
305 // tensor_t output = get_graph_output_tensor(graph, 0, 0);
306 // float scale = 0.1;
307 // int zero = 30;
308 // set_tensor_quant_param(output,&scale,&zero,1);
309 // }
310 // if(data_type == 2)
311 // {
312 // tensor_t output = get_graph_output_tensor(graph, 0, 0);
313 // float scale = 0.1;
314 // int zero = 0;
315 // set_tensor_quant_param(output,&scale,&zero,1);
316 // }
317 tensor_t output = get_graph_output_tensor(graph, 0, 0);
318 if(data_type == 3)
319 {
320 float scale = 0.1;
321 int zero = 0;
322 set_tensor_quant_param(output, &scale, &zero, 1);
323 }
324 // prerun graph
325 if(prerun_graph(graph) < 0)
326 {
327 std::cerr << "prerun_graph failed: ERRNO: " << get_tengine_errno() << "\n";
328 return 1;
329 }
330 dump_graph(graph);
331 node_t test_node = get_graph_node(graph, test_node_name);
332
333 const char* dev = get_node_device(test_node);
334
335 std::cout << "node running on dev: " << dev << "\n";
336
337 if(run_graph(graph, 1) < 0)
338 {
339 std::cerr << "run_graph failed: ERRNO: " << get_tengine_errno() << "\n";
340 return 2;
341 }
342
343 dump_output_data(test_node);
344
345 free(i_buf);
346

Callers 1

mainFunction · 0.70

Calls 14

get_graph_output_tensorFunction · 0.85
set_tensor_quant_paramFunction · 0.85
prerun_graphFunction · 0.85
get_tengine_errnoFunction · 0.85
dump_graphFunction · 0.85
get_graph_nodeFunction · 0.85
get_node_deviceFunction · 0.85
run_graphFunction · 0.85
release_graph_nodeFunction · 0.85
postrun_graphFunction · 0.85
destroy_graphFunction · 0.85
create_test_graphFunction · 0.70

Tested by

no test coverage detected