| 207 | } |
| 208 | |
| 209 | graph_t create_test_graph(const char* test_node_name, int c, int h, int w, int layout, int data_type, int i_type, |
| 210 | int case_num) |
| 211 | { |
| 212 | graph_t graph = create_graph(nullptr, nullptr, nullptr); |
| 213 | |
| 214 | if(graph == nullptr) |
| 215 | { |
| 216 | std::cerr << "create failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 217 | return nullptr; |
| 218 | } |
| 219 | |
| 220 | if(set_graph_layout(graph, layout) < 0) |
| 221 | { |
| 222 | std::cerr << "set layout failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 223 | return nullptr; |
| 224 | } |
| 225 | |
| 226 | const char* input_name = "data"; |
| 227 | const char* input_name_1 = "data1"; |
| 228 | if(layout == 0) |
| 229 | { |
| 230 | if(create_input_node(graph, input_name, c, h, w, data_type) < 0) |
| 231 | { |
| 232 | std::cerr << "create input failed\n"; |
| 233 | return nullptr; |
| 234 | } |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | if(create_input_node_1(graph, input_name, c, h, w, data_type) < 0) |
| 239 | { |
| 240 | std::cerr << "create input failed\n"; |
| 241 | return nullptr; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | if(case_num == 1) |
| 246 | { |
| 247 | if(layout == 0) |
| 248 | { |
| 249 | if(create_input_node_Case1(graph, input_name_1, c, h, w, data_type) < 0) |
| 250 | { |
| 251 | std::cerr << "create input1 failed\n"; |
| 252 | return nullptr; |
| 253 | } |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | if(create_input_node_Case1_NHWC(graph, input_name_1, c, h, w, data_type) < 0) |
| 258 | { |
| 259 | std::cerr << "create input1 failed\n"; |
| 260 | return nullptr; |
| 261 | } |
| 262 | } |
| 263 | } |
| 264 | else if(case_num == 2) |
| 265 | { |
| 266 | if(create_input_node_Case2(graph, input_name_1, c, h, w, data_type) < 0) |
no test coverage detected