| 78 | } |
| 79 | |
| 80 | graph_t create_pool_graph(int c, int h, int w, int k_h, int k_w, int s_h, int s_w, int pad_h0, int pad_w0, int pad_h1, |
| 81 | int pad_w1, int m) |
| 82 | { |
| 83 | graph_t graph = create_graph(nullptr, nullptr, nullptr); |
| 84 | |
| 85 | if(graph == nullptr) |
| 86 | { |
| 87 | std::cerr << "ERRNO: " << get_tengine_errno() << "\n"; |
| 88 | return nullptr; |
| 89 | } |
| 90 | |
| 91 | const char* input_name = "data"; |
| 92 | const char* pool_name = "pool"; |
| 93 | |
| 94 | if(create_input_node(graph, input_name, c, h, w) < 0) |
| 95 | { |
| 96 | std::cerr << "create input failed\n"; |
| 97 | return nullptr; |
| 98 | } |
| 99 | |
| 100 | if(create_pool_node(graph, pool_name, input_name, k_h, k_w, s_h, s_w, pad_h0, pad_w0, pad_h1, pad_w1, m) < 0) |
| 101 | { |
| 102 | std::cerr << "create pool node failed\n"; |
| 103 | return nullptr; |
| 104 | } |
| 105 | |
| 106 | /* set input/output node */ |
| 107 | |
| 108 | const char* inputs[] = {input_name}; |
| 109 | const char* outputs[] = {pool_name}; |
| 110 | |
| 111 | if(set_graph_input_node(graph, inputs, sizeof(inputs) / sizeof(char*)) < 0) |
| 112 | { |
| 113 | std::cerr << "set inputs failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 114 | return nullptr; |
| 115 | } |
| 116 | |
| 117 | if(set_graph_output_node(graph, outputs, sizeof(outputs) / sizeof(char*)) < 0) |
| 118 | { |
| 119 | std::cerr << "set outputs failed: ERRNO: " << get_tengine_errno() << "\n"; |
| 120 | return nullptr; |
| 121 | } |
| 122 | |
| 123 | return graph; |
| 124 | } |
| 125 | |
| 126 | int test_pool(int c, int h, int w, int k_h, int k_w, int s_h, int s_w, int pad_h0, int pad_w0, int pad_h1, int pad_w1, |
| 127 | int m) |
no test coverage detected