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