Marat Dukhan | 0743cdf | 2020-08-04 18:52:07 -0700 | [diff] [blame] | 1 | // Copyright 2020 Google LLC |
| 2 | // |
| 3 | // This source code is licensed under the BSD-style license found in the |
| 4 | // LICENSE file in the root directory of this source tree. |
| 5 | |
| 6 | #include <xnnpack.h> |
| 7 | |
| 8 | #include <algorithm> |
| 9 | #include <functional> |
| 10 | #include <iostream> |
| 11 | #include <limits> |
| 12 | #include <random> |
| 13 | |
| 14 | #include "models/models.h" |
| 15 | |
| 16 | namespace models { |
| 17 | |
| 18 | ExecutionPlan QS8MobileNetV1(pthreadpool_t threadpool) { |
| 19 | alignas(16) static int8_t v0[150528]; |
| 20 | alignas(16) static int8_t v1[401408]; |
| 21 | alignas(16) static int8_t v2[401408]; |
| 22 | alignas(16) static int8_t v3[802816]; |
| 23 | alignas(16) static int8_t v4[200704]; |
| 24 | alignas(16) static int8_t v5[401408]; |
| 25 | alignas(16) static int8_t v6[401408]; |
| 26 | alignas(16) static int8_t v7[401408]; |
| 27 | alignas(16) static int8_t v8[100352]; |
| 28 | alignas(16) static int8_t v9[200704]; |
| 29 | alignas(16) static int8_t v10[200704]; |
| 30 | alignas(16) static int8_t v11[200704]; |
| 31 | alignas(16) static int8_t v12[50176]; |
| 32 | alignas(16) static int8_t v13[100352]; |
| 33 | alignas(16) static int8_t v14[100352]; |
| 34 | alignas(16) static int8_t v15[100352]; |
| 35 | alignas(16) static int8_t v16[100352]; |
| 36 | alignas(16) static int8_t v17[100352]; |
| 37 | alignas(16) static int8_t v18[100352]; |
| 38 | alignas(16) static int8_t v19[100352]; |
| 39 | alignas(16) static int8_t v20[100352]; |
| 40 | alignas(16) static int8_t v21[100352]; |
| 41 | alignas(16) static int8_t v22[100352]; |
| 42 | alignas(16) static int8_t v23[100352]; |
| 43 | alignas(16) static int8_t v24[25088]; |
| 44 | alignas(16) static int8_t v25[50176]; |
| 45 | alignas(16) static int8_t v26[50176]; |
| 46 | alignas(16) static int8_t v27[50176]; |
| 47 | alignas(16) static int8_t v28[1024]; |
| 48 | alignas(16) static int8_t v29[1001]; |
| 49 | alignas(16) static int8_t w30[864]; |
| 50 | alignas(16) static int32_t w31[32]; |
| 51 | alignas(16) static int8_t w32[288]; |
| 52 | alignas(16) static int32_t w33[32]; |
| 53 | alignas(16) static int8_t w34[2048]; |
| 54 | alignas(16) static int32_t w35[64]; |
| 55 | alignas(16) static int8_t w36[576]; |
| 56 | alignas(16) static int32_t w37[64]; |
| 57 | alignas(16) static int8_t w38[8192]; |
| 58 | alignas(16) static int32_t w39[128]; |
| 59 | alignas(16) static int8_t w40[1152]; |
| 60 | alignas(16) static int32_t w41[128]; |
| 61 | alignas(16) static int8_t w42[16384]; |
| 62 | alignas(16) static int32_t w43[128]; |
| 63 | alignas(16) static int8_t w44[1152]; |
| 64 | alignas(16) static int32_t w45[128]; |
| 65 | alignas(16) static int8_t w46[32768]; |
| 66 | alignas(16) static int32_t w47[256]; |
| 67 | alignas(16) static int8_t w48[2304]; |
| 68 | alignas(16) static int32_t w49[256]; |
| 69 | alignas(16) static int8_t w50[65536]; |
| 70 | alignas(16) static int32_t w51[256]; |
| 71 | alignas(16) static int8_t w52[2304]; |
| 72 | alignas(16) static int32_t w53[256]; |
| 73 | alignas(16) static int8_t w54[131072]; |
| 74 | alignas(16) static int32_t w55[512]; |
| 75 | alignas(16) static int8_t w56[4608]; |
| 76 | alignas(16) static int32_t w57[512]; |
| 77 | alignas(16) static int8_t w58[262144]; |
| 78 | alignas(16) static int32_t w59[512]; |
| 79 | alignas(16) static int8_t w60[4608]; |
| 80 | alignas(16) static int32_t w61[512]; |
| 81 | alignas(16) static int8_t w62[262144]; |
| 82 | alignas(16) static int32_t w63[512]; |
| 83 | alignas(16) static int8_t w64[4608]; |
| 84 | alignas(16) static int32_t w65[512]; |
| 85 | alignas(16) static int8_t w66[262144]; |
| 86 | alignas(16) static int32_t w67[512]; |
| 87 | alignas(16) static int8_t w68[4608]; |
| 88 | alignas(16) static int32_t w69[512]; |
| 89 | alignas(16) static int8_t w70[262144]; |
| 90 | alignas(16) static int32_t w71[512]; |
| 91 | alignas(16) static int8_t w72[4608]; |
| 92 | alignas(16) static int32_t w73[512]; |
| 93 | alignas(16) static int8_t w74[262144]; |
| 94 | alignas(16) static int32_t w75[512]; |
| 95 | alignas(16) static int8_t w76[4608]; |
| 96 | alignas(16) static int32_t w77[512]; |
| 97 | alignas(16) static int8_t w78[524288]; |
| 98 | alignas(16) static int32_t w79[1024]; |
| 99 | alignas(16) static int8_t w80[9216]; |
| 100 | alignas(16) static int32_t w81[1024]; |
| 101 | alignas(16) static int8_t w82[1048576]; |
| 102 | alignas(16) static int32_t w83[1024]; |
| 103 | alignas(16) static int8_t w84[1025024]; |
| 104 | alignas(16) static int32_t w85[1001]; |
| 105 | |
| 106 | std::random_device random_device; |
| 107 | auto rng = std::mt19937(random_device()); |
| 108 | auto i8rng = std::bind(std::uniform_int_distribution<int32_t>(-127, 127), std::ref(rng)); |
| 109 | auto i32rng = std::bind(std::uniform_int_distribution<int32_t>(-10000, 10000), std::ref(rng)); |
| 110 | std::generate(v0, v0 + 150528, std::ref(i8rng)); |
| 111 | std::generate(v1, v1 + 401408, std::ref(i8rng)); |
| 112 | std::generate(v2, v2 + 401408, std::ref(i8rng)); |
| 113 | std::generate(v3, v3 + 802816, std::ref(i8rng)); |
| 114 | std::generate(v4, v4 + 200704, std::ref(i8rng)); |
| 115 | std::generate(v5, v5 + 401408, std::ref(i8rng)); |
| 116 | std::generate(v6, v6 + 401408, std::ref(i8rng)); |
| 117 | std::generate(v7, v7 + 401408, std::ref(i8rng)); |
| 118 | std::generate(v8, v8 + 100352, std::ref(i8rng)); |
| 119 | std::generate(v9, v9 + 200704, std::ref(i8rng)); |
| 120 | std::generate(v10, v10 + 200704, std::ref(i8rng)); |
| 121 | std::generate(v11, v11 + 200704, std::ref(i8rng)); |
| 122 | std::generate(v12, v12 + 50176, std::ref(i8rng)); |
| 123 | std::generate(v13, v13 + 100352, std::ref(i8rng)); |
| 124 | std::generate(v14, v14 + 100352, std::ref(i8rng)); |
| 125 | std::generate(v15, v15 + 100352, std::ref(i8rng)); |
| 126 | std::generate(v16, v16 + 100352, std::ref(i8rng)); |
| 127 | std::generate(v17, v17 + 100352, std::ref(i8rng)); |
| 128 | std::generate(v18, v18 + 100352, std::ref(i8rng)); |
| 129 | std::generate(v19, v19 + 100352, std::ref(i8rng)); |
| 130 | std::generate(v20, v20 + 100352, std::ref(i8rng)); |
| 131 | std::generate(v21, v21 + 100352, std::ref(i8rng)); |
| 132 | std::generate(v22, v22 + 100352, std::ref(i8rng)); |
| 133 | std::generate(v23, v23 + 100352, std::ref(i8rng)); |
| 134 | std::generate(v24, v24 + 25088, std::ref(i8rng)); |
| 135 | std::generate(v25, v25 + 50176, std::ref(i8rng)); |
| 136 | std::generate(v26, v26 + 50176, std::ref(i8rng)); |
| 137 | std::generate(v27, v27 + 50176, std::ref(i8rng)); |
| 138 | std::generate(v28, v28 + 1024, std::ref(i8rng)); |
| 139 | std::generate(v29, v29 + 1001, std::ref(i8rng)); |
| 140 | std::generate(w30, w30 + 864, std::ref(i8rng)); |
| 141 | std::generate(w31, w31 + 32, std::ref(i32rng)); |
| 142 | std::generate(w32, w32 + 288, std::ref(i8rng)); |
| 143 | std::generate(w33, w33 + 32, std::ref(i32rng)); |
| 144 | std::generate(w34, w34 + 2048, std::ref(i8rng)); |
| 145 | std::generate(w35, w35 + 64, std::ref(i32rng)); |
| 146 | std::generate(w36, w36 + 576, std::ref(i8rng)); |
| 147 | std::generate(w37, w37 + 64, std::ref(i32rng)); |
| 148 | std::generate(w38, w38 + 8192, std::ref(i8rng)); |
| 149 | std::generate(w39, w39 + 128, std::ref(i32rng)); |
| 150 | std::generate(w40, w40 + 1152, std::ref(i8rng)); |
| 151 | std::generate(w41, w41 + 128, std::ref(i32rng)); |
| 152 | std::generate(w42, w42 + 16384, std::ref(i8rng)); |
| 153 | std::generate(w43, w43 + 128, std::ref(i32rng)); |
| 154 | std::generate(w44, w44 + 1152, std::ref(i8rng)); |
| 155 | std::generate(w45, w45 + 128, std::ref(i32rng)); |
| 156 | std::generate(w46, w46 + 32768, std::ref(i8rng)); |
| 157 | std::generate(w47, w47 + 256, std::ref(i32rng)); |
| 158 | std::generate(w48, w48 + 2304, std::ref(i8rng)); |
| 159 | std::generate(w49, w49 + 256, std::ref(i32rng)); |
| 160 | std::generate(w50, w50 + 65536, std::ref(i8rng)); |
| 161 | std::generate(w51, w51 + 256, std::ref(i32rng)); |
| 162 | std::generate(w52, w52 + 2304, std::ref(i8rng)); |
| 163 | std::generate(w53, w53 + 256, std::ref(i32rng)); |
| 164 | std::generate(w54, w54 + 131072, std::ref(i8rng)); |
| 165 | std::generate(w55, w55 + 512, std::ref(i32rng)); |
| 166 | std::generate(w56, w56 + 4608, std::ref(i8rng)); |
| 167 | std::generate(w57, w57 + 512, std::ref(i32rng)); |
| 168 | std::generate(w58, w58 + 262144, std::ref(i8rng)); |
| 169 | std::generate(w59, w59 + 512, std::ref(i32rng)); |
| 170 | std::generate(w60, w60 + 4608, std::ref(i8rng)); |
| 171 | std::generate(w61, w61 + 512, std::ref(i32rng)); |
| 172 | std::generate(w62, w62 + 262144, std::ref(i8rng)); |
| 173 | std::generate(w63, w63 + 512, std::ref(i32rng)); |
| 174 | std::generate(w64, w64 + 4608, std::ref(i8rng)); |
| 175 | std::generate(w65, w65 + 512, std::ref(i32rng)); |
| 176 | std::generate(w66, w66 + 262144, std::ref(i8rng)); |
| 177 | std::generate(w67, w67 + 512, std::ref(i32rng)); |
| 178 | std::generate(w68, w68 + 4608, std::ref(i8rng)); |
| 179 | std::generate(w69, w69 + 512, std::ref(i32rng)); |
| 180 | std::generate(w70, w70 + 262144, std::ref(i8rng)); |
| 181 | std::generate(w71, w71 + 512, std::ref(i32rng)); |
| 182 | std::generate(w72, w72 + 4608, std::ref(i8rng)); |
| 183 | std::generate(w73, w73 + 512, std::ref(i32rng)); |
| 184 | std::generate(w74, w74 + 262144, std::ref(i8rng)); |
| 185 | std::generate(w75, w75 + 512, std::ref(i32rng)); |
| 186 | std::generate(w76, w76 + 4608, std::ref(i8rng)); |
| 187 | std::generate(w77, w77 + 512, std::ref(i32rng)); |
| 188 | std::generate(w78, w78 + 524288, std::ref(i8rng)); |
| 189 | std::generate(w79, w79 + 1024, std::ref(i32rng)); |
| 190 | std::generate(w80, w80 + 9216, std::ref(i8rng)); |
| 191 | std::generate(w81, w81 + 1024, std::ref(i32rng)); |
| 192 | std::generate(w82, w82 + 1048576, std::ref(i8rng)); |
| 193 | std::generate(w83, w83 + 1024, std::ref(i32rng)); |
| 194 | std::generate(w84, w84 + 1025024, std::ref(i8rng)); |
| 195 | std::generate(w85, w85 + 1001, std::ref(i32rng)); |
| 196 | |
| 197 | ExecutionPlan operators; |
| 198 | xnn_status status; |
| 199 | |
| 200 | xnn_operator_t op0 = nullptr; |
| 201 | status = xnn_create_convolution2d_nhwc_qs8( |
| 202 | 0 /* top padding */, 1 /* right padding */, |
| 203 | 1 /* bottom padding */, 0 /* left padding */, |
| 204 | 3 /* kernel height */, 3 /* kernel width */, |
| 205 | 2 /* subsampling height */, 2 /* subsampling width */, |
| 206 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 207 | 1 /* groups */, |
| 208 | 3 /* input channels per group */, |
| 209 | 32 /* output_channels_per_group */, |
| 210 | 3 /* input pixel stride */, |
| 211 | 32 /* output pixel stride */, |
| 212 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 213 | w30, w31, |
| 214 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 215 | 0 /* flags */, |
| 216 | &op0); |
| 217 | if (status != xnn_status_success) { |
| 218 | std::cerr << "failed to create operation #0" << std::endl; |
| 219 | return ExecutionPlan(); |
| 220 | } |
| 221 | operators.emplace_back(op0, xnn_delete_operator); |
| 222 | |
| 223 | xnn_operator_t op1 = nullptr; |
| 224 | status = xnn_create_convolution2d_nhwc_qs8( |
| 225 | 1 /* top padding */, 1 /* right padding */, |
| 226 | 1 /* bottom padding */, 1 /* left padding */, |
| 227 | 3 /* kernel height */, 3 /* kernel width */, |
| 228 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 229 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 230 | 32 /* groups */, |
| 231 | 1 /* input channels per group */, |
| 232 | 1 /* output_channels_per_group */, |
| 233 | 32 /* input pixel stride */, |
| 234 | 32 /* output pixel stride */, |
| 235 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 236 | w32, w33, |
| 237 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 238 | 0 /* flags */, |
| 239 | &op1); |
| 240 | if (status != xnn_status_success) { |
| 241 | std::cerr << "failed to create operation #1" << std::endl; |
| 242 | return ExecutionPlan(); |
| 243 | } |
| 244 | operators.emplace_back(op1, xnn_delete_operator); |
| 245 | |
| 246 | xnn_operator_t op2 = nullptr; |
| 247 | status = xnn_create_convolution2d_nhwc_qs8( |
| 248 | 0 /* top padding */, 0 /* right padding */, |
| 249 | 0 /* bottom padding */, 0 /* left padding */, |
| 250 | 1 /* kernel height */, 1 /* kernel width */, |
| 251 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 252 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 253 | 1 /* groups */, |
| 254 | 32 /* input channels per group */, |
| 255 | 64 /* output_channels_per_group */, |
| 256 | 32 /* input pixel stride */, |
| 257 | 64 /* output pixel stride */, |
| 258 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 259 | w34, w35, |
| 260 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 261 | 0 /* flags */, |
| 262 | &op2); |
| 263 | if (status != xnn_status_success) { |
| 264 | std::cerr << "failed to create operation #2" << std::endl; |
| 265 | return ExecutionPlan(); |
| 266 | } |
| 267 | operators.emplace_back(op2, xnn_delete_operator); |
| 268 | |
| 269 | xnn_operator_t op3 = nullptr; |
| 270 | status = xnn_create_convolution2d_nhwc_qs8( |
| 271 | 0 /* top padding */, 1 /* right padding */, |
| 272 | 1 /* bottom padding */, 0 /* left padding */, |
| 273 | 3 /* kernel height */, 3 /* kernel width */, |
| 274 | 2 /* subsampling height */, 2 /* subsampling width */, |
| 275 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 276 | 64 /* groups */, |
| 277 | 1 /* input channels per group */, |
| 278 | 1 /* output_channels_per_group */, |
| 279 | 64 /* input pixel stride */, |
| 280 | 64 /* output pixel stride */, |
| 281 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 282 | w36, w37, |
| 283 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 284 | 0 /* flags */, |
| 285 | &op3); |
| 286 | if (status != xnn_status_success) { |
| 287 | std::cerr << "failed to create operation #3" << std::endl; |
| 288 | return ExecutionPlan(); |
| 289 | } |
| 290 | operators.emplace_back(op3, xnn_delete_operator); |
| 291 | |
| 292 | xnn_operator_t op4 = nullptr; |
| 293 | status = xnn_create_convolution2d_nhwc_qs8( |
| 294 | 0 /* top padding */, 0 /* right padding */, |
| 295 | 0 /* bottom padding */, 0 /* left padding */, |
| 296 | 1 /* kernel height */, 1 /* kernel width */, |
| 297 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 298 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 299 | 1 /* groups */, |
| 300 | 64 /* input channels per group */, |
| 301 | 128 /* output_channels_per_group */, |
| 302 | 64 /* input pixel stride */, |
| 303 | 128 /* output pixel stride */, |
| 304 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 305 | w38, w39, |
| 306 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 307 | 0 /* flags */, |
| 308 | &op4); |
| 309 | if (status != xnn_status_success) { |
| 310 | std::cerr << "failed to create operation #4" << std::endl; |
| 311 | return ExecutionPlan(); |
| 312 | } |
| 313 | operators.emplace_back(op4, xnn_delete_operator); |
| 314 | |
| 315 | xnn_operator_t op5 = nullptr; |
| 316 | status = xnn_create_convolution2d_nhwc_qs8( |
| 317 | 1 /* top padding */, 1 /* right padding */, |
| 318 | 1 /* bottom padding */, 1 /* left padding */, |
| 319 | 3 /* kernel height */, 3 /* kernel width */, |
| 320 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 321 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 322 | 128 /* groups */, |
| 323 | 1 /* input channels per group */, |
| 324 | 1 /* output_channels_per_group */, |
| 325 | 128 /* input pixel stride */, |
| 326 | 128 /* output pixel stride */, |
| 327 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 328 | w40, w41, |
| 329 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 330 | 0 /* flags */, |
| 331 | &op5); |
| 332 | if (status != xnn_status_success) { |
| 333 | std::cerr << "failed to create operation #5" << std::endl; |
| 334 | return ExecutionPlan(); |
| 335 | } |
| 336 | operators.emplace_back(op5, xnn_delete_operator); |
| 337 | |
| 338 | xnn_operator_t op6 = nullptr; |
| 339 | status = xnn_create_convolution2d_nhwc_qs8( |
| 340 | 0 /* top padding */, 0 /* right padding */, |
| 341 | 0 /* bottom padding */, 0 /* left padding */, |
| 342 | 1 /* kernel height */, 1 /* kernel width */, |
| 343 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 344 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 345 | 1 /* groups */, |
| 346 | 128 /* input channels per group */, |
| 347 | 128 /* output_channels_per_group */, |
| 348 | 128 /* input pixel stride */, |
| 349 | 128 /* output pixel stride */, |
| 350 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 351 | w42, w43, |
| 352 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 353 | 0 /* flags */, |
| 354 | &op6); |
| 355 | if (status != xnn_status_success) { |
| 356 | std::cerr << "failed to create operation #6" << std::endl; |
| 357 | return ExecutionPlan(); |
| 358 | } |
| 359 | operators.emplace_back(op6, xnn_delete_operator); |
| 360 | |
| 361 | xnn_operator_t op7 = nullptr; |
| 362 | status = xnn_create_convolution2d_nhwc_qs8( |
| 363 | 0 /* top padding */, 1 /* right padding */, |
| 364 | 1 /* bottom padding */, 0 /* left padding */, |
| 365 | 3 /* kernel height */, 3 /* kernel width */, |
| 366 | 2 /* subsampling height */, 2 /* subsampling width */, |
| 367 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 368 | 128 /* groups */, |
| 369 | 1 /* input channels per group */, |
| 370 | 1 /* output_channels_per_group */, |
| 371 | 128 /* input pixel stride */, |
| 372 | 128 /* output pixel stride */, |
| 373 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 374 | w44, w45, |
| 375 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 376 | 0 /* flags */, |
| 377 | &op7); |
| 378 | if (status != xnn_status_success) { |
| 379 | std::cerr << "failed to create operation #7" << std::endl; |
| 380 | return ExecutionPlan(); |
| 381 | } |
| 382 | operators.emplace_back(op7, xnn_delete_operator); |
| 383 | |
| 384 | xnn_operator_t op8 = nullptr; |
| 385 | status = xnn_create_convolution2d_nhwc_qs8( |
| 386 | 0 /* top padding */, 0 /* right padding */, |
| 387 | 0 /* bottom padding */, 0 /* left padding */, |
| 388 | 1 /* kernel height */, 1 /* kernel width */, |
| 389 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 390 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 391 | 1 /* groups */, |
| 392 | 128 /* input channels per group */, |
| 393 | 256 /* output_channels_per_group */, |
| 394 | 128 /* input pixel stride */, |
| 395 | 256 /* output pixel stride */, |
| 396 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 397 | w46, w47, |
| 398 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 399 | 0 /* flags */, |
| 400 | &op8); |
| 401 | if (status != xnn_status_success) { |
| 402 | std::cerr << "failed to create operation #8" << std::endl; |
| 403 | return ExecutionPlan(); |
| 404 | } |
| 405 | operators.emplace_back(op8, xnn_delete_operator); |
| 406 | |
| 407 | xnn_operator_t op9 = nullptr; |
| 408 | status = xnn_create_convolution2d_nhwc_qs8( |
| 409 | 1 /* top padding */, 1 /* right padding */, |
| 410 | 1 /* bottom padding */, 1 /* left padding */, |
| 411 | 3 /* kernel height */, 3 /* kernel width */, |
| 412 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 413 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 414 | 256 /* groups */, |
| 415 | 1 /* input channels per group */, |
| 416 | 1 /* output_channels_per_group */, |
| 417 | 256 /* input pixel stride */, |
| 418 | 256 /* output pixel stride */, |
| 419 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 420 | w48, w49, |
| 421 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 422 | 0 /* flags */, |
| 423 | &op9); |
| 424 | if (status != xnn_status_success) { |
| 425 | std::cerr << "failed to create operation #9" << std::endl; |
| 426 | return ExecutionPlan(); |
| 427 | } |
| 428 | operators.emplace_back(op9, xnn_delete_operator); |
| 429 | |
| 430 | xnn_operator_t op10 = nullptr; |
| 431 | status = xnn_create_convolution2d_nhwc_qs8( |
| 432 | 0 /* top padding */, 0 /* right padding */, |
| 433 | 0 /* bottom padding */, 0 /* left padding */, |
| 434 | 1 /* kernel height */, 1 /* kernel width */, |
| 435 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 436 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 437 | 1 /* groups */, |
| 438 | 256 /* input channels per group */, |
| 439 | 256 /* output_channels_per_group */, |
| 440 | 256 /* input pixel stride */, |
| 441 | 256 /* output pixel stride */, |
| 442 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 443 | w50, w51, |
| 444 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 445 | 0 /* flags */, |
| 446 | &op10); |
| 447 | if (status != xnn_status_success) { |
| 448 | std::cerr << "failed to create operation #10" << std::endl; |
| 449 | return ExecutionPlan(); |
| 450 | } |
| 451 | operators.emplace_back(op10, xnn_delete_operator); |
| 452 | |
| 453 | xnn_operator_t op11 = nullptr; |
| 454 | status = xnn_create_convolution2d_nhwc_qs8( |
| 455 | 0 /* top padding */, 1 /* right padding */, |
| 456 | 1 /* bottom padding */, 0 /* left padding */, |
| 457 | 3 /* kernel height */, 3 /* kernel width */, |
| 458 | 2 /* subsampling height */, 2 /* subsampling width */, |
| 459 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 460 | 256 /* groups */, |
| 461 | 1 /* input channels per group */, |
| 462 | 1 /* output_channels_per_group */, |
| 463 | 256 /* input pixel stride */, |
| 464 | 256 /* output pixel stride */, |
| 465 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 466 | w52, w53, |
| 467 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 468 | 0 /* flags */, |
| 469 | &op11); |
| 470 | if (status != xnn_status_success) { |
| 471 | std::cerr << "failed to create operation #11" << std::endl; |
| 472 | return ExecutionPlan(); |
| 473 | } |
| 474 | operators.emplace_back(op11, xnn_delete_operator); |
| 475 | |
| 476 | xnn_operator_t op12 = nullptr; |
| 477 | status = xnn_create_convolution2d_nhwc_qs8( |
| 478 | 0 /* top padding */, 0 /* right padding */, |
| 479 | 0 /* bottom padding */, 0 /* left padding */, |
| 480 | 1 /* kernel height */, 1 /* kernel width */, |
| 481 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 482 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 483 | 1 /* groups */, |
| 484 | 256 /* input channels per group */, |
| 485 | 512 /* output_channels_per_group */, |
| 486 | 256 /* input pixel stride */, |
| 487 | 512 /* output pixel stride */, |
| 488 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 489 | w54, w55, |
| 490 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 491 | 0 /* flags */, |
| 492 | &op12); |
| 493 | if (status != xnn_status_success) { |
| 494 | std::cerr << "failed to create operation #12" << std::endl; |
| 495 | return ExecutionPlan(); |
| 496 | } |
| 497 | operators.emplace_back(op12, xnn_delete_operator); |
| 498 | |
| 499 | xnn_operator_t op13 = nullptr; |
| 500 | status = xnn_create_convolution2d_nhwc_qs8( |
| 501 | 1 /* top padding */, 1 /* right padding */, |
| 502 | 1 /* bottom padding */, 1 /* left padding */, |
| 503 | 3 /* kernel height */, 3 /* kernel width */, |
| 504 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 505 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 506 | 512 /* groups */, |
| 507 | 1 /* input channels per group */, |
| 508 | 1 /* output_channels_per_group */, |
| 509 | 512 /* input pixel stride */, |
| 510 | 512 /* output pixel stride */, |
| 511 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 512 | w56, w57, |
| 513 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 514 | 0 /* flags */, |
| 515 | &op13); |
| 516 | if (status != xnn_status_success) { |
| 517 | std::cerr << "failed to create operation #13" << std::endl; |
| 518 | return ExecutionPlan(); |
| 519 | } |
| 520 | operators.emplace_back(op13, xnn_delete_operator); |
| 521 | |
| 522 | xnn_operator_t op14 = nullptr; |
| 523 | status = xnn_create_convolution2d_nhwc_qs8( |
| 524 | 0 /* top padding */, 0 /* right padding */, |
| 525 | 0 /* bottom padding */, 0 /* left padding */, |
| 526 | 1 /* kernel height */, 1 /* kernel width */, |
| 527 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 528 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 529 | 1 /* groups */, |
| 530 | 512 /* input channels per group */, |
| 531 | 512 /* output_channels_per_group */, |
| 532 | 512 /* input pixel stride */, |
| 533 | 512 /* output pixel stride */, |
| 534 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 535 | w58, w59, |
| 536 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 537 | 0 /* flags */, |
| 538 | &op14); |
| 539 | if (status != xnn_status_success) { |
| 540 | std::cerr << "failed to create operation #14" << std::endl; |
| 541 | return ExecutionPlan(); |
| 542 | } |
| 543 | operators.emplace_back(op14, xnn_delete_operator); |
| 544 | |
| 545 | xnn_operator_t op15 = nullptr; |
| 546 | status = xnn_create_convolution2d_nhwc_qs8( |
| 547 | 1 /* top padding */, 1 /* right padding */, |
| 548 | 1 /* bottom padding */, 1 /* left padding */, |
| 549 | 3 /* kernel height */, 3 /* kernel width */, |
| 550 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 551 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 552 | 512 /* groups */, |
| 553 | 1 /* input channels per group */, |
| 554 | 1 /* output_channels_per_group */, |
| 555 | 512 /* input pixel stride */, |
| 556 | 512 /* output pixel stride */, |
| 557 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 558 | w60, w61, |
| 559 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 560 | 0 /* flags */, |
| 561 | &op15); |
| 562 | if (status != xnn_status_success) { |
| 563 | std::cerr << "failed to create operation #15" << std::endl; |
| 564 | return ExecutionPlan(); |
| 565 | } |
| 566 | operators.emplace_back(op15, xnn_delete_operator); |
| 567 | |
| 568 | xnn_operator_t op16 = nullptr; |
| 569 | status = xnn_create_convolution2d_nhwc_qs8( |
| 570 | 0 /* top padding */, 0 /* right padding */, |
| 571 | 0 /* bottom padding */, 0 /* left padding */, |
| 572 | 1 /* kernel height */, 1 /* kernel width */, |
| 573 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 574 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 575 | 1 /* groups */, |
| 576 | 512 /* input channels per group */, |
| 577 | 512 /* output_channels_per_group */, |
| 578 | 512 /* input pixel stride */, |
| 579 | 512 /* output pixel stride */, |
| 580 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 581 | w62, w63, |
| 582 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 583 | 0 /* flags */, |
| 584 | &op16); |
| 585 | if (status != xnn_status_success) { |
| 586 | std::cerr << "failed to create operation #16" << std::endl; |
| 587 | return ExecutionPlan(); |
| 588 | } |
| 589 | operators.emplace_back(op16, xnn_delete_operator); |
| 590 | |
| 591 | xnn_operator_t op17 = nullptr; |
| 592 | status = xnn_create_convolution2d_nhwc_qs8( |
| 593 | 1 /* top padding */, 1 /* right padding */, |
| 594 | 1 /* bottom padding */, 1 /* left padding */, |
| 595 | 3 /* kernel height */, 3 /* kernel width */, |
| 596 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 597 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 598 | 512 /* groups */, |
| 599 | 1 /* input channels per group */, |
| 600 | 1 /* output_channels_per_group */, |
| 601 | 512 /* input pixel stride */, |
| 602 | 512 /* output pixel stride */, |
| 603 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 604 | w64, w65, |
| 605 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 606 | 0 /* flags */, |
| 607 | &op17); |
| 608 | if (status != xnn_status_success) { |
| 609 | std::cerr << "failed to create operation #17" << std::endl; |
| 610 | return ExecutionPlan(); |
| 611 | } |
| 612 | operators.emplace_back(op17, xnn_delete_operator); |
| 613 | |
| 614 | xnn_operator_t op18 = nullptr; |
| 615 | status = xnn_create_convolution2d_nhwc_qs8( |
| 616 | 0 /* top padding */, 0 /* right padding */, |
| 617 | 0 /* bottom padding */, 0 /* left padding */, |
| 618 | 1 /* kernel height */, 1 /* kernel width */, |
| 619 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 620 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 621 | 1 /* groups */, |
| 622 | 512 /* input channels per group */, |
| 623 | 512 /* output_channels_per_group */, |
| 624 | 512 /* input pixel stride */, |
| 625 | 512 /* output pixel stride */, |
| 626 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 627 | w66, w67, |
| 628 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 629 | 0 /* flags */, |
| 630 | &op18); |
| 631 | if (status != xnn_status_success) { |
| 632 | std::cerr << "failed to create operation #18" << std::endl; |
| 633 | return ExecutionPlan(); |
| 634 | } |
| 635 | operators.emplace_back(op18, xnn_delete_operator); |
| 636 | |
| 637 | xnn_operator_t op19 = nullptr; |
| 638 | status = xnn_create_convolution2d_nhwc_qs8( |
| 639 | 1 /* top padding */, 1 /* right padding */, |
| 640 | 1 /* bottom padding */, 1 /* left padding */, |
| 641 | 3 /* kernel height */, 3 /* kernel width */, |
| 642 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 643 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 644 | 512 /* groups */, |
| 645 | 1 /* input channels per group */, |
| 646 | 1 /* output_channels_per_group */, |
| 647 | 512 /* input pixel stride */, |
| 648 | 512 /* output pixel stride */, |
| 649 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 650 | w68, w69, |
| 651 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 652 | 0 /* flags */, |
| 653 | &op19); |
| 654 | if (status != xnn_status_success) { |
| 655 | std::cerr << "failed to create operation #19" << std::endl; |
| 656 | return ExecutionPlan(); |
| 657 | } |
| 658 | operators.emplace_back(op19, xnn_delete_operator); |
| 659 | |
| 660 | xnn_operator_t op20 = nullptr; |
| 661 | status = xnn_create_convolution2d_nhwc_qs8( |
| 662 | 0 /* top padding */, 0 /* right padding */, |
| 663 | 0 /* bottom padding */, 0 /* left padding */, |
| 664 | 1 /* kernel height */, 1 /* kernel width */, |
| 665 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 666 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 667 | 1 /* groups */, |
| 668 | 512 /* input channels per group */, |
| 669 | 512 /* output_channels_per_group */, |
| 670 | 512 /* input pixel stride */, |
| 671 | 512 /* output pixel stride */, |
| 672 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 673 | w70, w71, |
| 674 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 675 | 0 /* flags */, |
| 676 | &op20); |
| 677 | if (status != xnn_status_success) { |
| 678 | std::cerr << "failed to create operation #20" << std::endl; |
| 679 | return ExecutionPlan(); |
| 680 | } |
| 681 | operators.emplace_back(op20, xnn_delete_operator); |
| 682 | |
| 683 | xnn_operator_t op21 = nullptr; |
| 684 | status = xnn_create_convolution2d_nhwc_qs8( |
| 685 | 1 /* top padding */, 1 /* right padding */, |
| 686 | 1 /* bottom padding */, 1 /* left padding */, |
| 687 | 3 /* kernel height */, 3 /* kernel width */, |
| 688 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 689 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 690 | 512 /* groups */, |
| 691 | 1 /* input channels per group */, |
| 692 | 1 /* output_channels_per_group */, |
| 693 | 512 /* input pixel stride */, |
| 694 | 512 /* output pixel stride */, |
| 695 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 696 | w72, w73, |
| 697 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 698 | 0 /* flags */, |
| 699 | &op21); |
| 700 | if (status != xnn_status_success) { |
| 701 | std::cerr << "failed to create operation #21" << std::endl; |
| 702 | return ExecutionPlan(); |
| 703 | } |
| 704 | operators.emplace_back(op21, xnn_delete_operator); |
| 705 | |
| 706 | xnn_operator_t op22 = nullptr; |
| 707 | status = xnn_create_convolution2d_nhwc_qs8( |
| 708 | 0 /* top padding */, 0 /* right padding */, |
| 709 | 0 /* bottom padding */, 0 /* left padding */, |
| 710 | 1 /* kernel height */, 1 /* kernel width */, |
| 711 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 712 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 713 | 1 /* groups */, |
| 714 | 512 /* input channels per group */, |
| 715 | 512 /* output_channels_per_group */, |
| 716 | 512 /* input pixel stride */, |
| 717 | 512 /* output pixel stride */, |
| 718 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 719 | w74, w75, |
| 720 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 721 | 0 /* flags */, |
| 722 | &op22); |
| 723 | if (status != xnn_status_success) { |
| 724 | std::cerr << "failed to create operation #22" << std::endl; |
| 725 | return ExecutionPlan(); |
| 726 | } |
| 727 | operators.emplace_back(op22, xnn_delete_operator); |
| 728 | |
| 729 | xnn_operator_t op23 = nullptr; |
| 730 | status = xnn_create_convolution2d_nhwc_qs8( |
| 731 | 0 /* top padding */, 1 /* right padding */, |
| 732 | 1 /* bottom padding */, 0 /* left padding */, |
| 733 | 3 /* kernel height */, 3 /* kernel width */, |
| 734 | 2 /* subsampling height */, 2 /* subsampling width */, |
| 735 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 736 | 512 /* groups */, |
| 737 | 1 /* input channels per group */, |
| 738 | 1 /* output_channels_per_group */, |
| 739 | 512 /* input pixel stride */, |
| 740 | 512 /* output pixel stride */, |
| 741 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 742 | w76, w77, |
| 743 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 744 | 0 /* flags */, |
| 745 | &op23); |
| 746 | if (status != xnn_status_success) { |
| 747 | std::cerr << "failed to create operation #23" << std::endl; |
| 748 | return ExecutionPlan(); |
| 749 | } |
| 750 | operators.emplace_back(op23, xnn_delete_operator); |
| 751 | |
| 752 | xnn_operator_t op24 = nullptr; |
| 753 | status = xnn_create_convolution2d_nhwc_qs8( |
| 754 | 0 /* top padding */, 0 /* right padding */, |
| 755 | 0 /* bottom padding */, 0 /* left padding */, |
| 756 | 1 /* kernel height */, 1 /* kernel width */, |
| 757 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 758 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 759 | 1 /* groups */, |
| 760 | 512 /* input channels per group */, |
| 761 | 1024 /* output_channels_per_group */, |
| 762 | 512 /* input pixel stride */, |
| 763 | 1024 /* output pixel stride */, |
| 764 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 765 | w78, w79, |
| 766 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 767 | 0 /* flags */, |
| 768 | &op24); |
| 769 | if (status != xnn_status_success) { |
| 770 | std::cerr << "failed to create operation #24" << std::endl; |
| 771 | return ExecutionPlan(); |
| 772 | } |
| 773 | operators.emplace_back(op24, xnn_delete_operator); |
| 774 | |
| 775 | xnn_operator_t op25 = nullptr; |
| 776 | status = xnn_create_convolution2d_nhwc_qs8( |
| 777 | 1 /* top padding */, 1 /* right padding */, |
| 778 | 1 /* bottom padding */, 1 /* left padding */, |
| 779 | 3 /* kernel height */, 3 /* kernel width */, |
| 780 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 781 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 782 | 1024 /* groups */, |
| 783 | 1 /* input channels per group */, |
| 784 | 1 /* output_channels_per_group */, |
| 785 | 1024 /* input pixel stride */, |
| 786 | 1024 /* output pixel stride */, |
| 787 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 788 | w80, w81, |
| 789 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 790 | 0 /* flags */, |
| 791 | &op25); |
| 792 | if (status != xnn_status_success) { |
| 793 | std::cerr << "failed to create operation #25" << std::endl; |
| 794 | return ExecutionPlan(); |
| 795 | } |
| 796 | operators.emplace_back(op25, xnn_delete_operator); |
| 797 | |
| 798 | xnn_operator_t op26 = nullptr; |
| 799 | status = xnn_create_convolution2d_nhwc_qs8( |
| 800 | 0 /* top padding */, 0 /* right padding */, |
| 801 | 0 /* bottom padding */, 0 /* left padding */, |
| 802 | 1 /* kernel height */, 1 /* kernel width */, |
| 803 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 804 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 805 | 1 /* groups */, |
| 806 | 1024 /* input channels per group */, |
| 807 | 1024 /* output_channels_per_group */, |
| 808 | 1024 /* input pixel stride */, |
| 809 | 1024 /* output pixel stride */, |
| 810 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 811 | w82, w83, |
| 812 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 813 | 0 /* flags */, |
| 814 | &op26); |
| 815 | if (status != xnn_status_success) { |
| 816 | std::cerr << "failed to create operation #26" << std::endl; |
| 817 | return ExecutionPlan(); |
| 818 | } |
| 819 | operators.emplace_back(op26, xnn_delete_operator); |
| 820 | |
| 821 | xnn_operator_t op27 = nullptr; |
Marat Dukhan | 9e0b539 | 2020-08-07 02:29:34 -0700 | [diff] [blame] | 822 | status = xnn_create_global_average_pooling_nwc_qs8( |
Marat Dukhan | 0743cdf | 2020-08-04 18:52:07 -0700 | [diff] [blame] | 823 | 1024 /* channels */, 1024 /* input stride */, 1024 /* output stride */, |
Marat Dukhan | 9e0b539 | 2020-08-07 02:29:34 -0700 | [diff] [blame] | 824 | -1 /* input zero point */, 0.5f /* input scale */, |
| 825 | -1 /* output zero point */, 0.5f /* output scale */, |
| 826 | -126 /* output min */, 126 /* output max */, |
Marat Dukhan | 0743cdf | 2020-08-04 18:52:07 -0700 | [diff] [blame] | 827 | 0 /* flags */, |
| 828 | &op27); |
| 829 | if (status != xnn_status_success) { |
| 830 | std::cerr << "failed to create operation #27" << std::endl; |
| 831 | return ExecutionPlan(); |
| 832 | } |
| 833 | operators.emplace_back(op27, xnn_delete_operator); |
| 834 | |
| 835 | xnn_operator_t op28 = nullptr; |
| 836 | status = xnn_create_convolution2d_nhwc_qs8( |
| 837 | 0 /* top padding */, 0 /* right padding */, |
| 838 | 0 /* bottom padding */, 0 /* left padding */, |
| 839 | 1 /* kernel height */, 1 /* kernel width */, |
| 840 | 1 /* subsampling height */, 1 /* subsampling width */, |
| 841 | 1 /* dilation_height */, 1 /* dilation_width */, |
| 842 | 1 /* groups */, |
| 843 | 1024 /* input channels per group */, |
| 844 | 1001 /* output_channels_per_group */, |
| 845 | 1024 /* input pixel stride */, |
| 846 | 1001 /* output pixel stride */, |
| 847 | -1 /* input zero point */, 0.5f /* input scale */, 0.5f /* kernel scale */, |
| 848 | w84, w85, |
| 849 | -1 /* output zero point */, 0.5f /* output scale */, -126 /* output min */, 126 /* output max */, |
| 850 | 0 /* flags */, |
| 851 | &op28); |
| 852 | if (status != xnn_status_success) { |
| 853 | std::cerr << "failed to create operation #28" << std::endl; |
| 854 | return ExecutionPlan(); |
| 855 | } |
| 856 | operators.emplace_back(op28, xnn_delete_operator); |
| 857 | |
| 858 | |
| 859 | |
| 860 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 861 | op0, |
| 862 | 1 /* batch size */, 224 /* input height */, 224 /* input width */, |
| 863 | v0 /* input */, v1 /* output */, |
| 864 | threadpool /* threadpool */); |
| 865 | if (status != xnn_status_success) { |
| 866 | std::cerr << "failed to setup operation #0" << std::endl; |
| 867 | return ExecutionPlan(); |
| 868 | } |
| 869 | |
| 870 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 871 | op1, |
| 872 | 1 /* batch size */, 112 /* input height */, 112 /* input width */, |
| 873 | v1 /* input */, v2 /* output */, |
| 874 | threadpool /* threadpool */); |
| 875 | if (status != xnn_status_success) { |
| 876 | std::cerr << "failed to setup operation #1" << std::endl; |
| 877 | return ExecutionPlan(); |
| 878 | } |
| 879 | |
| 880 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 881 | op2, |
| 882 | 1 /* batch size */, 112 /* input height */, 112 /* input width */, |
| 883 | v2 /* input */, v3 /* output */, |
| 884 | threadpool /* threadpool */); |
| 885 | if (status != xnn_status_success) { |
| 886 | std::cerr << "failed to setup operation #2" << std::endl; |
| 887 | return ExecutionPlan(); |
| 888 | } |
| 889 | |
| 890 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 891 | op3, |
| 892 | 1 /* batch size */, 112 /* input height */, 112 /* input width */, |
| 893 | v3 /* input */, v4 /* output */, |
| 894 | threadpool /* threadpool */); |
| 895 | if (status != xnn_status_success) { |
| 896 | std::cerr << "failed to setup operation #3" << std::endl; |
| 897 | return ExecutionPlan(); |
| 898 | } |
| 899 | |
| 900 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 901 | op4, |
| 902 | 1 /* batch size */, 56 /* input height */, 56 /* input width */, |
| 903 | v4 /* input */, v5 /* output */, |
| 904 | threadpool /* threadpool */); |
| 905 | if (status != xnn_status_success) { |
| 906 | std::cerr << "failed to setup operation #4" << std::endl; |
| 907 | return ExecutionPlan(); |
| 908 | } |
| 909 | |
| 910 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 911 | op5, |
| 912 | 1 /* batch size */, 56 /* input height */, 56 /* input width */, |
| 913 | v5 /* input */, v6 /* output */, |
| 914 | threadpool /* threadpool */); |
| 915 | if (status != xnn_status_success) { |
| 916 | std::cerr << "failed to setup operation #5" << std::endl; |
| 917 | return ExecutionPlan(); |
| 918 | } |
| 919 | |
| 920 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 921 | op6, |
| 922 | 1 /* batch size */, 56 /* input height */, 56 /* input width */, |
| 923 | v6 /* input */, v7 /* output */, |
| 924 | threadpool /* threadpool */); |
| 925 | if (status != xnn_status_success) { |
| 926 | std::cerr << "failed to setup operation #6" << std::endl; |
| 927 | return ExecutionPlan(); |
| 928 | } |
| 929 | |
| 930 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 931 | op7, |
| 932 | 1 /* batch size */, 56 /* input height */, 56 /* input width */, |
| 933 | v7 /* input */, v8 /* output */, |
| 934 | threadpool /* threadpool */); |
| 935 | if (status != xnn_status_success) { |
| 936 | std::cerr << "failed to setup operation #7" << std::endl; |
| 937 | return ExecutionPlan(); |
| 938 | } |
| 939 | |
| 940 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 941 | op8, |
| 942 | 1 /* batch size */, 28 /* input height */, 28 /* input width */, |
| 943 | v8 /* input */, v9 /* output */, |
| 944 | threadpool /* threadpool */); |
| 945 | if (status != xnn_status_success) { |
| 946 | std::cerr << "failed to setup operation #8" << std::endl; |
| 947 | return ExecutionPlan(); |
| 948 | } |
| 949 | |
| 950 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 951 | op9, |
| 952 | 1 /* batch size */, 28 /* input height */, 28 /* input width */, |
| 953 | v9 /* input */, v10 /* output */, |
| 954 | threadpool /* threadpool */); |
| 955 | if (status != xnn_status_success) { |
| 956 | std::cerr << "failed to setup operation #9" << std::endl; |
| 957 | return ExecutionPlan(); |
| 958 | } |
| 959 | |
| 960 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 961 | op10, |
| 962 | 1 /* batch size */, 28 /* input height */, 28 /* input width */, |
| 963 | v10 /* input */, v11 /* output */, |
| 964 | threadpool /* threadpool */); |
| 965 | if (status != xnn_status_success) { |
| 966 | std::cerr << "failed to setup operation #10" << std::endl; |
| 967 | return ExecutionPlan(); |
| 968 | } |
| 969 | |
| 970 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 971 | op11, |
| 972 | 1 /* batch size */, 28 /* input height */, 28 /* input width */, |
| 973 | v11 /* input */, v12 /* output */, |
| 974 | threadpool /* threadpool */); |
| 975 | if (status != xnn_status_success) { |
| 976 | std::cerr << "failed to setup operation #11" << std::endl; |
| 977 | return ExecutionPlan(); |
| 978 | } |
| 979 | |
| 980 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 981 | op12, |
| 982 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 983 | v12 /* input */, v13 /* output */, |
| 984 | threadpool /* threadpool */); |
| 985 | if (status != xnn_status_success) { |
| 986 | std::cerr << "failed to setup operation #12" << std::endl; |
| 987 | return ExecutionPlan(); |
| 988 | } |
| 989 | |
| 990 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 991 | op13, |
| 992 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 993 | v13 /* input */, v14 /* output */, |
| 994 | threadpool /* threadpool */); |
| 995 | if (status != xnn_status_success) { |
| 996 | std::cerr << "failed to setup operation #13" << std::endl; |
| 997 | return ExecutionPlan(); |
| 998 | } |
| 999 | |
| 1000 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1001 | op14, |
| 1002 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1003 | v14 /* input */, v15 /* output */, |
| 1004 | threadpool /* threadpool */); |
| 1005 | if (status != xnn_status_success) { |
| 1006 | std::cerr << "failed to setup operation #14" << std::endl; |
| 1007 | return ExecutionPlan(); |
| 1008 | } |
| 1009 | |
| 1010 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1011 | op15, |
| 1012 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1013 | v15 /* input */, v16 /* output */, |
| 1014 | threadpool /* threadpool */); |
| 1015 | if (status != xnn_status_success) { |
| 1016 | std::cerr << "failed to setup operation #15" << std::endl; |
| 1017 | return ExecutionPlan(); |
| 1018 | } |
| 1019 | |
| 1020 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1021 | op16, |
| 1022 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1023 | v16 /* input */, v17 /* output */, |
| 1024 | threadpool /* threadpool */); |
| 1025 | if (status != xnn_status_success) { |
| 1026 | std::cerr << "failed to setup operation #16" << std::endl; |
| 1027 | return ExecutionPlan(); |
| 1028 | } |
| 1029 | |
| 1030 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1031 | op17, |
| 1032 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1033 | v17 /* input */, v18 /* output */, |
| 1034 | threadpool /* threadpool */); |
| 1035 | if (status != xnn_status_success) { |
| 1036 | std::cerr << "failed to setup operation #17" << std::endl; |
| 1037 | return ExecutionPlan(); |
| 1038 | } |
| 1039 | |
| 1040 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1041 | op18, |
| 1042 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1043 | v18 /* input */, v19 /* output */, |
| 1044 | threadpool /* threadpool */); |
| 1045 | if (status != xnn_status_success) { |
| 1046 | std::cerr << "failed to setup operation #18" << std::endl; |
| 1047 | return ExecutionPlan(); |
| 1048 | } |
| 1049 | |
| 1050 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1051 | op19, |
| 1052 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1053 | v19 /* input */, v20 /* output */, |
| 1054 | threadpool /* threadpool */); |
| 1055 | if (status != xnn_status_success) { |
| 1056 | std::cerr << "failed to setup operation #19" << std::endl; |
| 1057 | return ExecutionPlan(); |
| 1058 | } |
| 1059 | |
| 1060 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1061 | op20, |
| 1062 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1063 | v20 /* input */, v21 /* output */, |
| 1064 | threadpool /* threadpool */); |
| 1065 | if (status != xnn_status_success) { |
| 1066 | std::cerr << "failed to setup operation #20" << std::endl; |
| 1067 | return ExecutionPlan(); |
| 1068 | } |
| 1069 | |
| 1070 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1071 | op21, |
| 1072 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1073 | v21 /* input */, v22 /* output */, |
| 1074 | threadpool /* threadpool */); |
| 1075 | if (status != xnn_status_success) { |
| 1076 | std::cerr << "failed to setup operation #21" << std::endl; |
| 1077 | return ExecutionPlan(); |
| 1078 | } |
| 1079 | |
| 1080 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1081 | op22, |
| 1082 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1083 | v22 /* input */, v23 /* output */, |
| 1084 | threadpool /* threadpool */); |
| 1085 | if (status != xnn_status_success) { |
| 1086 | std::cerr << "failed to setup operation #22" << std::endl; |
| 1087 | return ExecutionPlan(); |
| 1088 | } |
| 1089 | |
| 1090 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1091 | op23, |
| 1092 | 1 /* batch size */, 14 /* input height */, 14 /* input width */, |
| 1093 | v23 /* input */, v24 /* output */, |
| 1094 | threadpool /* threadpool */); |
| 1095 | if (status != xnn_status_success) { |
| 1096 | std::cerr << "failed to setup operation #23" << std::endl; |
| 1097 | return ExecutionPlan(); |
| 1098 | } |
| 1099 | |
| 1100 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1101 | op24, |
| 1102 | 1 /* batch size */, 7 /* input height */, 7 /* input width */, |
| 1103 | v24 /* input */, v25 /* output */, |
| 1104 | threadpool /* threadpool */); |
| 1105 | if (status != xnn_status_success) { |
| 1106 | std::cerr << "failed to setup operation #24" << std::endl; |
| 1107 | return ExecutionPlan(); |
| 1108 | } |
| 1109 | |
| 1110 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1111 | op25, |
| 1112 | 1 /* batch size */, 7 /* input height */, 7 /* input width */, |
| 1113 | v25 /* input */, v26 /* output */, |
| 1114 | threadpool /* threadpool */); |
| 1115 | if (status != xnn_status_success) { |
| 1116 | std::cerr << "failed to setup operation #25" << std::endl; |
| 1117 | return ExecutionPlan(); |
| 1118 | } |
| 1119 | |
| 1120 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1121 | op26, |
| 1122 | 1 /* batch size */, 7 /* input height */, 7 /* input width */, |
| 1123 | v26 /* input */, v27 /* output */, |
| 1124 | threadpool /* threadpool */); |
| 1125 | if (status != xnn_status_success) { |
| 1126 | std::cerr << "failed to setup operation #26" << std::endl; |
| 1127 | return ExecutionPlan(); |
| 1128 | } |
| 1129 | |
Marat Dukhan | 9e0b539 | 2020-08-07 02:29:34 -0700 | [diff] [blame] | 1130 | status = xnn_setup_global_average_pooling_nwc_qs8( |
Marat Dukhan | 0743cdf | 2020-08-04 18:52:07 -0700 | [diff] [blame] | 1131 | op27, |
| 1132 | 1 /* batch size */, 49 /* width */, |
Marat Dukhan | 9e0b539 | 2020-08-07 02:29:34 -0700 | [diff] [blame] | 1133 | v27 /* input */, v28 /* output */, |
Marat Dukhan | 0743cdf | 2020-08-04 18:52:07 -0700 | [diff] [blame] | 1134 | threadpool /* threadpool */); |
| 1135 | if (status != xnn_status_success) { |
| 1136 | std::cerr << "failed to setup operation #27" << std::endl; |
| 1137 | return ExecutionPlan(); |
| 1138 | } |
| 1139 | |
| 1140 | status = xnn_setup_convolution2d_nhwc_qs8( |
| 1141 | op28, |
| 1142 | 1 /* batch size */, 1 /* input height */, 1 /* input width */, |
| 1143 | v28 /* input */, v29 /* output */, |
| 1144 | threadpool /* threadpool */); |
| 1145 | if (status != xnn_status_success) { |
| 1146 | std::cerr << "failed to setup operation #28" << std::endl; |
| 1147 | return ExecutionPlan(); |
| 1148 | } |
| 1149 | |
| 1150 | #pragma clang diagnostic push |
| 1151 | #pragma clang diagnostic ignored "-Wpessimizing-move" |
| 1152 | return operators; |
| 1153 | #pragma clang diagnostic pop |
| 1154 | } |
| 1155 | |
| 1156 | } // namespace models |