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