| 185 | } |
| 186 | |
| 187 | int main(int argc, char* argv[]) |
| 188 | { |
| 189 | int c = 1, h = 224, w = 224; |
| 190 | const char* test_node_name = "Softmax"; |
| 191 | int data_type = TENGINE_DT_FP32; |
| 192 | int layout = TENGINE_LAYOUT_NCHW; |
| 193 | float negative_slope=0.0; |
| 194 | |
| 195 | init_tengine(); |
| 196 | |
| 197 | graph_t graph = create_test_graph(test_node_name, c, h, w, layout, data_type, negative_slope); |
| 198 | graph_t graph1 = create_test_graph(test_node_name, c, h, w, layout, data_type, negative_slope); |
| 199 | |
| 200 | if(graph == nullptr || graph1 == nullptr) |
| 201 | return -1; |
| 202 | |
| 203 | /* set input *//////////////////////////////////////////////////////////// |
| 204 | tensor_t input_tensor = get_graph_input_tensor(graph, 0, 0); |
| 205 | tensor_t input_tensor1 = get_graph_input_tensor(graph1, 0, 0); |
| 206 | |
| 207 | int buf_size = get_tensor_buffer_size(input_tensor); |
| 208 | float* i_buf = ( float* )malloc(buf_size); |
| 209 | float* i_buf1 = ( float* )malloc(buf_size); |
| 210 | |
| 211 | for(unsigned int i = 0; i < buf_size/sizeof(float) ; i++) |
| 212 | { |
| 213 | i_buf[i] = (rand()%10)*0.01; |
| 214 | i_buf1[i] = i_buf[i]; |
| 215 | } |
| 216 | |
| 217 | set_tensor_buffer(input_tensor, i_buf, buf_size); |
| 218 | set_tensor_buffer(input_tensor1, i_buf1, buf_size); |
| 219 | release_graph_tensor(input_tensor); |
| 220 | release_graph_tensor(input_tensor1); |
| 221 | |
| 222 | // prerun graph |
| 223 | if(prerun_graph(graph) < 0) |
| 224 | { |
| 225 | std::cerr << "prerun_graph failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 226 | return 1; |
| 227 | } |
| 228 | // prerun graph1 |
| 229 | setenv("OPS_REGISTRY","reference",1); |
| 230 | setenv("OP_NAME","Softmax",1); |
| 231 | if(prerun_graph(graph1) < 0 ) |
| 232 | { |
| 233 | std::cerr << "prerun_graph1 failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 234 | return 1; |
| 235 | } |
| 236 | unsetenv("OPS_REGISTRY"); |
| 237 | unsetenv("OP_NAME"); |
| 238 | |
| 239 | // get device |
| 240 | node_t test_node = get_graph_node(graph, test_node_name); |
| 241 | node_t test_node1 = get_graph_node(graph1, test_node_name); |
| 242 | // const char* dev = get_node_device(test_node); |
| 243 | |
| 244 | // std::cout << "node running on dev: " << dev << "\n"; |
nothing calls this directly
no test coverage detected