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