| 103 | }; |
| 104 | |
| 105 | int main(int argc, char* argv[]) |
| 106 | { |
| 107 | int res; |
| 108 | |
| 109 | while((res = getopt(argc, argv, "d:r:")) != -1) |
| 110 | { |
| 111 | switch(res) |
| 112 | { |
| 113 | case 'r': |
| 114 | repeat_count = strtoul(optarg, NULL, 10); |
| 115 | break; |
| 116 | default: |
| 117 | break; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | int img_h = 227; |
| 122 | int img_w = 227; |
| 123 | |
| 124 | std::string model_name = "squeeze_net"; |
| 125 | |
| 126 | /* prepare input data */ |
| 127 | float* input_data = ( float* )malloc(sizeof(float) * img_h * img_w * 3); |
| 128 | |
| 129 | get_input_data(image_file, input_data, img_h, img_w, channel_mean, 1); |
| 130 | |
| 131 | init_tengine(); |
| 132 | |
| 133 | std::cout << "run-time library version: " << get_tengine_version() << "\n"; |
| 134 | |
| 135 | if(request_tengine_version("0.9") < 0) |
| 136 | return -1; |
| 137 | |
| 138 | const struct cpu_info* p_info = get_predefined_cpu("rk3399"); |
| 139 | int a72_list[] = {4, 5}; |
| 140 | |
| 141 | set_online_cpu(( struct cpu_info* )p_info, a72_list, sizeof(a72_list) / sizeof(int)); |
| 142 | create_cpu_device("a72", p_info); |
| 143 | |
| 144 | const struct cpu_info* p_info1 = get_predefined_cpu("rk3399"); |
| 145 | int a53_list[] = {0, 1, 2, 3}; |
| 146 | |
| 147 | set_online_cpu(( struct cpu_info* )p_info1, a53_list, sizeof(a53_list) / sizeof(int)); |
| 148 | create_cpu_device("a53", p_info1); |
| 149 | |
| 150 | graph_t graph = create_graph(nullptr, "caffe", text_file, model_file); |
| 151 | |
| 152 | if(graph == nullptr) |
| 153 | { |
| 154 | std::cout << "Create graph0 failed\n"; |
| 155 | std::cout << "errno: " << get_tengine_errno() << "\n"; |
| 156 | return -1; |
| 157 | } |
| 158 | |
| 159 | /* get input tensor */ |
| 160 | int node_idx = 0; |
| 161 | int tensor_idx = 0; |
| 162 |
nothing calls this directly
no test coverage detected