| 103 | } |
| 104 | |
| 105 | graph_t create_test_graph(const char* test_node_name, int axis, int numbe_split, int dim0, int dim1, int dim2, int c, |
| 106 | int h, int w, int layout, int data_type) |
| 107 | { |
| 108 | graph_t graph = create_graph(nullptr, nullptr, nullptr); |
| 109 | |
| 110 | if(graph == nullptr) |
| 111 | { |
| 112 | std::cerr << "create failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 113 | return nullptr; |
| 114 | } |
| 115 | |
| 116 | if(set_graph_layout(graph, layout) < 0) |
| 117 | { |
| 118 | std::cerr << "set layout failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 119 | return nullptr; |
| 120 | } |
| 121 | |
| 122 | const char* input_name = "data"; |
| 123 | |
| 124 | if(create_input_node(graph, input_name, c, h, w, data_type) < 0) |
| 125 | { |
| 126 | std::cerr << "create input failed\n"; |
| 127 | return nullptr; |
| 128 | } |
| 129 | |
| 130 | if(create_test_node(graph, test_node_name, axis, numbe_split, dim0, dim1, dim2, input_name) < 0) |
| 131 | { |
| 132 | std::cerr << "create test node failed\n"; |
| 133 | return nullptr; |
| 134 | } |
| 135 | |
| 136 | /* set input/output node */ |
| 137 | const char* inputs[] = {input_name}; |
| 138 | const char* outputs[] = {test_node_name}; |
| 139 | |
| 140 | if(set_graph_input_node(graph, inputs, sizeof(inputs) / sizeof(char*)) < 0) |
| 141 | { |
| 142 | std::cerr << "set inputs failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 143 | return nullptr; |
| 144 | } |
| 145 | |
| 146 | if(set_graph_output_node(graph, outputs, sizeof(outputs) / sizeof(char*)) < 0) |
| 147 | { |
| 148 | std::cerr << "set outputs failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 149 | return nullptr; |
| 150 | } |
| 151 | |
| 152 | return graph; |
| 153 | } |
| 154 | |
| 155 | void* set_input_data(graph_t graph) |
| 156 | { |
no test coverage detected