1 // clang-format off 2 // Generated file (from: conv2d_v1_2.mod.py). Do not edit 3 void CreateModel_nhwc(Model *model) { 4 OperandType type0(Type::BOOL, {}); 5 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 6 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 7 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8 OperandType type4(Type::INT32, {}); 9 // Phase 1, operands 10 auto op1 = model->addOperand(&type1); 11 auto op2 = model->addOperand(&type2); 12 auto op3 = model->addOperand(&type3); 13 auto param = model->addOperand(&type4); 14 auto param1 = model->addOperand(&type4); 15 auto param2 = model->addOperand(&type4); 16 auto param3 = model->addOperand(&type4); 17 auto param4 = model->addOperand(&type4); 18 auto param5 = model->addOperand(&type4); 19 auto param6 = model->addOperand(&type4); 20 auto layout = model->addOperand(&type0); 21 auto op4 = model->addOperand(&type2); 22 // Phase 2, operations 23 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 24 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 25 static float op3_init[] = {0.0f}; 26 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 27 static int32_t param_init[] = {0}; 28 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 29 static int32_t param1_init[] = {0}; 30 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 31 static int32_t param2_init[] = {0}; 32 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 33 static int32_t param3_init[] = {0}; 34 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 35 static int32_t param4_init[] = {1}; 36 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 37 static int32_t param5_init[] = {1}; 38 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 39 static int32_t param6_init[] = {0}; 40 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 41 static bool8 layout_init[] = {false}; 42 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 43 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 44 // Phase 3, inputs and outputs 45 model->identifyInputsAndOutputs( 46 {op1}, 47 {op4}); 48 assert(model->isValid()); 49 } 50 51 inline bool is_ignored_nhwc(int i) { 52 static std::set<int> ignore = {}; 53 return ignore.find(i) != ignore.end(); 54 } 55 56 void CreateModel_nhwc_relaxed(Model *model) { 57 OperandType type0(Type::BOOL, {}); 58 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 59 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 60 OperandType type3(Type::TENSOR_FLOAT32, {1}); 61 OperandType type4(Type::INT32, {}); 62 // Phase 1, operands 63 auto op1 = model->addOperand(&type1); 64 auto op2 = model->addOperand(&type2); 65 auto op3 = model->addOperand(&type3); 66 auto param = model->addOperand(&type4); 67 auto param1 = model->addOperand(&type4); 68 auto param2 = model->addOperand(&type4); 69 auto param3 = model->addOperand(&type4); 70 auto param4 = model->addOperand(&type4); 71 auto param5 = model->addOperand(&type4); 72 auto param6 = model->addOperand(&type4); 73 auto layout = model->addOperand(&type0); 74 auto op4 = model->addOperand(&type2); 75 // Phase 2, operations 76 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 77 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 78 static float op3_init[] = {0.0f}; 79 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 80 static int32_t param_init[] = {0}; 81 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 82 static int32_t param1_init[] = {0}; 83 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 84 static int32_t param2_init[] = {0}; 85 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 86 static int32_t param3_init[] = {0}; 87 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 88 static int32_t param4_init[] = {1}; 89 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 90 static int32_t param5_init[] = {1}; 91 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 92 static int32_t param6_init[] = {0}; 93 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 94 static bool8 layout_init[] = {false}; 95 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 96 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 97 // Phase 3, inputs and outputs 98 model->identifyInputsAndOutputs( 99 {op1}, 100 {op4}); 101 // Phase 4: set relaxed execution 102 model->relaxComputationFloat32toFloat16(true); 103 assert(model->isValid()); 104 } 105 106 inline bool is_ignored_nhwc_relaxed(int i) { 107 static std::set<int> ignore = {}; 108 return ignore.find(i) != ignore.end(); 109 } 110 111 void CreateModel_nhwc_quant8(Model *model) { 112 OperandType type0(Type::BOOL, {}); 113 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 114 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 115 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 116 OperandType type4(Type::INT32, {}); 117 // Phase 1, operands 118 auto op1 = model->addOperand(&type32); 119 auto op2 = model->addOperand(&type33); 120 auto op3 = model->addOperand(&type34); 121 auto param = model->addOperand(&type4); 122 auto param1 = model->addOperand(&type4); 123 auto param2 = model->addOperand(&type4); 124 auto param3 = model->addOperand(&type4); 125 auto param4 = model->addOperand(&type4); 126 auto param5 = model->addOperand(&type4); 127 auto param6 = model->addOperand(&type4); 128 auto layout = model->addOperand(&type0); 129 auto op4 = model->addOperand(&type33); 130 // Phase 2, operations 131 static uint8_t op2_init[] = {2, 2, 2, 2}; 132 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4); 133 static int32_t op3_init[] = {0}; 134 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 135 static int32_t param_init[] = {0}; 136 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 137 static int32_t param1_init[] = {0}; 138 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 139 static int32_t param2_init[] = {0}; 140 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 141 static int32_t param3_init[] = {0}; 142 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 143 static int32_t param4_init[] = {1}; 144 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 145 static int32_t param5_init[] = {1}; 146 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 147 static int32_t param6_init[] = {0}; 148 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 149 static bool8 layout_init[] = {false}; 150 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 151 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 152 // Phase 3, inputs and outputs 153 model->identifyInputsAndOutputs( 154 {op1}, 155 {op4}); 156 assert(model->isValid()); 157 } 158 159 inline bool is_ignored_nhwc_quant8(int i) { 160 static std::set<int> ignore = {}; 161 return ignore.find(i) != ignore.end(); 162 } 163 164 void CreateModel_nhwc_channelQuant8(Model *model) { 165 OperandType type0(Type::BOOL, {}); 166 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 167 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 168 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 169 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 170 OperandType type4(Type::INT32, {}); 171 // Phase 1, operands 172 auto op1 = model->addOperand(&type32); 173 auto op2 = model->addOperand(&type35); 174 auto op3 = model->addOperand(&type36); 175 auto param = model->addOperand(&type4); 176 auto param1 = model->addOperand(&type4); 177 auto param2 = model->addOperand(&type4); 178 auto param3 = model->addOperand(&type4); 179 auto param4 = model->addOperand(&type4); 180 auto param5 = model->addOperand(&type4); 181 auto param6 = model->addOperand(&type4); 182 auto layout = model->addOperand(&type0); 183 auto op4 = model->addOperand(&type33); 184 // Phase 2, operations 185 static int8_t op2_init[] = {2, 2, 2, 2}; 186 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 4); 187 static int32_t op3_init[] = {0}; 188 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 189 static int32_t param_init[] = {0}; 190 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 191 static int32_t param1_init[] = {0}; 192 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 193 static int32_t param2_init[] = {0}; 194 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 195 static int32_t param3_init[] = {0}; 196 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 197 static int32_t param4_init[] = {1}; 198 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 199 static int32_t param5_init[] = {1}; 200 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 201 static int32_t param6_init[] = {0}; 202 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 203 static bool8 layout_init[] = {false}; 204 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 205 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 206 // Phase 3, inputs and outputs 207 model->identifyInputsAndOutputs( 208 {op1}, 209 {op4}); 210 assert(model->isValid()); 211 } 212 213 inline bool is_ignored_nhwc_channelQuant8(int i) { 214 static std::set<int> ignore = {}; 215 return ignore.find(i) != ignore.end(); 216 } 217 218 void CreateModel_nhwc_float16(Model *model) { 219 OperandType type0(Type::BOOL, {}); 220 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 221 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 222 OperandType type39(Type::TENSOR_FLOAT16, {1}); 223 OperandType type4(Type::INT32, {}); 224 // Phase 1, operands 225 auto op1 = model->addOperand(&type37); 226 auto op2 = model->addOperand(&type38); 227 auto op3 = model->addOperand(&type39); 228 auto param = model->addOperand(&type4); 229 auto param1 = model->addOperand(&type4); 230 auto param2 = model->addOperand(&type4); 231 auto param3 = model->addOperand(&type4); 232 auto param4 = model->addOperand(&type4); 233 auto param5 = model->addOperand(&type4); 234 auto param6 = model->addOperand(&type4); 235 auto layout = model->addOperand(&type0); 236 auto op4 = model->addOperand(&type38); 237 // Phase 2, operations 238 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 239 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4); 240 static _Float16 op3_init[] = {0.0f}; 241 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1); 242 static int32_t param_init[] = {0}; 243 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 244 static int32_t param1_init[] = {0}; 245 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 246 static int32_t param2_init[] = {0}; 247 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 248 static int32_t param3_init[] = {0}; 249 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 250 static int32_t param4_init[] = {1}; 251 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 252 static int32_t param5_init[] = {1}; 253 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 254 static int32_t param6_init[] = {0}; 255 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 256 static bool8 layout_init[] = {false}; 257 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 258 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 259 // Phase 3, inputs and outputs 260 model->identifyInputsAndOutputs( 261 {op1}, 262 {op4}); 263 assert(model->isValid()); 264 } 265 266 inline bool is_ignored_nhwc_float16(int i) { 267 static std::set<int> ignore = {}; 268 return ignore.find(i) != ignore.end(); 269 } 270 271 void CreateModel_nhwc_weight_as_input(Model *model) { 272 OperandType type0(Type::BOOL, {}); 273 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 274 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 275 OperandType type3(Type::TENSOR_FLOAT32, {1}); 276 OperandType type4(Type::INT32, {}); 277 // Phase 1, operands 278 auto op1 = model->addOperand(&type1); 279 auto op2 = model->addOperand(&type2); 280 auto op3 = model->addOperand(&type3); 281 auto param = model->addOperand(&type4); 282 auto param1 = model->addOperand(&type4); 283 auto param2 = model->addOperand(&type4); 284 auto param3 = model->addOperand(&type4); 285 auto param4 = model->addOperand(&type4); 286 auto param5 = model->addOperand(&type4); 287 auto param6 = model->addOperand(&type4); 288 auto layout = model->addOperand(&type0); 289 auto op4 = model->addOperand(&type2); 290 // Phase 2, operations 291 static int32_t param_init[] = {0}; 292 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 293 static int32_t param1_init[] = {0}; 294 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 295 static int32_t param2_init[] = {0}; 296 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 297 static int32_t param3_init[] = {0}; 298 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 299 static int32_t param4_init[] = {1}; 300 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 301 static int32_t param5_init[] = {1}; 302 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 303 static int32_t param6_init[] = {0}; 304 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 305 static bool8 layout_init[] = {false}; 306 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 307 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 308 // Phase 3, inputs and outputs 309 model->identifyInputsAndOutputs( 310 {op1, op2, op3}, 311 {op4}); 312 assert(model->isValid()); 313 } 314 315 inline bool is_ignored_nhwc_weight_as_input(int i) { 316 static std::set<int> ignore = {}; 317 return ignore.find(i) != ignore.end(); 318 } 319 320 void CreateModel_nhwc_weight_as_input_relaxed(Model *model) { 321 OperandType type0(Type::BOOL, {}); 322 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 323 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 324 OperandType type3(Type::TENSOR_FLOAT32, {1}); 325 OperandType type4(Type::INT32, {}); 326 // Phase 1, operands 327 auto op1 = model->addOperand(&type1); 328 auto op2 = model->addOperand(&type2); 329 auto op3 = model->addOperand(&type3); 330 auto param = model->addOperand(&type4); 331 auto param1 = model->addOperand(&type4); 332 auto param2 = model->addOperand(&type4); 333 auto param3 = model->addOperand(&type4); 334 auto param4 = model->addOperand(&type4); 335 auto param5 = model->addOperand(&type4); 336 auto param6 = model->addOperand(&type4); 337 auto layout = model->addOperand(&type0); 338 auto op4 = model->addOperand(&type2); 339 // Phase 2, operations 340 static int32_t param_init[] = {0}; 341 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 342 static int32_t param1_init[] = {0}; 343 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 344 static int32_t param2_init[] = {0}; 345 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 346 static int32_t param3_init[] = {0}; 347 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 348 static int32_t param4_init[] = {1}; 349 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 350 static int32_t param5_init[] = {1}; 351 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 352 static int32_t param6_init[] = {0}; 353 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 354 static bool8 layout_init[] = {false}; 355 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 356 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 357 // Phase 3, inputs and outputs 358 model->identifyInputsAndOutputs( 359 {op1, op2, op3}, 360 {op4}); 361 // Phase 4: set relaxed execution 362 model->relaxComputationFloat32toFloat16(true); 363 assert(model->isValid()); 364 } 365 366 inline bool is_ignored_nhwc_weight_as_input_relaxed(int i) { 367 static std::set<int> ignore = {}; 368 return ignore.find(i) != ignore.end(); 369 } 370 371 void CreateModel_nhwc_weight_as_input_quant8(Model *model) { 372 OperandType type0(Type::BOOL, {}); 373 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 374 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 375 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 376 OperandType type4(Type::INT32, {}); 377 // Phase 1, operands 378 auto op1 = model->addOperand(&type32); 379 auto op2 = model->addOperand(&type33); 380 auto op3 = model->addOperand(&type34); 381 auto param = model->addOperand(&type4); 382 auto param1 = model->addOperand(&type4); 383 auto param2 = model->addOperand(&type4); 384 auto param3 = model->addOperand(&type4); 385 auto param4 = model->addOperand(&type4); 386 auto param5 = model->addOperand(&type4); 387 auto param6 = model->addOperand(&type4); 388 auto layout = model->addOperand(&type0); 389 auto op4 = model->addOperand(&type33); 390 // Phase 2, operations 391 static int32_t param_init[] = {0}; 392 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 393 static int32_t param1_init[] = {0}; 394 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 395 static int32_t param2_init[] = {0}; 396 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 397 static int32_t param3_init[] = {0}; 398 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 399 static int32_t param4_init[] = {1}; 400 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 401 static int32_t param5_init[] = {1}; 402 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 403 static int32_t param6_init[] = {0}; 404 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 405 static bool8 layout_init[] = {false}; 406 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 407 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 408 // Phase 3, inputs and outputs 409 model->identifyInputsAndOutputs( 410 {op1, op2, op3}, 411 {op4}); 412 assert(model->isValid()); 413 } 414 415 inline bool is_ignored_nhwc_weight_as_input_quant8(int i) { 416 static std::set<int> ignore = {}; 417 return ignore.find(i) != ignore.end(); 418 } 419 420 void CreateModel_nhwc_weight_as_input_channelQuant8(Model *model) { 421 OperandType type0(Type::BOOL, {}); 422 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 423 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 424 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 425 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 426 OperandType type4(Type::INT32, {}); 427 // Phase 1, operands 428 auto op1 = model->addOperand(&type32); 429 auto op2 = model->addOperand(&type35); 430 auto op3 = model->addOperand(&type36); 431 auto param = model->addOperand(&type4); 432 auto param1 = model->addOperand(&type4); 433 auto param2 = model->addOperand(&type4); 434 auto param3 = model->addOperand(&type4); 435 auto param4 = model->addOperand(&type4); 436 auto param5 = model->addOperand(&type4); 437 auto param6 = model->addOperand(&type4); 438 auto layout = model->addOperand(&type0); 439 auto op4 = model->addOperand(&type33); 440 // Phase 2, operations 441 static int32_t param_init[] = {0}; 442 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 443 static int32_t param1_init[] = {0}; 444 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 445 static int32_t param2_init[] = {0}; 446 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 447 static int32_t param3_init[] = {0}; 448 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 449 static int32_t param4_init[] = {1}; 450 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 451 static int32_t param5_init[] = {1}; 452 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 453 static int32_t param6_init[] = {0}; 454 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 455 static bool8 layout_init[] = {false}; 456 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 457 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 458 // Phase 3, inputs and outputs 459 model->identifyInputsAndOutputs( 460 {op1, op2, op3}, 461 {op4}); 462 assert(model->isValid()); 463 } 464 465 inline bool is_ignored_nhwc_weight_as_input_channelQuant8(int i) { 466 static std::set<int> ignore = {}; 467 return ignore.find(i) != ignore.end(); 468 } 469 470 void CreateModel_nhwc_weight_as_input_float16(Model *model) { 471 OperandType type0(Type::BOOL, {}); 472 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 473 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 474 OperandType type39(Type::TENSOR_FLOAT16, {1}); 475 OperandType type4(Type::INT32, {}); 476 // Phase 1, operands 477 auto op1 = model->addOperand(&type37); 478 auto op2 = model->addOperand(&type38); 479 auto op3 = model->addOperand(&type39); 480 auto param = model->addOperand(&type4); 481 auto param1 = model->addOperand(&type4); 482 auto param2 = model->addOperand(&type4); 483 auto param3 = model->addOperand(&type4); 484 auto param4 = model->addOperand(&type4); 485 auto param5 = model->addOperand(&type4); 486 auto param6 = model->addOperand(&type4); 487 auto layout = model->addOperand(&type0); 488 auto op4 = model->addOperand(&type38); 489 // Phase 2, operations 490 static int32_t param_init[] = {0}; 491 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 492 static int32_t param1_init[] = {0}; 493 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 494 static int32_t param2_init[] = {0}; 495 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 496 static int32_t param3_init[] = {0}; 497 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 498 static int32_t param4_init[] = {1}; 499 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 500 static int32_t param5_init[] = {1}; 501 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 502 static int32_t param6_init[] = {0}; 503 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 504 static bool8 layout_init[] = {false}; 505 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 506 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 507 // Phase 3, inputs and outputs 508 model->identifyInputsAndOutputs( 509 {op1, op2, op3}, 510 {op4}); 511 assert(model->isValid()); 512 } 513 514 inline bool is_ignored_nhwc_weight_as_input_float16(int i) { 515 static std::set<int> ignore = {}; 516 return ignore.find(i) != ignore.end(); 517 } 518 519 void CreateModel_nchw(Model *model) { 520 OperandType type0(Type::BOOL, {}); 521 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 522 OperandType type3(Type::TENSOR_FLOAT32, {1}); 523 OperandType type4(Type::INT32, {}); 524 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 525 OperandType type41(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 526 // Phase 1, operands 527 auto op1 = model->addOperand(&type40); 528 auto op2 = model->addOperand(&type2); 529 auto op3 = model->addOperand(&type3); 530 auto param = model->addOperand(&type4); 531 auto param1 = model->addOperand(&type4); 532 auto param2 = model->addOperand(&type4); 533 auto param3 = model->addOperand(&type4); 534 auto param4 = model->addOperand(&type4); 535 auto param5 = model->addOperand(&type4); 536 auto param6 = model->addOperand(&type4); 537 auto layout = model->addOperand(&type0); 538 auto op4 = model->addOperand(&type41); 539 // Phase 2, operations 540 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 541 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 542 static float op3_init[] = {0.0f}; 543 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 544 static int32_t param_init[] = {0}; 545 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 546 static int32_t param1_init[] = {0}; 547 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 548 static int32_t param2_init[] = {0}; 549 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 550 static int32_t param3_init[] = {0}; 551 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 552 static int32_t param4_init[] = {1}; 553 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 554 static int32_t param5_init[] = {1}; 555 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 556 static int32_t param6_init[] = {0}; 557 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 558 static bool8 layout_init[] = {true}; 559 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 560 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 561 // Phase 3, inputs and outputs 562 model->identifyInputsAndOutputs( 563 {op1}, 564 {op4}); 565 assert(model->isValid()); 566 } 567 568 inline bool is_ignored_nchw(int i) { 569 static std::set<int> ignore = {}; 570 return ignore.find(i) != ignore.end(); 571 } 572 573 void CreateModel_nchw_relaxed(Model *model) { 574 OperandType type0(Type::BOOL, {}); 575 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 576 OperandType type3(Type::TENSOR_FLOAT32, {1}); 577 OperandType type4(Type::INT32, {}); 578 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 579 OperandType type41(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 580 // Phase 1, operands 581 auto op1 = model->addOperand(&type40); 582 auto op2 = model->addOperand(&type2); 583 auto op3 = model->addOperand(&type3); 584 auto param = model->addOperand(&type4); 585 auto param1 = model->addOperand(&type4); 586 auto param2 = model->addOperand(&type4); 587 auto param3 = model->addOperand(&type4); 588 auto param4 = model->addOperand(&type4); 589 auto param5 = model->addOperand(&type4); 590 auto param6 = model->addOperand(&type4); 591 auto layout = model->addOperand(&type0); 592 auto op4 = model->addOperand(&type41); 593 // Phase 2, operations 594 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 595 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 596 static float op3_init[] = {0.0f}; 597 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 598 static int32_t param_init[] = {0}; 599 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 600 static int32_t param1_init[] = {0}; 601 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 602 static int32_t param2_init[] = {0}; 603 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 604 static int32_t param3_init[] = {0}; 605 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 606 static int32_t param4_init[] = {1}; 607 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 608 static int32_t param5_init[] = {1}; 609 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 610 static int32_t param6_init[] = {0}; 611 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 612 static bool8 layout_init[] = {true}; 613 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 614 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 615 // Phase 3, inputs and outputs 616 model->identifyInputsAndOutputs( 617 {op1}, 618 {op4}); 619 // Phase 4: set relaxed execution 620 model->relaxComputationFloat32toFloat16(true); 621 assert(model->isValid()); 622 } 623 624 inline bool is_ignored_nchw_relaxed(int i) { 625 static std::set<int> ignore = {}; 626 return ignore.find(i) != ignore.end(); 627 } 628 629 void CreateModel_nchw_quant8(Model *model) { 630 OperandType type0(Type::BOOL, {}); 631 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 632 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 633 OperandType type4(Type::INT32, {}); 634 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 635 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0); 636 // Phase 1, operands 637 auto op1 = model->addOperand(&type42); 638 auto op2 = model->addOperand(&type33); 639 auto op3 = model->addOperand(&type34); 640 auto param = model->addOperand(&type4); 641 auto param1 = model->addOperand(&type4); 642 auto param2 = model->addOperand(&type4); 643 auto param3 = model->addOperand(&type4); 644 auto param4 = model->addOperand(&type4); 645 auto param5 = model->addOperand(&type4); 646 auto param6 = model->addOperand(&type4); 647 auto layout = model->addOperand(&type0); 648 auto op4 = model->addOperand(&type43); 649 // Phase 2, operations 650 static uint8_t op2_init[] = {2, 2, 2, 2}; 651 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4); 652 static int32_t op3_init[] = {0}; 653 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 654 static int32_t param_init[] = {0}; 655 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 656 static int32_t param1_init[] = {0}; 657 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 658 static int32_t param2_init[] = {0}; 659 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 660 static int32_t param3_init[] = {0}; 661 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 662 static int32_t param4_init[] = {1}; 663 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 664 static int32_t param5_init[] = {1}; 665 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 666 static int32_t param6_init[] = {0}; 667 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 668 static bool8 layout_init[] = {true}; 669 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 670 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 671 // Phase 3, inputs and outputs 672 model->identifyInputsAndOutputs( 673 {op1}, 674 {op4}); 675 assert(model->isValid()); 676 } 677 678 inline bool is_ignored_nchw_quant8(int i) { 679 static std::set<int> ignore = {}; 680 return ignore.find(i) != ignore.end(); 681 } 682 683 void CreateModel_nchw_channelQuant8(Model *model) { 684 OperandType type0(Type::BOOL, {}); 685 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 686 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 687 OperandType type4(Type::INT32, {}); 688 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 689 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0); 690 // Phase 1, operands 691 auto op1 = model->addOperand(&type42); 692 auto op2 = model->addOperand(&type35); 693 auto op3 = model->addOperand(&type36); 694 auto param = model->addOperand(&type4); 695 auto param1 = model->addOperand(&type4); 696 auto param2 = model->addOperand(&type4); 697 auto param3 = model->addOperand(&type4); 698 auto param4 = model->addOperand(&type4); 699 auto param5 = model->addOperand(&type4); 700 auto param6 = model->addOperand(&type4); 701 auto layout = model->addOperand(&type0); 702 auto op4 = model->addOperand(&type43); 703 // Phase 2, operations 704 static int8_t op2_init[] = {2, 2, 2, 2}; 705 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 4); 706 static int32_t op3_init[] = {0}; 707 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 708 static int32_t param_init[] = {0}; 709 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 710 static int32_t param1_init[] = {0}; 711 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 712 static int32_t param2_init[] = {0}; 713 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 714 static int32_t param3_init[] = {0}; 715 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 716 static int32_t param4_init[] = {1}; 717 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 718 static int32_t param5_init[] = {1}; 719 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 720 static int32_t param6_init[] = {0}; 721 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 722 static bool8 layout_init[] = {true}; 723 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 724 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 725 // Phase 3, inputs and outputs 726 model->identifyInputsAndOutputs( 727 {op1}, 728 {op4}); 729 assert(model->isValid()); 730 } 731 732 inline bool is_ignored_nchw_channelQuant8(int i) { 733 static std::set<int> ignore = {}; 734 return ignore.find(i) != ignore.end(); 735 } 736 737 void CreateModel_nchw_float16(Model *model) { 738 OperandType type0(Type::BOOL, {}); 739 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 740 OperandType type39(Type::TENSOR_FLOAT16, {1}); 741 OperandType type4(Type::INT32, {}); 742 OperandType type44(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); 743 OperandType type45(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 744 // Phase 1, operands 745 auto op1 = model->addOperand(&type44); 746 auto op2 = model->addOperand(&type38); 747 auto op3 = model->addOperand(&type39); 748 auto param = model->addOperand(&type4); 749 auto param1 = model->addOperand(&type4); 750 auto param2 = model->addOperand(&type4); 751 auto param3 = model->addOperand(&type4); 752 auto param4 = model->addOperand(&type4); 753 auto param5 = model->addOperand(&type4); 754 auto param6 = model->addOperand(&type4); 755 auto layout = model->addOperand(&type0); 756 auto op4 = model->addOperand(&type45); 757 // Phase 2, operations 758 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 759 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4); 760 static _Float16 op3_init[] = {0.0f}; 761 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1); 762 static int32_t param_init[] = {0}; 763 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 764 static int32_t param1_init[] = {0}; 765 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 766 static int32_t param2_init[] = {0}; 767 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 768 static int32_t param3_init[] = {0}; 769 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 770 static int32_t param4_init[] = {1}; 771 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 772 static int32_t param5_init[] = {1}; 773 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 774 static int32_t param6_init[] = {0}; 775 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 776 static bool8 layout_init[] = {true}; 777 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 778 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 779 // Phase 3, inputs and outputs 780 model->identifyInputsAndOutputs( 781 {op1}, 782 {op4}); 783 assert(model->isValid()); 784 } 785 786 inline bool is_ignored_nchw_float16(int i) { 787 static std::set<int> ignore = {}; 788 return ignore.find(i) != ignore.end(); 789 } 790 791 void CreateModel_nchw_weight_as_input(Model *model) { 792 OperandType type0(Type::BOOL, {}); 793 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 794 OperandType type3(Type::TENSOR_FLOAT32, {1}); 795 OperandType type4(Type::INT32, {}); 796 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 797 OperandType type41(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 798 // Phase 1, operands 799 auto op1 = model->addOperand(&type40); 800 auto op2 = model->addOperand(&type2); 801 auto op3 = model->addOperand(&type3); 802 auto param = model->addOperand(&type4); 803 auto param1 = model->addOperand(&type4); 804 auto param2 = model->addOperand(&type4); 805 auto param3 = model->addOperand(&type4); 806 auto param4 = model->addOperand(&type4); 807 auto param5 = model->addOperand(&type4); 808 auto param6 = model->addOperand(&type4); 809 auto layout = model->addOperand(&type0); 810 auto op4 = model->addOperand(&type41); 811 // Phase 2, operations 812 static int32_t param_init[] = {0}; 813 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 814 static int32_t param1_init[] = {0}; 815 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 816 static int32_t param2_init[] = {0}; 817 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 818 static int32_t param3_init[] = {0}; 819 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 820 static int32_t param4_init[] = {1}; 821 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 822 static int32_t param5_init[] = {1}; 823 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 824 static int32_t param6_init[] = {0}; 825 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 826 static bool8 layout_init[] = {true}; 827 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 828 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 829 // Phase 3, inputs and outputs 830 model->identifyInputsAndOutputs( 831 {op1, op2, op3}, 832 {op4}); 833 assert(model->isValid()); 834 } 835 836 inline bool is_ignored_nchw_weight_as_input(int i) { 837 static std::set<int> ignore = {}; 838 return ignore.find(i) != ignore.end(); 839 } 840 841 void CreateModel_nchw_weight_as_input_relaxed(Model *model) { 842 OperandType type0(Type::BOOL, {}); 843 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 844 OperandType type3(Type::TENSOR_FLOAT32, {1}); 845 OperandType type4(Type::INT32, {}); 846 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 847 OperandType type41(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 848 // Phase 1, operands 849 auto op1 = model->addOperand(&type40); 850 auto op2 = model->addOperand(&type2); 851 auto op3 = model->addOperand(&type3); 852 auto param = model->addOperand(&type4); 853 auto param1 = model->addOperand(&type4); 854 auto param2 = model->addOperand(&type4); 855 auto param3 = model->addOperand(&type4); 856 auto param4 = model->addOperand(&type4); 857 auto param5 = model->addOperand(&type4); 858 auto param6 = model->addOperand(&type4); 859 auto layout = model->addOperand(&type0); 860 auto op4 = model->addOperand(&type41); 861 // Phase 2, operations 862 static int32_t param_init[] = {0}; 863 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 864 static int32_t param1_init[] = {0}; 865 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 866 static int32_t param2_init[] = {0}; 867 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 868 static int32_t param3_init[] = {0}; 869 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 870 static int32_t param4_init[] = {1}; 871 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 872 static int32_t param5_init[] = {1}; 873 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 874 static int32_t param6_init[] = {0}; 875 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 876 static bool8 layout_init[] = {true}; 877 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 878 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 879 // Phase 3, inputs and outputs 880 model->identifyInputsAndOutputs( 881 {op1, op2, op3}, 882 {op4}); 883 // Phase 4: set relaxed execution 884 model->relaxComputationFloat32toFloat16(true); 885 assert(model->isValid()); 886 } 887 888 inline bool is_ignored_nchw_weight_as_input_relaxed(int i) { 889 static std::set<int> ignore = {}; 890 return ignore.find(i) != ignore.end(); 891 } 892 893 void CreateModel_nchw_weight_as_input_quant8(Model *model) { 894 OperandType type0(Type::BOOL, {}); 895 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 896 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 897 OperandType type4(Type::INT32, {}); 898 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 899 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0); 900 // Phase 1, operands 901 auto op1 = model->addOperand(&type42); 902 auto op2 = model->addOperand(&type33); 903 auto op3 = model->addOperand(&type34); 904 auto param = model->addOperand(&type4); 905 auto param1 = model->addOperand(&type4); 906 auto param2 = model->addOperand(&type4); 907 auto param3 = model->addOperand(&type4); 908 auto param4 = model->addOperand(&type4); 909 auto param5 = model->addOperand(&type4); 910 auto param6 = model->addOperand(&type4); 911 auto layout = model->addOperand(&type0); 912 auto op4 = model->addOperand(&type43); 913 // Phase 2, operations 914 static int32_t param_init[] = {0}; 915 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 916 static int32_t param1_init[] = {0}; 917 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 918 static int32_t param2_init[] = {0}; 919 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 920 static int32_t param3_init[] = {0}; 921 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 922 static int32_t param4_init[] = {1}; 923 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 924 static int32_t param5_init[] = {1}; 925 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 926 static int32_t param6_init[] = {0}; 927 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 928 static bool8 layout_init[] = {true}; 929 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 930 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 931 // Phase 3, inputs and outputs 932 model->identifyInputsAndOutputs( 933 {op1, op2, op3}, 934 {op4}); 935 assert(model->isValid()); 936 } 937 938 inline bool is_ignored_nchw_weight_as_input_quant8(int i) { 939 static std::set<int> ignore = {}; 940 return ignore.find(i) != ignore.end(); 941 } 942 943 void CreateModel_nchw_weight_as_input_channelQuant8(Model *model) { 944 OperandType type0(Type::BOOL, {}); 945 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 946 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 947 OperandType type4(Type::INT32, {}); 948 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 949 OperandType type43(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.125f, 0); 950 // Phase 1, operands 951 auto op1 = model->addOperand(&type42); 952 auto op2 = model->addOperand(&type35); 953 auto op3 = model->addOperand(&type36); 954 auto param = model->addOperand(&type4); 955 auto param1 = model->addOperand(&type4); 956 auto param2 = model->addOperand(&type4); 957 auto param3 = model->addOperand(&type4); 958 auto param4 = model->addOperand(&type4); 959 auto param5 = model->addOperand(&type4); 960 auto param6 = model->addOperand(&type4); 961 auto layout = model->addOperand(&type0); 962 auto op4 = model->addOperand(&type43); 963 // Phase 2, operations 964 static int32_t param_init[] = {0}; 965 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 966 static int32_t param1_init[] = {0}; 967 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 968 static int32_t param2_init[] = {0}; 969 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 970 static int32_t param3_init[] = {0}; 971 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 972 static int32_t param4_init[] = {1}; 973 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 974 static int32_t param5_init[] = {1}; 975 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 976 static int32_t param6_init[] = {0}; 977 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 978 static bool8 layout_init[] = {true}; 979 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 980 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 981 // Phase 3, inputs and outputs 982 model->identifyInputsAndOutputs( 983 {op1, op2, op3}, 984 {op4}); 985 assert(model->isValid()); 986 } 987 988 inline bool is_ignored_nchw_weight_as_input_channelQuant8(int i) { 989 static std::set<int> ignore = {}; 990 return ignore.find(i) != ignore.end(); 991 } 992 993 void CreateModel_nchw_weight_as_input_float16(Model *model) { 994 OperandType type0(Type::BOOL, {}); 995 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 996 OperandType type39(Type::TENSOR_FLOAT16, {1}); 997 OperandType type4(Type::INT32, {}); 998 OperandType type44(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); 999 OperandType type45(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 1000 // Phase 1, operands 1001 auto op1 = model->addOperand(&type44); 1002 auto op2 = model->addOperand(&type38); 1003 auto op3 = model->addOperand(&type39); 1004 auto param = model->addOperand(&type4); 1005 auto param1 = model->addOperand(&type4); 1006 auto param2 = model->addOperand(&type4); 1007 auto param3 = model->addOperand(&type4); 1008 auto param4 = model->addOperand(&type4); 1009 auto param5 = model->addOperand(&type4); 1010 auto param6 = model->addOperand(&type4); 1011 auto layout = model->addOperand(&type0); 1012 auto op4 = model->addOperand(&type45); 1013 // Phase 2, operations 1014 static int32_t param_init[] = {0}; 1015 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1016 static int32_t param1_init[] = {0}; 1017 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1018 static int32_t param2_init[] = {0}; 1019 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1020 static int32_t param3_init[] = {0}; 1021 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1022 static int32_t param4_init[] = {1}; 1023 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1024 static int32_t param5_init[] = {1}; 1025 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1026 static int32_t param6_init[] = {0}; 1027 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1028 static bool8 layout_init[] = {true}; 1029 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1030 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1031 // Phase 3, inputs and outputs 1032 model->identifyInputsAndOutputs( 1033 {op1, op2, op3}, 1034 {op4}); 1035 assert(model->isValid()); 1036 } 1037 1038 inline bool is_ignored_nchw_weight_as_input_float16(int i) { 1039 static std::set<int> ignore = {}; 1040 return ignore.find(i) != ignore.end(); 1041 } 1042 1043 void CreateModel_dynamic_output_shape_nhwc(Model *model) { 1044 OperandType type0(Type::BOOL, {}); 1045 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 1046 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1047 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1048 OperandType type4(Type::INT32, {}); 1049 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1050 // Phase 1, operands 1051 auto op1 = model->addOperand(&type1); 1052 auto op2 = model->addOperand(&type2); 1053 auto op3 = model->addOperand(&type3); 1054 auto param = model->addOperand(&type4); 1055 auto param1 = model->addOperand(&type4); 1056 auto param2 = model->addOperand(&type4); 1057 auto param3 = model->addOperand(&type4); 1058 auto param4 = model->addOperand(&type4); 1059 auto param5 = model->addOperand(&type4); 1060 auto param6 = model->addOperand(&type4); 1061 auto layout = model->addOperand(&type0); 1062 auto op4 = model->addOperand(&type46); 1063 // Phase 2, operations 1064 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 1065 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 1066 static float op3_init[] = {0.0f}; 1067 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 1068 static int32_t param_init[] = {0}; 1069 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1070 static int32_t param1_init[] = {0}; 1071 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1072 static int32_t param2_init[] = {0}; 1073 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1074 static int32_t param3_init[] = {0}; 1075 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1076 static int32_t param4_init[] = {1}; 1077 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1078 static int32_t param5_init[] = {1}; 1079 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1080 static int32_t param6_init[] = {0}; 1081 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1082 static bool8 layout_init[] = {false}; 1083 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1084 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1085 // Phase 3, inputs and outputs 1086 model->identifyInputsAndOutputs( 1087 {op1}, 1088 {op4}); 1089 assert(model->isValid()); 1090 } 1091 1092 inline bool is_ignored_dynamic_output_shape_nhwc(int i) { 1093 static std::set<int> ignore = {}; 1094 return ignore.find(i) != ignore.end(); 1095 } 1096 1097 void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) { 1098 OperandType type0(Type::BOOL, {}); 1099 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 1100 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1101 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1102 OperandType type4(Type::INT32, {}); 1103 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1104 // Phase 1, operands 1105 auto op1 = model->addOperand(&type1); 1106 auto op2 = model->addOperand(&type2); 1107 auto op3 = model->addOperand(&type3); 1108 auto param = model->addOperand(&type4); 1109 auto param1 = model->addOperand(&type4); 1110 auto param2 = model->addOperand(&type4); 1111 auto param3 = model->addOperand(&type4); 1112 auto param4 = model->addOperand(&type4); 1113 auto param5 = model->addOperand(&type4); 1114 auto param6 = model->addOperand(&type4); 1115 auto layout = model->addOperand(&type0); 1116 auto op4 = model->addOperand(&type46); 1117 // Phase 2, operations 1118 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 1119 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 1120 static float op3_init[] = {0.0f}; 1121 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 1122 static int32_t param_init[] = {0}; 1123 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1124 static int32_t param1_init[] = {0}; 1125 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1126 static int32_t param2_init[] = {0}; 1127 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1128 static int32_t param3_init[] = {0}; 1129 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1130 static int32_t param4_init[] = {1}; 1131 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1132 static int32_t param5_init[] = {1}; 1133 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1134 static int32_t param6_init[] = {0}; 1135 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1136 static bool8 layout_init[] = {false}; 1137 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1138 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1139 // Phase 3, inputs and outputs 1140 model->identifyInputsAndOutputs( 1141 {op1}, 1142 {op4}); 1143 // Phase 4: set relaxed execution 1144 model->relaxComputationFloat32toFloat16(true); 1145 assert(model->isValid()); 1146 } 1147 1148 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) { 1149 static std::set<int> ignore = {}; 1150 return ignore.find(i) != ignore.end(); 1151 } 1152 1153 void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) { 1154 OperandType type0(Type::BOOL, {}); 1155 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 1156 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 1157 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 1158 OperandType type4(Type::INT32, {}); 1159 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1160 // Phase 1, operands 1161 auto op1 = model->addOperand(&type32); 1162 auto op2 = model->addOperand(&type33); 1163 auto op3 = model->addOperand(&type34); 1164 auto param = model->addOperand(&type4); 1165 auto param1 = model->addOperand(&type4); 1166 auto param2 = model->addOperand(&type4); 1167 auto param3 = model->addOperand(&type4); 1168 auto param4 = model->addOperand(&type4); 1169 auto param5 = model->addOperand(&type4); 1170 auto param6 = model->addOperand(&type4); 1171 auto layout = model->addOperand(&type0); 1172 auto op4 = model->addOperand(&type47); 1173 // Phase 2, operations 1174 static uint8_t op2_init[] = {2, 2, 2, 2}; 1175 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4); 1176 static int32_t op3_init[] = {0}; 1177 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 1178 static int32_t param_init[] = {0}; 1179 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1180 static int32_t param1_init[] = {0}; 1181 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1182 static int32_t param2_init[] = {0}; 1183 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1184 static int32_t param3_init[] = {0}; 1185 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1186 static int32_t param4_init[] = {1}; 1187 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1188 static int32_t param5_init[] = {1}; 1189 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1190 static int32_t param6_init[] = {0}; 1191 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1192 static bool8 layout_init[] = {false}; 1193 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1194 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1195 // Phase 3, inputs and outputs 1196 model->identifyInputsAndOutputs( 1197 {op1}, 1198 {op4}); 1199 assert(model->isValid()); 1200 } 1201 1202 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) { 1203 static std::set<int> ignore = {}; 1204 return ignore.find(i) != ignore.end(); 1205 } 1206 1207 void CreateModel_dynamic_output_shape_nhwc_channelQuant8(Model *model) { 1208 OperandType type0(Type::BOOL, {}); 1209 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 1210 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 1211 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 1212 OperandType type4(Type::INT32, {}); 1213 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1214 // Phase 1, operands 1215 auto op1 = model->addOperand(&type32); 1216 auto op2 = model->addOperand(&type35); 1217 auto op3 = model->addOperand(&type36); 1218 auto param = model->addOperand(&type4); 1219 auto param1 = model->addOperand(&type4); 1220 auto param2 = model->addOperand(&type4); 1221 auto param3 = model->addOperand(&type4); 1222 auto param4 = model->addOperand(&type4); 1223 auto param5 = model->addOperand(&type4); 1224 auto param6 = model->addOperand(&type4); 1225 auto layout = model->addOperand(&type0); 1226 auto op4 = model->addOperand(&type47); 1227 // Phase 2, operations 1228 static int8_t op2_init[] = {2, 2, 2, 2}; 1229 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 4); 1230 static int32_t op3_init[] = {0}; 1231 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 1232 static int32_t param_init[] = {0}; 1233 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1234 static int32_t param1_init[] = {0}; 1235 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1236 static int32_t param2_init[] = {0}; 1237 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1238 static int32_t param3_init[] = {0}; 1239 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1240 static int32_t param4_init[] = {1}; 1241 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1242 static int32_t param5_init[] = {1}; 1243 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1244 static int32_t param6_init[] = {0}; 1245 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1246 static bool8 layout_init[] = {false}; 1247 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1248 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1249 // Phase 3, inputs and outputs 1250 model->identifyInputsAndOutputs( 1251 {op1}, 1252 {op4}); 1253 assert(model->isValid()); 1254 } 1255 1256 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8(int i) { 1257 static std::set<int> ignore = {}; 1258 return ignore.find(i) != ignore.end(); 1259 } 1260 1261 void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) { 1262 OperandType type0(Type::BOOL, {}); 1263 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 1264 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1265 OperandType type39(Type::TENSOR_FLOAT16, {1}); 1266 OperandType type4(Type::INT32, {}); 1267 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 1268 // Phase 1, operands 1269 auto op1 = model->addOperand(&type37); 1270 auto op2 = model->addOperand(&type38); 1271 auto op3 = model->addOperand(&type39); 1272 auto param = model->addOperand(&type4); 1273 auto param1 = model->addOperand(&type4); 1274 auto param2 = model->addOperand(&type4); 1275 auto param3 = model->addOperand(&type4); 1276 auto param4 = model->addOperand(&type4); 1277 auto param5 = model->addOperand(&type4); 1278 auto param6 = model->addOperand(&type4); 1279 auto layout = model->addOperand(&type0); 1280 auto op4 = model->addOperand(&type48); 1281 // Phase 2, operations 1282 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 1283 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4); 1284 static _Float16 op3_init[] = {0.0f}; 1285 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1); 1286 static int32_t param_init[] = {0}; 1287 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1288 static int32_t param1_init[] = {0}; 1289 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1290 static int32_t param2_init[] = {0}; 1291 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1292 static int32_t param3_init[] = {0}; 1293 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1294 static int32_t param4_init[] = {1}; 1295 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1296 static int32_t param5_init[] = {1}; 1297 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1298 static int32_t param6_init[] = {0}; 1299 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1300 static bool8 layout_init[] = {false}; 1301 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1302 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1303 // Phase 3, inputs and outputs 1304 model->identifyInputsAndOutputs( 1305 {op1}, 1306 {op4}); 1307 assert(model->isValid()); 1308 } 1309 1310 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) { 1311 static std::set<int> ignore = {}; 1312 return ignore.find(i) != ignore.end(); 1313 } 1314 1315 void CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model *model) { 1316 OperandType type0(Type::BOOL, {}); 1317 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 1318 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1319 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1320 OperandType type4(Type::INT32, {}); 1321 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1322 // Phase 1, operands 1323 auto op1 = model->addOperand(&type1); 1324 auto op2 = model->addOperand(&type2); 1325 auto op3 = model->addOperand(&type3); 1326 auto param = model->addOperand(&type4); 1327 auto param1 = model->addOperand(&type4); 1328 auto param2 = model->addOperand(&type4); 1329 auto param3 = model->addOperand(&type4); 1330 auto param4 = model->addOperand(&type4); 1331 auto param5 = model->addOperand(&type4); 1332 auto param6 = model->addOperand(&type4); 1333 auto layout = model->addOperand(&type0); 1334 auto op4 = model->addOperand(&type46); 1335 // Phase 2, operations 1336 static int32_t param_init[] = {0}; 1337 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1338 static int32_t param1_init[] = {0}; 1339 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1340 static int32_t param2_init[] = {0}; 1341 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1342 static int32_t param3_init[] = {0}; 1343 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1344 static int32_t param4_init[] = {1}; 1345 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1346 static int32_t param5_init[] = {1}; 1347 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1348 static int32_t param6_init[] = {0}; 1349 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1350 static bool8 layout_init[] = {false}; 1351 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1352 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1353 // Phase 3, inputs and outputs 1354 model->identifyInputsAndOutputs( 1355 {op1, op2, op3}, 1356 {op4}); 1357 assert(model->isValid()); 1358 } 1359 1360 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i) { 1361 static std::set<int> ignore = {}; 1362 return ignore.find(i) != ignore.end(); 1363 } 1364 1365 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) { 1366 OperandType type0(Type::BOOL, {}); 1367 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 1368 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1369 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1370 OperandType type4(Type::INT32, {}); 1371 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1372 // Phase 1, operands 1373 auto op1 = model->addOperand(&type1); 1374 auto op2 = model->addOperand(&type2); 1375 auto op3 = model->addOperand(&type3); 1376 auto param = model->addOperand(&type4); 1377 auto param1 = model->addOperand(&type4); 1378 auto param2 = model->addOperand(&type4); 1379 auto param3 = model->addOperand(&type4); 1380 auto param4 = model->addOperand(&type4); 1381 auto param5 = model->addOperand(&type4); 1382 auto param6 = model->addOperand(&type4); 1383 auto layout = model->addOperand(&type0); 1384 auto op4 = model->addOperand(&type46); 1385 // Phase 2, operations 1386 static int32_t param_init[] = {0}; 1387 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1388 static int32_t param1_init[] = {0}; 1389 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1390 static int32_t param2_init[] = {0}; 1391 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1392 static int32_t param3_init[] = {0}; 1393 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1394 static int32_t param4_init[] = {1}; 1395 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1396 static int32_t param5_init[] = {1}; 1397 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1398 static int32_t param6_init[] = {0}; 1399 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1400 static bool8 layout_init[] = {false}; 1401 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1402 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1403 // Phase 3, inputs and outputs 1404 model->identifyInputsAndOutputs( 1405 {op1, op2, op3}, 1406 {op4}); 1407 // Phase 4: set relaxed execution 1408 model->relaxComputationFloat32toFloat16(true); 1409 assert(model->isValid()); 1410 } 1411 1412 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) { 1413 static std::set<int> ignore = {}; 1414 return ignore.find(i) != ignore.end(); 1415 } 1416 1417 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) { 1418 OperandType type0(Type::BOOL, {}); 1419 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 1420 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 1421 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 1422 OperandType type4(Type::INT32, {}); 1423 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1424 // Phase 1, operands 1425 auto op1 = model->addOperand(&type32); 1426 auto op2 = model->addOperand(&type33); 1427 auto op3 = model->addOperand(&type34); 1428 auto param = model->addOperand(&type4); 1429 auto param1 = model->addOperand(&type4); 1430 auto param2 = model->addOperand(&type4); 1431 auto param3 = model->addOperand(&type4); 1432 auto param4 = model->addOperand(&type4); 1433 auto param5 = model->addOperand(&type4); 1434 auto param6 = model->addOperand(&type4); 1435 auto layout = model->addOperand(&type0); 1436 auto op4 = model->addOperand(&type47); 1437 // Phase 2, operations 1438 static int32_t param_init[] = {0}; 1439 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1440 static int32_t param1_init[] = {0}; 1441 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1442 static int32_t param2_init[] = {0}; 1443 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1444 static int32_t param3_init[] = {0}; 1445 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1446 static int32_t param4_init[] = {1}; 1447 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1448 static int32_t param5_init[] = {1}; 1449 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1450 static int32_t param6_init[] = {0}; 1451 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1452 static bool8 layout_init[] = {false}; 1453 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1454 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1455 // Phase 3, inputs and outputs 1456 model->identifyInputsAndOutputs( 1457 {op1, op2, op3}, 1458 {op4}); 1459 assert(model->isValid()); 1460 } 1461 1462 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) { 1463 static std::set<int> ignore = {}; 1464 return ignore.find(i) != ignore.end(); 1465 } 1466 1467 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model *model) { 1468 OperandType type0(Type::BOOL, {}); 1469 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 0); 1470 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 1471 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 1472 OperandType type4(Type::INT32, {}); 1473 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1474 // Phase 1, operands 1475 auto op1 = model->addOperand(&type32); 1476 auto op2 = model->addOperand(&type35); 1477 auto op3 = model->addOperand(&type36); 1478 auto param = model->addOperand(&type4); 1479 auto param1 = model->addOperand(&type4); 1480 auto param2 = model->addOperand(&type4); 1481 auto param3 = model->addOperand(&type4); 1482 auto param4 = model->addOperand(&type4); 1483 auto param5 = model->addOperand(&type4); 1484 auto param6 = model->addOperand(&type4); 1485 auto layout = model->addOperand(&type0); 1486 auto op4 = model->addOperand(&type47); 1487 // Phase 2, operations 1488 static int32_t param_init[] = {0}; 1489 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1490 static int32_t param1_init[] = {0}; 1491 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1492 static int32_t param2_init[] = {0}; 1493 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1494 static int32_t param3_init[] = {0}; 1495 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1496 static int32_t param4_init[] = {1}; 1497 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1498 static int32_t param5_init[] = {1}; 1499 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1500 static int32_t param6_init[] = {0}; 1501 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1502 static bool8 layout_init[] = {false}; 1503 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1504 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1505 // Phase 3, inputs and outputs 1506 model->identifyInputsAndOutputs( 1507 {op1, op2, op3}, 1508 {op4}); 1509 assert(model->isValid()); 1510 } 1511 1512 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i) { 1513 static std::set<int> ignore = {}; 1514 return ignore.find(i) != ignore.end(); 1515 } 1516 1517 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) { 1518 OperandType type0(Type::BOOL, {}); 1519 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 1520 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1521 OperandType type39(Type::TENSOR_FLOAT16, {1}); 1522 OperandType type4(Type::INT32, {}); 1523 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 1524 // Phase 1, operands 1525 auto op1 = model->addOperand(&type37); 1526 auto op2 = model->addOperand(&type38); 1527 auto op3 = model->addOperand(&type39); 1528 auto param = model->addOperand(&type4); 1529 auto param1 = model->addOperand(&type4); 1530 auto param2 = model->addOperand(&type4); 1531 auto param3 = model->addOperand(&type4); 1532 auto param4 = model->addOperand(&type4); 1533 auto param5 = model->addOperand(&type4); 1534 auto param6 = model->addOperand(&type4); 1535 auto layout = model->addOperand(&type0); 1536 auto op4 = model->addOperand(&type48); 1537 // Phase 2, operations 1538 static int32_t param_init[] = {0}; 1539 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1540 static int32_t param1_init[] = {0}; 1541 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1542 static int32_t param2_init[] = {0}; 1543 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1544 static int32_t param3_init[] = {0}; 1545 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1546 static int32_t param4_init[] = {1}; 1547 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1548 static int32_t param5_init[] = {1}; 1549 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1550 static int32_t param6_init[] = {0}; 1551 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1552 static bool8 layout_init[] = {false}; 1553 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1554 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1555 // Phase 3, inputs and outputs 1556 model->identifyInputsAndOutputs( 1557 {op1, op2, op3}, 1558 {op4}); 1559 assert(model->isValid()); 1560 } 1561 1562 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16(int i) { 1563 static std::set<int> ignore = {}; 1564 return ignore.find(i) != ignore.end(); 1565 } 1566 1567 void CreateModel_dynamic_output_shape_nchw(Model *model) { 1568 OperandType type0(Type::BOOL, {}); 1569 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1570 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1571 OperandType type4(Type::INT32, {}); 1572 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 1573 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1574 // Phase 1, operands 1575 auto op1 = model->addOperand(&type40); 1576 auto op2 = model->addOperand(&type2); 1577 auto op3 = model->addOperand(&type3); 1578 auto param = model->addOperand(&type4); 1579 auto param1 = model->addOperand(&type4); 1580 auto param2 = model->addOperand(&type4); 1581 auto param3 = model->addOperand(&type4); 1582 auto param4 = model->addOperand(&type4); 1583 auto param5 = model->addOperand(&type4); 1584 auto param6 = model->addOperand(&type4); 1585 auto layout = model->addOperand(&type0); 1586 auto op4 = model->addOperand(&type46); 1587 // Phase 2, operations 1588 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 1589 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 1590 static float op3_init[] = {0.0f}; 1591 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 1592 static int32_t param_init[] = {0}; 1593 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1594 static int32_t param1_init[] = {0}; 1595 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1596 static int32_t param2_init[] = {0}; 1597 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1598 static int32_t param3_init[] = {0}; 1599 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1600 static int32_t param4_init[] = {1}; 1601 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1602 static int32_t param5_init[] = {1}; 1603 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1604 static int32_t param6_init[] = {0}; 1605 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1606 static bool8 layout_init[] = {true}; 1607 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1608 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1609 // Phase 3, inputs and outputs 1610 model->identifyInputsAndOutputs( 1611 {op1}, 1612 {op4}); 1613 assert(model->isValid()); 1614 } 1615 1616 inline bool is_ignored_dynamic_output_shape_nchw(int i) { 1617 static std::set<int> ignore = {}; 1618 return ignore.find(i) != ignore.end(); 1619 } 1620 1621 void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) { 1622 OperandType type0(Type::BOOL, {}); 1623 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1624 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1625 OperandType type4(Type::INT32, {}); 1626 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 1627 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1628 // Phase 1, operands 1629 auto op1 = model->addOperand(&type40); 1630 auto op2 = model->addOperand(&type2); 1631 auto op3 = model->addOperand(&type3); 1632 auto param = model->addOperand(&type4); 1633 auto param1 = model->addOperand(&type4); 1634 auto param2 = model->addOperand(&type4); 1635 auto param3 = model->addOperand(&type4); 1636 auto param4 = model->addOperand(&type4); 1637 auto param5 = model->addOperand(&type4); 1638 auto param6 = model->addOperand(&type4); 1639 auto layout = model->addOperand(&type0); 1640 auto op4 = model->addOperand(&type46); 1641 // Phase 2, operations 1642 static float op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 1643 model->setOperandValue(op2, op2_init, sizeof(float) * 4); 1644 static float op3_init[] = {0.0f}; 1645 model->setOperandValue(op3, op3_init, sizeof(float) * 1); 1646 static int32_t param_init[] = {0}; 1647 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1648 static int32_t param1_init[] = {0}; 1649 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1650 static int32_t param2_init[] = {0}; 1651 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1652 static int32_t param3_init[] = {0}; 1653 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1654 static int32_t param4_init[] = {1}; 1655 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1656 static int32_t param5_init[] = {1}; 1657 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1658 static int32_t param6_init[] = {0}; 1659 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1660 static bool8 layout_init[] = {true}; 1661 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1662 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1663 // Phase 3, inputs and outputs 1664 model->identifyInputsAndOutputs( 1665 {op1}, 1666 {op4}); 1667 // Phase 4: set relaxed execution 1668 model->relaxComputationFloat32toFloat16(true); 1669 assert(model->isValid()); 1670 } 1671 1672 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) { 1673 static std::set<int> ignore = {}; 1674 return ignore.find(i) != ignore.end(); 1675 } 1676 1677 void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) { 1678 OperandType type0(Type::BOOL, {}); 1679 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 1680 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 1681 OperandType type4(Type::INT32, {}); 1682 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 1683 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1684 // Phase 1, operands 1685 auto op1 = model->addOperand(&type42); 1686 auto op2 = model->addOperand(&type33); 1687 auto op3 = model->addOperand(&type34); 1688 auto param = model->addOperand(&type4); 1689 auto param1 = model->addOperand(&type4); 1690 auto param2 = model->addOperand(&type4); 1691 auto param3 = model->addOperand(&type4); 1692 auto param4 = model->addOperand(&type4); 1693 auto param5 = model->addOperand(&type4); 1694 auto param6 = model->addOperand(&type4); 1695 auto layout = model->addOperand(&type0); 1696 auto op4 = model->addOperand(&type47); 1697 // Phase 2, operations 1698 static uint8_t op2_init[] = {2, 2, 2, 2}; 1699 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 4); 1700 static int32_t op3_init[] = {0}; 1701 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 1702 static int32_t param_init[] = {0}; 1703 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1704 static int32_t param1_init[] = {0}; 1705 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1706 static int32_t param2_init[] = {0}; 1707 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1708 static int32_t param3_init[] = {0}; 1709 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1710 static int32_t param4_init[] = {1}; 1711 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1712 static int32_t param5_init[] = {1}; 1713 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1714 static int32_t param6_init[] = {0}; 1715 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1716 static bool8 layout_init[] = {true}; 1717 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1718 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1719 // Phase 3, inputs and outputs 1720 model->identifyInputsAndOutputs( 1721 {op1}, 1722 {op4}); 1723 assert(model->isValid()); 1724 } 1725 1726 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) { 1727 static std::set<int> ignore = {}; 1728 return ignore.find(i) != ignore.end(); 1729 } 1730 1731 void CreateModel_dynamic_output_shape_nchw_channelQuant8(Model *model) { 1732 OperandType type0(Type::BOOL, {}); 1733 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 1734 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 1735 OperandType type4(Type::INT32, {}); 1736 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 1737 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1738 // Phase 1, operands 1739 auto op1 = model->addOperand(&type42); 1740 auto op2 = model->addOperand(&type35); 1741 auto op3 = model->addOperand(&type36); 1742 auto param = model->addOperand(&type4); 1743 auto param1 = model->addOperand(&type4); 1744 auto param2 = model->addOperand(&type4); 1745 auto param3 = model->addOperand(&type4); 1746 auto param4 = model->addOperand(&type4); 1747 auto param5 = model->addOperand(&type4); 1748 auto param6 = model->addOperand(&type4); 1749 auto layout = model->addOperand(&type0); 1750 auto op4 = model->addOperand(&type47); 1751 // Phase 2, operations 1752 static int8_t op2_init[] = {2, 2, 2, 2}; 1753 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 4); 1754 static int32_t op3_init[] = {0}; 1755 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 1); 1756 static int32_t param_init[] = {0}; 1757 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1758 static int32_t param1_init[] = {0}; 1759 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1760 static int32_t param2_init[] = {0}; 1761 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1762 static int32_t param3_init[] = {0}; 1763 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1764 static int32_t param4_init[] = {1}; 1765 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1766 static int32_t param5_init[] = {1}; 1767 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1768 static int32_t param6_init[] = {0}; 1769 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1770 static bool8 layout_init[] = {true}; 1771 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1772 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1773 // Phase 3, inputs and outputs 1774 model->identifyInputsAndOutputs( 1775 {op1}, 1776 {op4}); 1777 assert(model->isValid()); 1778 } 1779 1780 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8(int i) { 1781 static std::set<int> ignore = {}; 1782 return ignore.find(i) != ignore.end(); 1783 } 1784 1785 void CreateModel_dynamic_output_shape_nchw_float16(Model *model) { 1786 OperandType type0(Type::BOOL, {}); 1787 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1788 OperandType type39(Type::TENSOR_FLOAT16, {1}); 1789 OperandType type4(Type::INT32, {}); 1790 OperandType type44(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); 1791 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 1792 // Phase 1, operands 1793 auto op1 = model->addOperand(&type44); 1794 auto op2 = model->addOperand(&type38); 1795 auto op3 = model->addOperand(&type39); 1796 auto param = model->addOperand(&type4); 1797 auto param1 = model->addOperand(&type4); 1798 auto param2 = model->addOperand(&type4); 1799 auto param3 = model->addOperand(&type4); 1800 auto param4 = model->addOperand(&type4); 1801 auto param5 = model->addOperand(&type4); 1802 auto param6 = model->addOperand(&type4); 1803 auto layout = model->addOperand(&type0); 1804 auto op4 = model->addOperand(&type48); 1805 // Phase 2, operations 1806 static _Float16 op2_init[] = {0.25f, 0.25f, 0.25f, 0.25f}; 1807 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 4); 1808 static _Float16 op3_init[] = {0.0f}; 1809 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 1); 1810 static int32_t param_init[] = {0}; 1811 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1812 static int32_t param1_init[] = {0}; 1813 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1814 static int32_t param2_init[] = {0}; 1815 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1816 static int32_t param3_init[] = {0}; 1817 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1818 static int32_t param4_init[] = {1}; 1819 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1820 static int32_t param5_init[] = {1}; 1821 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1822 static int32_t param6_init[] = {0}; 1823 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1824 static bool8 layout_init[] = {true}; 1825 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1826 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1827 // Phase 3, inputs and outputs 1828 model->identifyInputsAndOutputs( 1829 {op1}, 1830 {op4}); 1831 assert(model->isValid()); 1832 } 1833 1834 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) { 1835 static std::set<int> ignore = {}; 1836 return ignore.find(i) != ignore.end(); 1837 } 1838 1839 void CreateModel_dynamic_output_shape_nchw_weight_as_input(Model *model) { 1840 OperandType type0(Type::BOOL, {}); 1841 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1842 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1843 OperandType type4(Type::INT32, {}); 1844 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 1845 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1846 // Phase 1, operands 1847 auto op1 = model->addOperand(&type40); 1848 auto op2 = model->addOperand(&type2); 1849 auto op3 = model->addOperand(&type3); 1850 auto param = model->addOperand(&type4); 1851 auto param1 = model->addOperand(&type4); 1852 auto param2 = model->addOperand(&type4); 1853 auto param3 = model->addOperand(&type4); 1854 auto param4 = model->addOperand(&type4); 1855 auto param5 = model->addOperand(&type4); 1856 auto param6 = model->addOperand(&type4); 1857 auto layout = model->addOperand(&type0); 1858 auto op4 = model->addOperand(&type46); 1859 // Phase 2, operations 1860 static int32_t param_init[] = {0}; 1861 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1862 static int32_t param1_init[] = {0}; 1863 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1864 static int32_t param2_init[] = {0}; 1865 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1866 static int32_t param3_init[] = {0}; 1867 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1868 static int32_t param4_init[] = {1}; 1869 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1870 static int32_t param5_init[] = {1}; 1871 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1872 static int32_t param6_init[] = {0}; 1873 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1874 static bool8 layout_init[] = {true}; 1875 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1876 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1877 // Phase 3, inputs and outputs 1878 model->identifyInputsAndOutputs( 1879 {op1, op2, op3}, 1880 {op4}); 1881 assert(model->isValid()); 1882 } 1883 1884 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input(int i) { 1885 static std::set<int> ignore = {}; 1886 return ignore.find(i) != ignore.end(); 1887 } 1888 1889 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) { 1890 OperandType type0(Type::BOOL, {}); 1891 OperandType type2(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1892 OperandType type3(Type::TENSOR_FLOAT32, {1}); 1893 OperandType type4(Type::INT32, {}); 1894 OperandType type40(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 1895 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 1896 // Phase 1, operands 1897 auto op1 = model->addOperand(&type40); 1898 auto op2 = model->addOperand(&type2); 1899 auto op3 = model->addOperand(&type3); 1900 auto param = model->addOperand(&type4); 1901 auto param1 = model->addOperand(&type4); 1902 auto param2 = model->addOperand(&type4); 1903 auto param3 = model->addOperand(&type4); 1904 auto param4 = model->addOperand(&type4); 1905 auto param5 = model->addOperand(&type4); 1906 auto param6 = model->addOperand(&type4); 1907 auto layout = model->addOperand(&type0); 1908 auto op4 = model->addOperand(&type46); 1909 // Phase 2, operations 1910 static int32_t param_init[] = {0}; 1911 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1912 static int32_t param1_init[] = {0}; 1913 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1914 static int32_t param2_init[] = {0}; 1915 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1916 static int32_t param3_init[] = {0}; 1917 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1918 static int32_t param4_init[] = {1}; 1919 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1920 static int32_t param5_init[] = {1}; 1921 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1922 static int32_t param6_init[] = {0}; 1923 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1924 static bool8 layout_init[] = {true}; 1925 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1926 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1927 // Phase 3, inputs and outputs 1928 model->identifyInputsAndOutputs( 1929 {op1, op2, op3}, 1930 {op4}); 1931 // Phase 4: set relaxed execution 1932 model->relaxComputationFloat32toFloat16(true); 1933 assert(model->isValid()); 1934 } 1935 1936 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) { 1937 static std::set<int> ignore = {}; 1938 return ignore.find(i) != ignore.end(); 1939 } 1940 1941 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) { 1942 OperandType type0(Type::BOOL, {}); 1943 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.125f, 0); 1944 OperandType type34(Type::TENSOR_INT32, {1}, 0.0625f, 0); 1945 OperandType type4(Type::INT32, {}); 1946 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 1947 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1948 // Phase 1, operands 1949 auto op1 = model->addOperand(&type42); 1950 auto op2 = model->addOperand(&type33); 1951 auto op3 = model->addOperand(&type34); 1952 auto param = model->addOperand(&type4); 1953 auto param1 = model->addOperand(&type4); 1954 auto param2 = model->addOperand(&type4); 1955 auto param3 = model->addOperand(&type4); 1956 auto param4 = model->addOperand(&type4); 1957 auto param5 = model->addOperand(&type4); 1958 auto param6 = model->addOperand(&type4); 1959 auto layout = model->addOperand(&type0); 1960 auto op4 = model->addOperand(&type47); 1961 // Phase 2, operations 1962 static int32_t param_init[] = {0}; 1963 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1964 static int32_t param1_init[] = {0}; 1965 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1966 static int32_t param2_init[] = {0}; 1967 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1968 static int32_t param3_init[] = {0}; 1969 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 1970 static int32_t param4_init[] = {1}; 1971 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 1972 static int32_t param5_init[] = {1}; 1973 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 1974 static int32_t param6_init[] = {0}; 1975 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 1976 static bool8 layout_init[] = {true}; 1977 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1978 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 1979 // Phase 3, inputs and outputs 1980 model->identifyInputsAndOutputs( 1981 {op1, op2, op3}, 1982 {op4}); 1983 assert(model->isValid()); 1984 } 1985 1986 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8(int i) { 1987 static std::set<int> ignore = {}; 1988 return ignore.find(i) != ignore.end(); 1989 } 1990 1991 void CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model *model) { 1992 OperandType type0(Type::BOOL, {}); 1993 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 2, 2, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.125f},0)); 1994 OperandType type36(Type::TENSOR_INT32, {1}, 0.0f, 0); 1995 OperandType type4(Type::INT32, {}); 1996 OperandType type42(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 0.5f, 0); 1997 OperandType type47(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.125f, 0); 1998 // Phase 1, operands 1999 auto op1 = model->addOperand(&type42); 2000 auto op2 = model->addOperand(&type35); 2001 auto op3 = model->addOperand(&type36); 2002 auto param = model->addOperand(&type4); 2003 auto param1 = model->addOperand(&type4); 2004 auto param2 = model->addOperand(&type4); 2005 auto param3 = model->addOperand(&type4); 2006 auto param4 = model->addOperand(&type4); 2007 auto param5 = model->addOperand(&type4); 2008 auto param6 = model->addOperand(&type4); 2009 auto layout = model->addOperand(&type0); 2010 auto op4 = model->addOperand(&type47); 2011 // Phase 2, operations 2012 static int32_t param_init[] = {0}; 2013 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2014 static int32_t param1_init[] = {0}; 2015 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2016 static int32_t param2_init[] = {0}; 2017 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2018 static int32_t param3_init[] = {0}; 2019 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 2020 static int32_t param4_init[] = {1}; 2021 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 2022 static int32_t param5_init[] = {1}; 2023 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 2024 static int32_t param6_init[] = {0}; 2025 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 2026 static bool8 layout_init[] = {true}; 2027 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2028 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 2029 // Phase 3, inputs and outputs 2030 model->identifyInputsAndOutputs( 2031 {op1, op2, op3}, 2032 {op4}); 2033 assert(model->isValid()); 2034 } 2035 2036 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i) { 2037 static std::set<int> ignore = {}; 2038 return ignore.find(i) != ignore.end(); 2039 } 2040 2041 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) { 2042 OperandType type0(Type::BOOL, {}); 2043 OperandType type38(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 2044 OperandType type39(Type::TENSOR_FLOAT16, {1}); 2045 OperandType type4(Type::INT32, {}); 2046 OperandType type44(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); 2047 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 2048 // Phase 1, operands 2049 auto op1 = model->addOperand(&type44); 2050 auto op2 = model->addOperand(&type38); 2051 auto op3 = model->addOperand(&type39); 2052 auto param = model->addOperand(&type4); 2053 auto param1 = model->addOperand(&type4); 2054 auto param2 = model->addOperand(&type4); 2055 auto param3 = model->addOperand(&type4); 2056 auto param4 = model->addOperand(&type4); 2057 auto param5 = model->addOperand(&type4); 2058 auto param6 = model->addOperand(&type4); 2059 auto layout = model->addOperand(&type0); 2060 auto op4 = model->addOperand(&type48); 2061 // Phase 2, operations 2062 static int32_t param_init[] = {0}; 2063 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2064 static int32_t param1_init[] = {0}; 2065 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2066 static int32_t param2_init[] = {0}; 2067 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2068 static int32_t param3_init[] = {0}; 2069 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 2070 static int32_t param4_init[] = {1}; 2071 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 2072 static int32_t param5_init[] = {1}; 2073 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 2074 static int32_t param6_init[] = {0}; 2075 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 2076 static bool8 layout_init[] = {true}; 2077 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2078 model->addOperation(ANEURALNETWORKS_CONV_2D, {op1, op2, op3, param, param1, param2, param3, param4, param5, param6, layout}, {op4}); 2079 // Phase 3, inputs and outputs 2080 model->identifyInputsAndOutputs( 2081 {op1, op2, op3}, 2082 {op4}); 2083 assert(model->isValid()); 2084 } 2085 2086 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16(int i) { 2087 static std::set<int> ignore = {}; 2088 return ignore.find(i) != ignore.end(); 2089 } 2090 2091 void CreateModel_nhwc_2(Model *model) { 2092 OperandType type0(Type::BOOL, {}); 2093 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2094 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2095 OperandType type4(Type::INT32, {}); 2096 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 2097 // Phase 1, operands 2098 auto op11 = model->addOperand(&type5); 2099 auto op21 = model->addOperand(&type1); 2100 auto op31 = model->addOperand(&type3); 2101 auto param7 = model->addOperand(&type4); 2102 auto param8 = model->addOperand(&type4); 2103 auto param9 = model->addOperand(&type4); 2104 auto param10 = model->addOperand(&type4); 2105 auto layout = model->addOperand(&type0); 2106 auto op41 = model->addOperand(&type5); 2107 // Phase 2, operations 2108 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2109 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 2110 static float op31_init[] = {-200.0f}; 2111 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 2112 static int32_t param7_init[] = {1}; 2113 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2114 static int32_t param8_init[] = {1}; 2115 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2116 static int32_t param9_init[] = {1}; 2117 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2118 static int32_t param10_init[] = {1}; 2119 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2120 static bool8 layout_init[] = {false}; 2121 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2122 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2123 // Phase 3, inputs and outputs 2124 model->identifyInputsAndOutputs( 2125 {op11}, 2126 {op41}); 2127 assert(model->isValid()); 2128 } 2129 2130 inline bool is_ignored_nhwc_2(int i) { 2131 static std::set<int> ignore = {}; 2132 return ignore.find(i) != ignore.end(); 2133 } 2134 2135 void CreateModel_nhwc_relaxed_2(Model *model) { 2136 OperandType type0(Type::BOOL, {}); 2137 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2138 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2139 OperandType type4(Type::INT32, {}); 2140 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 2141 // Phase 1, operands 2142 auto op11 = model->addOperand(&type5); 2143 auto op21 = model->addOperand(&type1); 2144 auto op31 = model->addOperand(&type3); 2145 auto param7 = model->addOperand(&type4); 2146 auto param8 = model->addOperand(&type4); 2147 auto param9 = model->addOperand(&type4); 2148 auto param10 = model->addOperand(&type4); 2149 auto layout = model->addOperand(&type0); 2150 auto op41 = model->addOperand(&type5); 2151 // Phase 2, operations 2152 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2153 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 2154 static float op31_init[] = {-200.0f}; 2155 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 2156 static int32_t param7_init[] = {1}; 2157 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2158 static int32_t param8_init[] = {1}; 2159 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2160 static int32_t param9_init[] = {1}; 2161 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2162 static int32_t param10_init[] = {1}; 2163 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2164 static bool8 layout_init[] = {false}; 2165 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2166 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2167 // Phase 3, inputs and outputs 2168 model->identifyInputsAndOutputs( 2169 {op11}, 2170 {op41}); 2171 // Phase 4: set relaxed execution 2172 model->relaxComputationFloat32toFloat16(true); 2173 assert(model->isValid()); 2174 } 2175 2176 inline bool is_ignored_nhwc_relaxed_2(int i) { 2177 static std::set<int> ignore = {}; 2178 return ignore.find(i) != ignore.end(); 2179 } 2180 2181 void CreateModel_nhwc_quant8_2(Model *model) { 2182 OperandType type0(Type::BOOL, {}); 2183 OperandType type4(Type::INT32, {}); 2184 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 2185 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 2186 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 2187 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 1.0f, 50); 2188 // Phase 1, operands 2189 auto op11 = model->addOperand(&type49); 2190 auto op21 = model->addOperand(&type50); 2191 auto op31 = model->addOperand(&type51); 2192 auto param7 = model->addOperand(&type4); 2193 auto param8 = model->addOperand(&type4); 2194 auto param9 = model->addOperand(&type4); 2195 auto param10 = model->addOperand(&type4); 2196 auto layout = model->addOperand(&type0); 2197 auto op41 = model->addOperand(&type52); 2198 // Phase 2, operations 2199 static uint8_t op21_init[] = {129, 135, 141, 131, 137, 143, 133, 139, 145}; 2200 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 2201 static int32_t op31_init[] = {-800}; 2202 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 2203 static int32_t param7_init[] = {1}; 2204 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2205 static int32_t param8_init[] = {1}; 2206 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2207 static int32_t param9_init[] = {1}; 2208 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2209 static int32_t param10_init[] = {1}; 2210 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2211 static bool8 layout_init[] = {false}; 2212 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2213 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2214 // Phase 3, inputs and outputs 2215 model->identifyInputsAndOutputs( 2216 {op11}, 2217 {op41}); 2218 assert(model->isValid()); 2219 } 2220 2221 inline bool is_ignored_nhwc_quant8_2(int i) { 2222 static std::set<int> ignore = {}; 2223 return ignore.find(i) != ignore.end(); 2224 } 2225 2226 void CreateModel_nhwc_channelQuant8_2(Model *model) { 2227 OperandType type0(Type::BOOL, {}); 2228 OperandType type4(Type::INT32, {}); 2229 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 2230 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 1.0f, 50); 2231 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 2232 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 2233 // Phase 1, operands 2234 auto op11 = model->addOperand(&type49); 2235 auto op21 = model->addOperand(&type53); 2236 auto op31 = model->addOperand(&type54); 2237 auto param7 = model->addOperand(&type4); 2238 auto param8 = model->addOperand(&type4); 2239 auto param9 = model->addOperand(&type4); 2240 auto param10 = model->addOperand(&type4); 2241 auto layout = model->addOperand(&type0); 2242 auto op41 = model->addOperand(&type52); 2243 // Phase 2, operations 2244 static int8_t op21_init[] = {2, 8, 14, 4, 10, 16, 6, 12, 18}; 2245 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 2246 static int32_t op31_init[] = {-800}; 2247 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 2248 static int32_t param7_init[] = {1}; 2249 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2250 static int32_t param8_init[] = {1}; 2251 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2252 static int32_t param9_init[] = {1}; 2253 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2254 static int32_t param10_init[] = {1}; 2255 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2256 static bool8 layout_init[] = {false}; 2257 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2258 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2259 // Phase 3, inputs and outputs 2260 model->identifyInputsAndOutputs( 2261 {op11}, 2262 {op41}); 2263 assert(model->isValid()); 2264 } 2265 2266 inline bool is_ignored_nhwc_channelQuant8_2(int i) { 2267 static std::set<int> ignore = {}; 2268 return ignore.find(i) != ignore.end(); 2269 } 2270 2271 void CreateModel_nhwc_float16_2(Model *model) { 2272 OperandType type0(Type::BOOL, {}); 2273 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 2274 OperandType type39(Type::TENSOR_FLOAT16, {1}); 2275 OperandType type4(Type::INT32, {}); 2276 OperandType type55(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); 2277 // Phase 1, operands 2278 auto op11 = model->addOperand(&type55); 2279 auto op21 = model->addOperand(&type37); 2280 auto op31 = model->addOperand(&type39); 2281 auto param7 = model->addOperand(&type4); 2282 auto param8 = model->addOperand(&type4); 2283 auto param9 = model->addOperand(&type4); 2284 auto param10 = model->addOperand(&type4); 2285 auto layout = model->addOperand(&type0); 2286 auto op41 = model->addOperand(&type55); 2287 // Phase 2, operations 2288 static _Float16 op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2289 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 2290 static _Float16 op31_init[] = {-200.0f}; 2291 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 2292 static int32_t param7_init[] = {1}; 2293 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2294 static int32_t param8_init[] = {1}; 2295 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2296 static int32_t param9_init[] = {1}; 2297 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2298 static int32_t param10_init[] = {1}; 2299 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2300 static bool8 layout_init[] = {false}; 2301 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2302 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2303 // Phase 3, inputs and outputs 2304 model->identifyInputsAndOutputs( 2305 {op11}, 2306 {op41}); 2307 assert(model->isValid()); 2308 } 2309 2310 inline bool is_ignored_nhwc_float16_2(int i) { 2311 static std::set<int> ignore = {}; 2312 return ignore.find(i) != ignore.end(); 2313 } 2314 2315 void CreateModel_nhwc_weight_as_input_2(Model *model) { 2316 OperandType type0(Type::BOOL, {}); 2317 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2318 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2319 OperandType type4(Type::INT32, {}); 2320 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 2321 // Phase 1, operands 2322 auto op11 = model->addOperand(&type5); 2323 auto op21 = model->addOperand(&type1); 2324 auto op31 = model->addOperand(&type3); 2325 auto param7 = model->addOperand(&type4); 2326 auto param8 = model->addOperand(&type4); 2327 auto param9 = model->addOperand(&type4); 2328 auto param10 = model->addOperand(&type4); 2329 auto layout = model->addOperand(&type0); 2330 auto op41 = model->addOperand(&type5); 2331 // Phase 2, operations 2332 static int32_t param7_init[] = {1}; 2333 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2334 static int32_t param8_init[] = {1}; 2335 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2336 static int32_t param9_init[] = {1}; 2337 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2338 static int32_t param10_init[] = {1}; 2339 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2340 static bool8 layout_init[] = {false}; 2341 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2342 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2343 // Phase 3, inputs and outputs 2344 model->identifyInputsAndOutputs( 2345 {op11, op21, op31}, 2346 {op41}); 2347 assert(model->isValid()); 2348 } 2349 2350 inline bool is_ignored_nhwc_weight_as_input_2(int i) { 2351 static std::set<int> ignore = {}; 2352 return ignore.find(i) != ignore.end(); 2353 } 2354 2355 void CreateModel_nhwc_weight_as_input_relaxed_2(Model *model) { 2356 OperandType type0(Type::BOOL, {}); 2357 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2358 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2359 OperandType type4(Type::INT32, {}); 2360 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 2361 // Phase 1, operands 2362 auto op11 = model->addOperand(&type5); 2363 auto op21 = model->addOperand(&type1); 2364 auto op31 = model->addOperand(&type3); 2365 auto param7 = model->addOperand(&type4); 2366 auto param8 = model->addOperand(&type4); 2367 auto param9 = model->addOperand(&type4); 2368 auto param10 = model->addOperand(&type4); 2369 auto layout = model->addOperand(&type0); 2370 auto op41 = model->addOperand(&type5); 2371 // Phase 2, operations 2372 static int32_t param7_init[] = {1}; 2373 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2374 static int32_t param8_init[] = {1}; 2375 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2376 static int32_t param9_init[] = {1}; 2377 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2378 static int32_t param10_init[] = {1}; 2379 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2380 static bool8 layout_init[] = {false}; 2381 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2382 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2383 // Phase 3, inputs and outputs 2384 model->identifyInputsAndOutputs( 2385 {op11, op21, op31}, 2386 {op41}); 2387 // Phase 4: set relaxed execution 2388 model->relaxComputationFloat32toFloat16(true); 2389 assert(model->isValid()); 2390 } 2391 2392 inline bool is_ignored_nhwc_weight_as_input_relaxed_2(int i) { 2393 static std::set<int> ignore = {}; 2394 return ignore.find(i) != ignore.end(); 2395 } 2396 2397 void CreateModel_nhwc_weight_as_input_quant8_2(Model *model) { 2398 OperandType type0(Type::BOOL, {}); 2399 OperandType type4(Type::INT32, {}); 2400 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 2401 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 2402 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 2403 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 1.0f, 50); 2404 // Phase 1, operands 2405 auto op11 = model->addOperand(&type49); 2406 auto op21 = model->addOperand(&type50); 2407 auto op31 = model->addOperand(&type51); 2408 auto param7 = model->addOperand(&type4); 2409 auto param8 = model->addOperand(&type4); 2410 auto param9 = model->addOperand(&type4); 2411 auto param10 = model->addOperand(&type4); 2412 auto layout = model->addOperand(&type0); 2413 auto op41 = model->addOperand(&type52); 2414 // Phase 2, operations 2415 static int32_t param7_init[] = {1}; 2416 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2417 static int32_t param8_init[] = {1}; 2418 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2419 static int32_t param9_init[] = {1}; 2420 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2421 static int32_t param10_init[] = {1}; 2422 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2423 static bool8 layout_init[] = {false}; 2424 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2425 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2426 // Phase 3, inputs and outputs 2427 model->identifyInputsAndOutputs( 2428 {op11, op21, op31}, 2429 {op41}); 2430 assert(model->isValid()); 2431 } 2432 2433 inline bool is_ignored_nhwc_weight_as_input_quant8_2(int i) { 2434 static std::set<int> ignore = {}; 2435 return ignore.find(i) != ignore.end(); 2436 } 2437 2438 void CreateModel_nhwc_weight_as_input_channelQuant8_2(Model *model) { 2439 OperandType type0(Type::BOOL, {}); 2440 OperandType type4(Type::INT32, {}); 2441 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 2442 OperandType type52(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 1.0f, 50); 2443 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 2444 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 2445 // Phase 1, operands 2446 auto op11 = model->addOperand(&type49); 2447 auto op21 = model->addOperand(&type53); 2448 auto op31 = model->addOperand(&type54); 2449 auto param7 = model->addOperand(&type4); 2450 auto param8 = model->addOperand(&type4); 2451 auto param9 = model->addOperand(&type4); 2452 auto param10 = model->addOperand(&type4); 2453 auto layout = model->addOperand(&type0); 2454 auto op41 = model->addOperand(&type52); 2455 // Phase 2, operations 2456 static int32_t param7_init[] = {1}; 2457 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2458 static int32_t param8_init[] = {1}; 2459 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2460 static int32_t param9_init[] = {1}; 2461 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2462 static int32_t param10_init[] = {1}; 2463 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2464 static bool8 layout_init[] = {false}; 2465 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2466 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2467 // Phase 3, inputs and outputs 2468 model->identifyInputsAndOutputs( 2469 {op11, op21, op31}, 2470 {op41}); 2471 assert(model->isValid()); 2472 } 2473 2474 inline bool is_ignored_nhwc_weight_as_input_channelQuant8_2(int i) { 2475 static std::set<int> ignore = {}; 2476 return ignore.find(i) != ignore.end(); 2477 } 2478 2479 void CreateModel_nhwc_weight_as_input_float16_2(Model *model) { 2480 OperandType type0(Type::BOOL, {}); 2481 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 2482 OperandType type39(Type::TENSOR_FLOAT16, {1}); 2483 OperandType type4(Type::INT32, {}); 2484 OperandType type55(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); 2485 // Phase 1, operands 2486 auto op11 = model->addOperand(&type55); 2487 auto op21 = model->addOperand(&type37); 2488 auto op31 = model->addOperand(&type39); 2489 auto param7 = model->addOperand(&type4); 2490 auto param8 = model->addOperand(&type4); 2491 auto param9 = model->addOperand(&type4); 2492 auto param10 = model->addOperand(&type4); 2493 auto layout = model->addOperand(&type0); 2494 auto op41 = model->addOperand(&type55); 2495 // Phase 2, operations 2496 static int32_t param7_init[] = {1}; 2497 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2498 static int32_t param8_init[] = {1}; 2499 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2500 static int32_t param9_init[] = {1}; 2501 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2502 static int32_t param10_init[] = {1}; 2503 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2504 static bool8 layout_init[] = {false}; 2505 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2506 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2507 // Phase 3, inputs and outputs 2508 model->identifyInputsAndOutputs( 2509 {op11, op21, op31}, 2510 {op41}); 2511 assert(model->isValid()); 2512 } 2513 2514 inline bool is_ignored_nhwc_weight_as_input_float16_2(int i) { 2515 static std::set<int> ignore = {}; 2516 return ignore.find(i) != ignore.end(); 2517 } 2518 2519 void CreateModel_nchw_2(Model *model) { 2520 OperandType type0(Type::BOOL, {}); 2521 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2522 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2523 OperandType type4(Type::INT32, {}); 2524 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 2525 // Phase 1, operands 2526 auto op11 = model->addOperand(&type56); 2527 auto op21 = model->addOperand(&type1); 2528 auto op31 = model->addOperand(&type3); 2529 auto param7 = model->addOperand(&type4); 2530 auto param8 = model->addOperand(&type4); 2531 auto param9 = model->addOperand(&type4); 2532 auto param10 = model->addOperand(&type4); 2533 auto layout = model->addOperand(&type0); 2534 auto op41 = model->addOperand(&type56); 2535 // Phase 2, operations 2536 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2537 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 2538 static float op31_init[] = {-200.0f}; 2539 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 2540 static int32_t param7_init[] = {1}; 2541 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2542 static int32_t param8_init[] = {1}; 2543 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2544 static int32_t param9_init[] = {1}; 2545 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2546 static int32_t param10_init[] = {1}; 2547 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2548 static bool8 layout_init[] = {true}; 2549 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2550 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2551 // Phase 3, inputs and outputs 2552 model->identifyInputsAndOutputs( 2553 {op11}, 2554 {op41}); 2555 assert(model->isValid()); 2556 } 2557 2558 inline bool is_ignored_nchw_2(int i) { 2559 static std::set<int> ignore = {}; 2560 return ignore.find(i) != ignore.end(); 2561 } 2562 2563 void CreateModel_nchw_relaxed_2(Model *model) { 2564 OperandType type0(Type::BOOL, {}); 2565 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2566 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2567 OperandType type4(Type::INT32, {}); 2568 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 2569 // Phase 1, operands 2570 auto op11 = model->addOperand(&type56); 2571 auto op21 = model->addOperand(&type1); 2572 auto op31 = model->addOperand(&type3); 2573 auto param7 = model->addOperand(&type4); 2574 auto param8 = model->addOperand(&type4); 2575 auto param9 = model->addOperand(&type4); 2576 auto param10 = model->addOperand(&type4); 2577 auto layout = model->addOperand(&type0); 2578 auto op41 = model->addOperand(&type56); 2579 // Phase 2, operations 2580 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2581 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 2582 static float op31_init[] = {-200.0f}; 2583 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 2584 static int32_t param7_init[] = {1}; 2585 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2586 static int32_t param8_init[] = {1}; 2587 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2588 static int32_t param9_init[] = {1}; 2589 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2590 static int32_t param10_init[] = {1}; 2591 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2592 static bool8 layout_init[] = {true}; 2593 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2594 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2595 // Phase 3, inputs and outputs 2596 model->identifyInputsAndOutputs( 2597 {op11}, 2598 {op41}); 2599 // Phase 4: set relaxed execution 2600 model->relaxComputationFloat32toFloat16(true); 2601 assert(model->isValid()); 2602 } 2603 2604 inline bool is_ignored_nchw_relaxed_2(int i) { 2605 static std::set<int> ignore = {}; 2606 return ignore.find(i) != ignore.end(); 2607 } 2608 2609 void CreateModel_nchw_quant8_2(Model *model) { 2610 OperandType type0(Type::BOOL, {}); 2611 OperandType type4(Type::INT32, {}); 2612 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 2613 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 2614 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 2615 OperandType type58(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 1.0f, 50); 2616 // Phase 1, operands 2617 auto op11 = model->addOperand(&type57); 2618 auto op21 = model->addOperand(&type50); 2619 auto op31 = model->addOperand(&type51); 2620 auto param7 = model->addOperand(&type4); 2621 auto param8 = model->addOperand(&type4); 2622 auto param9 = model->addOperand(&type4); 2623 auto param10 = model->addOperand(&type4); 2624 auto layout = model->addOperand(&type0); 2625 auto op41 = model->addOperand(&type58); 2626 // Phase 2, operations 2627 static uint8_t op21_init[] = {129, 135, 141, 131, 137, 143, 133, 139, 145}; 2628 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 2629 static int32_t op31_init[] = {-800}; 2630 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 2631 static int32_t param7_init[] = {1}; 2632 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2633 static int32_t param8_init[] = {1}; 2634 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2635 static int32_t param9_init[] = {1}; 2636 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2637 static int32_t param10_init[] = {1}; 2638 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2639 static bool8 layout_init[] = {true}; 2640 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2641 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2642 // Phase 3, inputs and outputs 2643 model->identifyInputsAndOutputs( 2644 {op11}, 2645 {op41}); 2646 assert(model->isValid()); 2647 } 2648 2649 inline bool is_ignored_nchw_quant8_2(int i) { 2650 static std::set<int> ignore = {}; 2651 return ignore.find(i) != ignore.end(); 2652 } 2653 2654 void CreateModel_nchw_channelQuant8_2(Model *model) { 2655 OperandType type0(Type::BOOL, {}); 2656 OperandType type4(Type::INT32, {}); 2657 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 2658 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 2659 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 2660 OperandType type58(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 1.0f, 50); 2661 // Phase 1, operands 2662 auto op11 = model->addOperand(&type57); 2663 auto op21 = model->addOperand(&type53); 2664 auto op31 = model->addOperand(&type54); 2665 auto param7 = model->addOperand(&type4); 2666 auto param8 = model->addOperand(&type4); 2667 auto param9 = model->addOperand(&type4); 2668 auto param10 = model->addOperand(&type4); 2669 auto layout = model->addOperand(&type0); 2670 auto op41 = model->addOperand(&type58); 2671 // Phase 2, operations 2672 static int8_t op21_init[] = {2, 8, 14, 4, 10, 16, 6, 12, 18}; 2673 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 2674 static int32_t op31_init[] = {-800}; 2675 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 2676 static int32_t param7_init[] = {1}; 2677 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2678 static int32_t param8_init[] = {1}; 2679 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2680 static int32_t param9_init[] = {1}; 2681 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2682 static int32_t param10_init[] = {1}; 2683 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2684 static bool8 layout_init[] = {true}; 2685 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2686 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2687 // Phase 3, inputs and outputs 2688 model->identifyInputsAndOutputs( 2689 {op11}, 2690 {op41}); 2691 assert(model->isValid()); 2692 } 2693 2694 inline bool is_ignored_nchw_channelQuant8_2(int i) { 2695 static std::set<int> ignore = {}; 2696 return ignore.find(i) != ignore.end(); 2697 } 2698 2699 void CreateModel_nchw_float16_2(Model *model) { 2700 OperandType type0(Type::BOOL, {}); 2701 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 2702 OperandType type39(Type::TENSOR_FLOAT16, {1}); 2703 OperandType type4(Type::INT32, {}); 2704 OperandType type59(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); 2705 // Phase 1, operands 2706 auto op11 = model->addOperand(&type59); 2707 auto op21 = model->addOperand(&type37); 2708 auto op31 = model->addOperand(&type39); 2709 auto param7 = model->addOperand(&type4); 2710 auto param8 = model->addOperand(&type4); 2711 auto param9 = model->addOperand(&type4); 2712 auto param10 = model->addOperand(&type4); 2713 auto layout = model->addOperand(&type0); 2714 auto op41 = model->addOperand(&type59); 2715 // Phase 2, operations 2716 static _Float16 op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2717 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 2718 static _Float16 op31_init[] = {-200.0f}; 2719 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 2720 static int32_t param7_init[] = {1}; 2721 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2722 static int32_t param8_init[] = {1}; 2723 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2724 static int32_t param9_init[] = {1}; 2725 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2726 static int32_t param10_init[] = {1}; 2727 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2728 static bool8 layout_init[] = {true}; 2729 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2730 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2731 // Phase 3, inputs and outputs 2732 model->identifyInputsAndOutputs( 2733 {op11}, 2734 {op41}); 2735 assert(model->isValid()); 2736 } 2737 2738 inline bool is_ignored_nchw_float16_2(int i) { 2739 static std::set<int> ignore = {}; 2740 return ignore.find(i) != ignore.end(); 2741 } 2742 2743 void CreateModel_nchw_weight_as_input_2(Model *model) { 2744 OperandType type0(Type::BOOL, {}); 2745 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2746 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2747 OperandType type4(Type::INT32, {}); 2748 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 2749 // Phase 1, operands 2750 auto op11 = model->addOperand(&type56); 2751 auto op21 = model->addOperand(&type1); 2752 auto op31 = model->addOperand(&type3); 2753 auto param7 = model->addOperand(&type4); 2754 auto param8 = model->addOperand(&type4); 2755 auto param9 = model->addOperand(&type4); 2756 auto param10 = model->addOperand(&type4); 2757 auto layout = model->addOperand(&type0); 2758 auto op41 = model->addOperand(&type56); 2759 // Phase 2, operations 2760 static int32_t param7_init[] = {1}; 2761 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2762 static int32_t param8_init[] = {1}; 2763 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2764 static int32_t param9_init[] = {1}; 2765 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2766 static int32_t param10_init[] = {1}; 2767 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2768 static bool8 layout_init[] = {true}; 2769 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2770 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2771 // Phase 3, inputs and outputs 2772 model->identifyInputsAndOutputs( 2773 {op11, op21, op31}, 2774 {op41}); 2775 assert(model->isValid()); 2776 } 2777 2778 inline bool is_ignored_nchw_weight_as_input_2(int i) { 2779 static std::set<int> ignore = {}; 2780 return ignore.find(i) != ignore.end(); 2781 } 2782 2783 void CreateModel_nchw_weight_as_input_relaxed_2(Model *model) { 2784 OperandType type0(Type::BOOL, {}); 2785 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2786 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2787 OperandType type4(Type::INT32, {}); 2788 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 2789 // Phase 1, operands 2790 auto op11 = model->addOperand(&type56); 2791 auto op21 = model->addOperand(&type1); 2792 auto op31 = model->addOperand(&type3); 2793 auto param7 = model->addOperand(&type4); 2794 auto param8 = model->addOperand(&type4); 2795 auto param9 = model->addOperand(&type4); 2796 auto param10 = model->addOperand(&type4); 2797 auto layout = model->addOperand(&type0); 2798 auto op41 = model->addOperand(&type56); 2799 // Phase 2, operations 2800 static int32_t param7_init[] = {1}; 2801 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2802 static int32_t param8_init[] = {1}; 2803 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2804 static int32_t param9_init[] = {1}; 2805 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2806 static int32_t param10_init[] = {1}; 2807 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2808 static bool8 layout_init[] = {true}; 2809 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2810 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2811 // Phase 3, inputs and outputs 2812 model->identifyInputsAndOutputs( 2813 {op11, op21, op31}, 2814 {op41}); 2815 // Phase 4: set relaxed execution 2816 model->relaxComputationFloat32toFloat16(true); 2817 assert(model->isValid()); 2818 } 2819 2820 inline bool is_ignored_nchw_weight_as_input_relaxed_2(int i) { 2821 static std::set<int> ignore = {}; 2822 return ignore.find(i) != ignore.end(); 2823 } 2824 2825 void CreateModel_nchw_weight_as_input_quant8_2(Model *model) { 2826 OperandType type0(Type::BOOL, {}); 2827 OperandType type4(Type::INT32, {}); 2828 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 2829 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 2830 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 2831 OperandType type58(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 1.0f, 50); 2832 // Phase 1, operands 2833 auto op11 = model->addOperand(&type57); 2834 auto op21 = model->addOperand(&type50); 2835 auto op31 = model->addOperand(&type51); 2836 auto param7 = model->addOperand(&type4); 2837 auto param8 = model->addOperand(&type4); 2838 auto param9 = model->addOperand(&type4); 2839 auto param10 = model->addOperand(&type4); 2840 auto layout = model->addOperand(&type0); 2841 auto op41 = model->addOperand(&type58); 2842 // Phase 2, operations 2843 static int32_t param7_init[] = {1}; 2844 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2845 static int32_t param8_init[] = {1}; 2846 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2847 static int32_t param9_init[] = {1}; 2848 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2849 static int32_t param10_init[] = {1}; 2850 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2851 static bool8 layout_init[] = {true}; 2852 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2853 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2854 // Phase 3, inputs and outputs 2855 model->identifyInputsAndOutputs( 2856 {op11, op21, op31}, 2857 {op41}); 2858 assert(model->isValid()); 2859 } 2860 2861 inline bool is_ignored_nchw_weight_as_input_quant8_2(int i) { 2862 static std::set<int> ignore = {}; 2863 return ignore.find(i) != ignore.end(); 2864 } 2865 2866 void CreateModel_nchw_weight_as_input_channelQuant8_2(Model *model) { 2867 OperandType type0(Type::BOOL, {}); 2868 OperandType type4(Type::INT32, {}); 2869 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 2870 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 2871 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 2872 OperandType type58(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 1.0f, 50); 2873 // Phase 1, operands 2874 auto op11 = model->addOperand(&type57); 2875 auto op21 = model->addOperand(&type53); 2876 auto op31 = model->addOperand(&type54); 2877 auto param7 = model->addOperand(&type4); 2878 auto param8 = model->addOperand(&type4); 2879 auto param9 = model->addOperand(&type4); 2880 auto param10 = model->addOperand(&type4); 2881 auto layout = model->addOperand(&type0); 2882 auto op41 = model->addOperand(&type58); 2883 // Phase 2, operations 2884 static int32_t param7_init[] = {1}; 2885 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2886 static int32_t param8_init[] = {1}; 2887 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2888 static int32_t param9_init[] = {1}; 2889 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2890 static int32_t param10_init[] = {1}; 2891 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2892 static bool8 layout_init[] = {true}; 2893 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2894 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2895 // Phase 3, inputs and outputs 2896 model->identifyInputsAndOutputs( 2897 {op11, op21, op31}, 2898 {op41}); 2899 assert(model->isValid()); 2900 } 2901 2902 inline bool is_ignored_nchw_weight_as_input_channelQuant8_2(int i) { 2903 static std::set<int> ignore = {}; 2904 return ignore.find(i) != ignore.end(); 2905 } 2906 2907 void CreateModel_nchw_weight_as_input_float16_2(Model *model) { 2908 OperandType type0(Type::BOOL, {}); 2909 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 2910 OperandType type39(Type::TENSOR_FLOAT16, {1}); 2911 OperandType type4(Type::INT32, {}); 2912 OperandType type59(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); 2913 // Phase 1, operands 2914 auto op11 = model->addOperand(&type59); 2915 auto op21 = model->addOperand(&type37); 2916 auto op31 = model->addOperand(&type39); 2917 auto param7 = model->addOperand(&type4); 2918 auto param8 = model->addOperand(&type4); 2919 auto param9 = model->addOperand(&type4); 2920 auto param10 = model->addOperand(&type4); 2921 auto layout = model->addOperand(&type0); 2922 auto op41 = model->addOperand(&type59); 2923 // Phase 2, operations 2924 static int32_t param7_init[] = {1}; 2925 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2926 static int32_t param8_init[] = {1}; 2927 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2928 static int32_t param9_init[] = {1}; 2929 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2930 static int32_t param10_init[] = {1}; 2931 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2932 static bool8 layout_init[] = {true}; 2933 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2934 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2935 // Phase 3, inputs and outputs 2936 model->identifyInputsAndOutputs( 2937 {op11, op21, op31}, 2938 {op41}); 2939 assert(model->isValid()); 2940 } 2941 2942 inline bool is_ignored_nchw_weight_as_input_float16_2(int i) { 2943 static std::set<int> ignore = {}; 2944 return ignore.find(i) != ignore.end(); 2945 } 2946 2947 void CreateModel_dynamic_output_shape_nhwc_2(Model *model) { 2948 OperandType type0(Type::BOOL, {}); 2949 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2950 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2951 OperandType type4(Type::INT32, {}); 2952 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 2953 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 2954 // Phase 1, operands 2955 auto op11 = model->addOperand(&type5); 2956 auto op21 = model->addOperand(&type1); 2957 auto op31 = model->addOperand(&type3); 2958 auto param7 = model->addOperand(&type4); 2959 auto param8 = model->addOperand(&type4); 2960 auto param9 = model->addOperand(&type4); 2961 auto param10 = model->addOperand(&type4); 2962 auto layout = model->addOperand(&type0); 2963 auto op41 = model->addOperand(&type46); 2964 // Phase 2, operations 2965 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 2966 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 2967 static float op31_init[] = {-200.0f}; 2968 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 2969 static int32_t param7_init[] = {1}; 2970 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 2971 static int32_t param8_init[] = {1}; 2972 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 2973 static int32_t param9_init[] = {1}; 2974 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 2975 static int32_t param10_init[] = {1}; 2976 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 2977 static bool8 layout_init[] = {false}; 2978 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2979 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 2980 // Phase 3, inputs and outputs 2981 model->identifyInputsAndOutputs( 2982 {op11}, 2983 {op41}); 2984 assert(model->isValid()); 2985 } 2986 2987 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) { 2988 static std::set<int> ignore = {}; 2989 return ignore.find(i) != ignore.end(); 2990 } 2991 2992 void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) { 2993 OperandType type0(Type::BOOL, {}); 2994 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 2995 OperandType type3(Type::TENSOR_FLOAT32, {1}); 2996 OperandType type4(Type::INT32, {}); 2997 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 2998 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 2999 // Phase 1, operands 3000 auto op11 = model->addOperand(&type5); 3001 auto op21 = model->addOperand(&type1); 3002 auto op31 = model->addOperand(&type3); 3003 auto param7 = model->addOperand(&type4); 3004 auto param8 = model->addOperand(&type4); 3005 auto param9 = model->addOperand(&type4); 3006 auto param10 = model->addOperand(&type4); 3007 auto layout = model->addOperand(&type0); 3008 auto op41 = model->addOperand(&type46); 3009 // Phase 2, operations 3010 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 3011 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 3012 static float op31_init[] = {-200.0f}; 3013 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 3014 static int32_t param7_init[] = {1}; 3015 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3016 static int32_t param8_init[] = {1}; 3017 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3018 static int32_t param9_init[] = {1}; 3019 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3020 static int32_t param10_init[] = {1}; 3021 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3022 static bool8 layout_init[] = {false}; 3023 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3024 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3025 // Phase 3, inputs and outputs 3026 model->identifyInputsAndOutputs( 3027 {op11}, 3028 {op41}); 3029 // Phase 4: set relaxed execution 3030 model->relaxComputationFloat32toFloat16(true); 3031 assert(model->isValid()); 3032 } 3033 3034 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) { 3035 static std::set<int> ignore = {}; 3036 return ignore.find(i) != ignore.end(); 3037 } 3038 3039 void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) { 3040 OperandType type0(Type::BOOL, {}); 3041 OperandType type4(Type::INT32, {}); 3042 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 3043 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 3044 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 3045 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3046 // Phase 1, operands 3047 auto op11 = model->addOperand(&type49); 3048 auto op21 = model->addOperand(&type50); 3049 auto op31 = model->addOperand(&type51); 3050 auto param7 = model->addOperand(&type4); 3051 auto param8 = model->addOperand(&type4); 3052 auto param9 = model->addOperand(&type4); 3053 auto param10 = model->addOperand(&type4); 3054 auto layout = model->addOperand(&type0); 3055 auto op41 = model->addOperand(&type60); 3056 // Phase 2, operations 3057 static uint8_t op21_init[] = {129, 135, 141, 131, 137, 143, 133, 139, 145}; 3058 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 3059 static int32_t op31_init[] = {-800}; 3060 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 3061 static int32_t param7_init[] = {1}; 3062 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3063 static int32_t param8_init[] = {1}; 3064 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3065 static int32_t param9_init[] = {1}; 3066 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3067 static int32_t param10_init[] = {1}; 3068 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3069 static bool8 layout_init[] = {false}; 3070 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3071 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3072 // Phase 3, inputs and outputs 3073 model->identifyInputsAndOutputs( 3074 {op11}, 3075 {op41}); 3076 assert(model->isValid()); 3077 } 3078 3079 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) { 3080 static std::set<int> ignore = {}; 3081 return ignore.find(i) != ignore.end(); 3082 } 3083 3084 void CreateModel_dynamic_output_shape_nhwc_channelQuant8_2(Model *model) { 3085 OperandType type0(Type::BOOL, {}); 3086 OperandType type4(Type::INT32, {}); 3087 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 3088 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 3089 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 3090 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3091 // Phase 1, operands 3092 auto op11 = model->addOperand(&type49); 3093 auto op21 = model->addOperand(&type53); 3094 auto op31 = model->addOperand(&type54); 3095 auto param7 = model->addOperand(&type4); 3096 auto param8 = model->addOperand(&type4); 3097 auto param9 = model->addOperand(&type4); 3098 auto param10 = model->addOperand(&type4); 3099 auto layout = model->addOperand(&type0); 3100 auto op41 = model->addOperand(&type60); 3101 // Phase 2, operations 3102 static int8_t op21_init[] = {2, 8, 14, 4, 10, 16, 6, 12, 18}; 3103 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 3104 static int32_t op31_init[] = {-800}; 3105 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 3106 static int32_t param7_init[] = {1}; 3107 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3108 static int32_t param8_init[] = {1}; 3109 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3110 static int32_t param9_init[] = {1}; 3111 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3112 static int32_t param10_init[] = {1}; 3113 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3114 static bool8 layout_init[] = {false}; 3115 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3116 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3117 // Phase 3, inputs and outputs 3118 model->identifyInputsAndOutputs( 3119 {op11}, 3120 {op41}); 3121 assert(model->isValid()); 3122 } 3123 3124 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8_2(int i) { 3125 static std::set<int> ignore = {}; 3126 return ignore.find(i) != ignore.end(); 3127 } 3128 3129 void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) { 3130 OperandType type0(Type::BOOL, {}); 3131 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 3132 OperandType type39(Type::TENSOR_FLOAT16, {1}); 3133 OperandType type4(Type::INT32, {}); 3134 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 3135 OperandType type55(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); 3136 // Phase 1, operands 3137 auto op11 = model->addOperand(&type55); 3138 auto op21 = model->addOperand(&type37); 3139 auto op31 = model->addOperand(&type39); 3140 auto param7 = model->addOperand(&type4); 3141 auto param8 = model->addOperand(&type4); 3142 auto param9 = model->addOperand(&type4); 3143 auto param10 = model->addOperand(&type4); 3144 auto layout = model->addOperand(&type0); 3145 auto op41 = model->addOperand(&type48); 3146 // Phase 2, operations 3147 static _Float16 op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 3148 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 3149 static _Float16 op31_init[] = {-200.0f}; 3150 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 3151 static int32_t param7_init[] = {1}; 3152 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3153 static int32_t param8_init[] = {1}; 3154 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3155 static int32_t param9_init[] = {1}; 3156 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3157 static int32_t param10_init[] = {1}; 3158 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3159 static bool8 layout_init[] = {false}; 3160 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3161 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3162 // Phase 3, inputs and outputs 3163 model->identifyInputsAndOutputs( 3164 {op11}, 3165 {op41}); 3166 assert(model->isValid()); 3167 } 3168 3169 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) { 3170 static std::set<int> ignore = {}; 3171 return ignore.find(i) != ignore.end(); 3172 } 3173 3174 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) { 3175 OperandType type0(Type::BOOL, {}); 3176 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 3177 OperandType type3(Type::TENSOR_FLOAT32, {1}); 3178 OperandType type4(Type::INT32, {}); 3179 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 3180 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 3181 // Phase 1, operands 3182 auto op11 = model->addOperand(&type5); 3183 auto op21 = model->addOperand(&type1); 3184 auto op31 = model->addOperand(&type3); 3185 auto param7 = model->addOperand(&type4); 3186 auto param8 = model->addOperand(&type4); 3187 auto param9 = model->addOperand(&type4); 3188 auto param10 = model->addOperand(&type4); 3189 auto layout = model->addOperand(&type0); 3190 auto op41 = model->addOperand(&type46); 3191 // Phase 2, operations 3192 static int32_t param7_init[] = {1}; 3193 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3194 static int32_t param8_init[] = {1}; 3195 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3196 static int32_t param9_init[] = {1}; 3197 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3198 static int32_t param10_init[] = {1}; 3199 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3200 static bool8 layout_init[] = {false}; 3201 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3202 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3203 // Phase 3, inputs and outputs 3204 model->identifyInputsAndOutputs( 3205 {op11, op21, op31}, 3206 {op41}); 3207 assert(model->isValid()); 3208 } 3209 3210 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i) { 3211 static std::set<int> ignore = {}; 3212 return ignore.find(i) != ignore.end(); 3213 } 3214 3215 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(Model *model) { 3216 OperandType type0(Type::BOOL, {}); 3217 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 3218 OperandType type3(Type::TENSOR_FLOAT32, {1}); 3219 OperandType type4(Type::INT32, {}); 3220 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 3221 OperandType type5(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 3222 // Phase 1, operands 3223 auto op11 = model->addOperand(&type5); 3224 auto op21 = model->addOperand(&type1); 3225 auto op31 = model->addOperand(&type3); 3226 auto param7 = model->addOperand(&type4); 3227 auto param8 = model->addOperand(&type4); 3228 auto param9 = model->addOperand(&type4); 3229 auto param10 = model->addOperand(&type4); 3230 auto layout = model->addOperand(&type0); 3231 auto op41 = model->addOperand(&type46); 3232 // Phase 2, operations 3233 static int32_t param7_init[] = {1}; 3234 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3235 static int32_t param8_init[] = {1}; 3236 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3237 static int32_t param9_init[] = {1}; 3238 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3239 static int32_t param10_init[] = {1}; 3240 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3241 static bool8 layout_init[] = {false}; 3242 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3243 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3244 // Phase 3, inputs and outputs 3245 model->identifyInputsAndOutputs( 3246 {op11, op21, op31}, 3247 {op41}); 3248 // Phase 4: set relaxed execution 3249 model->relaxComputationFloat32toFloat16(true); 3250 assert(model->isValid()); 3251 } 3252 3253 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_relaxed_2(int i) { 3254 static std::set<int> ignore = {}; 3255 return ignore.find(i) != ignore.end(); 3256 } 3257 3258 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_quant8_2(Model *model) { 3259 OperandType type0(Type::BOOL, {}); 3260 OperandType type4(Type::INT32, {}); 3261 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 3262 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 3263 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 3264 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3265 // Phase 1, operands 3266 auto op11 = model->addOperand(&type49); 3267 auto op21 = model->addOperand(&type50); 3268 auto op31 = model->addOperand(&type51); 3269 auto param7 = model->addOperand(&type4); 3270 auto param8 = model->addOperand(&type4); 3271 auto param9 = model->addOperand(&type4); 3272 auto param10 = model->addOperand(&type4); 3273 auto layout = model->addOperand(&type0); 3274 auto op41 = model->addOperand(&type60); 3275 // Phase 2, operations 3276 static int32_t param7_init[] = {1}; 3277 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3278 static int32_t param8_init[] = {1}; 3279 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3280 static int32_t param9_init[] = {1}; 3281 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3282 static int32_t param10_init[] = {1}; 3283 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3284 static bool8 layout_init[] = {false}; 3285 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3286 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3287 // Phase 3, inputs and outputs 3288 model->identifyInputsAndOutputs( 3289 {op11, op21, op31}, 3290 {op41}); 3291 assert(model->isValid()); 3292 } 3293 3294 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_quant8_2(int i) { 3295 static std::set<int> ignore = {}; 3296 return ignore.find(i) != ignore.end(); 3297 } 3298 3299 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(Model *model) { 3300 OperandType type0(Type::BOOL, {}); 3301 OperandType type4(Type::INT32, {}); 3302 OperandType type49(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 0.5f, 127); 3303 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 3304 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 3305 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3306 // Phase 1, operands 3307 auto op11 = model->addOperand(&type49); 3308 auto op21 = model->addOperand(&type53); 3309 auto op31 = model->addOperand(&type54); 3310 auto param7 = model->addOperand(&type4); 3311 auto param8 = model->addOperand(&type4); 3312 auto param9 = model->addOperand(&type4); 3313 auto param10 = model->addOperand(&type4); 3314 auto layout = model->addOperand(&type0); 3315 auto op41 = model->addOperand(&type60); 3316 // Phase 2, operations 3317 static int32_t param7_init[] = {1}; 3318 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3319 static int32_t param8_init[] = {1}; 3320 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3321 static int32_t param9_init[] = {1}; 3322 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3323 static int32_t param10_init[] = {1}; 3324 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3325 static bool8 layout_init[] = {false}; 3326 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3327 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3328 // Phase 3, inputs and outputs 3329 model->identifyInputsAndOutputs( 3330 {op11, op21, op31}, 3331 {op41}); 3332 assert(model->isValid()); 3333 } 3334 3335 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(int i) { 3336 static std::set<int> ignore = {}; 3337 return ignore.find(i) != ignore.end(); 3338 } 3339 3340 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_float16_2(Model *model) { 3341 OperandType type0(Type::BOOL, {}); 3342 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 3343 OperandType type39(Type::TENSOR_FLOAT16, {1}); 3344 OperandType type4(Type::INT32, {}); 3345 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 3346 OperandType type55(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); 3347 // Phase 1, operands 3348 auto op11 = model->addOperand(&type55); 3349 auto op21 = model->addOperand(&type37); 3350 auto op31 = model->addOperand(&type39); 3351 auto param7 = model->addOperand(&type4); 3352 auto param8 = model->addOperand(&type4); 3353 auto param9 = model->addOperand(&type4); 3354 auto param10 = model->addOperand(&type4); 3355 auto layout = model->addOperand(&type0); 3356 auto op41 = model->addOperand(&type48); 3357 // Phase 2, operations 3358 static int32_t param7_init[] = {1}; 3359 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3360 static int32_t param8_init[] = {1}; 3361 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3362 static int32_t param9_init[] = {1}; 3363 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3364 static int32_t param10_init[] = {1}; 3365 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3366 static bool8 layout_init[] = {false}; 3367 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3368 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3369 // Phase 3, inputs and outputs 3370 model->identifyInputsAndOutputs( 3371 {op11, op21, op31}, 3372 {op41}); 3373 assert(model->isValid()); 3374 } 3375 3376 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_float16_2(int i) { 3377 static std::set<int> ignore = {}; 3378 return ignore.find(i) != ignore.end(); 3379 } 3380 3381 void CreateModel_dynamic_output_shape_nchw_2(Model *model) { 3382 OperandType type0(Type::BOOL, {}); 3383 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 3384 OperandType type3(Type::TENSOR_FLOAT32, {1}); 3385 OperandType type4(Type::INT32, {}); 3386 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 3387 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 3388 // Phase 1, operands 3389 auto op11 = model->addOperand(&type56); 3390 auto op21 = model->addOperand(&type1); 3391 auto op31 = model->addOperand(&type3); 3392 auto param7 = model->addOperand(&type4); 3393 auto param8 = model->addOperand(&type4); 3394 auto param9 = model->addOperand(&type4); 3395 auto param10 = model->addOperand(&type4); 3396 auto layout = model->addOperand(&type0); 3397 auto op41 = model->addOperand(&type46); 3398 // Phase 2, operations 3399 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 3400 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 3401 static float op31_init[] = {-200.0f}; 3402 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 3403 static int32_t param7_init[] = {1}; 3404 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3405 static int32_t param8_init[] = {1}; 3406 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3407 static int32_t param9_init[] = {1}; 3408 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3409 static int32_t param10_init[] = {1}; 3410 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3411 static bool8 layout_init[] = {true}; 3412 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3413 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3414 // Phase 3, inputs and outputs 3415 model->identifyInputsAndOutputs( 3416 {op11}, 3417 {op41}); 3418 assert(model->isValid()); 3419 } 3420 3421 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) { 3422 static std::set<int> ignore = {}; 3423 return ignore.find(i) != ignore.end(); 3424 } 3425 3426 void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) { 3427 OperandType type0(Type::BOOL, {}); 3428 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 3429 OperandType type3(Type::TENSOR_FLOAT32, {1}); 3430 OperandType type4(Type::INT32, {}); 3431 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 3432 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 3433 // Phase 1, operands 3434 auto op11 = model->addOperand(&type56); 3435 auto op21 = model->addOperand(&type1); 3436 auto op31 = model->addOperand(&type3); 3437 auto param7 = model->addOperand(&type4); 3438 auto param8 = model->addOperand(&type4); 3439 auto param9 = model->addOperand(&type4); 3440 auto param10 = model->addOperand(&type4); 3441 auto layout = model->addOperand(&type0); 3442 auto op41 = model->addOperand(&type46); 3443 // Phase 2, operations 3444 static float op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 3445 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 3446 static float op31_init[] = {-200.0f}; 3447 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 3448 static int32_t param7_init[] = {1}; 3449 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3450 static int32_t param8_init[] = {1}; 3451 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3452 static int32_t param9_init[] = {1}; 3453 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3454 static int32_t param10_init[] = {1}; 3455 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3456 static bool8 layout_init[] = {true}; 3457 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3458 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3459 // Phase 3, inputs and outputs 3460 model->identifyInputsAndOutputs( 3461 {op11}, 3462 {op41}); 3463 // Phase 4: set relaxed execution 3464 model->relaxComputationFloat32toFloat16(true); 3465 assert(model->isValid()); 3466 } 3467 3468 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) { 3469 static std::set<int> ignore = {}; 3470 return ignore.find(i) != ignore.end(); 3471 } 3472 3473 void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) { 3474 OperandType type0(Type::BOOL, {}); 3475 OperandType type4(Type::INT32, {}); 3476 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 3477 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 3478 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 3479 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3480 // Phase 1, operands 3481 auto op11 = model->addOperand(&type57); 3482 auto op21 = model->addOperand(&type50); 3483 auto op31 = model->addOperand(&type51); 3484 auto param7 = model->addOperand(&type4); 3485 auto param8 = model->addOperand(&type4); 3486 auto param9 = model->addOperand(&type4); 3487 auto param10 = model->addOperand(&type4); 3488 auto layout = model->addOperand(&type0); 3489 auto op41 = model->addOperand(&type60); 3490 // Phase 2, operations 3491 static uint8_t op21_init[] = {129, 135, 141, 131, 137, 143, 133, 139, 145}; 3492 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 3493 static int32_t op31_init[] = {-800}; 3494 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 3495 static int32_t param7_init[] = {1}; 3496 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3497 static int32_t param8_init[] = {1}; 3498 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3499 static int32_t param9_init[] = {1}; 3500 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3501 static int32_t param10_init[] = {1}; 3502 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3503 static bool8 layout_init[] = {true}; 3504 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3505 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3506 // Phase 3, inputs and outputs 3507 model->identifyInputsAndOutputs( 3508 {op11}, 3509 {op41}); 3510 assert(model->isValid()); 3511 } 3512 3513 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) { 3514 static std::set<int> ignore = {}; 3515 return ignore.find(i) != ignore.end(); 3516 } 3517 3518 void CreateModel_dynamic_output_shape_nchw_channelQuant8_2(Model *model) { 3519 OperandType type0(Type::BOOL, {}); 3520 OperandType type4(Type::INT32, {}); 3521 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 3522 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 3523 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 3524 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3525 // Phase 1, operands 3526 auto op11 = model->addOperand(&type57); 3527 auto op21 = model->addOperand(&type53); 3528 auto op31 = model->addOperand(&type54); 3529 auto param7 = model->addOperand(&type4); 3530 auto param8 = model->addOperand(&type4); 3531 auto param9 = model->addOperand(&type4); 3532 auto param10 = model->addOperand(&type4); 3533 auto layout = model->addOperand(&type0); 3534 auto op41 = model->addOperand(&type60); 3535 // Phase 2, operations 3536 static int8_t op21_init[] = {2, 8, 14, 4, 10, 16, 6, 12, 18}; 3537 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 3538 static int32_t op31_init[] = {-800}; 3539 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 3540 static int32_t param7_init[] = {1}; 3541 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3542 static int32_t param8_init[] = {1}; 3543 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3544 static int32_t param9_init[] = {1}; 3545 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3546 static int32_t param10_init[] = {1}; 3547 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3548 static bool8 layout_init[] = {true}; 3549 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3550 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3551 // Phase 3, inputs and outputs 3552 model->identifyInputsAndOutputs( 3553 {op11}, 3554 {op41}); 3555 assert(model->isValid()); 3556 } 3557 3558 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8_2(int i) { 3559 static std::set<int> ignore = {}; 3560 return ignore.find(i) != ignore.end(); 3561 } 3562 3563 void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) { 3564 OperandType type0(Type::BOOL, {}); 3565 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 3566 OperandType type39(Type::TENSOR_FLOAT16, {1}); 3567 OperandType type4(Type::INT32, {}); 3568 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 3569 OperandType type59(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); 3570 // Phase 1, operands 3571 auto op11 = model->addOperand(&type59); 3572 auto op21 = model->addOperand(&type37); 3573 auto op31 = model->addOperand(&type39); 3574 auto param7 = model->addOperand(&type4); 3575 auto param8 = model->addOperand(&type4); 3576 auto param9 = model->addOperand(&type4); 3577 auto param10 = model->addOperand(&type4); 3578 auto layout = model->addOperand(&type0); 3579 auto op41 = model->addOperand(&type48); 3580 // Phase 2, operations 3581 static _Float16 op21_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 3582 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 3583 static _Float16 op31_init[] = {-200.0f}; 3584 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 3585 static int32_t param7_init[] = {1}; 3586 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3587 static int32_t param8_init[] = {1}; 3588 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3589 static int32_t param9_init[] = {1}; 3590 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3591 static int32_t param10_init[] = {1}; 3592 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3593 static bool8 layout_init[] = {true}; 3594 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3595 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3596 // Phase 3, inputs and outputs 3597 model->identifyInputsAndOutputs( 3598 {op11}, 3599 {op41}); 3600 assert(model->isValid()); 3601 } 3602 3603 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) { 3604 static std::set<int> ignore = {}; 3605 return ignore.find(i) != ignore.end(); 3606 } 3607 3608 void CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model *model) { 3609 OperandType type0(Type::BOOL, {}); 3610 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 3611 OperandType type3(Type::TENSOR_FLOAT32, {1}); 3612 OperandType type4(Type::INT32, {}); 3613 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 3614 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 3615 // Phase 1, operands 3616 auto op11 = model->addOperand(&type56); 3617 auto op21 = model->addOperand(&type1); 3618 auto op31 = model->addOperand(&type3); 3619 auto param7 = model->addOperand(&type4); 3620 auto param8 = model->addOperand(&type4); 3621 auto param9 = model->addOperand(&type4); 3622 auto param10 = model->addOperand(&type4); 3623 auto layout = model->addOperand(&type0); 3624 auto op41 = model->addOperand(&type46); 3625 // Phase 2, operations 3626 static int32_t param7_init[] = {1}; 3627 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3628 static int32_t param8_init[] = {1}; 3629 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3630 static int32_t param9_init[] = {1}; 3631 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3632 static int32_t param10_init[] = {1}; 3633 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3634 static bool8 layout_init[] = {true}; 3635 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3636 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3637 // Phase 3, inputs and outputs 3638 model->identifyInputsAndOutputs( 3639 {op11, op21, op31}, 3640 {op41}); 3641 assert(model->isValid()); 3642 } 3643 3644 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i) { 3645 static std::set<int> ignore = {}; 3646 return ignore.find(i) != ignore.end(); 3647 } 3648 3649 void CreateModel_dynamic_output_shape_nchw_weight_as_input_relaxed_2(Model *model) { 3650 OperandType type0(Type::BOOL, {}); 3651 OperandType type1(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 3652 OperandType type3(Type::TENSOR_FLOAT32, {1}); 3653 OperandType type4(Type::INT32, {}); 3654 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 3655 OperandType type56(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 3656 // Phase 1, operands 3657 auto op11 = model->addOperand(&type56); 3658 auto op21 = model->addOperand(&type1); 3659 auto op31 = model->addOperand(&type3); 3660 auto param7 = model->addOperand(&type4); 3661 auto param8 = model->addOperand(&type4); 3662 auto param9 = model->addOperand(&type4); 3663 auto param10 = model->addOperand(&type4); 3664 auto layout = model->addOperand(&type0); 3665 auto op41 = model->addOperand(&type46); 3666 // Phase 2, operations 3667 static int32_t param7_init[] = {1}; 3668 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3669 static int32_t param8_init[] = {1}; 3670 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3671 static int32_t param9_init[] = {1}; 3672 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3673 static int32_t param10_init[] = {1}; 3674 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3675 static bool8 layout_init[] = {true}; 3676 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3677 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3678 // Phase 3, inputs and outputs 3679 model->identifyInputsAndOutputs( 3680 {op11, op21, op31}, 3681 {op41}); 3682 // Phase 4: set relaxed execution 3683 model->relaxComputationFloat32toFloat16(true); 3684 assert(model->isValid()); 3685 } 3686 3687 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_relaxed_2(int i) { 3688 static std::set<int> ignore = {}; 3689 return ignore.find(i) != ignore.end(); 3690 } 3691 3692 void CreateModel_dynamic_output_shape_nchw_weight_as_input_quant8_2(Model *model) { 3693 OperandType type0(Type::BOOL, {}); 3694 OperandType type4(Type::INT32, {}); 3695 OperandType type50(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.5f, 127); 3696 OperandType type51(Type::TENSOR_INT32, {1}, 0.25f, 0); 3697 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 3698 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3699 // Phase 1, operands 3700 auto op11 = model->addOperand(&type57); 3701 auto op21 = model->addOperand(&type50); 3702 auto op31 = model->addOperand(&type51); 3703 auto param7 = model->addOperand(&type4); 3704 auto param8 = model->addOperand(&type4); 3705 auto param9 = model->addOperand(&type4); 3706 auto param10 = model->addOperand(&type4); 3707 auto layout = model->addOperand(&type0); 3708 auto op41 = model->addOperand(&type60); 3709 // Phase 2, operations 3710 static int32_t param7_init[] = {1}; 3711 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3712 static int32_t param8_init[] = {1}; 3713 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3714 static int32_t param9_init[] = {1}; 3715 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3716 static int32_t param10_init[] = {1}; 3717 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3718 static bool8 layout_init[] = {true}; 3719 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3720 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3721 // Phase 3, inputs and outputs 3722 model->identifyInputsAndOutputs( 3723 {op11, op21, op31}, 3724 {op41}); 3725 assert(model->isValid()); 3726 } 3727 3728 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_quant8_2(int i) { 3729 static std::set<int> ignore = {}; 3730 return ignore.find(i) != ignore.end(); 3731 } 3732 3733 void CreateModel_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(Model *model) { 3734 OperandType type0(Type::BOOL, {}); 3735 OperandType type4(Type::INT32, {}); 3736 OperandType type53(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.5f},0)); 3737 OperandType type54(Type::TENSOR_INT32, {1}, 0.0f, 0); 3738 OperandType type57(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 0.5f, 127); 3739 OperandType type60(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 50); 3740 // Phase 1, operands 3741 auto op11 = model->addOperand(&type57); 3742 auto op21 = model->addOperand(&type53); 3743 auto op31 = model->addOperand(&type54); 3744 auto param7 = model->addOperand(&type4); 3745 auto param8 = model->addOperand(&type4); 3746 auto param9 = model->addOperand(&type4); 3747 auto param10 = model->addOperand(&type4); 3748 auto layout = model->addOperand(&type0); 3749 auto op41 = model->addOperand(&type60); 3750 // Phase 2, operations 3751 static int32_t param7_init[] = {1}; 3752 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3753 static int32_t param8_init[] = {1}; 3754 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3755 static int32_t param9_init[] = {1}; 3756 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3757 static int32_t param10_init[] = {1}; 3758 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3759 static bool8 layout_init[] = {true}; 3760 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3761 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3762 // Phase 3, inputs and outputs 3763 model->identifyInputsAndOutputs( 3764 {op11, op21, op31}, 3765 {op41}); 3766 assert(model->isValid()); 3767 } 3768 3769 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(int i) { 3770 static std::set<int> ignore = {}; 3771 return ignore.find(i) != ignore.end(); 3772 } 3773 3774 void CreateModel_dynamic_output_shape_nchw_weight_as_input_float16_2(Model *model) { 3775 OperandType type0(Type::BOOL, {}); 3776 OperandType type37(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 3777 OperandType type39(Type::TENSOR_FLOAT16, {1}); 3778 OperandType type4(Type::INT32, {}); 3779 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 3780 OperandType type59(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); 3781 // Phase 1, operands 3782 auto op11 = model->addOperand(&type59); 3783 auto op21 = model->addOperand(&type37); 3784 auto op31 = model->addOperand(&type39); 3785 auto param7 = model->addOperand(&type4); 3786 auto param8 = model->addOperand(&type4); 3787 auto param9 = model->addOperand(&type4); 3788 auto param10 = model->addOperand(&type4); 3789 auto layout = model->addOperand(&type0); 3790 auto op41 = model->addOperand(&type48); 3791 // Phase 2, operations 3792 static int32_t param7_init[] = {1}; 3793 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 3794 static int32_t param8_init[] = {1}; 3795 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 3796 static int32_t param9_init[] = {1}; 3797 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 3798 static int32_t param10_init[] = {1}; 3799 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 3800 static bool8 layout_init[] = {true}; 3801 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3802 model->addOperation(ANEURALNETWORKS_CONV_2D, {op11, op21, op31, param7, param8, param9, param10, layout}, {op41}); 3803 // Phase 3, inputs and outputs 3804 model->identifyInputsAndOutputs( 3805 {op11, op21, op31}, 3806 {op41}); 3807 assert(model->isValid()); 3808 } 3809 3810 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_float16_2(int i) { 3811 static std::set<int> ignore = {}; 3812 return ignore.find(i) != ignore.end(); 3813 } 3814 3815 void CreateModel_channel_nhwc(Model *model) { 3816 OperandType type0(Type::BOOL, {}); 3817 OperandType type4(Type::INT32, {}); 3818 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 3819 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 3820 OperandType type8(Type::TENSOR_FLOAT32, {3}); 3821 // Phase 1, operands 3822 auto op12 = model->addOperand(&type6); 3823 auto op22 = model->addOperand(&type7); 3824 auto op32 = model->addOperand(&type8); 3825 auto param11 = model->addOperand(&type4); 3826 auto param12 = model->addOperand(&type4); 3827 auto param13 = model->addOperand(&type4); 3828 auto param14 = model->addOperand(&type4); 3829 auto param15 = model->addOperand(&type4); 3830 auto param16 = model->addOperand(&type4); 3831 auto param17 = model->addOperand(&type4); 3832 auto layout = model->addOperand(&type0); 3833 auto op42 = model->addOperand(&type6); 3834 // Phase 2, operations 3835 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 3836 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 3837 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 3838 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 3839 static int32_t param11_init[] = {0}; 3840 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 3841 static int32_t param12_init[] = {0}; 3842 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 3843 static int32_t param13_init[] = {0}; 3844 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 3845 static int32_t param14_init[] = {0}; 3846 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 3847 static int32_t param15_init[] = {1}; 3848 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 3849 static int32_t param16_init[] = {1}; 3850 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 3851 static int32_t param17_init[] = {0}; 3852 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 3853 static bool8 layout_init[] = {false}; 3854 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3855 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 3856 // Phase 3, inputs and outputs 3857 model->identifyInputsAndOutputs( 3858 {op12}, 3859 {op42}); 3860 assert(model->isValid()); 3861 } 3862 3863 inline bool is_ignored_channel_nhwc(int i) { 3864 static std::set<int> ignore = {}; 3865 return ignore.find(i) != ignore.end(); 3866 } 3867 3868 void CreateModel_channel_nhwc_relaxed(Model *model) { 3869 OperandType type0(Type::BOOL, {}); 3870 OperandType type4(Type::INT32, {}); 3871 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 3872 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 3873 OperandType type8(Type::TENSOR_FLOAT32, {3}); 3874 // Phase 1, operands 3875 auto op12 = model->addOperand(&type6); 3876 auto op22 = model->addOperand(&type7); 3877 auto op32 = model->addOperand(&type8); 3878 auto param11 = model->addOperand(&type4); 3879 auto param12 = model->addOperand(&type4); 3880 auto param13 = model->addOperand(&type4); 3881 auto param14 = model->addOperand(&type4); 3882 auto param15 = model->addOperand(&type4); 3883 auto param16 = model->addOperand(&type4); 3884 auto param17 = model->addOperand(&type4); 3885 auto layout = model->addOperand(&type0); 3886 auto op42 = model->addOperand(&type6); 3887 // Phase 2, operations 3888 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 3889 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 3890 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 3891 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 3892 static int32_t param11_init[] = {0}; 3893 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 3894 static int32_t param12_init[] = {0}; 3895 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 3896 static int32_t param13_init[] = {0}; 3897 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 3898 static int32_t param14_init[] = {0}; 3899 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 3900 static int32_t param15_init[] = {1}; 3901 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 3902 static int32_t param16_init[] = {1}; 3903 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 3904 static int32_t param17_init[] = {0}; 3905 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 3906 static bool8 layout_init[] = {false}; 3907 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3908 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 3909 // Phase 3, inputs and outputs 3910 model->identifyInputsAndOutputs( 3911 {op12}, 3912 {op42}); 3913 // Phase 4: set relaxed execution 3914 model->relaxComputationFloat32toFloat16(true); 3915 assert(model->isValid()); 3916 } 3917 3918 inline bool is_ignored_channel_nhwc_relaxed(int i) { 3919 static std::set<int> ignore = {}; 3920 return ignore.find(i) != ignore.end(); 3921 } 3922 3923 void CreateModel_channel_nhwc_quant8(Model *model) { 3924 OperandType type0(Type::BOOL, {}); 3925 OperandType type4(Type::INT32, {}); 3926 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 3927 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 3928 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 3929 // Phase 1, operands 3930 auto op12 = model->addOperand(&type61); 3931 auto op22 = model->addOperand(&type62); 3932 auto op32 = model->addOperand(&type63); 3933 auto param11 = model->addOperand(&type4); 3934 auto param12 = model->addOperand(&type4); 3935 auto param13 = model->addOperand(&type4); 3936 auto param14 = model->addOperand(&type4); 3937 auto param15 = model->addOperand(&type4); 3938 auto param16 = model->addOperand(&type4); 3939 auto param17 = model->addOperand(&type4); 3940 auto layout = model->addOperand(&type0); 3941 auto op42 = model->addOperand(&type61); 3942 // Phase 2, operations 3943 static uint8_t op22_init[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; 3944 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 9); 3945 static int32_t op32_init[] = {0, 0, 0}; 3946 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 3947 static int32_t param11_init[] = {0}; 3948 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 3949 static int32_t param12_init[] = {0}; 3950 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 3951 static int32_t param13_init[] = {0}; 3952 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 3953 static int32_t param14_init[] = {0}; 3954 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 3955 static int32_t param15_init[] = {1}; 3956 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 3957 static int32_t param16_init[] = {1}; 3958 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 3959 static int32_t param17_init[] = {0}; 3960 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 3961 static bool8 layout_init[] = {false}; 3962 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3963 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 3964 // Phase 3, inputs and outputs 3965 model->identifyInputsAndOutputs( 3966 {op12}, 3967 {op42}); 3968 assert(model->isValid()); 3969 } 3970 3971 inline bool is_ignored_channel_nhwc_quant8(int i) { 3972 static std::set<int> ignore = {}; 3973 return ignore.find(i) != ignore.end(); 3974 } 3975 3976 void CreateModel_channel_nhwc_channelQuant8(Model *model) { 3977 OperandType type0(Type::BOOL, {}); 3978 OperandType type4(Type::INT32, {}); 3979 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 3980 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 3981 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 3982 // Phase 1, operands 3983 auto op12 = model->addOperand(&type61); 3984 auto op22 = model->addOperand(&type64); 3985 auto op32 = model->addOperand(&type65); 3986 auto param11 = model->addOperand(&type4); 3987 auto param12 = model->addOperand(&type4); 3988 auto param13 = model->addOperand(&type4); 3989 auto param14 = model->addOperand(&type4); 3990 auto param15 = model->addOperand(&type4); 3991 auto param16 = model->addOperand(&type4); 3992 auto param17 = model->addOperand(&type4); 3993 auto layout = model->addOperand(&type0); 3994 auto op42 = model->addOperand(&type61); 3995 // Phase 2, operations 3996 static int8_t op22_init[] = {1, 2, 3, 5, 6, 8, 12, 13, 15}; 3997 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 9); 3998 static int32_t op32_init[] = {0, 0, 0}; 3999 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 4000 static int32_t param11_init[] = {0}; 4001 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4002 static int32_t param12_init[] = {0}; 4003 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4004 static int32_t param13_init[] = {0}; 4005 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4006 static int32_t param14_init[] = {0}; 4007 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4008 static int32_t param15_init[] = {1}; 4009 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4010 static int32_t param16_init[] = {1}; 4011 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4012 static int32_t param17_init[] = {0}; 4013 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4014 static bool8 layout_init[] = {false}; 4015 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4016 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4017 // Phase 3, inputs and outputs 4018 model->identifyInputsAndOutputs( 4019 {op12}, 4020 {op42}); 4021 assert(model->isValid()); 4022 } 4023 4024 inline bool is_ignored_channel_nhwc_channelQuant8(int i) { 4025 static std::set<int> ignore = {}; 4026 return ignore.find(i) != ignore.end(); 4027 } 4028 4029 void CreateModel_channel_nhwc_float16(Model *model) { 4030 OperandType type0(Type::BOOL, {}); 4031 OperandType type4(Type::INT32, {}); 4032 OperandType type66(Type::TENSOR_FLOAT16, {1, 1, 1, 3}); 4033 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 4034 OperandType type68(Type::TENSOR_FLOAT16, {3}); 4035 // Phase 1, operands 4036 auto op12 = model->addOperand(&type66); 4037 auto op22 = model->addOperand(&type67); 4038 auto op32 = model->addOperand(&type68); 4039 auto param11 = model->addOperand(&type4); 4040 auto param12 = model->addOperand(&type4); 4041 auto param13 = model->addOperand(&type4); 4042 auto param14 = model->addOperand(&type4); 4043 auto param15 = model->addOperand(&type4); 4044 auto param16 = model->addOperand(&type4); 4045 auto param17 = model->addOperand(&type4); 4046 auto layout = model->addOperand(&type0); 4047 auto op42 = model->addOperand(&type66); 4048 // Phase 2, operations 4049 static _Float16 op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 4050 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 9); 4051 static _Float16 op32_init[] = {0.0f, 0.0f, 0.0f}; 4052 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 3); 4053 static int32_t param11_init[] = {0}; 4054 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4055 static int32_t param12_init[] = {0}; 4056 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4057 static int32_t param13_init[] = {0}; 4058 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4059 static int32_t param14_init[] = {0}; 4060 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4061 static int32_t param15_init[] = {1}; 4062 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4063 static int32_t param16_init[] = {1}; 4064 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4065 static int32_t param17_init[] = {0}; 4066 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4067 static bool8 layout_init[] = {false}; 4068 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4069 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4070 // Phase 3, inputs and outputs 4071 model->identifyInputsAndOutputs( 4072 {op12}, 4073 {op42}); 4074 assert(model->isValid()); 4075 } 4076 4077 inline bool is_ignored_channel_nhwc_float16(int i) { 4078 static std::set<int> ignore = {}; 4079 return ignore.find(i) != ignore.end(); 4080 } 4081 4082 void CreateModel_channel_nhwc_weight_as_input(Model *model) { 4083 OperandType type0(Type::BOOL, {}); 4084 OperandType type4(Type::INT32, {}); 4085 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 4086 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4087 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4088 // Phase 1, operands 4089 auto op12 = model->addOperand(&type6); 4090 auto op22 = model->addOperand(&type7); 4091 auto op32 = model->addOperand(&type8); 4092 auto param11 = model->addOperand(&type4); 4093 auto param12 = model->addOperand(&type4); 4094 auto param13 = model->addOperand(&type4); 4095 auto param14 = model->addOperand(&type4); 4096 auto param15 = model->addOperand(&type4); 4097 auto param16 = model->addOperand(&type4); 4098 auto param17 = model->addOperand(&type4); 4099 auto layout = model->addOperand(&type0); 4100 auto op42 = model->addOperand(&type6); 4101 // Phase 2, operations 4102 static int32_t param11_init[] = {0}; 4103 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4104 static int32_t param12_init[] = {0}; 4105 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4106 static int32_t param13_init[] = {0}; 4107 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4108 static int32_t param14_init[] = {0}; 4109 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4110 static int32_t param15_init[] = {1}; 4111 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4112 static int32_t param16_init[] = {1}; 4113 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4114 static int32_t param17_init[] = {0}; 4115 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4116 static bool8 layout_init[] = {false}; 4117 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4118 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4119 // Phase 3, inputs and outputs 4120 model->identifyInputsAndOutputs( 4121 {op12, op22, op32}, 4122 {op42}); 4123 assert(model->isValid()); 4124 } 4125 4126 inline bool is_ignored_channel_nhwc_weight_as_input(int i) { 4127 static std::set<int> ignore = {}; 4128 return ignore.find(i) != ignore.end(); 4129 } 4130 4131 void CreateModel_channel_nhwc_weight_as_input_relaxed(Model *model) { 4132 OperandType type0(Type::BOOL, {}); 4133 OperandType type4(Type::INT32, {}); 4134 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 4135 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4136 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4137 // Phase 1, operands 4138 auto op12 = model->addOperand(&type6); 4139 auto op22 = model->addOperand(&type7); 4140 auto op32 = model->addOperand(&type8); 4141 auto param11 = model->addOperand(&type4); 4142 auto param12 = model->addOperand(&type4); 4143 auto param13 = model->addOperand(&type4); 4144 auto param14 = model->addOperand(&type4); 4145 auto param15 = model->addOperand(&type4); 4146 auto param16 = model->addOperand(&type4); 4147 auto param17 = model->addOperand(&type4); 4148 auto layout = model->addOperand(&type0); 4149 auto op42 = model->addOperand(&type6); 4150 // Phase 2, operations 4151 static int32_t param11_init[] = {0}; 4152 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4153 static int32_t param12_init[] = {0}; 4154 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4155 static int32_t param13_init[] = {0}; 4156 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4157 static int32_t param14_init[] = {0}; 4158 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4159 static int32_t param15_init[] = {1}; 4160 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4161 static int32_t param16_init[] = {1}; 4162 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4163 static int32_t param17_init[] = {0}; 4164 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4165 static bool8 layout_init[] = {false}; 4166 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4167 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4168 // Phase 3, inputs and outputs 4169 model->identifyInputsAndOutputs( 4170 {op12, op22, op32}, 4171 {op42}); 4172 // Phase 4: set relaxed execution 4173 model->relaxComputationFloat32toFloat16(true); 4174 assert(model->isValid()); 4175 } 4176 4177 inline bool is_ignored_channel_nhwc_weight_as_input_relaxed(int i) { 4178 static std::set<int> ignore = {}; 4179 return ignore.find(i) != ignore.end(); 4180 } 4181 4182 void CreateModel_channel_nhwc_weight_as_input_quant8(Model *model) { 4183 OperandType type0(Type::BOOL, {}); 4184 OperandType type4(Type::INT32, {}); 4185 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 4186 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 4187 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 4188 // Phase 1, operands 4189 auto op12 = model->addOperand(&type61); 4190 auto op22 = model->addOperand(&type62); 4191 auto op32 = model->addOperand(&type63); 4192 auto param11 = model->addOperand(&type4); 4193 auto param12 = model->addOperand(&type4); 4194 auto param13 = model->addOperand(&type4); 4195 auto param14 = model->addOperand(&type4); 4196 auto param15 = model->addOperand(&type4); 4197 auto param16 = model->addOperand(&type4); 4198 auto param17 = model->addOperand(&type4); 4199 auto layout = model->addOperand(&type0); 4200 auto op42 = model->addOperand(&type61); 4201 // Phase 2, operations 4202 static int32_t param11_init[] = {0}; 4203 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4204 static int32_t param12_init[] = {0}; 4205 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4206 static int32_t param13_init[] = {0}; 4207 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4208 static int32_t param14_init[] = {0}; 4209 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4210 static int32_t param15_init[] = {1}; 4211 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4212 static int32_t param16_init[] = {1}; 4213 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4214 static int32_t param17_init[] = {0}; 4215 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4216 static bool8 layout_init[] = {false}; 4217 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4218 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4219 // Phase 3, inputs and outputs 4220 model->identifyInputsAndOutputs( 4221 {op12, op22, op32}, 4222 {op42}); 4223 assert(model->isValid()); 4224 } 4225 4226 inline bool is_ignored_channel_nhwc_weight_as_input_quant8(int i) { 4227 static std::set<int> ignore = {}; 4228 return ignore.find(i) != ignore.end(); 4229 } 4230 4231 void CreateModel_channel_nhwc_weight_as_input_channelQuant8(Model *model) { 4232 OperandType type0(Type::BOOL, {}); 4233 OperandType type4(Type::INT32, {}); 4234 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 4235 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 4236 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 4237 // Phase 1, operands 4238 auto op12 = model->addOperand(&type61); 4239 auto op22 = model->addOperand(&type64); 4240 auto op32 = model->addOperand(&type65); 4241 auto param11 = model->addOperand(&type4); 4242 auto param12 = model->addOperand(&type4); 4243 auto param13 = model->addOperand(&type4); 4244 auto param14 = model->addOperand(&type4); 4245 auto param15 = model->addOperand(&type4); 4246 auto param16 = model->addOperand(&type4); 4247 auto param17 = model->addOperand(&type4); 4248 auto layout = model->addOperand(&type0); 4249 auto op42 = model->addOperand(&type61); 4250 // Phase 2, operations 4251 static int32_t param11_init[] = {0}; 4252 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4253 static int32_t param12_init[] = {0}; 4254 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4255 static int32_t param13_init[] = {0}; 4256 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4257 static int32_t param14_init[] = {0}; 4258 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4259 static int32_t param15_init[] = {1}; 4260 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4261 static int32_t param16_init[] = {1}; 4262 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4263 static int32_t param17_init[] = {0}; 4264 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4265 static bool8 layout_init[] = {false}; 4266 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4267 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4268 // Phase 3, inputs and outputs 4269 model->identifyInputsAndOutputs( 4270 {op12, op22, op32}, 4271 {op42}); 4272 assert(model->isValid()); 4273 } 4274 4275 inline bool is_ignored_channel_nhwc_weight_as_input_channelQuant8(int i) { 4276 static std::set<int> ignore = {}; 4277 return ignore.find(i) != ignore.end(); 4278 } 4279 4280 void CreateModel_channel_nhwc_weight_as_input_float16(Model *model) { 4281 OperandType type0(Type::BOOL, {}); 4282 OperandType type4(Type::INT32, {}); 4283 OperandType type66(Type::TENSOR_FLOAT16, {1, 1, 1, 3}); 4284 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 4285 OperandType type68(Type::TENSOR_FLOAT16, {3}); 4286 // Phase 1, operands 4287 auto op12 = model->addOperand(&type66); 4288 auto op22 = model->addOperand(&type67); 4289 auto op32 = model->addOperand(&type68); 4290 auto param11 = model->addOperand(&type4); 4291 auto param12 = model->addOperand(&type4); 4292 auto param13 = model->addOperand(&type4); 4293 auto param14 = model->addOperand(&type4); 4294 auto param15 = model->addOperand(&type4); 4295 auto param16 = model->addOperand(&type4); 4296 auto param17 = model->addOperand(&type4); 4297 auto layout = model->addOperand(&type0); 4298 auto op42 = model->addOperand(&type66); 4299 // Phase 2, operations 4300 static int32_t param11_init[] = {0}; 4301 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4302 static int32_t param12_init[] = {0}; 4303 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4304 static int32_t param13_init[] = {0}; 4305 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4306 static int32_t param14_init[] = {0}; 4307 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4308 static int32_t param15_init[] = {1}; 4309 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4310 static int32_t param16_init[] = {1}; 4311 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4312 static int32_t param17_init[] = {0}; 4313 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4314 static bool8 layout_init[] = {false}; 4315 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4316 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4317 // Phase 3, inputs and outputs 4318 model->identifyInputsAndOutputs( 4319 {op12, op22, op32}, 4320 {op42}); 4321 assert(model->isValid()); 4322 } 4323 4324 inline bool is_ignored_channel_nhwc_weight_as_input_float16(int i) { 4325 static std::set<int> ignore = {}; 4326 return ignore.find(i) != ignore.end(); 4327 } 4328 4329 void CreateModel_channel_nchw(Model *model) { 4330 OperandType type0(Type::BOOL, {}); 4331 OperandType type4(Type::INT32, {}); 4332 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 4333 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4334 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4335 // Phase 1, operands 4336 auto op12 = model->addOperand(&type69); 4337 auto op22 = model->addOperand(&type7); 4338 auto op32 = model->addOperand(&type8); 4339 auto param11 = model->addOperand(&type4); 4340 auto param12 = model->addOperand(&type4); 4341 auto param13 = model->addOperand(&type4); 4342 auto param14 = model->addOperand(&type4); 4343 auto param15 = model->addOperand(&type4); 4344 auto param16 = model->addOperand(&type4); 4345 auto param17 = model->addOperand(&type4); 4346 auto layout = model->addOperand(&type0); 4347 auto op42 = model->addOperand(&type69); 4348 // Phase 2, operations 4349 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 4350 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 4351 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 4352 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 4353 static int32_t param11_init[] = {0}; 4354 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4355 static int32_t param12_init[] = {0}; 4356 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4357 static int32_t param13_init[] = {0}; 4358 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4359 static int32_t param14_init[] = {0}; 4360 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4361 static int32_t param15_init[] = {1}; 4362 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4363 static int32_t param16_init[] = {1}; 4364 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4365 static int32_t param17_init[] = {0}; 4366 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4367 static bool8 layout_init[] = {true}; 4368 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4369 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4370 // Phase 3, inputs and outputs 4371 model->identifyInputsAndOutputs( 4372 {op12}, 4373 {op42}); 4374 assert(model->isValid()); 4375 } 4376 4377 inline bool is_ignored_channel_nchw(int i) { 4378 static std::set<int> ignore = {}; 4379 return ignore.find(i) != ignore.end(); 4380 } 4381 4382 void CreateModel_channel_nchw_relaxed(Model *model) { 4383 OperandType type0(Type::BOOL, {}); 4384 OperandType type4(Type::INT32, {}); 4385 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 4386 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4387 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4388 // Phase 1, operands 4389 auto op12 = model->addOperand(&type69); 4390 auto op22 = model->addOperand(&type7); 4391 auto op32 = model->addOperand(&type8); 4392 auto param11 = model->addOperand(&type4); 4393 auto param12 = model->addOperand(&type4); 4394 auto param13 = model->addOperand(&type4); 4395 auto param14 = model->addOperand(&type4); 4396 auto param15 = model->addOperand(&type4); 4397 auto param16 = model->addOperand(&type4); 4398 auto param17 = model->addOperand(&type4); 4399 auto layout = model->addOperand(&type0); 4400 auto op42 = model->addOperand(&type69); 4401 // Phase 2, operations 4402 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 4403 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 4404 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 4405 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 4406 static int32_t param11_init[] = {0}; 4407 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4408 static int32_t param12_init[] = {0}; 4409 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4410 static int32_t param13_init[] = {0}; 4411 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4412 static int32_t param14_init[] = {0}; 4413 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4414 static int32_t param15_init[] = {1}; 4415 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4416 static int32_t param16_init[] = {1}; 4417 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4418 static int32_t param17_init[] = {0}; 4419 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4420 static bool8 layout_init[] = {true}; 4421 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4422 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4423 // Phase 3, inputs and outputs 4424 model->identifyInputsAndOutputs( 4425 {op12}, 4426 {op42}); 4427 // Phase 4: set relaxed execution 4428 model->relaxComputationFloat32toFloat16(true); 4429 assert(model->isValid()); 4430 } 4431 4432 inline bool is_ignored_channel_nchw_relaxed(int i) { 4433 static std::set<int> ignore = {}; 4434 return ignore.find(i) != ignore.end(); 4435 } 4436 4437 void CreateModel_channel_nchw_quant8(Model *model) { 4438 OperandType type0(Type::BOOL, {}); 4439 OperandType type4(Type::INT32, {}); 4440 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 4441 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 4442 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 4443 // Phase 1, operands 4444 auto op12 = model->addOperand(&type70); 4445 auto op22 = model->addOperand(&type62); 4446 auto op32 = model->addOperand(&type63); 4447 auto param11 = model->addOperand(&type4); 4448 auto param12 = model->addOperand(&type4); 4449 auto param13 = model->addOperand(&type4); 4450 auto param14 = model->addOperand(&type4); 4451 auto param15 = model->addOperand(&type4); 4452 auto param16 = model->addOperand(&type4); 4453 auto param17 = model->addOperand(&type4); 4454 auto layout = model->addOperand(&type0); 4455 auto op42 = model->addOperand(&type70); 4456 // Phase 2, operations 4457 static uint8_t op22_init[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; 4458 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 9); 4459 static int32_t op32_init[] = {0, 0, 0}; 4460 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 4461 static int32_t param11_init[] = {0}; 4462 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4463 static int32_t param12_init[] = {0}; 4464 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4465 static int32_t param13_init[] = {0}; 4466 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4467 static int32_t param14_init[] = {0}; 4468 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4469 static int32_t param15_init[] = {1}; 4470 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4471 static int32_t param16_init[] = {1}; 4472 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4473 static int32_t param17_init[] = {0}; 4474 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4475 static bool8 layout_init[] = {true}; 4476 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4477 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4478 // Phase 3, inputs and outputs 4479 model->identifyInputsAndOutputs( 4480 {op12}, 4481 {op42}); 4482 assert(model->isValid()); 4483 } 4484 4485 inline bool is_ignored_channel_nchw_quant8(int i) { 4486 static std::set<int> ignore = {}; 4487 return ignore.find(i) != ignore.end(); 4488 } 4489 4490 void CreateModel_channel_nchw_channelQuant8(Model *model) { 4491 OperandType type0(Type::BOOL, {}); 4492 OperandType type4(Type::INT32, {}); 4493 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 4494 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 4495 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 4496 // Phase 1, operands 4497 auto op12 = model->addOperand(&type70); 4498 auto op22 = model->addOperand(&type64); 4499 auto op32 = model->addOperand(&type65); 4500 auto param11 = model->addOperand(&type4); 4501 auto param12 = model->addOperand(&type4); 4502 auto param13 = model->addOperand(&type4); 4503 auto param14 = model->addOperand(&type4); 4504 auto param15 = model->addOperand(&type4); 4505 auto param16 = model->addOperand(&type4); 4506 auto param17 = model->addOperand(&type4); 4507 auto layout = model->addOperand(&type0); 4508 auto op42 = model->addOperand(&type70); 4509 // Phase 2, operations 4510 static int8_t op22_init[] = {1, 2, 3, 5, 6, 8, 12, 13, 15}; 4511 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 9); 4512 static int32_t op32_init[] = {0, 0, 0}; 4513 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 4514 static int32_t param11_init[] = {0}; 4515 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4516 static int32_t param12_init[] = {0}; 4517 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4518 static int32_t param13_init[] = {0}; 4519 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4520 static int32_t param14_init[] = {0}; 4521 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4522 static int32_t param15_init[] = {1}; 4523 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4524 static int32_t param16_init[] = {1}; 4525 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4526 static int32_t param17_init[] = {0}; 4527 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4528 static bool8 layout_init[] = {true}; 4529 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4530 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4531 // Phase 3, inputs and outputs 4532 model->identifyInputsAndOutputs( 4533 {op12}, 4534 {op42}); 4535 assert(model->isValid()); 4536 } 4537 4538 inline bool is_ignored_channel_nchw_channelQuant8(int i) { 4539 static std::set<int> ignore = {}; 4540 return ignore.find(i) != ignore.end(); 4541 } 4542 4543 void CreateModel_channel_nchw_float16(Model *model) { 4544 OperandType type0(Type::BOOL, {}); 4545 OperandType type4(Type::INT32, {}); 4546 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 4547 OperandType type68(Type::TENSOR_FLOAT16, {3}); 4548 OperandType type71(Type::TENSOR_FLOAT16, {1, 3, 1, 1}); 4549 // Phase 1, operands 4550 auto op12 = model->addOperand(&type71); 4551 auto op22 = model->addOperand(&type67); 4552 auto op32 = model->addOperand(&type68); 4553 auto param11 = model->addOperand(&type4); 4554 auto param12 = model->addOperand(&type4); 4555 auto param13 = model->addOperand(&type4); 4556 auto param14 = model->addOperand(&type4); 4557 auto param15 = model->addOperand(&type4); 4558 auto param16 = model->addOperand(&type4); 4559 auto param17 = model->addOperand(&type4); 4560 auto layout = model->addOperand(&type0); 4561 auto op42 = model->addOperand(&type71); 4562 // Phase 2, operations 4563 static _Float16 op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 4564 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 9); 4565 static _Float16 op32_init[] = {0.0f, 0.0f, 0.0f}; 4566 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 3); 4567 static int32_t param11_init[] = {0}; 4568 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4569 static int32_t param12_init[] = {0}; 4570 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4571 static int32_t param13_init[] = {0}; 4572 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4573 static int32_t param14_init[] = {0}; 4574 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4575 static int32_t param15_init[] = {1}; 4576 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4577 static int32_t param16_init[] = {1}; 4578 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4579 static int32_t param17_init[] = {0}; 4580 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4581 static bool8 layout_init[] = {true}; 4582 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4583 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4584 // Phase 3, inputs and outputs 4585 model->identifyInputsAndOutputs( 4586 {op12}, 4587 {op42}); 4588 assert(model->isValid()); 4589 } 4590 4591 inline bool is_ignored_channel_nchw_float16(int i) { 4592 static std::set<int> ignore = {}; 4593 return ignore.find(i) != ignore.end(); 4594 } 4595 4596 void CreateModel_channel_nchw_weight_as_input(Model *model) { 4597 OperandType type0(Type::BOOL, {}); 4598 OperandType type4(Type::INT32, {}); 4599 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 4600 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4601 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4602 // Phase 1, operands 4603 auto op12 = model->addOperand(&type69); 4604 auto op22 = model->addOperand(&type7); 4605 auto op32 = model->addOperand(&type8); 4606 auto param11 = model->addOperand(&type4); 4607 auto param12 = model->addOperand(&type4); 4608 auto param13 = model->addOperand(&type4); 4609 auto param14 = model->addOperand(&type4); 4610 auto param15 = model->addOperand(&type4); 4611 auto param16 = model->addOperand(&type4); 4612 auto param17 = model->addOperand(&type4); 4613 auto layout = model->addOperand(&type0); 4614 auto op42 = model->addOperand(&type69); 4615 // Phase 2, operations 4616 static int32_t param11_init[] = {0}; 4617 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4618 static int32_t param12_init[] = {0}; 4619 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4620 static int32_t param13_init[] = {0}; 4621 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4622 static int32_t param14_init[] = {0}; 4623 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4624 static int32_t param15_init[] = {1}; 4625 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4626 static int32_t param16_init[] = {1}; 4627 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4628 static int32_t param17_init[] = {0}; 4629 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4630 static bool8 layout_init[] = {true}; 4631 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4632 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4633 // Phase 3, inputs and outputs 4634 model->identifyInputsAndOutputs( 4635 {op12, op22, op32}, 4636 {op42}); 4637 assert(model->isValid()); 4638 } 4639 4640 inline bool is_ignored_channel_nchw_weight_as_input(int i) { 4641 static std::set<int> ignore = {}; 4642 return ignore.find(i) != ignore.end(); 4643 } 4644 4645 void CreateModel_channel_nchw_weight_as_input_relaxed(Model *model) { 4646 OperandType type0(Type::BOOL, {}); 4647 OperandType type4(Type::INT32, {}); 4648 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 4649 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4650 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4651 // Phase 1, operands 4652 auto op12 = model->addOperand(&type69); 4653 auto op22 = model->addOperand(&type7); 4654 auto op32 = model->addOperand(&type8); 4655 auto param11 = model->addOperand(&type4); 4656 auto param12 = model->addOperand(&type4); 4657 auto param13 = model->addOperand(&type4); 4658 auto param14 = model->addOperand(&type4); 4659 auto param15 = model->addOperand(&type4); 4660 auto param16 = model->addOperand(&type4); 4661 auto param17 = model->addOperand(&type4); 4662 auto layout = model->addOperand(&type0); 4663 auto op42 = model->addOperand(&type69); 4664 // Phase 2, operations 4665 static int32_t param11_init[] = {0}; 4666 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4667 static int32_t param12_init[] = {0}; 4668 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4669 static int32_t param13_init[] = {0}; 4670 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4671 static int32_t param14_init[] = {0}; 4672 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4673 static int32_t param15_init[] = {1}; 4674 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4675 static int32_t param16_init[] = {1}; 4676 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4677 static int32_t param17_init[] = {0}; 4678 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4679 static bool8 layout_init[] = {true}; 4680 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4681 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4682 // Phase 3, inputs and outputs 4683 model->identifyInputsAndOutputs( 4684 {op12, op22, op32}, 4685 {op42}); 4686 // Phase 4: set relaxed execution 4687 model->relaxComputationFloat32toFloat16(true); 4688 assert(model->isValid()); 4689 } 4690 4691 inline bool is_ignored_channel_nchw_weight_as_input_relaxed(int i) { 4692 static std::set<int> ignore = {}; 4693 return ignore.find(i) != ignore.end(); 4694 } 4695 4696 void CreateModel_channel_nchw_weight_as_input_quant8(Model *model) { 4697 OperandType type0(Type::BOOL, {}); 4698 OperandType type4(Type::INT32, {}); 4699 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 4700 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 4701 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 4702 // Phase 1, operands 4703 auto op12 = model->addOperand(&type70); 4704 auto op22 = model->addOperand(&type62); 4705 auto op32 = model->addOperand(&type63); 4706 auto param11 = model->addOperand(&type4); 4707 auto param12 = model->addOperand(&type4); 4708 auto param13 = model->addOperand(&type4); 4709 auto param14 = model->addOperand(&type4); 4710 auto param15 = model->addOperand(&type4); 4711 auto param16 = model->addOperand(&type4); 4712 auto param17 = model->addOperand(&type4); 4713 auto layout = model->addOperand(&type0); 4714 auto op42 = model->addOperand(&type70); 4715 // Phase 2, operations 4716 static int32_t param11_init[] = {0}; 4717 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4718 static int32_t param12_init[] = {0}; 4719 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4720 static int32_t param13_init[] = {0}; 4721 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4722 static int32_t param14_init[] = {0}; 4723 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4724 static int32_t param15_init[] = {1}; 4725 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4726 static int32_t param16_init[] = {1}; 4727 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4728 static int32_t param17_init[] = {0}; 4729 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4730 static bool8 layout_init[] = {true}; 4731 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4732 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4733 // Phase 3, inputs and outputs 4734 model->identifyInputsAndOutputs( 4735 {op12, op22, op32}, 4736 {op42}); 4737 assert(model->isValid()); 4738 } 4739 4740 inline bool is_ignored_channel_nchw_weight_as_input_quant8(int i) { 4741 static std::set<int> ignore = {}; 4742 return ignore.find(i) != ignore.end(); 4743 } 4744 4745 void CreateModel_channel_nchw_weight_as_input_channelQuant8(Model *model) { 4746 OperandType type0(Type::BOOL, {}); 4747 OperandType type4(Type::INT32, {}); 4748 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 4749 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 4750 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 4751 // Phase 1, operands 4752 auto op12 = model->addOperand(&type70); 4753 auto op22 = model->addOperand(&type64); 4754 auto op32 = model->addOperand(&type65); 4755 auto param11 = model->addOperand(&type4); 4756 auto param12 = model->addOperand(&type4); 4757 auto param13 = model->addOperand(&type4); 4758 auto param14 = model->addOperand(&type4); 4759 auto param15 = model->addOperand(&type4); 4760 auto param16 = model->addOperand(&type4); 4761 auto param17 = model->addOperand(&type4); 4762 auto layout = model->addOperand(&type0); 4763 auto op42 = model->addOperand(&type70); 4764 // Phase 2, operations 4765 static int32_t param11_init[] = {0}; 4766 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4767 static int32_t param12_init[] = {0}; 4768 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4769 static int32_t param13_init[] = {0}; 4770 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4771 static int32_t param14_init[] = {0}; 4772 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4773 static int32_t param15_init[] = {1}; 4774 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4775 static int32_t param16_init[] = {1}; 4776 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4777 static int32_t param17_init[] = {0}; 4778 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4779 static bool8 layout_init[] = {true}; 4780 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4781 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4782 // Phase 3, inputs and outputs 4783 model->identifyInputsAndOutputs( 4784 {op12, op22, op32}, 4785 {op42}); 4786 assert(model->isValid()); 4787 } 4788 4789 inline bool is_ignored_channel_nchw_weight_as_input_channelQuant8(int i) { 4790 static std::set<int> ignore = {}; 4791 return ignore.find(i) != ignore.end(); 4792 } 4793 4794 void CreateModel_channel_nchw_weight_as_input_float16(Model *model) { 4795 OperandType type0(Type::BOOL, {}); 4796 OperandType type4(Type::INT32, {}); 4797 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 4798 OperandType type68(Type::TENSOR_FLOAT16, {3}); 4799 OperandType type71(Type::TENSOR_FLOAT16, {1, 3, 1, 1}); 4800 // Phase 1, operands 4801 auto op12 = model->addOperand(&type71); 4802 auto op22 = model->addOperand(&type67); 4803 auto op32 = model->addOperand(&type68); 4804 auto param11 = model->addOperand(&type4); 4805 auto param12 = model->addOperand(&type4); 4806 auto param13 = model->addOperand(&type4); 4807 auto param14 = model->addOperand(&type4); 4808 auto param15 = model->addOperand(&type4); 4809 auto param16 = model->addOperand(&type4); 4810 auto param17 = model->addOperand(&type4); 4811 auto layout = model->addOperand(&type0); 4812 auto op42 = model->addOperand(&type71); 4813 // Phase 2, operations 4814 static int32_t param11_init[] = {0}; 4815 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4816 static int32_t param12_init[] = {0}; 4817 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4818 static int32_t param13_init[] = {0}; 4819 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4820 static int32_t param14_init[] = {0}; 4821 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4822 static int32_t param15_init[] = {1}; 4823 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4824 static int32_t param16_init[] = {1}; 4825 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4826 static int32_t param17_init[] = {0}; 4827 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4828 static bool8 layout_init[] = {true}; 4829 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4830 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4831 // Phase 3, inputs and outputs 4832 model->identifyInputsAndOutputs( 4833 {op12, op22, op32}, 4834 {op42}); 4835 assert(model->isValid()); 4836 } 4837 4838 inline bool is_ignored_channel_nchw_weight_as_input_float16(int i) { 4839 static std::set<int> ignore = {}; 4840 return ignore.find(i) != ignore.end(); 4841 } 4842 4843 void CreateModel_channel_dynamic_output_shape_nhwc(Model *model) { 4844 OperandType type0(Type::BOOL, {}); 4845 OperandType type4(Type::INT32, {}); 4846 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 4847 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 4848 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4849 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4850 // Phase 1, operands 4851 auto op12 = model->addOperand(&type6); 4852 auto op22 = model->addOperand(&type7); 4853 auto op32 = model->addOperand(&type8); 4854 auto param11 = model->addOperand(&type4); 4855 auto param12 = model->addOperand(&type4); 4856 auto param13 = model->addOperand(&type4); 4857 auto param14 = model->addOperand(&type4); 4858 auto param15 = model->addOperand(&type4); 4859 auto param16 = model->addOperand(&type4); 4860 auto param17 = model->addOperand(&type4); 4861 auto layout = model->addOperand(&type0); 4862 auto op42 = model->addOperand(&type46); 4863 // Phase 2, operations 4864 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 4865 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 4866 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 4867 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 4868 static int32_t param11_init[] = {0}; 4869 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4870 static int32_t param12_init[] = {0}; 4871 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4872 static int32_t param13_init[] = {0}; 4873 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4874 static int32_t param14_init[] = {0}; 4875 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4876 static int32_t param15_init[] = {1}; 4877 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4878 static int32_t param16_init[] = {1}; 4879 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4880 static int32_t param17_init[] = {0}; 4881 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4882 static bool8 layout_init[] = {false}; 4883 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4884 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4885 // Phase 3, inputs and outputs 4886 model->identifyInputsAndOutputs( 4887 {op12}, 4888 {op42}); 4889 assert(model->isValid()); 4890 } 4891 4892 inline bool is_ignored_channel_dynamic_output_shape_nhwc(int i) { 4893 static std::set<int> ignore = {}; 4894 return ignore.find(i) != ignore.end(); 4895 } 4896 4897 void CreateModel_channel_dynamic_output_shape_nhwc_relaxed(Model *model) { 4898 OperandType type0(Type::BOOL, {}); 4899 OperandType type4(Type::INT32, {}); 4900 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 4901 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 4902 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 4903 OperandType type8(Type::TENSOR_FLOAT32, {3}); 4904 // Phase 1, operands 4905 auto op12 = model->addOperand(&type6); 4906 auto op22 = model->addOperand(&type7); 4907 auto op32 = model->addOperand(&type8); 4908 auto param11 = model->addOperand(&type4); 4909 auto param12 = model->addOperand(&type4); 4910 auto param13 = model->addOperand(&type4); 4911 auto param14 = model->addOperand(&type4); 4912 auto param15 = model->addOperand(&type4); 4913 auto param16 = model->addOperand(&type4); 4914 auto param17 = model->addOperand(&type4); 4915 auto layout = model->addOperand(&type0); 4916 auto op42 = model->addOperand(&type46); 4917 // Phase 2, operations 4918 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 4919 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 4920 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 4921 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 4922 static int32_t param11_init[] = {0}; 4923 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4924 static int32_t param12_init[] = {0}; 4925 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4926 static int32_t param13_init[] = {0}; 4927 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4928 static int32_t param14_init[] = {0}; 4929 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4930 static int32_t param15_init[] = {1}; 4931 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4932 static int32_t param16_init[] = {1}; 4933 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4934 static int32_t param17_init[] = {0}; 4935 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4936 static bool8 layout_init[] = {false}; 4937 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4938 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4939 // Phase 3, inputs and outputs 4940 model->identifyInputsAndOutputs( 4941 {op12}, 4942 {op42}); 4943 // Phase 4: set relaxed execution 4944 model->relaxComputationFloat32toFloat16(true); 4945 assert(model->isValid()); 4946 } 4947 4948 inline bool is_ignored_channel_dynamic_output_shape_nhwc_relaxed(int i) { 4949 static std::set<int> ignore = {}; 4950 return ignore.find(i) != ignore.end(); 4951 } 4952 4953 void CreateModel_channel_dynamic_output_shape_nhwc_quant8(Model *model) { 4954 OperandType type0(Type::BOOL, {}); 4955 OperandType type4(Type::INT32, {}); 4956 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 4957 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 4958 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 4959 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 4960 // Phase 1, operands 4961 auto op12 = model->addOperand(&type61); 4962 auto op22 = model->addOperand(&type62); 4963 auto op32 = model->addOperand(&type63); 4964 auto param11 = model->addOperand(&type4); 4965 auto param12 = model->addOperand(&type4); 4966 auto param13 = model->addOperand(&type4); 4967 auto param14 = model->addOperand(&type4); 4968 auto param15 = model->addOperand(&type4); 4969 auto param16 = model->addOperand(&type4); 4970 auto param17 = model->addOperand(&type4); 4971 auto layout = model->addOperand(&type0); 4972 auto op42 = model->addOperand(&type72); 4973 // Phase 2, operations 4974 static uint8_t op22_init[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; 4975 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 9); 4976 static int32_t op32_init[] = {0, 0, 0}; 4977 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 4978 static int32_t param11_init[] = {0}; 4979 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 4980 static int32_t param12_init[] = {0}; 4981 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 4982 static int32_t param13_init[] = {0}; 4983 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 4984 static int32_t param14_init[] = {0}; 4985 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 4986 static int32_t param15_init[] = {1}; 4987 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 4988 static int32_t param16_init[] = {1}; 4989 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 4990 static int32_t param17_init[] = {0}; 4991 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 4992 static bool8 layout_init[] = {false}; 4993 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4994 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 4995 // Phase 3, inputs and outputs 4996 model->identifyInputsAndOutputs( 4997 {op12}, 4998 {op42}); 4999 assert(model->isValid()); 5000 } 5001 5002 inline bool is_ignored_channel_dynamic_output_shape_nhwc_quant8(int i) { 5003 static std::set<int> ignore = {}; 5004 return ignore.find(i) != ignore.end(); 5005 } 5006 5007 void CreateModel_channel_dynamic_output_shape_nhwc_channelQuant8(Model *model) { 5008 OperandType type0(Type::BOOL, {}); 5009 OperandType type4(Type::INT32, {}); 5010 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 5011 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 5012 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 5013 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5014 // Phase 1, operands 5015 auto op12 = model->addOperand(&type61); 5016 auto op22 = model->addOperand(&type64); 5017 auto op32 = model->addOperand(&type65); 5018 auto param11 = model->addOperand(&type4); 5019 auto param12 = model->addOperand(&type4); 5020 auto param13 = model->addOperand(&type4); 5021 auto param14 = model->addOperand(&type4); 5022 auto param15 = model->addOperand(&type4); 5023 auto param16 = model->addOperand(&type4); 5024 auto param17 = model->addOperand(&type4); 5025 auto layout = model->addOperand(&type0); 5026 auto op42 = model->addOperand(&type72); 5027 // Phase 2, operations 5028 static int8_t op22_init[] = {1, 2, 3, 5, 6, 8, 12, 13, 15}; 5029 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 9); 5030 static int32_t op32_init[] = {0, 0, 0}; 5031 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 5032 static int32_t param11_init[] = {0}; 5033 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5034 static int32_t param12_init[] = {0}; 5035 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5036 static int32_t param13_init[] = {0}; 5037 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5038 static int32_t param14_init[] = {0}; 5039 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5040 static int32_t param15_init[] = {1}; 5041 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5042 static int32_t param16_init[] = {1}; 5043 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5044 static int32_t param17_init[] = {0}; 5045 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5046 static bool8 layout_init[] = {false}; 5047 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5048 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5049 // Phase 3, inputs and outputs 5050 model->identifyInputsAndOutputs( 5051 {op12}, 5052 {op42}); 5053 assert(model->isValid()); 5054 } 5055 5056 inline bool is_ignored_channel_dynamic_output_shape_nhwc_channelQuant8(int i) { 5057 static std::set<int> ignore = {}; 5058 return ignore.find(i) != ignore.end(); 5059 } 5060 5061 void CreateModel_channel_dynamic_output_shape_nhwc_float16(Model *model) { 5062 OperandType type0(Type::BOOL, {}); 5063 OperandType type4(Type::INT32, {}); 5064 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 5065 OperandType type66(Type::TENSOR_FLOAT16, {1, 1, 1, 3}); 5066 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 5067 OperandType type68(Type::TENSOR_FLOAT16, {3}); 5068 // Phase 1, operands 5069 auto op12 = model->addOperand(&type66); 5070 auto op22 = model->addOperand(&type67); 5071 auto op32 = model->addOperand(&type68); 5072 auto param11 = model->addOperand(&type4); 5073 auto param12 = model->addOperand(&type4); 5074 auto param13 = model->addOperand(&type4); 5075 auto param14 = model->addOperand(&type4); 5076 auto param15 = model->addOperand(&type4); 5077 auto param16 = model->addOperand(&type4); 5078 auto param17 = model->addOperand(&type4); 5079 auto layout = model->addOperand(&type0); 5080 auto op42 = model->addOperand(&type48); 5081 // Phase 2, operations 5082 static _Float16 op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 5083 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 9); 5084 static _Float16 op32_init[] = {0.0f, 0.0f, 0.0f}; 5085 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 3); 5086 static int32_t param11_init[] = {0}; 5087 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5088 static int32_t param12_init[] = {0}; 5089 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5090 static int32_t param13_init[] = {0}; 5091 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5092 static int32_t param14_init[] = {0}; 5093 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5094 static int32_t param15_init[] = {1}; 5095 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5096 static int32_t param16_init[] = {1}; 5097 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5098 static int32_t param17_init[] = {0}; 5099 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5100 static bool8 layout_init[] = {false}; 5101 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5102 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5103 // Phase 3, inputs and outputs 5104 model->identifyInputsAndOutputs( 5105 {op12}, 5106 {op42}); 5107 assert(model->isValid()); 5108 } 5109 5110 inline bool is_ignored_channel_dynamic_output_shape_nhwc_float16(int i) { 5111 static std::set<int> ignore = {}; 5112 return ignore.find(i) != ignore.end(); 5113 } 5114 5115 void CreateModel_channel_dynamic_output_shape_nhwc_weight_as_input(Model *model) { 5116 OperandType type0(Type::BOOL, {}); 5117 OperandType type4(Type::INT32, {}); 5118 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5119 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 5120 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5121 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5122 // Phase 1, operands 5123 auto op12 = model->addOperand(&type6); 5124 auto op22 = model->addOperand(&type7); 5125 auto op32 = model->addOperand(&type8); 5126 auto param11 = model->addOperand(&type4); 5127 auto param12 = model->addOperand(&type4); 5128 auto param13 = model->addOperand(&type4); 5129 auto param14 = model->addOperand(&type4); 5130 auto param15 = model->addOperand(&type4); 5131 auto param16 = model->addOperand(&type4); 5132 auto param17 = model->addOperand(&type4); 5133 auto layout = model->addOperand(&type0); 5134 auto op42 = model->addOperand(&type46); 5135 // Phase 2, operations 5136 static int32_t param11_init[] = {0}; 5137 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5138 static int32_t param12_init[] = {0}; 5139 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5140 static int32_t param13_init[] = {0}; 5141 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5142 static int32_t param14_init[] = {0}; 5143 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5144 static int32_t param15_init[] = {1}; 5145 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5146 static int32_t param16_init[] = {1}; 5147 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5148 static int32_t param17_init[] = {0}; 5149 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5150 static bool8 layout_init[] = {false}; 5151 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5152 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5153 // Phase 3, inputs and outputs 5154 model->identifyInputsAndOutputs( 5155 {op12, op22, op32}, 5156 {op42}); 5157 assert(model->isValid()); 5158 } 5159 5160 inline bool is_ignored_channel_dynamic_output_shape_nhwc_weight_as_input(int i) { 5161 static std::set<int> ignore = {}; 5162 return ignore.find(i) != ignore.end(); 5163 } 5164 5165 void CreateModel_channel_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) { 5166 OperandType type0(Type::BOOL, {}); 5167 OperandType type4(Type::INT32, {}); 5168 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5169 OperandType type6(Type::TENSOR_FLOAT32, {1, 1, 1, 3}); 5170 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5171 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5172 // Phase 1, operands 5173 auto op12 = model->addOperand(&type6); 5174 auto op22 = model->addOperand(&type7); 5175 auto op32 = model->addOperand(&type8); 5176 auto param11 = model->addOperand(&type4); 5177 auto param12 = model->addOperand(&type4); 5178 auto param13 = model->addOperand(&type4); 5179 auto param14 = model->addOperand(&type4); 5180 auto param15 = model->addOperand(&type4); 5181 auto param16 = model->addOperand(&type4); 5182 auto param17 = model->addOperand(&type4); 5183 auto layout = model->addOperand(&type0); 5184 auto op42 = model->addOperand(&type46); 5185 // Phase 2, operations 5186 static int32_t param11_init[] = {0}; 5187 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5188 static int32_t param12_init[] = {0}; 5189 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5190 static int32_t param13_init[] = {0}; 5191 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5192 static int32_t param14_init[] = {0}; 5193 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5194 static int32_t param15_init[] = {1}; 5195 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5196 static int32_t param16_init[] = {1}; 5197 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5198 static int32_t param17_init[] = {0}; 5199 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5200 static bool8 layout_init[] = {false}; 5201 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5202 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5203 // Phase 3, inputs and outputs 5204 model->identifyInputsAndOutputs( 5205 {op12, op22, op32}, 5206 {op42}); 5207 // Phase 4: set relaxed execution 5208 model->relaxComputationFloat32toFloat16(true); 5209 assert(model->isValid()); 5210 } 5211 5212 inline bool is_ignored_channel_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) { 5213 static std::set<int> ignore = {}; 5214 return ignore.find(i) != ignore.end(); 5215 } 5216 5217 void CreateModel_channel_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) { 5218 OperandType type0(Type::BOOL, {}); 5219 OperandType type4(Type::INT32, {}); 5220 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 5221 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 5222 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 5223 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5224 // Phase 1, operands 5225 auto op12 = model->addOperand(&type61); 5226 auto op22 = model->addOperand(&type62); 5227 auto op32 = model->addOperand(&type63); 5228 auto param11 = model->addOperand(&type4); 5229 auto param12 = model->addOperand(&type4); 5230 auto param13 = model->addOperand(&type4); 5231 auto param14 = model->addOperand(&type4); 5232 auto param15 = model->addOperand(&type4); 5233 auto param16 = model->addOperand(&type4); 5234 auto param17 = model->addOperand(&type4); 5235 auto layout = model->addOperand(&type0); 5236 auto op42 = model->addOperand(&type72); 5237 // Phase 2, operations 5238 static int32_t param11_init[] = {0}; 5239 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5240 static int32_t param12_init[] = {0}; 5241 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5242 static int32_t param13_init[] = {0}; 5243 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5244 static int32_t param14_init[] = {0}; 5245 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5246 static int32_t param15_init[] = {1}; 5247 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5248 static int32_t param16_init[] = {1}; 5249 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5250 static int32_t param17_init[] = {0}; 5251 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5252 static bool8 layout_init[] = {false}; 5253 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5254 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5255 // Phase 3, inputs and outputs 5256 model->identifyInputsAndOutputs( 5257 {op12, op22, op32}, 5258 {op42}); 5259 assert(model->isValid()); 5260 } 5261 5262 inline bool is_ignored_channel_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) { 5263 static std::set<int> ignore = {}; 5264 return ignore.find(i) != ignore.end(); 5265 } 5266 5267 void CreateModel_channel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model *model) { 5268 OperandType type0(Type::BOOL, {}); 5269 OperandType type4(Type::INT32, {}); 5270 OperandType type61(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 3}, 0.5f, 0); 5271 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 5272 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 5273 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5274 // Phase 1, operands 5275 auto op12 = model->addOperand(&type61); 5276 auto op22 = model->addOperand(&type64); 5277 auto op32 = model->addOperand(&type65); 5278 auto param11 = model->addOperand(&type4); 5279 auto param12 = model->addOperand(&type4); 5280 auto param13 = model->addOperand(&type4); 5281 auto param14 = model->addOperand(&type4); 5282 auto param15 = model->addOperand(&type4); 5283 auto param16 = model->addOperand(&type4); 5284 auto param17 = model->addOperand(&type4); 5285 auto layout = model->addOperand(&type0); 5286 auto op42 = model->addOperand(&type72); 5287 // Phase 2, operations 5288 static int32_t param11_init[] = {0}; 5289 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5290 static int32_t param12_init[] = {0}; 5291 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5292 static int32_t param13_init[] = {0}; 5293 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5294 static int32_t param14_init[] = {0}; 5295 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5296 static int32_t param15_init[] = {1}; 5297 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5298 static int32_t param16_init[] = {1}; 5299 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5300 static int32_t param17_init[] = {0}; 5301 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5302 static bool8 layout_init[] = {false}; 5303 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5304 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5305 // Phase 3, inputs and outputs 5306 model->identifyInputsAndOutputs( 5307 {op12, op22, op32}, 5308 {op42}); 5309 assert(model->isValid()); 5310 } 5311 5312 inline bool is_ignored_channel_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i) { 5313 static std::set<int> ignore = {}; 5314 return ignore.find(i) != ignore.end(); 5315 } 5316 5317 void CreateModel_channel_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) { 5318 OperandType type0(Type::BOOL, {}); 5319 OperandType type4(Type::INT32, {}); 5320 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 5321 OperandType type66(Type::TENSOR_FLOAT16, {1, 1, 1, 3}); 5322 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 5323 OperandType type68(Type::TENSOR_FLOAT16, {3}); 5324 // Phase 1, operands 5325 auto op12 = model->addOperand(&type66); 5326 auto op22 = model->addOperand(&type67); 5327 auto op32 = model->addOperand(&type68); 5328 auto param11 = model->addOperand(&type4); 5329 auto param12 = model->addOperand(&type4); 5330 auto param13 = model->addOperand(&type4); 5331 auto param14 = model->addOperand(&type4); 5332 auto param15 = model->addOperand(&type4); 5333 auto param16 = model->addOperand(&type4); 5334 auto param17 = model->addOperand(&type4); 5335 auto layout = model->addOperand(&type0); 5336 auto op42 = model->addOperand(&type48); 5337 // Phase 2, operations 5338 static int32_t param11_init[] = {0}; 5339 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5340 static int32_t param12_init[] = {0}; 5341 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5342 static int32_t param13_init[] = {0}; 5343 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5344 static int32_t param14_init[] = {0}; 5345 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5346 static int32_t param15_init[] = {1}; 5347 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5348 static int32_t param16_init[] = {1}; 5349 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5350 static int32_t param17_init[] = {0}; 5351 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5352 static bool8 layout_init[] = {false}; 5353 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5354 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5355 // Phase 3, inputs and outputs 5356 model->identifyInputsAndOutputs( 5357 {op12, op22, op32}, 5358 {op42}); 5359 assert(model->isValid()); 5360 } 5361 5362 inline bool is_ignored_channel_dynamic_output_shape_nhwc_weight_as_input_float16(int i) { 5363 static std::set<int> ignore = {}; 5364 return ignore.find(i) != ignore.end(); 5365 } 5366 5367 void CreateModel_channel_dynamic_output_shape_nchw(Model *model) { 5368 OperandType type0(Type::BOOL, {}); 5369 OperandType type4(Type::INT32, {}); 5370 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5371 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 5372 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5373 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5374 // Phase 1, operands 5375 auto op12 = model->addOperand(&type69); 5376 auto op22 = model->addOperand(&type7); 5377 auto op32 = model->addOperand(&type8); 5378 auto param11 = model->addOperand(&type4); 5379 auto param12 = model->addOperand(&type4); 5380 auto param13 = model->addOperand(&type4); 5381 auto param14 = model->addOperand(&type4); 5382 auto param15 = model->addOperand(&type4); 5383 auto param16 = model->addOperand(&type4); 5384 auto param17 = model->addOperand(&type4); 5385 auto layout = model->addOperand(&type0); 5386 auto op42 = model->addOperand(&type46); 5387 // Phase 2, operations 5388 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 5389 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 5390 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 5391 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 5392 static int32_t param11_init[] = {0}; 5393 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5394 static int32_t param12_init[] = {0}; 5395 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5396 static int32_t param13_init[] = {0}; 5397 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5398 static int32_t param14_init[] = {0}; 5399 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5400 static int32_t param15_init[] = {1}; 5401 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5402 static int32_t param16_init[] = {1}; 5403 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5404 static int32_t param17_init[] = {0}; 5405 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5406 static bool8 layout_init[] = {true}; 5407 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5408 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5409 // Phase 3, inputs and outputs 5410 model->identifyInputsAndOutputs( 5411 {op12}, 5412 {op42}); 5413 assert(model->isValid()); 5414 } 5415 5416 inline bool is_ignored_channel_dynamic_output_shape_nchw(int i) { 5417 static std::set<int> ignore = {}; 5418 return ignore.find(i) != ignore.end(); 5419 } 5420 5421 void CreateModel_channel_dynamic_output_shape_nchw_relaxed(Model *model) { 5422 OperandType type0(Type::BOOL, {}); 5423 OperandType type4(Type::INT32, {}); 5424 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5425 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 5426 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5427 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5428 // Phase 1, operands 5429 auto op12 = model->addOperand(&type69); 5430 auto op22 = model->addOperand(&type7); 5431 auto op32 = model->addOperand(&type8); 5432 auto param11 = model->addOperand(&type4); 5433 auto param12 = model->addOperand(&type4); 5434 auto param13 = model->addOperand(&type4); 5435 auto param14 = model->addOperand(&type4); 5436 auto param15 = model->addOperand(&type4); 5437 auto param16 = model->addOperand(&type4); 5438 auto param17 = model->addOperand(&type4); 5439 auto layout = model->addOperand(&type0); 5440 auto op42 = model->addOperand(&type46); 5441 // Phase 2, operations 5442 static float op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 5443 model->setOperandValue(op22, op22_init, sizeof(float) * 9); 5444 static float op32_init[] = {0.0f, 0.0f, 0.0f}; 5445 model->setOperandValue(op32, op32_init, sizeof(float) * 3); 5446 static int32_t param11_init[] = {0}; 5447 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5448 static int32_t param12_init[] = {0}; 5449 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5450 static int32_t param13_init[] = {0}; 5451 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5452 static int32_t param14_init[] = {0}; 5453 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5454 static int32_t param15_init[] = {1}; 5455 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5456 static int32_t param16_init[] = {1}; 5457 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5458 static int32_t param17_init[] = {0}; 5459 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5460 static bool8 layout_init[] = {true}; 5461 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5462 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5463 // Phase 3, inputs and outputs 5464 model->identifyInputsAndOutputs( 5465 {op12}, 5466 {op42}); 5467 // Phase 4: set relaxed execution 5468 model->relaxComputationFloat32toFloat16(true); 5469 assert(model->isValid()); 5470 } 5471 5472 inline bool is_ignored_channel_dynamic_output_shape_nchw_relaxed(int i) { 5473 static std::set<int> ignore = {}; 5474 return ignore.find(i) != ignore.end(); 5475 } 5476 5477 void CreateModel_channel_dynamic_output_shape_nchw_quant8(Model *model) { 5478 OperandType type0(Type::BOOL, {}); 5479 OperandType type4(Type::INT32, {}); 5480 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 5481 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 5482 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 5483 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5484 // Phase 1, operands 5485 auto op12 = model->addOperand(&type70); 5486 auto op22 = model->addOperand(&type62); 5487 auto op32 = model->addOperand(&type63); 5488 auto param11 = model->addOperand(&type4); 5489 auto param12 = model->addOperand(&type4); 5490 auto param13 = model->addOperand(&type4); 5491 auto param14 = model->addOperand(&type4); 5492 auto param15 = model->addOperand(&type4); 5493 auto param16 = model->addOperand(&type4); 5494 auto param17 = model->addOperand(&type4); 5495 auto layout = model->addOperand(&type0); 5496 auto op42 = model->addOperand(&type72); 5497 // Phase 2, operations 5498 static uint8_t op22_init[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; 5499 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 9); 5500 static int32_t op32_init[] = {0, 0, 0}; 5501 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 5502 static int32_t param11_init[] = {0}; 5503 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5504 static int32_t param12_init[] = {0}; 5505 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5506 static int32_t param13_init[] = {0}; 5507 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5508 static int32_t param14_init[] = {0}; 5509 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5510 static int32_t param15_init[] = {1}; 5511 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5512 static int32_t param16_init[] = {1}; 5513 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5514 static int32_t param17_init[] = {0}; 5515 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5516 static bool8 layout_init[] = {true}; 5517 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5518 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5519 // Phase 3, inputs and outputs 5520 model->identifyInputsAndOutputs( 5521 {op12}, 5522 {op42}); 5523 assert(model->isValid()); 5524 } 5525 5526 inline bool is_ignored_channel_dynamic_output_shape_nchw_quant8(int i) { 5527 static std::set<int> ignore = {}; 5528 return ignore.find(i) != ignore.end(); 5529 } 5530 5531 void CreateModel_channel_dynamic_output_shape_nchw_channelQuant8(Model *model) { 5532 OperandType type0(Type::BOOL, {}); 5533 OperandType type4(Type::INT32, {}); 5534 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 5535 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 5536 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 5537 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5538 // Phase 1, operands 5539 auto op12 = model->addOperand(&type70); 5540 auto op22 = model->addOperand(&type64); 5541 auto op32 = model->addOperand(&type65); 5542 auto param11 = model->addOperand(&type4); 5543 auto param12 = model->addOperand(&type4); 5544 auto param13 = model->addOperand(&type4); 5545 auto param14 = model->addOperand(&type4); 5546 auto param15 = model->addOperand(&type4); 5547 auto param16 = model->addOperand(&type4); 5548 auto param17 = model->addOperand(&type4); 5549 auto layout = model->addOperand(&type0); 5550 auto op42 = model->addOperand(&type72); 5551 // Phase 2, operations 5552 static int8_t op22_init[] = {1, 2, 3, 5, 6, 8, 12, 13, 15}; 5553 model->setOperandValue(op22, op22_init, sizeof(int8_t) * 9); 5554 static int32_t op32_init[] = {0, 0, 0}; 5555 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 3); 5556 static int32_t param11_init[] = {0}; 5557 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5558 static int32_t param12_init[] = {0}; 5559 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5560 static int32_t param13_init[] = {0}; 5561 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5562 static int32_t param14_init[] = {0}; 5563 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5564 static int32_t param15_init[] = {1}; 5565 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5566 static int32_t param16_init[] = {1}; 5567 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5568 static int32_t param17_init[] = {0}; 5569 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5570 static bool8 layout_init[] = {true}; 5571 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5572 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5573 // Phase 3, inputs and outputs 5574 model->identifyInputsAndOutputs( 5575 {op12}, 5576 {op42}); 5577 assert(model->isValid()); 5578 } 5579 5580 inline bool is_ignored_channel_dynamic_output_shape_nchw_channelQuant8(int i) { 5581 static std::set<int> ignore = {}; 5582 return ignore.find(i) != ignore.end(); 5583 } 5584 5585 void CreateModel_channel_dynamic_output_shape_nchw_float16(Model *model) { 5586 OperandType type0(Type::BOOL, {}); 5587 OperandType type4(Type::INT32, {}); 5588 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 5589 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 5590 OperandType type68(Type::TENSOR_FLOAT16, {3}); 5591 OperandType type71(Type::TENSOR_FLOAT16, {1, 3, 1, 1}); 5592 // Phase 1, operands 5593 auto op12 = model->addOperand(&type71); 5594 auto op22 = model->addOperand(&type67); 5595 auto op32 = model->addOperand(&type68); 5596 auto param11 = model->addOperand(&type4); 5597 auto param12 = model->addOperand(&type4); 5598 auto param13 = model->addOperand(&type4); 5599 auto param14 = model->addOperand(&type4); 5600 auto param15 = model->addOperand(&type4); 5601 auto param16 = model->addOperand(&type4); 5602 auto param17 = model->addOperand(&type4); 5603 auto layout = model->addOperand(&type0); 5604 auto op42 = model->addOperand(&type48); 5605 // Phase 2, operations 5606 static _Float16 op22_init[] = {0.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f}; 5607 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 9); 5608 static _Float16 op32_init[] = {0.0f, 0.0f, 0.0f}; 5609 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 3); 5610 static int32_t param11_init[] = {0}; 5611 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5612 static int32_t param12_init[] = {0}; 5613 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5614 static int32_t param13_init[] = {0}; 5615 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5616 static int32_t param14_init[] = {0}; 5617 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5618 static int32_t param15_init[] = {1}; 5619 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5620 static int32_t param16_init[] = {1}; 5621 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5622 static int32_t param17_init[] = {0}; 5623 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5624 static bool8 layout_init[] = {true}; 5625 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5626 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5627 // Phase 3, inputs and outputs 5628 model->identifyInputsAndOutputs( 5629 {op12}, 5630 {op42}); 5631 assert(model->isValid()); 5632 } 5633 5634 inline bool is_ignored_channel_dynamic_output_shape_nchw_float16(int i) { 5635 static std::set<int> ignore = {}; 5636 return ignore.find(i) != ignore.end(); 5637 } 5638 5639 void CreateModel_channel_dynamic_output_shape_nchw_weight_as_input(Model *model) { 5640 OperandType type0(Type::BOOL, {}); 5641 OperandType type4(Type::INT32, {}); 5642 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5643 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 5644 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5645 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5646 // Phase 1, operands 5647 auto op12 = model->addOperand(&type69); 5648 auto op22 = model->addOperand(&type7); 5649 auto op32 = model->addOperand(&type8); 5650 auto param11 = model->addOperand(&type4); 5651 auto param12 = model->addOperand(&type4); 5652 auto param13 = model->addOperand(&type4); 5653 auto param14 = model->addOperand(&type4); 5654 auto param15 = model->addOperand(&type4); 5655 auto param16 = model->addOperand(&type4); 5656 auto param17 = model->addOperand(&type4); 5657 auto layout = model->addOperand(&type0); 5658 auto op42 = model->addOperand(&type46); 5659 // Phase 2, operations 5660 static int32_t param11_init[] = {0}; 5661 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5662 static int32_t param12_init[] = {0}; 5663 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5664 static int32_t param13_init[] = {0}; 5665 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5666 static int32_t param14_init[] = {0}; 5667 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5668 static int32_t param15_init[] = {1}; 5669 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5670 static int32_t param16_init[] = {1}; 5671 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5672 static int32_t param17_init[] = {0}; 5673 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5674 static bool8 layout_init[] = {true}; 5675 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5676 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5677 // Phase 3, inputs and outputs 5678 model->identifyInputsAndOutputs( 5679 {op12, op22, op32}, 5680 {op42}); 5681 assert(model->isValid()); 5682 } 5683 5684 inline bool is_ignored_channel_dynamic_output_shape_nchw_weight_as_input(int i) { 5685 static std::set<int> ignore = {}; 5686 return ignore.find(i) != ignore.end(); 5687 } 5688 5689 void CreateModel_channel_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) { 5690 OperandType type0(Type::BOOL, {}); 5691 OperandType type4(Type::INT32, {}); 5692 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5693 OperandType type69(Type::TENSOR_FLOAT32, {1, 3, 1, 1}); 5694 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5695 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5696 // Phase 1, operands 5697 auto op12 = model->addOperand(&type69); 5698 auto op22 = model->addOperand(&type7); 5699 auto op32 = model->addOperand(&type8); 5700 auto param11 = model->addOperand(&type4); 5701 auto param12 = model->addOperand(&type4); 5702 auto param13 = model->addOperand(&type4); 5703 auto param14 = model->addOperand(&type4); 5704 auto param15 = model->addOperand(&type4); 5705 auto param16 = model->addOperand(&type4); 5706 auto param17 = model->addOperand(&type4); 5707 auto layout = model->addOperand(&type0); 5708 auto op42 = model->addOperand(&type46); 5709 // Phase 2, operations 5710 static int32_t param11_init[] = {0}; 5711 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5712 static int32_t param12_init[] = {0}; 5713 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5714 static int32_t param13_init[] = {0}; 5715 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5716 static int32_t param14_init[] = {0}; 5717 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5718 static int32_t param15_init[] = {1}; 5719 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5720 static int32_t param16_init[] = {1}; 5721 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5722 static int32_t param17_init[] = {0}; 5723 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5724 static bool8 layout_init[] = {true}; 5725 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5726 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5727 // Phase 3, inputs and outputs 5728 model->identifyInputsAndOutputs( 5729 {op12, op22, op32}, 5730 {op42}); 5731 // Phase 4: set relaxed execution 5732 model->relaxComputationFloat32toFloat16(true); 5733 assert(model->isValid()); 5734 } 5735 5736 inline bool is_ignored_channel_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) { 5737 static std::set<int> ignore = {}; 5738 return ignore.find(i) != ignore.end(); 5739 } 5740 5741 void CreateModel_channel_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) { 5742 OperandType type0(Type::BOOL, {}); 5743 OperandType type4(Type::INT32, {}); 5744 OperandType type62(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 0); 5745 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 5746 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 5747 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5748 // Phase 1, operands 5749 auto op12 = model->addOperand(&type70); 5750 auto op22 = model->addOperand(&type62); 5751 auto op32 = model->addOperand(&type63); 5752 auto param11 = model->addOperand(&type4); 5753 auto param12 = model->addOperand(&type4); 5754 auto param13 = model->addOperand(&type4); 5755 auto param14 = model->addOperand(&type4); 5756 auto param15 = model->addOperand(&type4); 5757 auto param16 = model->addOperand(&type4); 5758 auto param17 = model->addOperand(&type4); 5759 auto layout = model->addOperand(&type0); 5760 auto op42 = model->addOperand(&type72); 5761 // Phase 2, operations 5762 static int32_t param11_init[] = {0}; 5763 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5764 static int32_t param12_init[] = {0}; 5765 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5766 static int32_t param13_init[] = {0}; 5767 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5768 static int32_t param14_init[] = {0}; 5769 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5770 static int32_t param15_init[] = {1}; 5771 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5772 static int32_t param16_init[] = {1}; 5773 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5774 static int32_t param17_init[] = {0}; 5775 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5776 static bool8 layout_init[] = {true}; 5777 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5778 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5779 // Phase 3, inputs and outputs 5780 model->identifyInputsAndOutputs( 5781 {op12, op22, op32}, 5782 {op42}); 5783 assert(model->isValid()); 5784 } 5785 5786 inline bool is_ignored_channel_dynamic_output_shape_nchw_weight_as_input_quant8(int i) { 5787 static std::set<int> ignore = {}; 5788 return ignore.find(i) != ignore.end(); 5789 } 5790 5791 void CreateModel_channel_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model *model) { 5792 OperandType type0(Type::BOOL, {}); 5793 OperandType type4(Type::INT32, {}); 5794 OperandType type64(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 0.4f, 0.3f},0)); 5795 OperandType type65(Type::TENSOR_INT32, {3}, 0.0f, 0); 5796 OperandType type70(Type::TENSOR_QUANT8_ASYMM, {1, 3, 1, 1}, 0.5f, 0); 5797 OperandType type72(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5798 // Phase 1, operands 5799 auto op12 = model->addOperand(&type70); 5800 auto op22 = model->addOperand(&type64); 5801 auto op32 = model->addOperand(&type65); 5802 auto param11 = model->addOperand(&type4); 5803 auto param12 = model->addOperand(&type4); 5804 auto param13 = model->addOperand(&type4); 5805 auto param14 = model->addOperand(&type4); 5806 auto param15 = model->addOperand(&type4); 5807 auto param16 = model->addOperand(&type4); 5808 auto param17 = model->addOperand(&type4); 5809 auto layout = model->addOperand(&type0); 5810 auto op42 = model->addOperand(&type72); 5811 // Phase 2, operations 5812 static int32_t param11_init[] = {0}; 5813 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5814 static int32_t param12_init[] = {0}; 5815 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5816 static int32_t param13_init[] = {0}; 5817 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5818 static int32_t param14_init[] = {0}; 5819 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5820 static int32_t param15_init[] = {1}; 5821 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5822 static int32_t param16_init[] = {1}; 5823 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5824 static int32_t param17_init[] = {0}; 5825 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5826 static bool8 layout_init[] = {true}; 5827 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5828 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5829 // Phase 3, inputs and outputs 5830 model->identifyInputsAndOutputs( 5831 {op12, op22, op32}, 5832 {op42}); 5833 assert(model->isValid()); 5834 } 5835 5836 inline bool is_ignored_channel_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i) { 5837 static std::set<int> ignore = {}; 5838 return ignore.find(i) != ignore.end(); 5839 } 5840 5841 void CreateModel_channel_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) { 5842 OperandType type0(Type::BOOL, {}); 5843 OperandType type4(Type::INT32, {}); 5844 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 5845 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 5846 OperandType type68(Type::TENSOR_FLOAT16, {3}); 5847 OperandType type71(Type::TENSOR_FLOAT16, {1, 3, 1, 1}); 5848 // Phase 1, operands 5849 auto op12 = model->addOperand(&type71); 5850 auto op22 = model->addOperand(&type67); 5851 auto op32 = model->addOperand(&type68); 5852 auto param11 = model->addOperand(&type4); 5853 auto param12 = model->addOperand(&type4); 5854 auto param13 = model->addOperand(&type4); 5855 auto param14 = model->addOperand(&type4); 5856 auto param15 = model->addOperand(&type4); 5857 auto param16 = model->addOperand(&type4); 5858 auto param17 = model->addOperand(&type4); 5859 auto layout = model->addOperand(&type0); 5860 auto op42 = model->addOperand(&type48); 5861 // Phase 2, operations 5862 static int32_t param11_init[] = {0}; 5863 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 5864 static int32_t param12_init[] = {0}; 5865 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 5866 static int32_t param13_init[] = {0}; 5867 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 5868 static int32_t param14_init[] = {0}; 5869 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 5870 static int32_t param15_init[] = {1}; 5871 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 5872 static int32_t param16_init[] = {1}; 5873 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 5874 static int32_t param17_init[] = {0}; 5875 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 5876 static bool8 layout_init[] = {true}; 5877 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5878 model->addOperation(ANEURALNETWORKS_CONV_2D, {op12, op22, op32, param11, param12, param13, param14, param15, param16, param17, layout}, {op42}); 5879 // Phase 3, inputs and outputs 5880 model->identifyInputsAndOutputs( 5881 {op12, op22, op32}, 5882 {op42}); 5883 assert(model->isValid()); 5884 } 5885 5886 inline bool is_ignored_channel_dynamic_output_shape_nchw_weight_as_input_float16(int i) { 5887 static std::set<int> ignore = {}; 5888 return ignore.find(i) != ignore.end(); 5889 } 5890 5891 void CreateModel_large_nhwc(Model *model) { 5892 OperandType type0(Type::BOOL, {}); 5893 OperandType type4(Type::INT32, {}); 5894 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5895 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5896 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 5897 // Phase 1, operands 5898 auto op13 = model->addOperand(&type9); 5899 auto op23 = model->addOperand(&type7); 5900 auto op33 = model->addOperand(&type8); 5901 auto param18 = model->addOperand(&type4); 5902 auto param19 = model->addOperand(&type4); 5903 auto param20 = model->addOperand(&type4); 5904 auto param21 = model->addOperand(&type4); 5905 auto param22 = model->addOperand(&type4); 5906 auto param23 = model->addOperand(&type4); 5907 auto param24 = model->addOperand(&type4); 5908 auto layout = model->addOperand(&type0); 5909 auto op43 = model->addOperand(&type9); 5910 // Phase 2, operations 5911 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 5912 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 5913 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 5914 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 5915 static int32_t param18_init[] = {0}; 5916 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 5917 static int32_t param19_init[] = {0}; 5918 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 5919 static int32_t param20_init[] = {0}; 5920 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 5921 static int32_t param21_init[] = {0}; 5922 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 5923 static int32_t param22_init[] = {1}; 5924 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 5925 static int32_t param23_init[] = {1}; 5926 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 5927 static int32_t param24_init[] = {0}; 5928 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 5929 static bool8 layout_init[] = {false}; 5930 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5931 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 5932 // Phase 3, inputs and outputs 5933 model->identifyInputsAndOutputs( 5934 {op13}, 5935 {op43}); 5936 assert(model->isValid()); 5937 } 5938 5939 inline bool is_ignored_large_nhwc(int i) { 5940 static std::set<int> ignore = {}; 5941 return ignore.find(i) != ignore.end(); 5942 } 5943 5944 void CreateModel_large_nhwc_relaxed(Model *model) { 5945 OperandType type0(Type::BOOL, {}); 5946 OperandType type4(Type::INT32, {}); 5947 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 5948 OperandType type8(Type::TENSOR_FLOAT32, {3}); 5949 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 5950 // Phase 1, operands 5951 auto op13 = model->addOperand(&type9); 5952 auto op23 = model->addOperand(&type7); 5953 auto op33 = model->addOperand(&type8); 5954 auto param18 = model->addOperand(&type4); 5955 auto param19 = model->addOperand(&type4); 5956 auto param20 = model->addOperand(&type4); 5957 auto param21 = model->addOperand(&type4); 5958 auto param22 = model->addOperand(&type4); 5959 auto param23 = model->addOperand(&type4); 5960 auto param24 = model->addOperand(&type4); 5961 auto layout = model->addOperand(&type0); 5962 auto op43 = model->addOperand(&type9); 5963 // Phase 2, operations 5964 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 5965 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 5966 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 5967 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 5968 static int32_t param18_init[] = {0}; 5969 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 5970 static int32_t param19_init[] = {0}; 5971 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 5972 static int32_t param20_init[] = {0}; 5973 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 5974 static int32_t param21_init[] = {0}; 5975 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 5976 static int32_t param22_init[] = {1}; 5977 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 5978 static int32_t param23_init[] = {1}; 5979 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 5980 static int32_t param24_init[] = {0}; 5981 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 5982 static bool8 layout_init[] = {false}; 5983 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5984 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 5985 // Phase 3, inputs and outputs 5986 model->identifyInputsAndOutputs( 5987 {op13}, 5988 {op43}); 5989 // Phase 4: set relaxed execution 5990 model->relaxComputationFloat32toFloat16(true); 5991 assert(model->isValid()); 5992 } 5993 5994 inline bool is_ignored_large_nhwc_relaxed(int i) { 5995 static std::set<int> ignore = {}; 5996 return ignore.find(i) != ignore.end(); 5997 } 5998 5999 void CreateModel_large_nhwc_quant8(Model *model) { 6000 OperandType type0(Type::BOOL, {}); 6001 OperandType type4(Type::INT32, {}); 6002 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 6003 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 6004 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 6005 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 2.0f, 0); 6006 // Phase 1, operands 6007 auto op13 = model->addOperand(&type73); 6008 auto op23 = model->addOperand(&type74); 6009 auto op33 = model->addOperand(&type63); 6010 auto param18 = model->addOperand(&type4); 6011 auto param19 = model->addOperand(&type4); 6012 auto param20 = model->addOperand(&type4); 6013 auto param21 = model->addOperand(&type4); 6014 auto param22 = model->addOperand(&type4); 6015 auto param23 = model->addOperand(&type4); 6016 auto param24 = model->addOperand(&type4); 6017 auto layout = model->addOperand(&type0); 6018 auto op43 = model->addOperand(&type75); 6019 // Phase 2, operations 6020 static uint8_t op23_init[] = {130, 136, 142, 132, 138, 144, 134, 140, 146}; 6021 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9); 6022 static int32_t op33_init[] = {0, 0, 0}; 6023 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 6024 static int32_t param18_init[] = {0}; 6025 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6026 static int32_t param19_init[] = {0}; 6027 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6028 static int32_t param20_init[] = {0}; 6029 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6030 static int32_t param21_init[] = {0}; 6031 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6032 static int32_t param22_init[] = {1}; 6033 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6034 static int32_t param23_init[] = {1}; 6035 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6036 static int32_t param24_init[] = {0}; 6037 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6038 static bool8 layout_init[] = {false}; 6039 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6040 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6041 // Phase 3, inputs and outputs 6042 model->identifyInputsAndOutputs( 6043 {op13}, 6044 {op43}); 6045 assert(model->isValid()); 6046 } 6047 6048 inline bool is_ignored_large_nhwc_quant8(int i) { 6049 static std::set<int> ignore = {}; 6050 return ignore.find(i) != ignore.end(); 6051 } 6052 6053 void CreateModel_large_nhwc_channelQuant8(Model *model) { 6054 OperandType type0(Type::BOOL, {}); 6055 OperandType type4(Type::INT32, {}); 6056 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 6057 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 2.0f, 0); 6058 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 6059 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 6060 // Phase 1, operands 6061 auto op13 = model->addOperand(&type73); 6062 auto op23 = model->addOperand(&type76); 6063 auto op33 = model->addOperand(&type77); 6064 auto param18 = model->addOperand(&type4); 6065 auto param19 = model->addOperand(&type4); 6066 auto param20 = model->addOperand(&type4); 6067 auto param21 = model->addOperand(&type4); 6068 auto param22 = model->addOperand(&type4); 6069 auto param23 = model->addOperand(&type4); 6070 auto param24 = model->addOperand(&type4); 6071 auto layout = model->addOperand(&type0); 6072 auto op43 = model->addOperand(&type75); 6073 // Phase 2, operations 6074 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 6, 12, 18}; 6075 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 6076 static int32_t op33_init[] = {0, 0, 0}; 6077 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 6078 static int32_t param18_init[] = {0}; 6079 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6080 static int32_t param19_init[] = {0}; 6081 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6082 static int32_t param20_init[] = {0}; 6083 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6084 static int32_t param21_init[] = {0}; 6085 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6086 static int32_t param22_init[] = {1}; 6087 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6088 static int32_t param23_init[] = {1}; 6089 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6090 static int32_t param24_init[] = {0}; 6091 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6092 static bool8 layout_init[] = {false}; 6093 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6094 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6095 // Phase 3, inputs and outputs 6096 model->identifyInputsAndOutputs( 6097 {op13}, 6098 {op43}); 6099 assert(model->isValid()); 6100 } 6101 6102 inline bool is_ignored_large_nhwc_channelQuant8(int i) { 6103 static std::set<int> ignore = {}; 6104 return ignore.find(i) != ignore.end(); 6105 } 6106 6107 void CreateModel_large_nhwc_channelQuant8_2(Model *model) { 6108 OperandType type0(Type::BOOL, {}); 6109 OperandType type4(Type::INT32, {}); 6110 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 1.0f, 127); 6111 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 6112 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 6113 // Phase 1, operands 6114 auto op13 = model->addOperand(&type78); 6115 auto op23 = model->addOperand(&type79); 6116 auto op33 = model->addOperand(&type80); 6117 auto param18 = model->addOperand(&type4); 6118 auto param19 = model->addOperand(&type4); 6119 auto param20 = model->addOperand(&type4); 6120 auto param21 = model->addOperand(&type4); 6121 auto param22 = model->addOperand(&type4); 6122 auto param23 = model->addOperand(&type4); 6123 auto param24 = model->addOperand(&type4); 6124 auto layout = model->addOperand(&type0); 6125 auto op43 = model->addOperand(&type78); 6126 // Phase 2, operations 6127 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 3, 6, 9}; 6128 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 6129 static int32_t op33_init[] = {0, 0, 0}; 6130 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 6131 static int32_t param18_init[] = {0}; 6132 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6133 static int32_t param19_init[] = {0}; 6134 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6135 static int32_t param20_init[] = {0}; 6136 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6137 static int32_t param21_init[] = {0}; 6138 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6139 static int32_t param22_init[] = {1}; 6140 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6141 static int32_t param23_init[] = {1}; 6142 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6143 static int32_t param24_init[] = {0}; 6144 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6145 static bool8 layout_init[] = {false}; 6146 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6147 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6148 // Phase 3, inputs and outputs 6149 model->identifyInputsAndOutputs( 6150 {op13}, 6151 {op43}); 6152 assert(model->isValid()); 6153 } 6154 6155 inline bool is_ignored_large_nhwc_channelQuant8_2(int i) { 6156 static std::set<int> ignore = {}; 6157 return ignore.find(i) != ignore.end(); 6158 } 6159 6160 void CreateModel_large_nhwc_float16(Model *model) { 6161 OperandType type0(Type::BOOL, {}); 6162 OperandType type4(Type::INT32, {}); 6163 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 6164 OperandType type68(Type::TENSOR_FLOAT16, {3}); 6165 OperandType type81(Type::TENSOR_FLOAT16, {1, 2, 3, 3}); 6166 // Phase 1, operands 6167 auto op13 = model->addOperand(&type81); 6168 auto op23 = model->addOperand(&type67); 6169 auto op33 = model->addOperand(&type68); 6170 auto param18 = model->addOperand(&type4); 6171 auto param19 = model->addOperand(&type4); 6172 auto param20 = model->addOperand(&type4); 6173 auto param21 = model->addOperand(&type4); 6174 auto param22 = model->addOperand(&type4); 6175 auto param23 = model->addOperand(&type4); 6176 auto param24 = model->addOperand(&type4); 6177 auto layout = model->addOperand(&type0); 6178 auto op43 = model->addOperand(&type81); 6179 // Phase 2, operations 6180 static _Float16 op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 6181 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9); 6182 static _Float16 op33_init[] = {0.0f, 0.0f, 0.0f}; 6183 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 3); 6184 static int32_t param18_init[] = {0}; 6185 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6186 static int32_t param19_init[] = {0}; 6187 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6188 static int32_t param20_init[] = {0}; 6189 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6190 static int32_t param21_init[] = {0}; 6191 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6192 static int32_t param22_init[] = {1}; 6193 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6194 static int32_t param23_init[] = {1}; 6195 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6196 static int32_t param24_init[] = {0}; 6197 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6198 static bool8 layout_init[] = {false}; 6199 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6200 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6201 // Phase 3, inputs and outputs 6202 model->identifyInputsAndOutputs( 6203 {op13}, 6204 {op43}); 6205 assert(model->isValid()); 6206 } 6207 6208 inline bool is_ignored_large_nhwc_float16(int i) { 6209 static std::set<int> ignore = {}; 6210 return ignore.find(i) != ignore.end(); 6211 } 6212 6213 void CreateModel_large_nhwc_weight_as_input(Model *model) { 6214 OperandType type0(Type::BOOL, {}); 6215 OperandType type4(Type::INT32, {}); 6216 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 6217 OperandType type8(Type::TENSOR_FLOAT32, {3}); 6218 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 6219 // Phase 1, operands 6220 auto op13 = model->addOperand(&type9); 6221 auto op23 = model->addOperand(&type7); 6222 auto op33 = model->addOperand(&type8); 6223 auto param18 = model->addOperand(&type4); 6224 auto param19 = model->addOperand(&type4); 6225 auto param20 = model->addOperand(&type4); 6226 auto param21 = model->addOperand(&type4); 6227 auto param22 = model->addOperand(&type4); 6228 auto param23 = model->addOperand(&type4); 6229 auto param24 = model->addOperand(&type4); 6230 auto layout = model->addOperand(&type0); 6231 auto op43 = model->addOperand(&type9); 6232 // Phase 2, operations 6233 static int32_t param18_init[] = {0}; 6234 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6235 static int32_t param19_init[] = {0}; 6236 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6237 static int32_t param20_init[] = {0}; 6238 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6239 static int32_t param21_init[] = {0}; 6240 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6241 static int32_t param22_init[] = {1}; 6242 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6243 static int32_t param23_init[] = {1}; 6244 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6245 static int32_t param24_init[] = {0}; 6246 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6247 static bool8 layout_init[] = {false}; 6248 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6249 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6250 // Phase 3, inputs and outputs 6251 model->identifyInputsAndOutputs( 6252 {op13, op23, op33}, 6253 {op43}); 6254 assert(model->isValid()); 6255 } 6256 6257 inline bool is_ignored_large_nhwc_weight_as_input(int i) { 6258 static std::set<int> ignore = {}; 6259 return ignore.find(i) != ignore.end(); 6260 } 6261 6262 void CreateModel_large_nhwc_weight_as_input_relaxed(Model *model) { 6263 OperandType type0(Type::BOOL, {}); 6264 OperandType type4(Type::INT32, {}); 6265 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 6266 OperandType type8(Type::TENSOR_FLOAT32, {3}); 6267 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 6268 // Phase 1, operands 6269 auto op13 = model->addOperand(&type9); 6270 auto op23 = model->addOperand(&type7); 6271 auto op33 = model->addOperand(&type8); 6272 auto param18 = model->addOperand(&type4); 6273 auto param19 = model->addOperand(&type4); 6274 auto param20 = model->addOperand(&type4); 6275 auto param21 = model->addOperand(&type4); 6276 auto param22 = model->addOperand(&type4); 6277 auto param23 = model->addOperand(&type4); 6278 auto param24 = model->addOperand(&type4); 6279 auto layout = model->addOperand(&type0); 6280 auto op43 = model->addOperand(&type9); 6281 // Phase 2, operations 6282 static int32_t param18_init[] = {0}; 6283 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6284 static int32_t param19_init[] = {0}; 6285 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6286 static int32_t param20_init[] = {0}; 6287 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6288 static int32_t param21_init[] = {0}; 6289 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6290 static int32_t param22_init[] = {1}; 6291 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6292 static int32_t param23_init[] = {1}; 6293 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6294 static int32_t param24_init[] = {0}; 6295 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6296 static bool8 layout_init[] = {false}; 6297 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6298 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6299 // Phase 3, inputs and outputs 6300 model->identifyInputsAndOutputs( 6301 {op13, op23, op33}, 6302 {op43}); 6303 // Phase 4: set relaxed execution 6304 model->relaxComputationFloat32toFloat16(true); 6305 assert(model->isValid()); 6306 } 6307 6308 inline bool is_ignored_large_nhwc_weight_as_input_relaxed(int i) { 6309 static std::set<int> ignore = {}; 6310 return ignore.find(i) != ignore.end(); 6311 } 6312 6313 void CreateModel_large_nhwc_weight_as_input_quant8(Model *model) { 6314 OperandType type0(Type::BOOL, {}); 6315 OperandType type4(Type::INT32, {}); 6316 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 6317 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 6318 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 6319 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 2.0f, 0); 6320 // Phase 1, operands 6321 auto op13 = model->addOperand(&type73); 6322 auto op23 = model->addOperand(&type74); 6323 auto op33 = model->addOperand(&type63); 6324 auto param18 = model->addOperand(&type4); 6325 auto param19 = model->addOperand(&type4); 6326 auto param20 = model->addOperand(&type4); 6327 auto param21 = model->addOperand(&type4); 6328 auto param22 = model->addOperand(&type4); 6329 auto param23 = model->addOperand(&type4); 6330 auto param24 = model->addOperand(&type4); 6331 auto layout = model->addOperand(&type0); 6332 auto op43 = model->addOperand(&type75); 6333 // Phase 2, operations 6334 static int32_t param18_init[] = {0}; 6335 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6336 static int32_t param19_init[] = {0}; 6337 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6338 static int32_t param20_init[] = {0}; 6339 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6340 static int32_t param21_init[] = {0}; 6341 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6342 static int32_t param22_init[] = {1}; 6343 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6344 static int32_t param23_init[] = {1}; 6345 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6346 static int32_t param24_init[] = {0}; 6347 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6348 static bool8 layout_init[] = {false}; 6349 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6350 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6351 // Phase 3, inputs and outputs 6352 model->identifyInputsAndOutputs( 6353 {op13, op23, op33}, 6354 {op43}); 6355 assert(model->isValid()); 6356 } 6357 6358 inline bool is_ignored_large_nhwc_weight_as_input_quant8(int i) { 6359 static std::set<int> ignore = {}; 6360 return ignore.find(i) != ignore.end(); 6361 } 6362 6363 void CreateModel_large_nhwc_weight_as_input_channelQuant8(Model *model) { 6364 OperandType type0(Type::BOOL, {}); 6365 OperandType type4(Type::INT32, {}); 6366 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 6367 OperandType type75(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 2.0f, 0); 6368 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 6369 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 6370 // Phase 1, operands 6371 auto op13 = model->addOperand(&type73); 6372 auto op23 = model->addOperand(&type76); 6373 auto op33 = model->addOperand(&type77); 6374 auto param18 = model->addOperand(&type4); 6375 auto param19 = model->addOperand(&type4); 6376 auto param20 = model->addOperand(&type4); 6377 auto param21 = model->addOperand(&type4); 6378 auto param22 = model->addOperand(&type4); 6379 auto param23 = model->addOperand(&type4); 6380 auto param24 = model->addOperand(&type4); 6381 auto layout = model->addOperand(&type0); 6382 auto op43 = model->addOperand(&type75); 6383 // Phase 2, operations 6384 static int32_t param18_init[] = {0}; 6385 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6386 static int32_t param19_init[] = {0}; 6387 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6388 static int32_t param20_init[] = {0}; 6389 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6390 static int32_t param21_init[] = {0}; 6391 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6392 static int32_t param22_init[] = {1}; 6393 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6394 static int32_t param23_init[] = {1}; 6395 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6396 static int32_t param24_init[] = {0}; 6397 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6398 static bool8 layout_init[] = {false}; 6399 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6400 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6401 // Phase 3, inputs and outputs 6402 model->identifyInputsAndOutputs( 6403 {op13, op23, op33}, 6404 {op43}); 6405 assert(model->isValid()); 6406 } 6407 6408 inline bool is_ignored_large_nhwc_weight_as_input_channelQuant8(int i) { 6409 static std::set<int> ignore = {}; 6410 return ignore.find(i) != ignore.end(); 6411 } 6412 6413 void CreateModel_large_nhwc_weight_as_input_channelQuant8_2(Model *model) { 6414 OperandType type0(Type::BOOL, {}); 6415 OperandType type4(Type::INT32, {}); 6416 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 1.0f, 127); 6417 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 6418 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 6419 // Phase 1, operands 6420 auto op13 = model->addOperand(&type78); 6421 auto op23 = model->addOperand(&type79); 6422 auto op33 = model->addOperand(&type80); 6423 auto param18 = model->addOperand(&type4); 6424 auto param19 = model->addOperand(&type4); 6425 auto param20 = model->addOperand(&type4); 6426 auto param21 = model->addOperand(&type4); 6427 auto param22 = model->addOperand(&type4); 6428 auto param23 = model->addOperand(&type4); 6429 auto param24 = model->addOperand(&type4); 6430 auto layout = model->addOperand(&type0); 6431 auto op43 = model->addOperand(&type78); 6432 // Phase 2, operations 6433 static int32_t param18_init[] = {0}; 6434 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6435 static int32_t param19_init[] = {0}; 6436 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6437 static int32_t param20_init[] = {0}; 6438 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6439 static int32_t param21_init[] = {0}; 6440 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6441 static int32_t param22_init[] = {1}; 6442 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6443 static int32_t param23_init[] = {1}; 6444 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6445 static int32_t param24_init[] = {0}; 6446 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6447 static bool8 layout_init[] = {false}; 6448 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6449 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6450 // Phase 3, inputs and outputs 6451 model->identifyInputsAndOutputs( 6452 {op13, op23, op33}, 6453 {op43}); 6454 assert(model->isValid()); 6455 } 6456 6457 inline bool is_ignored_large_nhwc_weight_as_input_channelQuant8_2(int i) { 6458 static std::set<int> ignore = {}; 6459 return ignore.find(i) != ignore.end(); 6460 } 6461 6462 void CreateModel_large_nhwc_weight_as_input_float16(Model *model) { 6463 OperandType type0(Type::BOOL, {}); 6464 OperandType type4(Type::INT32, {}); 6465 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 6466 OperandType type68(Type::TENSOR_FLOAT16, {3}); 6467 OperandType type81(Type::TENSOR_FLOAT16, {1, 2, 3, 3}); 6468 // Phase 1, operands 6469 auto op13 = model->addOperand(&type81); 6470 auto op23 = model->addOperand(&type67); 6471 auto op33 = model->addOperand(&type68); 6472 auto param18 = model->addOperand(&type4); 6473 auto param19 = model->addOperand(&type4); 6474 auto param20 = model->addOperand(&type4); 6475 auto param21 = model->addOperand(&type4); 6476 auto param22 = model->addOperand(&type4); 6477 auto param23 = model->addOperand(&type4); 6478 auto param24 = model->addOperand(&type4); 6479 auto layout = model->addOperand(&type0); 6480 auto op43 = model->addOperand(&type81); 6481 // Phase 2, operations 6482 static int32_t param18_init[] = {0}; 6483 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6484 static int32_t param19_init[] = {0}; 6485 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6486 static int32_t param20_init[] = {0}; 6487 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6488 static int32_t param21_init[] = {0}; 6489 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6490 static int32_t param22_init[] = {1}; 6491 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6492 static int32_t param23_init[] = {1}; 6493 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6494 static int32_t param24_init[] = {0}; 6495 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6496 static bool8 layout_init[] = {false}; 6497 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6498 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6499 // Phase 3, inputs and outputs 6500 model->identifyInputsAndOutputs( 6501 {op13, op23, op33}, 6502 {op43}); 6503 assert(model->isValid()); 6504 } 6505 6506 inline bool is_ignored_large_nhwc_weight_as_input_float16(int i) { 6507 static std::set<int> ignore = {}; 6508 return ignore.find(i) != ignore.end(); 6509 } 6510 6511 void CreateModel_large_nchw(Model *model) { 6512 OperandType type0(Type::BOOL, {}); 6513 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 6514 OperandType type4(Type::INT32, {}); 6515 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 6516 OperandType type8(Type::TENSOR_FLOAT32, {3}); 6517 // Phase 1, operands 6518 auto op13 = model->addOperand(&type11); 6519 auto op23 = model->addOperand(&type7); 6520 auto op33 = model->addOperand(&type8); 6521 auto param18 = model->addOperand(&type4); 6522 auto param19 = model->addOperand(&type4); 6523 auto param20 = model->addOperand(&type4); 6524 auto param21 = model->addOperand(&type4); 6525 auto param22 = model->addOperand(&type4); 6526 auto param23 = model->addOperand(&type4); 6527 auto param24 = model->addOperand(&type4); 6528 auto layout = model->addOperand(&type0); 6529 auto op43 = model->addOperand(&type11); 6530 // Phase 2, operations 6531 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 6532 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 6533 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 6534 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 6535 static int32_t param18_init[] = {0}; 6536 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6537 static int32_t param19_init[] = {0}; 6538 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6539 static int32_t param20_init[] = {0}; 6540 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6541 static int32_t param21_init[] = {0}; 6542 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6543 static int32_t param22_init[] = {1}; 6544 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6545 static int32_t param23_init[] = {1}; 6546 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6547 static int32_t param24_init[] = {0}; 6548 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6549 static bool8 layout_init[] = {true}; 6550 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6551 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6552 // Phase 3, inputs and outputs 6553 model->identifyInputsAndOutputs( 6554 {op13}, 6555 {op43}); 6556 assert(model->isValid()); 6557 } 6558 6559 inline bool is_ignored_large_nchw(int i) { 6560 static std::set<int> ignore = {}; 6561 return ignore.find(i) != ignore.end(); 6562 } 6563 6564 void CreateModel_large_nchw_relaxed(Model *model) { 6565 OperandType type0(Type::BOOL, {}); 6566 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 6567 OperandType type4(Type::INT32, {}); 6568 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 6569 OperandType type8(Type::TENSOR_FLOAT32, {3}); 6570 // Phase 1, operands 6571 auto op13 = model->addOperand(&type11); 6572 auto op23 = model->addOperand(&type7); 6573 auto op33 = model->addOperand(&type8); 6574 auto param18 = model->addOperand(&type4); 6575 auto param19 = model->addOperand(&type4); 6576 auto param20 = model->addOperand(&type4); 6577 auto param21 = model->addOperand(&type4); 6578 auto param22 = model->addOperand(&type4); 6579 auto param23 = model->addOperand(&type4); 6580 auto param24 = model->addOperand(&type4); 6581 auto layout = model->addOperand(&type0); 6582 auto op43 = model->addOperand(&type11); 6583 // Phase 2, operations 6584 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 6585 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 6586 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 6587 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 6588 static int32_t param18_init[] = {0}; 6589 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6590 static int32_t param19_init[] = {0}; 6591 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6592 static int32_t param20_init[] = {0}; 6593 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6594 static int32_t param21_init[] = {0}; 6595 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6596 static int32_t param22_init[] = {1}; 6597 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6598 static int32_t param23_init[] = {1}; 6599 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6600 static int32_t param24_init[] = {0}; 6601 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6602 static bool8 layout_init[] = {true}; 6603 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6604 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6605 // Phase 3, inputs and outputs 6606 model->identifyInputsAndOutputs( 6607 {op13}, 6608 {op43}); 6609 // Phase 4: set relaxed execution 6610 model->relaxComputationFloat32toFloat16(true); 6611 assert(model->isValid()); 6612 } 6613 6614 inline bool is_ignored_large_nchw_relaxed(int i) { 6615 static std::set<int> ignore = {}; 6616 return ignore.find(i) != ignore.end(); 6617 } 6618 6619 void CreateModel_large_nchw_quant8(Model *model) { 6620 OperandType type0(Type::BOOL, {}); 6621 OperandType type4(Type::INT32, {}); 6622 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 6623 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 6624 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 6625 OperandType type83(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 2.0f, 0); 6626 // Phase 1, operands 6627 auto op13 = model->addOperand(&type82); 6628 auto op23 = model->addOperand(&type74); 6629 auto op33 = model->addOperand(&type63); 6630 auto param18 = model->addOperand(&type4); 6631 auto param19 = model->addOperand(&type4); 6632 auto param20 = model->addOperand(&type4); 6633 auto param21 = model->addOperand(&type4); 6634 auto param22 = model->addOperand(&type4); 6635 auto param23 = model->addOperand(&type4); 6636 auto param24 = model->addOperand(&type4); 6637 auto layout = model->addOperand(&type0); 6638 auto op43 = model->addOperand(&type83); 6639 // Phase 2, operations 6640 static uint8_t op23_init[] = {130, 136, 142, 132, 138, 144, 134, 140, 146}; 6641 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9); 6642 static int32_t op33_init[] = {0, 0, 0}; 6643 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 6644 static int32_t param18_init[] = {0}; 6645 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6646 static int32_t param19_init[] = {0}; 6647 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6648 static int32_t param20_init[] = {0}; 6649 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6650 static int32_t param21_init[] = {0}; 6651 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6652 static int32_t param22_init[] = {1}; 6653 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6654 static int32_t param23_init[] = {1}; 6655 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6656 static int32_t param24_init[] = {0}; 6657 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6658 static bool8 layout_init[] = {true}; 6659 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6660 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6661 // Phase 3, inputs and outputs 6662 model->identifyInputsAndOutputs( 6663 {op13}, 6664 {op43}); 6665 assert(model->isValid()); 6666 } 6667 6668 inline bool is_ignored_large_nchw_quant8(int i) { 6669 static std::set<int> ignore = {}; 6670 return ignore.find(i) != ignore.end(); 6671 } 6672 6673 void CreateModel_large_nchw_channelQuant8(Model *model) { 6674 OperandType type0(Type::BOOL, {}); 6675 OperandType type4(Type::INT32, {}); 6676 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 6677 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 6678 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 6679 OperandType type83(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 2.0f, 0); 6680 // Phase 1, operands 6681 auto op13 = model->addOperand(&type82); 6682 auto op23 = model->addOperand(&type76); 6683 auto op33 = model->addOperand(&type77); 6684 auto param18 = model->addOperand(&type4); 6685 auto param19 = model->addOperand(&type4); 6686 auto param20 = model->addOperand(&type4); 6687 auto param21 = model->addOperand(&type4); 6688 auto param22 = model->addOperand(&type4); 6689 auto param23 = model->addOperand(&type4); 6690 auto param24 = model->addOperand(&type4); 6691 auto layout = model->addOperand(&type0); 6692 auto op43 = model->addOperand(&type83); 6693 // Phase 2, operations 6694 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 6, 12, 18}; 6695 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 6696 static int32_t op33_init[] = {0, 0, 0}; 6697 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 6698 static int32_t param18_init[] = {0}; 6699 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6700 static int32_t param19_init[] = {0}; 6701 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6702 static int32_t param20_init[] = {0}; 6703 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6704 static int32_t param21_init[] = {0}; 6705 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6706 static int32_t param22_init[] = {1}; 6707 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6708 static int32_t param23_init[] = {1}; 6709 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6710 static int32_t param24_init[] = {0}; 6711 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6712 static bool8 layout_init[] = {true}; 6713 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6714 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6715 // Phase 3, inputs and outputs 6716 model->identifyInputsAndOutputs( 6717 {op13}, 6718 {op43}); 6719 assert(model->isValid()); 6720 } 6721 6722 inline bool is_ignored_large_nchw_channelQuant8(int i) { 6723 static std::set<int> ignore = {}; 6724 return ignore.find(i) != ignore.end(); 6725 } 6726 6727 void CreateModel_large_nchw_channelQuant8_2(Model *model) { 6728 OperandType type0(Type::BOOL, {}); 6729 OperandType type4(Type::INT32, {}); 6730 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 6731 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 6732 OperandType type84(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 1.0f, 127); 6733 // Phase 1, operands 6734 auto op13 = model->addOperand(&type84); 6735 auto op23 = model->addOperand(&type79); 6736 auto op33 = model->addOperand(&type80); 6737 auto param18 = model->addOperand(&type4); 6738 auto param19 = model->addOperand(&type4); 6739 auto param20 = model->addOperand(&type4); 6740 auto param21 = model->addOperand(&type4); 6741 auto param22 = model->addOperand(&type4); 6742 auto param23 = model->addOperand(&type4); 6743 auto param24 = model->addOperand(&type4); 6744 auto layout = model->addOperand(&type0); 6745 auto op43 = model->addOperand(&type84); 6746 // Phase 2, operations 6747 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 3, 6, 9}; 6748 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 6749 static int32_t op33_init[] = {0, 0, 0}; 6750 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 6751 static int32_t param18_init[] = {0}; 6752 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6753 static int32_t param19_init[] = {0}; 6754 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6755 static int32_t param20_init[] = {0}; 6756 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6757 static int32_t param21_init[] = {0}; 6758 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6759 static int32_t param22_init[] = {1}; 6760 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6761 static int32_t param23_init[] = {1}; 6762 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6763 static int32_t param24_init[] = {0}; 6764 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6765 static bool8 layout_init[] = {true}; 6766 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6767 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6768 // Phase 3, inputs and outputs 6769 model->identifyInputsAndOutputs( 6770 {op13}, 6771 {op43}); 6772 assert(model->isValid()); 6773 } 6774 6775 inline bool is_ignored_large_nchw_channelQuant8_2(int i) { 6776 static std::set<int> ignore = {}; 6777 return ignore.find(i) != ignore.end(); 6778 } 6779 6780 void CreateModel_large_nchw_float16(Model *model) { 6781 OperandType type0(Type::BOOL, {}); 6782 OperandType type4(Type::INT32, {}); 6783 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 6784 OperandType type68(Type::TENSOR_FLOAT16, {3}); 6785 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 6786 // Phase 1, operands 6787 auto op13 = model->addOperand(&type85); 6788 auto op23 = model->addOperand(&type67); 6789 auto op33 = model->addOperand(&type68); 6790 auto param18 = model->addOperand(&type4); 6791 auto param19 = model->addOperand(&type4); 6792 auto param20 = model->addOperand(&type4); 6793 auto param21 = model->addOperand(&type4); 6794 auto param22 = model->addOperand(&type4); 6795 auto param23 = model->addOperand(&type4); 6796 auto param24 = model->addOperand(&type4); 6797 auto layout = model->addOperand(&type0); 6798 auto op43 = model->addOperand(&type85); 6799 // Phase 2, operations 6800 static _Float16 op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 6801 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9); 6802 static _Float16 op33_init[] = {0.0f, 0.0f, 0.0f}; 6803 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 3); 6804 static int32_t param18_init[] = {0}; 6805 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6806 static int32_t param19_init[] = {0}; 6807 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6808 static int32_t param20_init[] = {0}; 6809 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6810 static int32_t param21_init[] = {0}; 6811 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6812 static int32_t param22_init[] = {1}; 6813 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6814 static int32_t param23_init[] = {1}; 6815 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6816 static int32_t param24_init[] = {0}; 6817 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6818 static bool8 layout_init[] = {true}; 6819 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6820 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6821 // Phase 3, inputs and outputs 6822 model->identifyInputsAndOutputs( 6823 {op13}, 6824 {op43}); 6825 assert(model->isValid()); 6826 } 6827 6828 inline bool is_ignored_large_nchw_float16(int i) { 6829 static std::set<int> ignore = {}; 6830 return ignore.find(i) != ignore.end(); 6831 } 6832 6833 void CreateModel_large_nchw_weight_as_input(Model *model) { 6834 OperandType type0(Type::BOOL, {}); 6835 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 6836 OperandType type4(Type::INT32, {}); 6837 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 6838 OperandType type8(Type::TENSOR_FLOAT32, {3}); 6839 // Phase 1, operands 6840 auto op13 = model->addOperand(&type11); 6841 auto op23 = model->addOperand(&type7); 6842 auto op33 = model->addOperand(&type8); 6843 auto param18 = model->addOperand(&type4); 6844 auto param19 = model->addOperand(&type4); 6845 auto param20 = model->addOperand(&type4); 6846 auto param21 = model->addOperand(&type4); 6847 auto param22 = model->addOperand(&type4); 6848 auto param23 = model->addOperand(&type4); 6849 auto param24 = model->addOperand(&type4); 6850 auto layout = model->addOperand(&type0); 6851 auto op43 = model->addOperand(&type11); 6852 // Phase 2, operations 6853 static int32_t param18_init[] = {0}; 6854 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6855 static int32_t param19_init[] = {0}; 6856 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6857 static int32_t param20_init[] = {0}; 6858 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6859 static int32_t param21_init[] = {0}; 6860 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6861 static int32_t param22_init[] = {1}; 6862 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6863 static int32_t param23_init[] = {1}; 6864 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6865 static int32_t param24_init[] = {0}; 6866 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6867 static bool8 layout_init[] = {true}; 6868 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6869 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6870 // Phase 3, inputs and outputs 6871 model->identifyInputsAndOutputs( 6872 {op13, op23, op33}, 6873 {op43}); 6874 assert(model->isValid()); 6875 } 6876 6877 inline bool is_ignored_large_nchw_weight_as_input(int i) { 6878 static std::set<int> ignore = {}; 6879 return ignore.find(i) != ignore.end(); 6880 } 6881 6882 void CreateModel_large_nchw_weight_as_input_relaxed(Model *model) { 6883 OperandType type0(Type::BOOL, {}); 6884 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 6885 OperandType type4(Type::INT32, {}); 6886 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 6887 OperandType type8(Type::TENSOR_FLOAT32, {3}); 6888 // Phase 1, operands 6889 auto op13 = model->addOperand(&type11); 6890 auto op23 = model->addOperand(&type7); 6891 auto op33 = model->addOperand(&type8); 6892 auto param18 = model->addOperand(&type4); 6893 auto param19 = model->addOperand(&type4); 6894 auto param20 = model->addOperand(&type4); 6895 auto param21 = model->addOperand(&type4); 6896 auto param22 = model->addOperand(&type4); 6897 auto param23 = model->addOperand(&type4); 6898 auto param24 = model->addOperand(&type4); 6899 auto layout = model->addOperand(&type0); 6900 auto op43 = model->addOperand(&type11); 6901 // Phase 2, operations 6902 static int32_t param18_init[] = {0}; 6903 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6904 static int32_t param19_init[] = {0}; 6905 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6906 static int32_t param20_init[] = {0}; 6907 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6908 static int32_t param21_init[] = {0}; 6909 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6910 static int32_t param22_init[] = {1}; 6911 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6912 static int32_t param23_init[] = {1}; 6913 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6914 static int32_t param24_init[] = {0}; 6915 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6916 static bool8 layout_init[] = {true}; 6917 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6918 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6919 // Phase 3, inputs and outputs 6920 model->identifyInputsAndOutputs( 6921 {op13, op23, op33}, 6922 {op43}); 6923 // Phase 4: set relaxed execution 6924 model->relaxComputationFloat32toFloat16(true); 6925 assert(model->isValid()); 6926 } 6927 6928 inline bool is_ignored_large_nchw_weight_as_input_relaxed(int i) { 6929 static std::set<int> ignore = {}; 6930 return ignore.find(i) != ignore.end(); 6931 } 6932 6933 void CreateModel_large_nchw_weight_as_input_quant8(Model *model) { 6934 OperandType type0(Type::BOOL, {}); 6935 OperandType type4(Type::INT32, {}); 6936 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 6937 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 6938 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 6939 OperandType type83(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 2.0f, 0); 6940 // Phase 1, operands 6941 auto op13 = model->addOperand(&type82); 6942 auto op23 = model->addOperand(&type74); 6943 auto op33 = model->addOperand(&type63); 6944 auto param18 = model->addOperand(&type4); 6945 auto param19 = model->addOperand(&type4); 6946 auto param20 = model->addOperand(&type4); 6947 auto param21 = model->addOperand(&type4); 6948 auto param22 = model->addOperand(&type4); 6949 auto param23 = model->addOperand(&type4); 6950 auto param24 = model->addOperand(&type4); 6951 auto layout = model->addOperand(&type0); 6952 auto op43 = model->addOperand(&type83); 6953 // Phase 2, operations 6954 static int32_t param18_init[] = {0}; 6955 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 6956 static int32_t param19_init[] = {0}; 6957 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 6958 static int32_t param20_init[] = {0}; 6959 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 6960 static int32_t param21_init[] = {0}; 6961 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 6962 static int32_t param22_init[] = {1}; 6963 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 6964 static int32_t param23_init[] = {1}; 6965 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 6966 static int32_t param24_init[] = {0}; 6967 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 6968 static bool8 layout_init[] = {true}; 6969 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6970 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 6971 // Phase 3, inputs and outputs 6972 model->identifyInputsAndOutputs( 6973 {op13, op23, op33}, 6974 {op43}); 6975 assert(model->isValid()); 6976 } 6977 6978 inline bool is_ignored_large_nchw_weight_as_input_quant8(int i) { 6979 static std::set<int> ignore = {}; 6980 return ignore.find(i) != ignore.end(); 6981 } 6982 6983 void CreateModel_large_nchw_weight_as_input_channelQuant8(Model *model) { 6984 OperandType type0(Type::BOOL, {}); 6985 OperandType type4(Type::INT32, {}); 6986 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 6987 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 6988 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 6989 OperandType type83(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 2.0f, 0); 6990 // Phase 1, operands 6991 auto op13 = model->addOperand(&type82); 6992 auto op23 = model->addOperand(&type76); 6993 auto op33 = model->addOperand(&type77); 6994 auto param18 = model->addOperand(&type4); 6995 auto param19 = model->addOperand(&type4); 6996 auto param20 = model->addOperand(&type4); 6997 auto param21 = model->addOperand(&type4); 6998 auto param22 = model->addOperand(&type4); 6999 auto param23 = model->addOperand(&type4); 7000 auto param24 = model->addOperand(&type4); 7001 auto layout = model->addOperand(&type0); 7002 auto op43 = model->addOperand(&type83); 7003 // Phase 2, operations 7004 static int32_t param18_init[] = {0}; 7005 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7006 static int32_t param19_init[] = {0}; 7007 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7008 static int32_t param20_init[] = {0}; 7009 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7010 static int32_t param21_init[] = {0}; 7011 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7012 static int32_t param22_init[] = {1}; 7013 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7014 static int32_t param23_init[] = {1}; 7015 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7016 static int32_t param24_init[] = {0}; 7017 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7018 static bool8 layout_init[] = {true}; 7019 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7020 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7021 // Phase 3, inputs and outputs 7022 model->identifyInputsAndOutputs( 7023 {op13, op23, op33}, 7024 {op43}); 7025 assert(model->isValid()); 7026 } 7027 7028 inline bool is_ignored_large_nchw_weight_as_input_channelQuant8(int i) { 7029 static std::set<int> ignore = {}; 7030 return ignore.find(i) != ignore.end(); 7031 } 7032 7033 void CreateModel_large_nchw_weight_as_input_channelQuant8_2(Model *model) { 7034 OperandType type0(Type::BOOL, {}); 7035 OperandType type4(Type::INT32, {}); 7036 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 7037 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 7038 OperandType type84(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 1.0f, 127); 7039 // Phase 1, operands 7040 auto op13 = model->addOperand(&type84); 7041 auto op23 = model->addOperand(&type79); 7042 auto op33 = model->addOperand(&type80); 7043 auto param18 = model->addOperand(&type4); 7044 auto param19 = model->addOperand(&type4); 7045 auto param20 = model->addOperand(&type4); 7046 auto param21 = model->addOperand(&type4); 7047 auto param22 = model->addOperand(&type4); 7048 auto param23 = model->addOperand(&type4); 7049 auto param24 = model->addOperand(&type4); 7050 auto layout = model->addOperand(&type0); 7051 auto op43 = model->addOperand(&type84); 7052 // Phase 2, operations 7053 static int32_t param18_init[] = {0}; 7054 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7055 static int32_t param19_init[] = {0}; 7056 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7057 static int32_t param20_init[] = {0}; 7058 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7059 static int32_t param21_init[] = {0}; 7060 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7061 static int32_t param22_init[] = {1}; 7062 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7063 static int32_t param23_init[] = {1}; 7064 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7065 static int32_t param24_init[] = {0}; 7066 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7067 static bool8 layout_init[] = {true}; 7068 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7069 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7070 // Phase 3, inputs and outputs 7071 model->identifyInputsAndOutputs( 7072 {op13, op23, op33}, 7073 {op43}); 7074 assert(model->isValid()); 7075 } 7076 7077 inline bool is_ignored_large_nchw_weight_as_input_channelQuant8_2(int i) { 7078 static std::set<int> ignore = {}; 7079 return ignore.find(i) != ignore.end(); 7080 } 7081 7082 void CreateModel_large_nchw_weight_as_input_float16(Model *model) { 7083 OperandType type0(Type::BOOL, {}); 7084 OperandType type4(Type::INT32, {}); 7085 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 7086 OperandType type68(Type::TENSOR_FLOAT16, {3}); 7087 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 7088 // Phase 1, operands 7089 auto op13 = model->addOperand(&type85); 7090 auto op23 = model->addOperand(&type67); 7091 auto op33 = model->addOperand(&type68); 7092 auto param18 = model->addOperand(&type4); 7093 auto param19 = model->addOperand(&type4); 7094 auto param20 = model->addOperand(&type4); 7095 auto param21 = model->addOperand(&type4); 7096 auto param22 = model->addOperand(&type4); 7097 auto param23 = model->addOperand(&type4); 7098 auto param24 = model->addOperand(&type4); 7099 auto layout = model->addOperand(&type0); 7100 auto op43 = model->addOperand(&type85); 7101 // Phase 2, operations 7102 static int32_t param18_init[] = {0}; 7103 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7104 static int32_t param19_init[] = {0}; 7105 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7106 static int32_t param20_init[] = {0}; 7107 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7108 static int32_t param21_init[] = {0}; 7109 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7110 static int32_t param22_init[] = {1}; 7111 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7112 static int32_t param23_init[] = {1}; 7113 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7114 static int32_t param24_init[] = {0}; 7115 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7116 static bool8 layout_init[] = {true}; 7117 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7118 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7119 // Phase 3, inputs and outputs 7120 model->identifyInputsAndOutputs( 7121 {op13, op23, op33}, 7122 {op43}); 7123 assert(model->isValid()); 7124 } 7125 7126 inline bool is_ignored_large_nchw_weight_as_input_float16(int i) { 7127 static std::set<int> ignore = {}; 7128 return ignore.find(i) != ignore.end(); 7129 } 7130 7131 void CreateModel_large_dynamic_output_shape_nhwc(Model *model) { 7132 OperandType type0(Type::BOOL, {}); 7133 OperandType type4(Type::INT32, {}); 7134 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7135 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 7136 OperandType type8(Type::TENSOR_FLOAT32, {3}); 7137 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 7138 // Phase 1, operands 7139 auto op13 = model->addOperand(&type9); 7140 auto op23 = model->addOperand(&type7); 7141 auto op33 = model->addOperand(&type8); 7142 auto param18 = model->addOperand(&type4); 7143 auto param19 = model->addOperand(&type4); 7144 auto param20 = model->addOperand(&type4); 7145 auto param21 = model->addOperand(&type4); 7146 auto param22 = model->addOperand(&type4); 7147 auto param23 = model->addOperand(&type4); 7148 auto param24 = model->addOperand(&type4); 7149 auto layout = model->addOperand(&type0); 7150 auto op43 = model->addOperand(&type46); 7151 // Phase 2, operations 7152 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 7153 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 7154 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 7155 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 7156 static int32_t param18_init[] = {0}; 7157 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7158 static int32_t param19_init[] = {0}; 7159 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7160 static int32_t param20_init[] = {0}; 7161 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7162 static int32_t param21_init[] = {0}; 7163 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7164 static int32_t param22_init[] = {1}; 7165 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7166 static int32_t param23_init[] = {1}; 7167 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7168 static int32_t param24_init[] = {0}; 7169 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7170 static bool8 layout_init[] = {false}; 7171 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7172 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7173 // Phase 3, inputs and outputs 7174 model->identifyInputsAndOutputs( 7175 {op13}, 7176 {op43}); 7177 assert(model->isValid()); 7178 } 7179 7180 inline bool is_ignored_large_dynamic_output_shape_nhwc(int i) { 7181 static std::set<int> ignore = {}; 7182 return ignore.find(i) != ignore.end(); 7183 } 7184 7185 void CreateModel_large_dynamic_output_shape_nhwc_relaxed(Model *model) { 7186 OperandType type0(Type::BOOL, {}); 7187 OperandType type4(Type::INT32, {}); 7188 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7189 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 7190 OperandType type8(Type::TENSOR_FLOAT32, {3}); 7191 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 7192 // Phase 1, operands 7193 auto op13 = model->addOperand(&type9); 7194 auto op23 = model->addOperand(&type7); 7195 auto op33 = model->addOperand(&type8); 7196 auto param18 = model->addOperand(&type4); 7197 auto param19 = model->addOperand(&type4); 7198 auto param20 = model->addOperand(&type4); 7199 auto param21 = model->addOperand(&type4); 7200 auto param22 = model->addOperand(&type4); 7201 auto param23 = model->addOperand(&type4); 7202 auto param24 = model->addOperand(&type4); 7203 auto layout = model->addOperand(&type0); 7204 auto op43 = model->addOperand(&type46); 7205 // Phase 2, operations 7206 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 7207 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 7208 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 7209 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 7210 static int32_t param18_init[] = {0}; 7211 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7212 static int32_t param19_init[] = {0}; 7213 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7214 static int32_t param20_init[] = {0}; 7215 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7216 static int32_t param21_init[] = {0}; 7217 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7218 static int32_t param22_init[] = {1}; 7219 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7220 static int32_t param23_init[] = {1}; 7221 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7222 static int32_t param24_init[] = {0}; 7223 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7224 static bool8 layout_init[] = {false}; 7225 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7226 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7227 // Phase 3, inputs and outputs 7228 model->identifyInputsAndOutputs( 7229 {op13}, 7230 {op43}); 7231 // Phase 4: set relaxed execution 7232 model->relaxComputationFloat32toFloat16(true); 7233 assert(model->isValid()); 7234 } 7235 7236 inline bool is_ignored_large_dynamic_output_shape_nhwc_relaxed(int i) { 7237 static std::set<int> ignore = {}; 7238 return ignore.find(i) != ignore.end(); 7239 } 7240 7241 void CreateModel_large_dynamic_output_shape_nhwc_quant8(Model *model) { 7242 OperandType type0(Type::BOOL, {}); 7243 OperandType type4(Type::INT32, {}); 7244 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 7245 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 7246 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 7247 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 7248 // Phase 1, operands 7249 auto op13 = model->addOperand(&type73); 7250 auto op23 = model->addOperand(&type74); 7251 auto op33 = model->addOperand(&type63); 7252 auto param18 = model->addOperand(&type4); 7253 auto param19 = model->addOperand(&type4); 7254 auto param20 = model->addOperand(&type4); 7255 auto param21 = model->addOperand(&type4); 7256 auto param22 = model->addOperand(&type4); 7257 auto param23 = model->addOperand(&type4); 7258 auto param24 = model->addOperand(&type4); 7259 auto layout = model->addOperand(&type0); 7260 auto op43 = model->addOperand(&type86); 7261 // Phase 2, operations 7262 static uint8_t op23_init[] = {130, 136, 142, 132, 138, 144, 134, 140, 146}; 7263 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9); 7264 static int32_t op33_init[] = {0, 0, 0}; 7265 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 7266 static int32_t param18_init[] = {0}; 7267 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7268 static int32_t param19_init[] = {0}; 7269 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7270 static int32_t param20_init[] = {0}; 7271 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7272 static int32_t param21_init[] = {0}; 7273 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7274 static int32_t param22_init[] = {1}; 7275 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7276 static int32_t param23_init[] = {1}; 7277 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7278 static int32_t param24_init[] = {0}; 7279 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7280 static bool8 layout_init[] = {false}; 7281 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7282 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7283 // Phase 3, inputs and outputs 7284 model->identifyInputsAndOutputs( 7285 {op13}, 7286 {op43}); 7287 assert(model->isValid()); 7288 } 7289 7290 inline bool is_ignored_large_dynamic_output_shape_nhwc_quant8(int i) { 7291 static std::set<int> ignore = {}; 7292 return ignore.find(i) != ignore.end(); 7293 } 7294 7295 void CreateModel_large_dynamic_output_shape_nhwc_channelQuant8(Model *model) { 7296 OperandType type0(Type::BOOL, {}); 7297 OperandType type4(Type::INT32, {}); 7298 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 7299 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 7300 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 7301 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 7302 // Phase 1, operands 7303 auto op13 = model->addOperand(&type73); 7304 auto op23 = model->addOperand(&type76); 7305 auto op33 = model->addOperand(&type77); 7306 auto param18 = model->addOperand(&type4); 7307 auto param19 = model->addOperand(&type4); 7308 auto param20 = model->addOperand(&type4); 7309 auto param21 = model->addOperand(&type4); 7310 auto param22 = model->addOperand(&type4); 7311 auto param23 = model->addOperand(&type4); 7312 auto param24 = model->addOperand(&type4); 7313 auto layout = model->addOperand(&type0); 7314 auto op43 = model->addOperand(&type86); 7315 // Phase 2, operations 7316 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 6, 12, 18}; 7317 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 7318 static int32_t op33_init[] = {0, 0, 0}; 7319 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 7320 static int32_t param18_init[] = {0}; 7321 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7322 static int32_t param19_init[] = {0}; 7323 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7324 static int32_t param20_init[] = {0}; 7325 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7326 static int32_t param21_init[] = {0}; 7327 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7328 static int32_t param22_init[] = {1}; 7329 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7330 static int32_t param23_init[] = {1}; 7331 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7332 static int32_t param24_init[] = {0}; 7333 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7334 static bool8 layout_init[] = {false}; 7335 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7336 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7337 // Phase 3, inputs and outputs 7338 model->identifyInputsAndOutputs( 7339 {op13}, 7340 {op43}); 7341 assert(model->isValid()); 7342 } 7343 7344 inline bool is_ignored_large_dynamic_output_shape_nhwc_channelQuant8(int i) { 7345 static std::set<int> ignore = {}; 7346 return ignore.find(i) != ignore.end(); 7347 } 7348 7349 void CreateModel_large_dynamic_output_shape_nhwc_channelQuant8_2(Model *model) { 7350 OperandType type0(Type::BOOL, {}); 7351 OperandType type4(Type::INT32, {}); 7352 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 1.0f, 127); 7353 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 7354 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 7355 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 7356 // Phase 1, operands 7357 auto op13 = model->addOperand(&type78); 7358 auto op23 = model->addOperand(&type79); 7359 auto op33 = model->addOperand(&type80); 7360 auto param18 = model->addOperand(&type4); 7361 auto param19 = model->addOperand(&type4); 7362 auto param20 = model->addOperand(&type4); 7363 auto param21 = model->addOperand(&type4); 7364 auto param22 = model->addOperand(&type4); 7365 auto param23 = model->addOperand(&type4); 7366 auto param24 = model->addOperand(&type4); 7367 auto layout = model->addOperand(&type0); 7368 auto op43 = model->addOperand(&type87); 7369 // Phase 2, operations 7370 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 3, 6, 9}; 7371 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 7372 static int32_t op33_init[] = {0, 0, 0}; 7373 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 7374 static int32_t param18_init[] = {0}; 7375 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7376 static int32_t param19_init[] = {0}; 7377 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7378 static int32_t param20_init[] = {0}; 7379 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7380 static int32_t param21_init[] = {0}; 7381 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7382 static int32_t param22_init[] = {1}; 7383 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7384 static int32_t param23_init[] = {1}; 7385 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7386 static int32_t param24_init[] = {0}; 7387 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7388 static bool8 layout_init[] = {false}; 7389 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7390 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7391 // Phase 3, inputs and outputs 7392 model->identifyInputsAndOutputs( 7393 {op13}, 7394 {op43}); 7395 assert(model->isValid()); 7396 } 7397 7398 inline bool is_ignored_large_dynamic_output_shape_nhwc_channelQuant8_2(int i) { 7399 static std::set<int> ignore = {}; 7400 return ignore.find(i) != ignore.end(); 7401 } 7402 7403 void CreateModel_large_dynamic_output_shape_nhwc_float16(Model *model) { 7404 OperandType type0(Type::BOOL, {}); 7405 OperandType type4(Type::INT32, {}); 7406 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 7407 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 7408 OperandType type68(Type::TENSOR_FLOAT16, {3}); 7409 OperandType type81(Type::TENSOR_FLOAT16, {1, 2, 3, 3}); 7410 // Phase 1, operands 7411 auto op13 = model->addOperand(&type81); 7412 auto op23 = model->addOperand(&type67); 7413 auto op33 = model->addOperand(&type68); 7414 auto param18 = model->addOperand(&type4); 7415 auto param19 = model->addOperand(&type4); 7416 auto param20 = model->addOperand(&type4); 7417 auto param21 = model->addOperand(&type4); 7418 auto param22 = model->addOperand(&type4); 7419 auto param23 = model->addOperand(&type4); 7420 auto param24 = model->addOperand(&type4); 7421 auto layout = model->addOperand(&type0); 7422 auto op43 = model->addOperand(&type48); 7423 // Phase 2, operations 7424 static _Float16 op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 7425 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9); 7426 static _Float16 op33_init[] = {0.0f, 0.0f, 0.0f}; 7427 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 3); 7428 static int32_t param18_init[] = {0}; 7429 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7430 static int32_t param19_init[] = {0}; 7431 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7432 static int32_t param20_init[] = {0}; 7433 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7434 static int32_t param21_init[] = {0}; 7435 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7436 static int32_t param22_init[] = {1}; 7437 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7438 static int32_t param23_init[] = {1}; 7439 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7440 static int32_t param24_init[] = {0}; 7441 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7442 static bool8 layout_init[] = {false}; 7443 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7444 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7445 // Phase 3, inputs and outputs 7446 model->identifyInputsAndOutputs( 7447 {op13}, 7448 {op43}); 7449 assert(model->isValid()); 7450 } 7451 7452 inline bool is_ignored_large_dynamic_output_shape_nhwc_float16(int i) { 7453 static std::set<int> ignore = {}; 7454 return ignore.find(i) != ignore.end(); 7455 } 7456 7457 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input(Model *model) { 7458 OperandType type0(Type::BOOL, {}); 7459 OperandType type4(Type::INT32, {}); 7460 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7461 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 7462 OperandType type8(Type::TENSOR_FLOAT32, {3}); 7463 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 7464 // Phase 1, operands 7465 auto op13 = model->addOperand(&type9); 7466 auto op23 = model->addOperand(&type7); 7467 auto op33 = model->addOperand(&type8); 7468 auto param18 = model->addOperand(&type4); 7469 auto param19 = model->addOperand(&type4); 7470 auto param20 = model->addOperand(&type4); 7471 auto param21 = model->addOperand(&type4); 7472 auto param22 = model->addOperand(&type4); 7473 auto param23 = model->addOperand(&type4); 7474 auto param24 = model->addOperand(&type4); 7475 auto layout = model->addOperand(&type0); 7476 auto op43 = model->addOperand(&type46); 7477 // Phase 2, operations 7478 static int32_t param18_init[] = {0}; 7479 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7480 static int32_t param19_init[] = {0}; 7481 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7482 static int32_t param20_init[] = {0}; 7483 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7484 static int32_t param21_init[] = {0}; 7485 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7486 static int32_t param22_init[] = {1}; 7487 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7488 static int32_t param23_init[] = {1}; 7489 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7490 static int32_t param24_init[] = {0}; 7491 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7492 static bool8 layout_init[] = {false}; 7493 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7494 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7495 // Phase 3, inputs and outputs 7496 model->identifyInputsAndOutputs( 7497 {op13, op23, op33}, 7498 {op43}); 7499 assert(model->isValid()); 7500 } 7501 7502 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input(int i) { 7503 static std::set<int> ignore = {}; 7504 return ignore.find(i) != ignore.end(); 7505 } 7506 7507 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_relaxed(Model *model) { 7508 OperandType type0(Type::BOOL, {}); 7509 OperandType type4(Type::INT32, {}); 7510 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7511 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 7512 OperandType type8(Type::TENSOR_FLOAT32, {3}); 7513 OperandType type9(Type::TENSOR_FLOAT32, {1, 2, 3, 3}); 7514 // Phase 1, operands 7515 auto op13 = model->addOperand(&type9); 7516 auto op23 = model->addOperand(&type7); 7517 auto op33 = model->addOperand(&type8); 7518 auto param18 = model->addOperand(&type4); 7519 auto param19 = model->addOperand(&type4); 7520 auto param20 = model->addOperand(&type4); 7521 auto param21 = model->addOperand(&type4); 7522 auto param22 = model->addOperand(&type4); 7523 auto param23 = model->addOperand(&type4); 7524 auto param24 = model->addOperand(&type4); 7525 auto layout = model->addOperand(&type0); 7526 auto op43 = model->addOperand(&type46); 7527 // Phase 2, operations 7528 static int32_t param18_init[] = {0}; 7529 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7530 static int32_t param19_init[] = {0}; 7531 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7532 static int32_t param20_init[] = {0}; 7533 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7534 static int32_t param21_init[] = {0}; 7535 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7536 static int32_t param22_init[] = {1}; 7537 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7538 static int32_t param23_init[] = {1}; 7539 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7540 static int32_t param24_init[] = {0}; 7541 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7542 static bool8 layout_init[] = {false}; 7543 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7544 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7545 // Phase 3, inputs and outputs 7546 model->identifyInputsAndOutputs( 7547 {op13, op23, op33}, 7548 {op43}); 7549 // Phase 4: set relaxed execution 7550 model->relaxComputationFloat32toFloat16(true); 7551 assert(model->isValid()); 7552 } 7553 7554 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_relaxed(int i) { 7555 static std::set<int> ignore = {}; 7556 return ignore.find(i) != ignore.end(); 7557 } 7558 7559 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_quant8(Model *model) { 7560 OperandType type0(Type::BOOL, {}); 7561 OperandType type4(Type::INT32, {}); 7562 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 7563 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 7564 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 7565 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 7566 // Phase 1, operands 7567 auto op13 = model->addOperand(&type73); 7568 auto op23 = model->addOperand(&type74); 7569 auto op33 = model->addOperand(&type63); 7570 auto param18 = model->addOperand(&type4); 7571 auto param19 = model->addOperand(&type4); 7572 auto param20 = model->addOperand(&type4); 7573 auto param21 = model->addOperand(&type4); 7574 auto param22 = model->addOperand(&type4); 7575 auto param23 = model->addOperand(&type4); 7576 auto param24 = model->addOperand(&type4); 7577 auto layout = model->addOperand(&type0); 7578 auto op43 = model->addOperand(&type86); 7579 // Phase 2, operations 7580 static int32_t param18_init[] = {0}; 7581 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7582 static int32_t param19_init[] = {0}; 7583 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7584 static int32_t param20_init[] = {0}; 7585 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7586 static int32_t param21_init[] = {0}; 7587 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7588 static int32_t param22_init[] = {1}; 7589 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7590 static int32_t param23_init[] = {1}; 7591 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7592 static int32_t param24_init[] = {0}; 7593 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7594 static bool8 layout_init[] = {false}; 7595 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7596 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7597 // Phase 3, inputs and outputs 7598 model->identifyInputsAndOutputs( 7599 {op13, op23, op33}, 7600 {op43}); 7601 assert(model->isValid()); 7602 } 7603 7604 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_quant8(int i) { 7605 static std::set<int> ignore = {}; 7606 return ignore.find(i) != ignore.end(); 7607 } 7608 7609 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(Model *model) { 7610 OperandType type0(Type::BOOL, {}); 7611 OperandType type4(Type::INT32, {}); 7612 OperandType type73(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 0.5f, 128); 7613 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 7614 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 7615 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 7616 // Phase 1, operands 7617 auto op13 = model->addOperand(&type73); 7618 auto op23 = model->addOperand(&type76); 7619 auto op33 = model->addOperand(&type77); 7620 auto param18 = model->addOperand(&type4); 7621 auto param19 = model->addOperand(&type4); 7622 auto param20 = model->addOperand(&type4); 7623 auto param21 = model->addOperand(&type4); 7624 auto param22 = model->addOperand(&type4); 7625 auto param23 = model->addOperand(&type4); 7626 auto param24 = model->addOperand(&type4); 7627 auto layout = model->addOperand(&type0); 7628 auto op43 = model->addOperand(&type86); 7629 // Phase 2, operations 7630 static int32_t param18_init[] = {0}; 7631 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7632 static int32_t param19_init[] = {0}; 7633 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7634 static int32_t param20_init[] = {0}; 7635 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7636 static int32_t param21_init[] = {0}; 7637 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7638 static int32_t param22_init[] = {1}; 7639 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7640 static int32_t param23_init[] = {1}; 7641 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7642 static int32_t param24_init[] = {0}; 7643 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7644 static bool8 layout_init[] = {false}; 7645 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7646 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7647 // Phase 3, inputs and outputs 7648 model->identifyInputsAndOutputs( 7649 {op13, op23, op33}, 7650 {op43}); 7651 assert(model->isValid()); 7652 } 7653 7654 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8(int i) { 7655 static std::set<int> ignore = {}; 7656 return ignore.find(i) != ignore.end(); 7657 } 7658 7659 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(Model *model) { 7660 OperandType type0(Type::BOOL, {}); 7661 OperandType type4(Type::INT32, {}); 7662 OperandType type78(Type::TENSOR_QUANT8_ASYMM, {1, 2, 3, 3}, 1.0f, 127); 7663 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 7664 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 7665 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 7666 // Phase 1, operands 7667 auto op13 = model->addOperand(&type78); 7668 auto op23 = model->addOperand(&type79); 7669 auto op33 = model->addOperand(&type80); 7670 auto param18 = model->addOperand(&type4); 7671 auto param19 = model->addOperand(&type4); 7672 auto param20 = model->addOperand(&type4); 7673 auto param21 = model->addOperand(&type4); 7674 auto param22 = model->addOperand(&type4); 7675 auto param23 = model->addOperand(&type4); 7676 auto param24 = model->addOperand(&type4); 7677 auto layout = model->addOperand(&type0); 7678 auto op43 = model->addOperand(&type87); 7679 // Phase 2, operations 7680 static int32_t param18_init[] = {0}; 7681 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7682 static int32_t param19_init[] = {0}; 7683 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7684 static int32_t param20_init[] = {0}; 7685 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7686 static int32_t param21_init[] = {0}; 7687 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7688 static int32_t param22_init[] = {1}; 7689 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7690 static int32_t param23_init[] = {1}; 7691 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7692 static int32_t param24_init[] = {0}; 7693 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7694 static bool8 layout_init[] = {false}; 7695 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7696 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7697 // Phase 3, inputs and outputs 7698 model->identifyInputsAndOutputs( 7699 {op13, op23, op33}, 7700 {op43}); 7701 assert(model->isValid()); 7702 } 7703 7704 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_channelQuant8_2(int i) { 7705 static std::set<int> ignore = {}; 7706 return ignore.find(i) != ignore.end(); 7707 } 7708 7709 void CreateModel_large_dynamic_output_shape_nhwc_weight_as_input_float16(Model *model) { 7710 OperandType type0(Type::BOOL, {}); 7711 OperandType type4(Type::INT32, {}); 7712 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 7713 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 7714 OperandType type68(Type::TENSOR_FLOAT16, {3}); 7715 OperandType type81(Type::TENSOR_FLOAT16, {1, 2, 3, 3}); 7716 // Phase 1, operands 7717 auto op13 = model->addOperand(&type81); 7718 auto op23 = model->addOperand(&type67); 7719 auto op33 = model->addOperand(&type68); 7720 auto param18 = model->addOperand(&type4); 7721 auto param19 = model->addOperand(&type4); 7722 auto param20 = model->addOperand(&type4); 7723 auto param21 = model->addOperand(&type4); 7724 auto param22 = model->addOperand(&type4); 7725 auto param23 = model->addOperand(&type4); 7726 auto param24 = model->addOperand(&type4); 7727 auto layout = model->addOperand(&type0); 7728 auto op43 = model->addOperand(&type48); 7729 // Phase 2, operations 7730 static int32_t param18_init[] = {0}; 7731 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7732 static int32_t param19_init[] = {0}; 7733 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7734 static int32_t param20_init[] = {0}; 7735 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7736 static int32_t param21_init[] = {0}; 7737 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7738 static int32_t param22_init[] = {1}; 7739 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7740 static int32_t param23_init[] = {1}; 7741 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7742 static int32_t param24_init[] = {0}; 7743 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7744 static bool8 layout_init[] = {false}; 7745 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7746 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7747 // Phase 3, inputs and outputs 7748 model->identifyInputsAndOutputs( 7749 {op13, op23, op33}, 7750 {op43}); 7751 assert(model->isValid()); 7752 } 7753 7754 inline bool is_ignored_large_dynamic_output_shape_nhwc_weight_as_input_float16(int i) { 7755 static std::set<int> ignore = {}; 7756 return ignore.find(i) != ignore.end(); 7757 } 7758 7759 void CreateModel_large_dynamic_output_shape_nchw(Model *model) { 7760 OperandType type0(Type::BOOL, {}); 7761 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 7762 OperandType type4(Type::INT32, {}); 7763 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7764 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 7765 OperandType type8(Type::TENSOR_FLOAT32, {3}); 7766 // Phase 1, operands 7767 auto op13 = model->addOperand(&type11); 7768 auto op23 = model->addOperand(&type7); 7769 auto op33 = model->addOperand(&type8); 7770 auto param18 = model->addOperand(&type4); 7771 auto param19 = model->addOperand(&type4); 7772 auto param20 = model->addOperand(&type4); 7773 auto param21 = model->addOperand(&type4); 7774 auto param22 = model->addOperand(&type4); 7775 auto param23 = model->addOperand(&type4); 7776 auto param24 = model->addOperand(&type4); 7777 auto layout = model->addOperand(&type0); 7778 auto op43 = model->addOperand(&type46); 7779 // Phase 2, operations 7780 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 7781 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 7782 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 7783 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 7784 static int32_t param18_init[] = {0}; 7785 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7786 static int32_t param19_init[] = {0}; 7787 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7788 static int32_t param20_init[] = {0}; 7789 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7790 static int32_t param21_init[] = {0}; 7791 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7792 static int32_t param22_init[] = {1}; 7793 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7794 static int32_t param23_init[] = {1}; 7795 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7796 static int32_t param24_init[] = {0}; 7797 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7798 static bool8 layout_init[] = {true}; 7799 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7800 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7801 // Phase 3, inputs and outputs 7802 model->identifyInputsAndOutputs( 7803 {op13}, 7804 {op43}); 7805 assert(model->isValid()); 7806 } 7807 7808 inline bool is_ignored_large_dynamic_output_shape_nchw(int i) { 7809 static std::set<int> ignore = {}; 7810 return ignore.find(i) != ignore.end(); 7811 } 7812 7813 void CreateModel_large_dynamic_output_shape_nchw_relaxed(Model *model) { 7814 OperandType type0(Type::BOOL, {}); 7815 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 7816 OperandType type4(Type::INT32, {}); 7817 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7818 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 7819 OperandType type8(Type::TENSOR_FLOAT32, {3}); 7820 // Phase 1, operands 7821 auto op13 = model->addOperand(&type11); 7822 auto op23 = model->addOperand(&type7); 7823 auto op33 = model->addOperand(&type8); 7824 auto param18 = model->addOperand(&type4); 7825 auto param19 = model->addOperand(&type4); 7826 auto param20 = model->addOperand(&type4); 7827 auto param21 = model->addOperand(&type4); 7828 auto param22 = model->addOperand(&type4); 7829 auto param23 = model->addOperand(&type4); 7830 auto param24 = model->addOperand(&type4); 7831 auto layout = model->addOperand(&type0); 7832 auto op43 = model->addOperand(&type46); 7833 // Phase 2, operations 7834 static float op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 7835 model->setOperandValue(op23, op23_init, sizeof(float) * 9); 7836 static float op33_init[] = {0.0f, 0.0f, 0.0f}; 7837 model->setOperandValue(op33, op33_init, sizeof(float) * 3); 7838 static int32_t param18_init[] = {0}; 7839 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7840 static int32_t param19_init[] = {0}; 7841 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7842 static int32_t param20_init[] = {0}; 7843 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7844 static int32_t param21_init[] = {0}; 7845 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7846 static int32_t param22_init[] = {1}; 7847 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7848 static int32_t param23_init[] = {1}; 7849 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7850 static int32_t param24_init[] = {0}; 7851 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7852 static bool8 layout_init[] = {true}; 7853 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7854 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7855 // Phase 3, inputs and outputs 7856 model->identifyInputsAndOutputs( 7857 {op13}, 7858 {op43}); 7859 // Phase 4: set relaxed execution 7860 model->relaxComputationFloat32toFloat16(true); 7861 assert(model->isValid()); 7862 } 7863 7864 inline bool is_ignored_large_dynamic_output_shape_nchw_relaxed(int i) { 7865 static std::set<int> ignore = {}; 7866 return ignore.find(i) != ignore.end(); 7867 } 7868 7869 void CreateModel_large_dynamic_output_shape_nchw_quant8(Model *model) { 7870 OperandType type0(Type::BOOL, {}); 7871 OperandType type4(Type::INT32, {}); 7872 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 7873 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 7874 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 7875 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 7876 // Phase 1, operands 7877 auto op13 = model->addOperand(&type82); 7878 auto op23 = model->addOperand(&type74); 7879 auto op33 = model->addOperand(&type63); 7880 auto param18 = model->addOperand(&type4); 7881 auto param19 = model->addOperand(&type4); 7882 auto param20 = model->addOperand(&type4); 7883 auto param21 = model->addOperand(&type4); 7884 auto param22 = model->addOperand(&type4); 7885 auto param23 = model->addOperand(&type4); 7886 auto param24 = model->addOperand(&type4); 7887 auto layout = model->addOperand(&type0); 7888 auto op43 = model->addOperand(&type86); 7889 // Phase 2, operations 7890 static uint8_t op23_init[] = {130, 136, 142, 132, 138, 144, 134, 140, 146}; 7891 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 9); 7892 static int32_t op33_init[] = {0, 0, 0}; 7893 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 7894 static int32_t param18_init[] = {0}; 7895 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7896 static int32_t param19_init[] = {0}; 7897 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7898 static int32_t param20_init[] = {0}; 7899 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7900 static int32_t param21_init[] = {0}; 7901 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7902 static int32_t param22_init[] = {1}; 7903 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7904 static int32_t param23_init[] = {1}; 7905 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7906 static int32_t param24_init[] = {0}; 7907 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7908 static bool8 layout_init[] = {true}; 7909 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7910 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7911 // Phase 3, inputs and outputs 7912 model->identifyInputsAndOutputs( 7913 {op13}, 7914 {op43}); 7915 assert(model->isValid()); 7916 } 7917 7918 inline bool is_ignored_large_dynamic_output_shape_nchw_quant8(int i) { 7919 static std::set<int> ignore = {}; 7920 return ignore.find(i) != ignore.end(); 7921 } 7922 7923 void CreateModel_large_dynamic_output_shape_nchw_channelQuant8(Model *model) { 7924 OperandType type0(Type::BOOL, {}); 7925 OperandType type4(Type::INT32, {}); 7926 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 7927 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 7928 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 7929 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 7930 // Phase 1, operands 7931 auto op13 = model->addOperand(&type82); 7932 auto op23 = model->addOperand(&type76); 7933 auto op33 = model->addOperand(&type77); 7934 auto param18 = model->addOperand(&type4); 7935 auto param19 = model->addOperand(&type4); 7936 auto param20 = model->addOperand(&type4); 7937 auto param21 = model->addOperand(&type4); 7938 auto param22 = model->addOperand(&type4); 7939 auto param23 = model->addOperand(&type4); 7940 auto param24 = model->addOperand(&type4); 7941 auto layout = model->addOperand(&type0); 7942 auto op43 = model->addOperand(&type86); 7943 // Phase 2, operations 7944 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 6, 12, 18}; 7945 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 7946 static int32_t op33_init[] = {0, 0, 0}; 7947 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 7948 static int32_t param18_init[] = {0}; 7949 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 7950 static int32_t param19_init[] = {0}; 7951 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 7952 static int32_t param20_init[] = {0}; 7953 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 7954 static int32_t param21_init[] = {0}; 7955 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 7956 static int32_t param22_init[] = {1}; 7957 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 7958 static int32_t param23_init[] = {1}; 7959 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 7960 static int32_t param24_init[] = {0}; 7961 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 7962 static bool8 layout_init[] = {true}; 7963 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7964 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 7965 // Phase 3, inputs and outputs 7966 model->identifyInputsAndOutputs( 7967 {op13}, 7968 {op43}); 7969 assert(model->isValid()); 7970 } 7971 7972 inline bool is_ignored_large_dynamic_output_shape_nchw_channelQuant8(int i) { 7973 static std::set<int> ignore = {}; 7974 return ignore.find(i) != ignore.end(); 7975 } 7976 7977 void CreateModel_large_dynamic_output_shape_nchw_channelQuant8_2(Model *model) { 7978 OperandType type0(Type::BOOL, {}); 7979 OperandType type4(Type::INT32, {}); 7980 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 7981 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 7982 OperandType type84(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 1.0f, 127); 7983 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 7984 // Phase 1, operands 7985 auto op13 = model->addOperand(&type84); 7986 auto op23 = model->addOperand(&type79); 7987 auto op33 = model->addOperand(&type80); 7988 auto param18 = model->addOperand(&type4); 7989 auto param19 = model->addOperand(&type4); 7990 auto param20 = model->addOperand(&type4); 7991 auto param21 = model->addOperand(&type4); 7992 auto param22 = model->addOperand(&type4); 7993 auto param23 = model->addOperand(&type4); 7994 auto param24 = model->addOperand(&type4); 7995 auto layout = model->addOperand(&type0); 7996 auto op43 = model->addOperand(&type87); 7997 // Phase 2, operations 7998 static int8_t op23_init[] = {2, 8, 14, 2, 5, 8, 3, 6, 9}; 7999 model->setOperandValue(op23, op23_init, sizeof(int8_t) * 9); 8000 static int32_t op33_init[] = {0, 0, 0}; 8001 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 3); 8002 static int32_t param18_init[] = {0}; 8003 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8004 static int32_t param19_init[] = {0}; 8005 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8006 static int32_t param20_init[] = {0}; 8007 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8008 static int32_t param21_init[] = {0}; 8009 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8010 static int32_t param22_init[] = {1}; 8011 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8012 static int32_t param23_init[] = {1}; 8013 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8014 static int32_t param24_init[] = {0}; 8015 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8016 static bool8 layout_init[] = {true}; 8017 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8018 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8019 // Phase 3, inputs and outputs 8020 model->identifyInputsAndOutputs( 8021 {op13}, 8022 {op43}); 8023 assert(model->isValid()); 8024 } 8025 8026 inline bool is_ignored_large_dynamic_output_shape_nchw_channelQuant8_2(int i) { 8027 static std::set<int> ignore = {}; 8028 return ignore.find(i) != ignore.end(); 8029 } 8030 8031 void CreateModel_large_dynamic_output_shape_nchw_float16(Model *model) { 8032 OperandType type0(Type::BOOL, {}); 8033 OperandType type4(Type::INT32, {}); 8034 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 8035 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 8036 OperandType type68(Type::TENSOR_FLOAT16, {3}); 8037 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 8038 // Phase 1, operands 8039 auto op13 = model->addOperand(&type85); 8040 auto op23 = model->addOperand(&type67); 8041 auto op33 = model->addOperand(&type68); 8042 auto param18 = model->addOperand(&type4); 8043 auto param19 = model->addOperand(&type4); 8044 auto param20 = model->addOperand(&type4); 8045 auto param21 = model->addOperand(&type4); 8046 auto param22 = model->addOperand(&type4); 8047 auto param23 = model->addOperand(&type4); 8048 auto param24 = model->addOperand(&type4); 8049 auto layout = model->addOperand(&type0); 8050 auto op43 = model->addOperand(&type48); 8051 // Phase 2, operations 8052 static _Float16 op23_init[] = {1.0f, 4.0f, 7.0f, 2.0f, 5.0f, 8.0f, 3.0f, 6.0f, 9.0f}; 8053 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 9); 8054 static _Float16 op33_init[] = {0.0f, 0.0f, 0.0f}; 8055 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 3); 8056 static int32_t param18_init[] = {0}; 8057 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8058 static int32_t param19_init[] = {0}; 8059 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8060 static int32_t param20_init[] = {0}; 8061 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8062 static int32_t param21_init[] = {0}; 8063 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8064 static int32_t param22_init[] = {1}; 8065 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8066 static int32_t param23_init[] = {1}; 8067 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8068 static int32_t param24_init[] = {0}; 8069 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8070 static bool8 layout_init[] = {true}; 8071 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8072 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8073 // Phase 3, inputs and outputs 8074 model->identifyInputsAndOutputs( 8075 {op13}, 8076 {op43}); 8077 assert(model->isValid()); 8078 } 8079 8080 inline bool is_ignored_large_dynamic_output_shape_nchw_float16(int i) { 8081 static std::set<int> ignore = {}; 8082 return ignore.find(i) != ignore.end(); 8083 } 8084 8085 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input(Model *model) { 8086 OperandType type0(Type::BOOL, {}); 8087 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8088 OperandType type4(Type::INT32, {}); 8089 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8090 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 8091 OperandType type8(Type::TENSOR_FLOAT32, {3}); 8092 // Phase 1, operands 8093 auto op13 = model->addOperand(&type11); 8094 auto op23 = model->addOperand(&type7); 8095 auto op33 = model->addOperand(&type8); 8096 auto param18 = model->addOperand(&type4); 8097 auto param19 = model->addOperand(&type4); 8098 auto param20 = model->addOperand(&type4); 8099 auto param21 = model->addOperand(&type4); 8100 auto param22 = model->addOperand(&type4); 8101 auto param23 = model->addOperand(&type4); 8102 auto param24 = model->addOperand(&type4); 8103 auto layout = model->addOperand(&type0); 8104 auto op43 = model->addOperand(&type46); 8105 // Phase 2, operations 8106 static int32_t param18_init[] = {0}; 8107 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8108 static int32_t param19_init[] = {0}; 8109 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8110 static int32_t param20_init[] = {0}; 8111 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8112 static int32_t param21_init[] = {0}; 8113 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8114 static int32_t param22_init[] = {1}; 8115 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8116 static int32_t param23_init[] = {1}; 8117 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8118 static int32_t param24_init[] = {0}; 8119 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8120 static bool8 layout_init[] = {true}; 8121 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8122 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8123 // Phase 3, inputs and outputs 8124 model->identifyInputsAndOutputs( 8125 {op13, op23, op33}, 8126 {op43}); 8127 assert(model->isValid()); 8128 } 8129 8130 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input(int i) { 8131 static std::set<int> ignore = {}; 8132 return ignore.find(i) != ignore.end(); 8133 } 8134 8135 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_relaxed(Model *model) { 8136 OperandType type0(Type::BOOL, {}); 8137 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8138 OperandType type4(Type::INT32, {}); 8139 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8140 OperandType type7(Type::TENSOR_FLOAT32, {3, 1, 1, 3}); 8141 OperandType type8(Type::TENSOR_FLOAT32, {3}); 8142 // Phase 1, operands 8143 auto op13 = model->addOperand(&type11); 8144 auto op23 = model->addOperand(&type7); 8145 auto op33 = model->addOperand(&type8); 8146 auto param18 = model->addOperand(&type4); 8147 auto param19 = model->addOperand(&type4); 8148 auto param20 = model->addOperand(&type4); 8149 auto param21 = model->addOperand(&type4); 8150 auto param22 = model->addOperand(&type4); 8151 auto param23 = model->addOperand(&type4); 8152 auto param24 = model->addOperand(&type4); 8153 auto layout = model->addOperand(&type0); 8154 auto op43 = model->addOperand(&type46); 8155 // Phase 2, operations 8156 static int32_t param18_init[] = {0}; 8157 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8158 static int32_t param19_init[] = {0}; 8159 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8160 static int32_t param20_init[] = {0}; 8161 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8162 static int32_t param21_init[] = {0}; 8163 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8164 static int32_t param22_init[] = {1}; 8165 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8166 static int32_t param23_init[] = {1}; 8167 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8168 static int32_t param24_init[] = {0}; 8169 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8170 static bool8 layout_init[] = {true}; 8171 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8172 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8173 // Phase 3, inputs and outputs 8174 model->identifyInputsAndOutputs( 8175 {op13, op23, op33}, 8176 {op43}); 8177 // Phase 4: set relaxed execution 8178 model->relaxComputationFloat32toFloat16(true); 8179 assert(model->isValid()); 8180 } 8181 8182 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_relaxed(int i) { 8183 static std::set<int> ignore = {}; 8184 return ignore.find(i) != ignore.end(); 8185 } 8186 8187 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_quant8(Model *model) { 8188 OperandType type0(Type::BOOL, {}); 8189 OperandType type4(Type::INT32, {}); 8190 OperandType type63(Type::TENSOR_INT32, {3}, 0.25f, 0); 8191 OperandType type74(Type::TENSOR_QUANT8_ASYMM, {3, 1, 1, 3}, 0.5f, 128); 8192 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 8193 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 8194 // Phase 1, operands 8195 auto op13 = model->addOperand(&type82); 8196 auto op23 = model->addOperand(&type74); 8197 auto op33 = model->addOperand(&type63); 8198 auto param18 = model->addOperand(&type4); 8199 auto param19 = model->addOperand(&type4); 8200 auto param20 = model->addOperand(&type4); 8201 auto param21 = model->addOperand(&type4); 8202 auto param22 = model->addOperand(&type4); 8203 auto param23 = model->addOperand(&type4); 8204 auto param24 = model->addOperand(&type4); 8205 auto layout = model->addOperand(&type0); 8206 auto op43 = model->addOperand(&type86); 8207 // Phase 2, operations 8208 static int32_t param18_init[] = {0}; 8209 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8210 static int32_t param19_init[] = {0}; 8211 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8212 static int32_t param20_init[] = {0}; 8213 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8214 static int32_t param21_init[] = {0}; 8215 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8216 static int32_t param22_init[] = {1}; 8217 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8218 static int32_t param23_init[] = {1}; 8219 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8220 static int32_t param24_init[] = {0}; 8221 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8222 static bool8 layout_init[] = {true}; 8223 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8224 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8225 // Phase 3, inputs and outputs 8226 model->identifyInputsAndOutputs( 8227 {op13, op23, op33}, 8228 {op43}); 8229 assert(model->isValid()); 8230 } 8231 8232 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_quant8(int i) { 8233 static std::set<int> ignore = {}; 8234 return ignore.find(i) != ignore.end(); 8235 } 8236 8237 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8(Model *model) { 8238 OperandType type0(Type::BOOL, {}); 8239 OperandType type4(Type::INT32, {}); 8240 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 0.5f},0)); 8241 OperandType type77(Type::TENSOR_INT32, {3}, 0.0f, 0); 8242 OperandType type82(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 0.5f, 128); 8243 OperandType type86(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 2.0f, 0); 8244 // Phase 1, operands 8245 auto op13 = model->addOperand(&type82); 8246 auto op23 = model->addOperand(&type76); 8247 auto op33 = model->addOperand(&type77); 8248 auto param18 = model->addOperand(&type4); 8249 auto param19 = model->addOperand(&type4); 8250 auto param20 = model->addOperand(&type4); 8251 auto param21 = model->addOperand(&type4); 8252 auto param22 = model->addOperand(&type4); 8253 auto param23 = model->addOperand(&type4); 8254 auto param24 = model->addOperand(&type4); 8255 auto layout = model->addOperand(&type0); 8256 auto op43 = model->addOperand(&type86); 8257 // Phase 2, operations 8258 static int32_t param18_init[] = {0}; 8259 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8260 static int32_t param19_init[] = {0}; 8261 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8262 static int32_t param20_init[] = {0}; 8263 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8264 static int32_t param21_init[] = {0}; 8265 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8266 static int32_t param22_init[] = {1}; 8267 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8268 static int32_t param23_init[] = {1}; 8269 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8270 static int32_t param24_init[] = {0}; 8271 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8272 static bool8 layout_init[] = {true}; 8273 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8274 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8275 // Phase 3, inputs and outputs 8276 model->identifyInputsAndOutputs( 8277 {op13, op23, op33}, 8278 {op43}); 8279 assert(model->isValid()); 8280 } 8281 8282 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8(int i) { 8283 static std::set<int> ignore = {}; 8284 return ignore.find(i) != ignore.end(); 8285 } 8286 8287 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(Model *model) { 8288 OperandType type0(Type::BOOL, {}); 8289 OperandType type4(Type::INT32, {}); 8290 OperandType type79(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {3, 1, 1, 3}, 0.0f, 0, SymmPerChannelQuantParams({0.5f, 1.0f, 1.005f},0)); 8291 OperandType type80(Type::TENSOR_INT32, {3}, 0.0f, 0); 8292 OperandType type84(Type::TENSOR_QUANT8_ASYMM, {1, 3, 2, 3}, 1.0f, 127); 8293 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 8294 // Phase 1, operands 8295 auto op13 = model->addOperand(&type84); 8296 auto op23 = model->addOperand(&type79); 8297 auto op33 = model->addOperand(&type80); 8298 auto param18 = model->addOperand(&type4); 8299 auto param19 = model->addOperand(&type4); 8300 auto param20 = model->addOperand(&type4); 8301 auto param21 = model->addOperand(&type4); 8302 auto param22 = model->addOperand(&type4); 8303 auto param23 = model->addOperand(&type4); 8304 auto param24 = model->addOperand(&type4); 8305 auto layout = model->addOperand(&type0); 8306 auto op43 = model->addOperand(&type87); 8307 // Phase 2, operations 8308 static int32_t param18_init[] = {0}; 8309 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8310 static int32_t param19_init[] = {0}; 8311 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8312 static int32_t param20_init[] = {0}; 8313 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8314 static int32_t param21_init[] = {0}; 8315 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8316 static int32_t param22_init[] = {1}; 8317 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8318 static int32_t param23_init[] = {1}; 8319 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8320 static int32_t param24_init[] = {0}; 8321 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8322 static bool8 layout_init[] = {true}; 8323 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8324 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8325 // Phase 3, inputs and outputs 8326 model->identifyInputsAndOutputs( 8327 {op13, op23, op33}, 8328 {op43}); 8329 assert(model->isValid()); 8330 } 8331 8332 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_channelQuant8_2(int i) { 8333 static std::set<int> ignore = {}; 8334 return ignore.find(i) != ignore.end(); 8335 } 8336 8337 void CreateModel_large_dynamic_output_shape_nchw_weight_as_input_float16(Model *model) { 8338 OperandType type0(Type::BOOL, {}); 8339 OperandType type4(Type::INT32, {}); 8340 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 8341 OperandType type67(Type::TENSOR_FLOAT16, {3, 1, 1, 3}); 8342 OperandType type68(Type::TENSOR_FLOAT16, {3}); 8343 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 8344 // Phase 1, operands 8345 auto op13 = model->addOperand(&type85); 8346 auto op23 = model->addOperand(&type67); 8347 auto op33 = model->addOperand(&type68); 8348 auto param18 = model->addOperand(&type4); 8349 auto param19 = model->addOperand(&type4); 8350 auto param20 = model->addOperand(&type4); 8351 auto param21 = model->addOperand(&type4); 8352 auto param22 = model->addOperand(&type4); 8353 auto param23 = model->addOperand(&type4); 8354 auto param24 = model->addOperand(&type4); 8355 auto layout = model->addOperand(&type0); 8356 auto op43 = model->addOperand(&type48); 8357 // Phase 2, operations 8358 static int32_t param18_init[] = {0}; 8359 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 8360 static int32_t param19_init[] = {0}; 8361 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 8362 static int32_t param20_init[] = {0}; 8363 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 8364 static int32_t param21_init[] = {0}; 8365 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 8366 static int32_t param22_init[] = {1}; 8367 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 8368 static int32_t param23_init[] = {1}; 8369 model->setOperandValue(param23, param23_init, sizeof(int32_t) * 1); 8370 static int32_t param24_init[] = {0}; 8371 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 8372 static bool8 layout_init[] = {true}; 8373 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8374 model->addOperation(ANEURALNETWORKS_CONV_2D, {op13, op23, op33, param18, param19, param20, param21, param22, param23, param24, layout}, {op43}); 8375 // Phase 3, inputs and outputs 8376 model->identifyInputsAndOutputs( 8377 {op13, op23, op33}, 8378 {op43}); 8379 assert(model->isValid()); 8380 } 8381 8382 inline bool is_ignored_large_dynamic_output_shape_nchw_weight_as_input_float16(int i) { 8383 static std::set<int> ignore = {}; 8384 return ignore.find(i) != ignore.end(); 8385 } 8386 8387 void CreateModel_1_H3_W2_SAME_nhwc(Model *model) { 8388 OperandType type0(Type::BOOL, {}); 8389 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 8390 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8391 OperandType type12(Type::TENSOR_FLOAT32, {1, 8, 8, 1}); 8392 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8393 OperandType type4(Type::INT32, {}); 8394 // Phase 1, operands 8395 auto op14 = model->addOperand(&type10); 8396 auto op24 = model->addOperand(&type11); 8397 auto op34 = model->addOperand(&type3); 8398 auto param25 = model->addOperand(&type4); 8399 auto param26 = model->addOperand(&type4); 8400 auto param27 = model->addOperand(&type4); 8401 auto param28 = model->addOperand(&type4); 8402 auto layout = model->addOperand(&type0); 8403 auto op44 = model->addOperand(&type12); 8404 // Phase 2, operations 8405 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8406 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8407 static float op34_init[] = {0.0f}; 8408 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8409 static int32_t param25_init[] = {1}; 8410 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8411 static int32_t param26_init[] = {1}; 8412 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8413 static int32_t param27_init[] = {1}; 8414 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8415 static int32_t param28_init[] = {0}; 8416 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8417 static bool8 layout_init[] = {false}; 8418 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8419 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8420 // Phase 3, inputs and outputs 8421 model->identifyInputsAndOutputs( 8422 {op14}, 8423 {op44}); 8424 assert(model->isValid()); 8425 } 8426 8427 inline bool is_ignored_1_H3_W2_SAME_nhwc(int i) { 8428 static std::set<int> ignore = {}; 8429 return ignore.find(i) != ignore.end(); 8430 } 8431 8432 void CreateModel_1_H3_W2_SAME_nhwc_relaxed(Model *model) { 8433 OperandType type0(Type::BOOL, {}); 8434 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 8435 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8436 OperandType type12(Type::TENSOR_FLOAT32, {1, 8, 8, 1}); 8437 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8438 OperandType type4(Type::INT32, {}); 8439 // Phase 1, operands 8440 auto op14 = model->addOperand(&type10); 8441 auto op24 = model->addOperand(&type11); 8442 auto op34 = model->addOperand(&type3); 8443 auto param25 = model->addOperand(&type4); 8444 auto param26 = model->addOperand(&type4); 8445 auto param27 = model->addOperand(&type4); 8446 auto param28 = model->addOperand(&type4); 8447 auto layout = model->addOperand(&type0); 8448 auto op44 = model->addOperand(&type12); 8449 // Phase 2, operations 8450 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8451 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8452 static float op34_init[] = {0.0f}; 8453 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8454 static int32_t param25_init[] = {1}; 8455 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8456 static int32_t param26_init[] = {1}; 8457 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8458 static int32_t param27_init[] = {1}; 8459 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8460 static int32_t param28_init[] = {0}; 8461 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8462 static bool8 layout_init[] = {false}; 8463 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8464 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8465 // Phase 3, inputs and outputs 8466 model->identifyInputsAndOutputs( 8467 {op14}, 8468 {op44}); 8469 // Phase 4: set relaxed execution 8470 model->relaxComputationFloat32toFloat16(true); 8471 assert(model->isValid()); 8472 } 8473 8474 inline bool is_ignored_1_H3_W2_SAME_nhwc_relaxed(int i) { 8475 static std::set<int> ignore = {}; 8476 return ignore.find(i) != ignore.end(); 8477 } 8478 8479 void CreateModel_1_H3_W2_SAME_nhwc_float16(Model *model) { 8480 OperandType type0(Type::BOOL, {}); 8481 OperandType type39(Type::TENSOR_FLOAT16, {1}); 8482 OperandType type4(Type::INT32, {}); 8483 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 8484 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 8485 OperandType type89(Type::TENSOR_FLOAT16, {1, 8, 8, 1}); 8486 // Phase 1, operands 8487 auto op14 = model->addOperand(&type88); 8488 auto op24 = model->addOperand(&type85); 8489 auto op34 = model->addOperand(&type39); 8490 auto param25 = model->addOperand(&type4); 8491 auto param26 = model->addOperand(&type4); 8492 auto param27 = model->addOperand(&type4); 8493 auto param28 = model->addOperand(&type4); 8494 auto layout = model->addOperand(&type0); 8495 auto op44 = model->addOperand(&type89); 8496 // Phase 2, operations 8497 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 8498 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 8499 static _Float16 op34_init[] = {0.0f}; 8500 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 8501 static int32_t param25_init[] = {1}; 8502 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8503 static int32_t param26_init[] = {1}; 8504 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8505 static int32_t param27_init[] = {1}; 8506 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8507 static int32_t param28_init[] = {0}; 8508 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8509 static bool8 layout_init[] = {false}; 8510 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8511 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8512 // Phase 3, inputs and outputs 8513 model->identifyInputsAndOutputs( 8514 {op14}, 8515 {op44}); 8516 assert(model->isValid()); 8517 } 8518 8519 inline bool is_ignored_1_H3_W2_SAME_nhwc_float16(int i) { 8520 static std::set<int> ignore = {}; 8521 return ignore.find(i) != ignore.end(); 8522 } 8523 8524 void CreateModel_1_H3_W2_SAME_nchw(Model *model) { 8525 OperandType type0(Type::BOOL, {}); 8526 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8527 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8528 OperandType type4(Type::INT32, {}); 8529 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 8530 OperandType type91(Type::TENSOR_FLOAT32, {1, 1, 8, 8}); 8531 // Phase 1, operands 8532 auto op14 = model->addOperand(&type90); 8533 auto op24 = model->addOperand(&type11); 8534 auto op34 = model->addOperand(&type3); 8535 auto param25 = model->addOperand(&type4); 8536 auto param26 = model->addOperand(&type4); 8537 auto param27 = model->addOperand(&type4); 8538 auto param28 = model->addOperand(&type4); 8539 auto layout = model->addOperand(&type0); 8540 auto op44 = model->addOperand(&type91); 8541 // Phase 2, operations 8542 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8543 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8544 static float op34_init[] = {0.0f}; 8545 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8546 static int32_t param25_init[] = {1}; 8547 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8548 static int32_t param26_init[] = {1}; 8549 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8550 static int32_t param27_init[] = {1}; 8551 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8552 static int32_t param28_init[] = {0}; 8553 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8554 static bool8 layout_init[] = {true}; 8555 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8556 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8557 // Phase 3, inputs and outputs 8558 model->identifyInputsAndOutputs( 8559 {op14}, 8560 {op44}); 8561 assert(model->isValid()); 8562 } 8563 8564 inline bool is_ignored_1_H3_W2_SAME_nchw(int i) { 8565 static std::set<int> ignore = {}; 8566 return ignore.find(i) != ignore.end(); 8567 } 8568 8569 void CreateModel_1_H3_W2_SAME_nchw_relaxed(Model *model) { 8570 OperandType type0(Type::BOOL, {}); 8571 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8572 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8573 OperandType type4(Type::INT32, {}); 8574 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 8575 OperandType type91(Type::TENSOR_FLOAT32, {1, 1, 8, 8}); 8576 // Phase 1, operands 8577 auto op14 = model->addOperand(&type90); 8578 auto op24 = model->addOperand(&type11); 8579 auto op34 = model->addOperand(&type3); 8580 auto param25 = model->addOperand(&type4); 8581 auto param26 = model->addOperand(&type4); 8582 auto param27 = model->addOperand(&type4); 8583 auto param28 = model->addOperand(&type4); 8584 auto layout = model->addOperand(&type0); 8585 auto op44 = model->addOperand(&type91); 8586 // Phase 2, operations 8587 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8588 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8589 static float op34_init[] = {0.0f}; 8590 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8591 static int32_t param25_init[] = {1}; 8592 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8593 static int32_t param26_init[] = {1}; 8594 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8595 static int32_t param27_init[] = {1}; 8596 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8597 static int32_t param28_init[] = {0}; 8598 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8599 static bool8 layout_init[] = {true}; 8600 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8601 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8602 // Phase 3, inputs and outputs 8603 model->identifyInputsAndOutputs( 8604 {op14}, 8605 {op44}); 8606 // Phase 4: set relaxed execution 8607 model->relaxComputationFloat32toFloat16(true); 8608 assert(model->isValid()); 8609 } 8610 8611 inline bool is_ignored_1_H3_W2_SAME_nchw_relaxed(int i) { 8612 static std::set<int> ignore = {}; 8613 return ignore.find(i) != ignore.end(); 8614 } 8615 8616 void CreateModel_1_H3_W2_SAME_nchw_float16(Model *model) { 8617 OperandType type0(Type::BOOL, {}); 8618 OperandType type39(Type::TENSOR_FLOAT16, {1}); 8619 OperandType type4(Type::INT32, {}); 8620 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 8621 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 8622 OperandType type93(Type::TENSOR_FLOAT16, {1, 1, 8, 8}); 8623 // Phase 1, operands 8624 auto op14 = model->addOperand(&type92); 8625 auto op24 = model->addOperand(&type85); 8626 auto op34 = model->addOperand(&type39); 8627 auto param25 = model->addOperand(&type4); 8628 auto param26 = model->addOperand(&type4); 8629 auto param27 = model->addOperand(&type4); 8630 auto param28 = model->addOperand(&type4); 8631 auto layout = model->addOperand(&type0); 8632 auto op44 = model->addOperand(&type93); 8633 // Phase 2, operations 8634 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 8635 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 8636 static _Float16 op34_init[] = {0.0f}; 8637 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 8638 static int32_t param25_init[] = {1}; 8639 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8640 static int32_t param26_init[] = {1}; 8641 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8642 static int32_t param27_init[] = {1}; 8643 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8644 static int32_t param28_init[] = {0}; 8645 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8646 static bool8 layout_init[] = {true}; 8647 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8648 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8649 // Phase 3, inputs and outputs 8650 model->identifyInputsAndOutputs( 8651 {op14}, 8652 {op44}); 8653 assert(model->isValid()); 8654 } 8655 8656 inline bool is_ignored_1_H3_W2_SAME_nchw_float16(int i) { 8657 static std::set<int> ignore = {}; 8658 return ignore.find(i) != ignore.end(); 8659 } 8660 8661 void CreateModel_1_H3_W2_SAME_dynamic_output_shape_nhwc(Model *model) { 8662 OperandType type0(Type::BOOL, {}); 8663 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 8664 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8665 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8666 OperandType type4(Type::INT32, {}); 8667 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8668 // Phase 1, operands 8669 auto op14 = model->addOperand(&type10); 8670 auto op24 = model->addOperand(&type11); 8671 auto op34 = model->addOperand(&type3); 8672 auto param25 = model->addOperand(&type4); 8673 auto param26 = model->addOperand(&type4); 8674 auto param27 = model->addOperand(&type4); 8675 auto param28 = model->addOperand(&type4); 8676 auto layout = model->addOperand(&type0); 8677 auto op44 = model->addOperand(&type46); 8678 // Phase 2, operations 8679 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8680 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8681 static float op34_init[] = {0.0f}; 8682 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8683 static int32_t param25_init[] = {1}; 8684 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8685 static int32_t param26_init[] = {1}; 8686 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8687 static int32_t param27_init[] = {1}; 8688 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8689 static int32_t param28_init[] = {0}; 8690 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8691 static bool8 layout_init[] = {false}; 8692 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8693 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8694 // Phase 3, inputs and outputs 8695 model->identifyInputsAndOutputs( 8696 {op14}, 8697 {op44}); 8698 assert(model->isValid()); 8699 } 8700 8701 inline bool is_ignored_1_H3_W2_SAME_dynamic_output_shape_nhwc(int i) { 8702 static std::set<int> ignore = {}; 8703 return ignore.find(i) != ignore.end(); 8704 } 8705 8706 void CreateModel_1_H3_W2_SAME_dynamic_output_shape_nhwc_relaxed(Model *model) { 8707 OperandType type0(Type::BOOL, {}); 8708 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 8709 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8710 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8711 OperandType type4(Type::INT32, {}); 8712 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8713 // Phase 1, operands 8714 auto op14 = model->addOperand(&type10); 8715 auto op24 = model->addOperand(&type11); 8716 auto op34 = model->addOperand(&type3); 8717 auto param25 = model->addOperand(&type4); 8718 auto param26 = model->addOperand(&type4); 8719 auto param27 = model->addOperand(&type4); 8720 auto param28 = model->addOperand(&type4); 8721 auto layout = model->addOperand(&type0); 8722 auto op44 = model->addOperand(&type46); 8723 // Phase 2, operations 8724 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8725 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8726 static float op34_init[] = {0.0f}; 8727 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8728 static int32_t param25_init[] = {1}; 8729 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8730 static int32_t param26_init[] = {1}; 8731 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8732 static int32_t param27_init[] = {1}; 8733 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8734 static int32_t param28_init[] = {0}; 8735 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8736 static bool8 layout_init[] = {false}; 8737 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8738 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8739 // Phase 3, inputs and outputs 8740 model->identifyInputsAndOutputs( 8741 {op14}, 8742 {op44}); 8743 // Phase 4: set relaxed execution 8744 model->relaxComputationFloat32toFloat16(true); 8745 assert(model->isValid()); 8746 } 8747 8748 inline bool is_ignored_1_H3_W2_SAME_dynamic_output_shape_nhwc_relaxed(int i) { 8749 static std::set<int> ignore = {}; 8750 return ignore.find(i) != ignore.end(); 8751 } 8752 8753 void CreateModel_1_H3_W2_SAME_dynamic_output_shape_nhwc_float16(Model *model) { 8754 OperandType type0(Type::BOOL, {}); 8755 OperandType type39(Type::TENSOR_FLOAT16, {1}); 8756 OperandType type4(Type::INT32, {}); 8757 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 8758 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 8759 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 8760 // Phase 1, operands 8761 auto op14 = model->addOperand(&type88); 8762 auto op24 = model->addOperand(&type85); 8763 auto op34 = model->addOperand(&type39); 8764 auto param25 = model->addOperand(&type4); 8765 auto param26 = model->addOperand(&type4); 8766 auto param27 = model->addOperand(&type4); 8767 auto param28 = model->addOperand(&type4); 8768 auto layout = model->addOperand(&type0); 8769 auto op44 = model->addOperand(&type48); 8770 // Phase 2, operations 8771 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 8772 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 8773 static _Float16 op34_init[] = {0.0f}; 8774 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 8775 static int32_t param25_init[] = {1}; 8776 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8777 static int32_t param26_init[] = {1}; 8778 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8779 static int32_t param27_init[] = {1}; 8780 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8781 static int32_t param28_init[] = {0}; 8782 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8783 static bool8 layout_init[] = {false}; 8784 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8785 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8786 // Phase 3, inputs and outputs 8787 model->identifyInputsAndOutputs( 8788 {op14}, 8789 {op44}); 8790 assert(model->isValid()); 8791 } 8792 8793 inline bool is_ignored_1_H3_W2_SAME_dynamic_output_shape_nhwc_float16(int i) { 8794 static std::set<int> ignore = {}; 8795 return ignore.find(i) != ignore.end(); 8796 } 8797 8798 void CreateModel_1_H3_W2_SAME_dynamic_output_shape_nchw(Model *model) { 8799 OperandType type0(Type::BOOL, {}); 8800 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8801 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8802 OperandType type4(Type::INT32, {}); 8803 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8804 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 8805 // Phase 1, operands 8806 auto op14 = model->addOperand(&type90); 8807 auto op24 = model->addOperand(&type11); 8808 auto op34 = model->addOperand(&type3); 8809 auto param25 = model->addOperand(&type4); 8810 auto param26 = model->addOperand(&type4); 8811 auto param27 = model->addOperand(&type4); 8812 auto param28 = model->addOperand(&type4); 8813 auto layout = model->addOperand(&type0); 8814 auto op44 = model->addOperand(&type46); 8815 // Phase 2, operations 8816 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8817 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8818 static float op34_init[] = {0.0f}; 8819 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8820 static int32_t param25_init[] = {1}; 8821 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8822 static int32_t param26_init[] = {1}; 8823 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8824 static int32_t param27_init[] = {1}; 8825 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8826 static int32_t param28_init[] = {0}; 8827 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8828 static bool8 layout_init[] = {true}; 8829 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8830 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8831 // Phase 3, inputs and outputs 8832 model->identifyInputsAndOutputs( 8833 {op14}, 8834 {op44}); 8835 assert(model->isValid()); 8836 } 8837 8838 inline bool is_ignored_1_H3_W2_SAME_dynamic_output_shape_nchw(int i) { 8839 static std::set<int> ignore = {}; 8840 return ignore.find(i) != ignore.end(); 8841 } 8842 8843 void CreateModel_1_H3_W2_SAME_dynamic_output_shape_nchw_relaxed(Model *model) { 8844 OperandType type0(Type::BOOL, {}); 8845 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8846 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8847 OperandType type4(Type::INT32, {}); 8848 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8849 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 8850 // Phase 1, operands 8851 auto op14 = model->addOperand(&type90); 8852 auto op24 = model->addOperand(&type11); 8853 auto op34 = model->addOperand(&type3); 8854 auto param25 = model->addOperand(&type4); 8855 auto param26 = model->addOperand(&type4); 8856 auto param27 = model->addOperand(&type4); 8857 auto param28 = model->addOperand(&type4); 8858 auto layout = model->addOperand(&type0); 8859 auto op44 = model->addOperand(&type46); 8860 // Phase 2, operations 8861 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8862 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8863 static float op34_init[] = {0.0f}; 8864 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8865 static int32_t param25_init[] = {1}; 8866 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8867 static int32_t param26_init[] = {1}; 8868 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8869 static int32_t param27_init[] = {1}; 8870 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8871 static int32_t param28_init[] = {0}; 8872 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8873 static bool8 layout_init[] = {true}; 8874 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8875 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8876 // Phase 3, inputs and outputs 8877 model->identifyInputsAndOutputs( 8878 {op14}, 8879 {op44}); 8880 // Phase 4: set relaxed execution 8881 model->relaxComputationFloat32toFloat16(true); 8882 assert(model->isValid()); 8883 } 8884 8885 inline bool is_ignored_1_H3_W2_SAME_dynamic_output_shape_nchw_relaxed(int i) { 8886 static std::set<int> ignore = {}; 8887 return ignore.find(i) != ignore.end(); 8888 } 8889 8890 void CreateModel_1_H3_W2_SAME_dynamic_output_shape_nchw_float16(Model *model) { 8891 OperandType type0(Type::BOOL, {}); 8892 OperandType type39(Type::TENSOR_FLOAT16, {1}); 8893 OperandType type4(Type::INT32, {}); 8894 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 8895 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 8896 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 8897 // Phase 1, operands 8898 auto op14 = model->addOperand(&type92); 8899 auto op24 = model->addOperand(&type85); 8900 auto op34 = model->addOperand(&type39); 8901 auto param25 = model->addOperand(&type4); 8902 auto param26 = model->addOperand(&type4); 8903 auto param27 = model->addOperand(&type4); 8904 auto param28 = model->addOperand(&type4); 8905 auto layout = model->addOperand(&type0); 8906 auto op44 = model->addOperand(&type48); 8907 // Phase 2, operations 8908 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 8909 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 8910 static _Float16 op34_init[] = {0.0f}; 8911 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 8912 static int32_t param25_init[] = {1}; 8913 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 8914 static int32_t param26_init[] = {1}; 8915 model->setOperandValue(param26, param26_init, sizeof(int32_t) * 1); 8916 static int32_t param27_init[] = {1}; 8917 model->setOperandValue(param27, param27_init, sizeof(int32_t) * 1); 8918 static int32_t param28_init[] = {0}; 8919 model->setOperandValue(param28, param28_init, sizeof(int32_t) * 1); 8920 static bool8 layout_init[] = {true}; 8921 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8922 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param25, param26, param27, param28, layout}, {op44}); 8923 // Phase 3, inputs and outputs 8924 model->identifyInputsAndOutputs( 8925 {op14}, 8926 {op44}); 8927 assert(model->isValid()); 8928 } 8929 8930 inline bool is_ignored_1_H3_W2_SAME_dynamic_output_shape_nchw_float16(int i) { 8931 static std::set<int> ignore = {}; 8932 return ignore.find(i) != ignore.end(); 8933 } 8934 8935 void CreateModel_1_H3_W2_VALID_nhwc(Model *model) { 8936 OperandType type0(Type::BOOL, {}); 8937 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 8938 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8939 OperandType type13(Type::TENSOR_FLOAT32, {1, 6, 7, 1}); 8940 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8941 OperandType type4(Type::INT32, {}); 8942 // Phase 1, operands 8943 auto op14 = model->addOperand(&type10); 8944 auto op24 = model->addOperand(&type11); 8945 auto op34 = model->addOperand(&type3); 8946 auto param29 = model->addOperand(&type4); 8947 auto param30 = model->addOperand(&type4); 8948 auto param31 = model->addOperand(&type4); 8949 auto param32 = model->addOperand(&type4); 8950 auto layout = model->addOperand(&type0); 8951 auto op45 = model->addOperand(&type13); 8952 // Phase 2, operations 8953 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8954 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 8955 static float op34_init[] = {0.0f}; 8956 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 8957 static int32_t param29_init[] = {2}; 8958 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 8959 static int32_t param30_init[] = {1}; 8960 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 8961 static int32_t param31_init[] = {1}; 8962 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 8963 static int32_t param32_init[] = {0}; 8964 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 8965 static bool8 layout_init[] = {false}; 8966 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8967 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 8968 // Phase 3, inputs and outputs 8969 model->identifyInputsAndOutputs( 8970 {op14}, 8971 {op45}); 8972 assert(model->isValid()); 8973 } 8974 8975 inline bool is_ignored_1_H3_W2_VALID_nhwc(int i) { 8976 static std::set<int> ignore = {}; 8977 return ignore.find(i) != ignore.end(); 8978 } 8979 8980 void CreateModel_1_H3_W2_VALID_nhwc_relaxed(Model *model) { 8981 OperandType type0(Type::BOOL, {}); 8982 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 8983 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 8984 OperandType type13(Type::TENSOR_FLOAT32, {1, 6, 7, 1}); 8985 OperandType type3(Type::TENSOR_FLOAT32, {1}); 8986 OperandType type4(Type::INT32, {}); 8987 // Phase 1, operands 8988 auto op14 = model->addOperand(&type10); 8989 auto op24 = model->addOperand(&type11); 8990 auto op34 = model->addOperand(&type3); 8991 auto param29 = model->addOperand(&type4); 8992 auto param30 = model->addOperand(&type4); 8993 auto param31 = model->addOperand(&type4); 8994 auto param32 = model->addOperand(&type4); 8995 auto layout = model->addOperand(&type0); 8996 auto op45 = model->addOperand(&type13); 8997 // Phase 2, operations 8998 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 8999 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9000 static float op34_init[] = {0.0f}; 9001 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9002 static int32_t param29_init[] = {2}; 9003 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9004 static int32_t param30_init[] = {1}; 9005 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9006 static int32_t param31_init[] = {1}; 9007 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9008 static int32_t param32_init[] = {0}; 9009 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9010 static bool8 layout_init[] = {false}; 9011 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9012 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9013 // Phase 3, inputs and outputs 9014 model->identifyInputsAndOutputs( 9015 {op14}, 9016 {op45}); 9017 // Phase 4: set relaxed execution 9018 model->relaxComputationFloat32toFloat16(true); 9019 assert(model->isValid()); 9020 } 9021 9022 inline bool is_ignored_1_H3_W2_VALID_nhwc_relaxed(int i) { 9023 static std::set<int> ignore = {}; 9024 return ignore.find(i) != ignore.end(); 9025 } 9026 9027 void CreateModel_1_H3_W2_VALID_nhwc_float16(Model *model) { 9028 OperandType type0(Type::BOOL, {}); 9029 OperandType type39(Type::TENSOR_FLOAT16, {1}); 9030 OperandType type4(Type::INT32, {}); 9031 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 9032 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 9033 OperandType type94(Type::TENSOR_FLOAT16, {1, 6, 7, 1}); 9034 // Phase 1, operands 9035 auto op14 = model->addOperand(&type88); 9036 auto op24 = model->addOperand(&type85); 9037 auto op34 = model->addOperand(&type39); 9038 auto param29 = model->addOperand(&type4); 9039 auto param30 = model->addOperand(&type4); 9040 auto param31 = model->addOperand(&type4); 9041 auto param32 = model->addOperand(&type4); 9042 auto layout = model->addOperand(&type0); 9043 auto op45 = model->addOperand(&type94); 9044 // Phase 2, operations 9045 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 9046 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 9047 static _Float16 op34_init[] = {0.0f}; 9048 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 9049 static int32_t param29_init[] = {2}; 9050 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9051 static int32_t param30_init[] = {1}; 9052 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9053 static int32_t param31_init[] = {1}; 9054 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9055 static int32_t param32_init[] = {0}; 9056 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9057 static bool8 layout_init[] = {false}; 9058 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9059 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9060 // Phase 3, inputs and outputs 9061 model->identifyInputsAndOutputs( 9062 {op14}, 9063 {op45}); 9064 assert(model->isValid()); 9065 } 9066 9067 inline bool is_ignored_1_H3_W2_VALID_nhwc_float16(int i) { 9068 static std::set<int> ignore = {}; 9069 return ignore.find(i) != ignore.end(); 9070 } 9071 9072 void CreateModel_1_H3_W2_VALID_nchw(Model *model) { 9073 OperandType type0(Type::BOOL, {}); 9074 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 9075 OperandType type3(Type::TENSOR_FLOAT32, {1}); 9076 OperandType type4(Type::INT32, {}); 9077 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9078 OperandType type95(Type::TENSOR_FLOAT32, {1, 1, 6, 7}); 9079 // Phase 1, operands 9080 auto op14 = model->addOperand(&type90); 9081 auto op24 = model->addOperand(&type11); 9082 auto op34 = model->addOperand(&type3); 9083 auto param29 = model->addOperand(&type4); 9084 auto param30 = model->addOperand(&type4); 9085 auto param31 = model->addOperand(&type4); 9086 auto param32 = model->addOperand(&type4); 9087 auto layout = model->addOperand(&type0); 9088 auto op45 = model->addOperand(&type95); 9089 // Phase 2, operations 9090 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 9091 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9092 static float op34_init[] = {0.0f}; 9093 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9094 static int32_t param29_init[] = {2}; 9095 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9096 static int32_t param30_init[] = {1}; 9097 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9098 static int32_t param31_init[] = {1}; 9099 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9100 static int32_t param32_init[] = {0}; 9101 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9102 static bool8 layout_init[] = {true}; 9103 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9104 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9105 // Phase 3, inputs and outputs 9106 model->identifyInputsAndOutputs( 9107 {op14}, 9108 {op45}); 9109 assert(model->isValid()); 9110 } 9111 9112 inline bool is_ignored_1_H3_W2_VALID_nchw(int i) { 9113 static std::set<int> ignore = {}; 9114 return ignore.find(i) != ignore.end(); 9115 } 9116 9117 void CreateModel_1_H3_W2_VALID_nchw_relaxed(Model *model) { 9118 OperandType type0(Type::BOOL, {}); 9119 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 9120 OperandType type3(Type::TENSOR_FLOAT32, {1}); 9121 OperandType type4(Type::INT32, {}); 9122 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9123 OperandType type95(Type::TENSOR_FLOAT32, {1, 1, 6, 7}); 9124 // Phase 1, operands 9125 auto op14 = model->addOperand(&type90); 9126 auto op24 = model->addOperand(&type11); 9127 auto op34 = model->addOperand(&type3); 9128 auto param29 = model->addOperand(&type4); 9129 auto param30 = model->addOperand(&type4); 9130 auto param31 = model->addOperand(&type4); 9131 auto param32 = model->addOperand(&type4); 9132 auto layout = model->addOperand(&type0); 9133 auto op45 = model->addOperand(&type95); 9134 // Phase 2, operations 9135 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 9136 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9137 static float op34_init[] = {0.0f}; 9138 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9139 static int32_t param29_init[] = {2}; 9140 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9141 static int32_t param30_init[] = {1}; 9142 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9143 static int32_t param31_init[] = {1}; 9144 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9145 static int32_t param32_init[] = {0}; 9146 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9147 static bool8 layout_init[] = {true}; 9148 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9149 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9150 // Phase 3, inputs and outputs 9151 model->identifyInputsAndOutputs( 9152 {op14}, 9153 {op45}); 9154 // Phase 4: set relaxed execution 9155 model->relaxComputationFloat32toFloat16(true); 9156 assert(model->isValid()); 9157 } 9158 9159 inline bool is_ignored_1_H3_W2_VALID_nchw_relaxed(int i) { 9160 static std::set<int> ignore = {}; 9161 return ignore.find(i) != ignore.end(); 9162 } 9163 9164 void CreateModel_1_H3_W2_VALID_nchw_float16(Model *model) { 9165 OperandType type0(Type::BOOL, {}); 9166 OperandType type39(Type::TENSOR_FLOAT16, {1}); 9167 OperandType type4(Type::INT32, {}); 9168 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 9169 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 9170 OperandType type96(Type::TENSOR_FLOAT16, {1, 1, 6, 7}); 9171 // Phase 1, operands 9172 auto op14 = model->addOperand(&type92); 9173 auto op24 = model->addOperand(&type85); 9174 auto op34 = model->addOperand(&type39); 9175 auto param29 = model->addOperand(&type4); 9176 auto param30 = model->addOperand(&type4); 9177 auto param31 = model->addOperand(&type4); 9178 auto param32 = model->addOperand(&type4); 9179 auto layout = model->addOperand(&type0); 9180 auto op45 = model->addOperand(&type96); 9181 // Phase 2, operations 9182 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 9183 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 9184 static _Float16 op34_init[] = {0.0f}; 9185 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 9186 static int32_t param29_init[] = {2}; 9187 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9188 static int32_t param30_init[] = {1}; 9189 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9190 static int32_t param31_init[] = {1}; 9191 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9192 static int32_t param32_init[] = {0}; 9193 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9194 static bool8 layout_init[] = {true}; 9195 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9196 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9197 // Phase 3, inputs and outputs 9198 model->identifyInputsAndOutputs( 9199 {op14}, 9200 {op45}); 9201 assert(model->isValid()); 9202 } 9203 9204 inline bool is_ignored_1_H3_W2_VALID_nchw_float16(int i) { 9205 static std::set<int> ignore = {}; 9206 return ignore.find(i) != ignore.end(); 9207 } 9208 9209 void CreateModel_1_H3_W2_VALID_dynamic_output_shape_nhwc(Model *model) { 9210 OperandType type0(Type::BOOL, {}); 9211 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 9212 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 9213 OperandType type3(Type::TENSOR_FLOAT32, {1}); 9214 OperandType type4(Type::INT32, {}); 9215 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9216 // Phase 1, operands 9217 auto op14 = model->addOperand(&type10); 9218 auto op24 = model->addOperand(&type11); 9219 auto op34 = model->addOperand(&type3); 9220 auto param29 = model->addOperand(&type4); 9221 auto param30 = model->addOperand(&type4); 9222 auto param31 = model->addOperand(&type4); 9223 auto param32 = model->addOperand(&type4); 9224 auto layout = model->addOperand(&type0); 9225 auto op45 = model->addOperand(&type46); 9226 // Phase 2, operations 9227 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 9228 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9229 static float op34_init[] = {0.0f}; 9230 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9231 static int32_t param29_init[] = {2}; 9232 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9233 static int32_t param30_init[] = {1}; 9234 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9235 static int32_t param31_init[] = {1}; 9236 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9237 static int32_t param32_init[] = {0}; 9238 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9239 static bool8 layout_init[] = {false}; 9240 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9241 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9242 // Phase 3, inputs and outputs 9243 model->identifyInputsAndOutputs( 9244 {op14}, 9245 {op45}); 9246 assert(model->isValid()); 9247 } 9248 9249 inline bool is_ignored_1_H3_W2_VALID_dynamic_output_shape_nhwc(int i) { 9250 static std::set<int> ignore = {}; 9251 return ignore.find(i) != ignore.end(); 9252 } 9253 9254 void CreateModel_1_H3_W2_VALID_dynamic_output_shape_nhwc_relaxed(Model *model) { 9255 OperandType type0(Type::BOOL, {}); 9256 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 9257 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 9258 OperandType type3(Type::TENSOR_FLOAT32, {1}); 9259 OperandType type4(Type::INT32, {}); 9260 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9261 // Phase 1, operands 9262 auto op14 = model->addOperand(&type10); 9263 auto op24 = model->addOperand(&type11); 9264 auto op34 = model->addOperand(&type3); 9265 auto param29 = model->addOperand(&type4); 9266 auto param30 = model->addOperand(&type4); 9267 auto param31 = model->addOperand(&type4); 9268 auto param32 = model->addOperand(&type4); 9269 auto layout = model->addOperand(&type0); 9270 auto op45 = model->addOperand(&type46); 9271 // Phase 2, operations 9272 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 9273 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9274 static float op34_init[] = {0.0f}; 9275 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9276 static int32_t param29_init[] = {2}; 9277 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9278 static int32_t param30_init[] = {1}; 9279 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9280 static int32_t param31_init[] = {1}; 9281 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9282 static int32_t param32_init[] = {0}; 9283 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9284 static bool8 layout_init[] = {false}; 9285 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9286 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9287 // Phase 3, inputs and outputs 9288 model->identifyInputsAndOutputs( 9289 {op14}, 9290 {op45}); 9291 // Phase 4: set relaxed execution 9292 model->relaxComputationFloat32toFloat16(true); 9293 assert(model->isValid()); 9294 } 9295 9296 inline bool is_ignored_1_H3_W2_VALID_dynamic_output_shape_nhwc_relaxed(int i) { 9297 static std::set<int> ignore = {}; 9298 return ignore.find(i) != ignore.end(); 9299 } 9300 9301 void CreateModel_1_H3_W2_VALID_dynamic_output_shape_nhwc_float16(Model *model) { 9302 OperandType type0(Type::BOOL, {}); 9303 OperandType type39(Type::TENSOR_FLOAT16, {1}); 9304 OperandType type4(Type::INT32, {}); 9305 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9306 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 9307 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 9308 // Phase 1, operands 9309 auto op14 = model->addOperand(&type88); 9310 auto op24 = model->addOperand(&type85); 9311 auto op34 = model->addOperand(&type39); 9312 auto param29 = model->addOperand(&type4); 9313 auto param30 = model->addOperand(&type4); 9314 auto param31 = model->addOperand(&type4); 9315 auto param32 = model->addOperand(&type4); 9316 auto layout = model->addOperand(&type0); 9317 auto op45 = model->addOperand(&type48); 9318 // Phase 2, operations 9319 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 9320 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 9321 static _Float16 op34_init[] = {0.0f}; 9322 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 9323 static int32_t param29_init[] = {2}; 9324 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9325 static int32_t param30_init[] = {1}; 9326 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9327 static int32_t param31_init[] = {1}; 9328 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9329 static int32_t param32_init[] = {0}; 9330 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9331 static bool8 layout_init[] = {false}; 9332 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9333 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9334 // Phase 3, inputs and outputs 9335 model->identifyInputsAndOutputs( 9336 {op14}, 9337 {op45}); 9338 assert(model->isValid()); 9339 } 9340 9341 inline bool is_ignored_1_H3_W2_VALID_dynamic_output_shape_nhwc_float16(int i) { 9342 static std::set<int> ignore = {}; 9343 return ignore.find(i) != ignore.end(); 9344 } 9345 9346 void CreateModel_1_H3_W2_VALID_dynamic_output_shape_nchw(Model *model) { 9347 OperandType type0(Type::BOOL, {}); 9348 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 9349 OperandType type3(Type::TENSOR_FLOAT32, {1}); 9350 OperandType type4(Type::INT32, {}); 9351 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9352 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9353 // Phase 1, operands 9354 auto op14 = model->addOperand(&type90); 9355 auto op24 = model->addOperand(&type11); 9356 auto op34 = model->addOperand(&type3); 9357 auto param29 = model->addOperand(&type4); 9358 auto param30 = model->addOperand(&type4); 9359 auto param31 = model->addOperand(&type4); 9360 auto param32 = model->addOperand(&type4); 9361 auto layout = model->addOperand(&type0); 9362 auto op45 = model->addOperand(&type46); 9363 // Phase 2, operations 9364 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 9365 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9366 static float op34_init[] = {0.0f}; 9367 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9368 static int32_t param29_init[] = {2}; 9369 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9370 static int32_t param30_init[] = {1}; 9371 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9372 static int32_t param31_init[] = {1}; 9373 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9374 static int32_t param32_init[] = {0}; 9375 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9376 static bool8 layout_init[] = {true}; 9377 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9378 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9379 // Phase 3, inputs and outputs 9380 model->identifyInputsAndOutputs( 9381 {op14}, 9382 {op45}); 9383 assert(model->isValid()); 9384 } 9385 9386 inline bool is_ignored_1_H3_W2_VALID_dynamic_output_shape_nchw(int i) { 9387 static std::set<int> ignore = {}; 9388 return ignore.find(i) != ignore.end(); 9389 } 9390 9391 void CreateModel_1_H3_W2_VALID_dynamic_output_shape_nchw_relaxed(Model *model) { 9392 OperandType type0(Type::BOOL, {}); 9393 OperandType type11(Type::TENSOR_FLOAT32, {1, 3, 2, 3}); 9394 OperandType type3(Type::TENSOR_FLOAT32, {1}); 9395 OperandType type4(Type::INT32, {}); 9396 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9397 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9398 // Phase 1, operands 9399 auto op14 = model->addOperand(&type90); 9400 auto op24 = model->addOperand(&type11); 9401 auto op34 = model->addOperand(&type3); 9402 auto param29 = model->addOperand(&type4); 9403 auto param30 = model->addOperand(&type4); 9404 auto param31 = model->addOperand(&type4); 9405 auto param32 = model->addOperand(&type4); 9406 auto layout = model->addOperand(&type0); 9407 auto op45 = model->addOperand(&type46); 9408 // Phase 2, operations 9409 static float op24_init[] = {-0.966213f, -0.467474f, -0.82203f, -0.579455f, 0.0278809f, -0.79946f, -0.684259f, 0.563238f, 0.37289f, 0.738216f, 0.386045f, -0.917775f, 0.184325f, -0.270568f, 0.82236f, 0.0973683f, -0.941308f, -0.144706f}; 9410 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 9411 static float op34_init[] = {0.0f}; 9412 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 9413 static int32_t param29_init[] = {2}; 9414 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9415 static int32_t param30_init[] = {1}; 9416 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9417 static int32_t param31_init[] = {1}; 9418 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9419 static int32_t param32_init[] = {0}; 9420 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9421 static bool8 layout_init[] = {true}; 9422 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9423 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9424 // Phase 3, inputs and outputs 9425 model->identifyInputsAndOutputs( 9426 {op14}, 9427 {op45}); 9428 // Phase 4: set relaxed execution 9429 model->relaxComputationFloat32toFloat16(true); 9430 assert(model->isValid()); 9431 } 9432 9433 inline bool is_ignored_1_H3_W2_VALID_dynamic_output_shape_nchw_relaxed(int i) { 9434 static std::set<int> ignore = {}; 9435 return ignore.find(i) != ignore.end(); 9436 } 9437 9438 void CreateModel_1_H3_W2_VALID_dynamic_output_shape_nchw_float16(Model *model) { 9439 OperandType type0(Type::BOOL, {}); 9440 OperandType type39(Type::TENSOR_FLOAT16, {1}); 9441 OperandType type4(Type::INT32, {}); 9442 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9443 OperandType type85(Type::TENSOR_FLOAT16, {1, 3, 2, 3}); 9444 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 9445 // Phase 1, operands 9446 auto op14 = model->addOperand(&type92); 9447 auto op24 = model->addOperand(&type85); 9448 auto op34 = model->addOperand(&type39); 9449 auto param29 = model->addOperand(&type4); 9450 auto param30 = model->addOperand(&type4); 9451 auto param31 = model->addOperand(&type4); 9452 auto param32 = model->addOperand(&type4); 9453 auto layout = model->addOperand(&type0); 9454 auto op45 = model->addOperand(&type48); 9455 // Phase 2, operations 9456 static _Float16 op24_init[] = {-0.9662129878997803f, -0.4674740135669708f, -0.8220300078392029f, -0.5794550180435181f, 0.027880899608135223f, -0.7994599938392639f, -0.6842589974403381f, 0.5632380247116089f, 0.37288999557495117f, 0.738215982913971f, 0.38604500889778137f, -0.9177749752998352f, 0.18432499468326569f, -0.27056801319122314f, 0.8223599791526794f, 0.09736829996109009f, -0.9413080215454102f, -0.14470599591732025f}; 9457 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 9458 static _Float16 op34_init[] = {0.0f}; 9459 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 9460 static int32_t param29_init[] = {2}; 9461 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 9462 static int32_t param30_init[] = {1}; 9463 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 9464 static int32_t param31_init[] = {1}; 9465 model->setOperandValue(param31, param31_init, sizeof(int32_t) * 1); 9466 static int32_t param32_init[] = {0}; 9467 model->setOperandValue(param32, param32_init, sizeof(int32_t) * 1); 9468 static bool8 layout_init[] = {true}; 9469 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9470 model->addOperation(ANEURALNETWORKS_CONV_2D, {op14, op24, op34, param29, param30, param31, param32, layout}, {op45}); 9471 // Phase 3, inputs and outputs 9472 model->identifyInputsAndOutputs( 9473 {op14}, 9474 {op45}); 9475 assert(model->isValid()); 9476 } 9477 9478 inline bool is_ignored_1_H3_W2_VALID_dynamic_output_shape_nchw_float16(int i) { 9479 static std::set<int> ignore = {}; 9480 return ignore.find(i) != ignore.end(); 9481 } 9482 9483 void CreateModel_3_H3_W2_SAME_nhwc(Model *model) { 9484 OperandType type0(Type::BOOL, {}); 9485 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 9486 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9487 OperandType type4(Type::INT32, {}); 9488 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9489 // Phase 1, operands 9490 auto op15 = model->addOperand(&type10); 9491 auto op25 = model->addOperand(&type14); 9492 auto op35 = model->addOperand(&type8); 9493 auto param33 = model->addOperand(&type4); 9494 auto param34 = model->addOperand(&type4); 9495 auto param35 = model->addOperand(&type4); 9496 auto param36 = model->addOperand(&type4); 9497 auto layout = model->addOperand(&type0); 9498 auto op46 = model->addOperand(&type10); 9499 // Phase 2, operations 9500 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9501 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9502 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9503 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9504 static int32_t param33_init[] = {1}; 9505 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9506 static int32_t param34_init[] = {1}; 9507 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9508 static int32_t param35_init[] = {1}; 9509 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9510 static int32_t param36_init[] = {0}; 9511 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9512 static bool8 layout_init[] = {false}; 9513 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9514 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9515 // Phase 3, inputs and outputs 9516 model->identifyInputsAndOutputs( 9517 {op15}, 9518 {op46}); 9519 assert(model->isValid()); 9520 } 9521 9522 inline bool is_ignored_3_H3_W2_SAME_nhwc(int i) { 9523 static std::set<int> ignore = {}; 9524 return ignore.find(i) != ignore.end(); 9525 } 9526 9527 void CreateModel_3_H3_W2_SAME_nhwc_relaxed(Model *model) { 9528 OperandType type0(Type::BOOL, {}); 9529 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 9530 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9531 OperandType type4(Type::INT32, {}); 9532 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9533 // Phase 1, operands 9534 auto op15 = model->addOperand(&type10); 9535 auto op25 = model->addOperand(&type14); 9536 auto op35 = model->addOperand(&type8); 9537 auto param33 = model->addOperand(&type4); 9538 auto param34 = model->addOperand(&type4); 9539 auto param35 = model->addOperand(&type4); 9540 auto param36 = model->addOperand(&type4); 9541 auto layout = model->addOperand(&type0); 9542 auto op46 = model->addOperand(&type10); 9543 // Phase 2, operations 9544 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9545 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9546 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9547 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9548 static int32_t param33_init[] = {1}; 9549 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9550 static int32_t param34_init[] = {1}; 9551 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9552 static int32_t param35_init[] = {1}; 9553 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9554 static int32_t param36_init[] = {0}; 9555 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9556 static bool8 layout_init[] = {false}; 9557 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9558 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9559 // Phase 3, inputs and outputs 9560 model->identifyInputsAndOutputs( 9561 {op15}, 9562 {op46}); 9563 // Phase 4: set relaxed execution 9564 model->relaxComputationFloat32toFloat16(true); 9565 assert(model->isValid()); 9566 } 9567 9568 inline bool is_ignored_3_H3_W2_SAME_nhwc_relaxed(int i) { 9569 static std::set<int> ignore = {}; 9570 return ignore.find(i) != ignore.end(); 9571 } 9572 9573 void CreateModel_3_H3_W2_SAME_nhwc_float16(Model *model) { 9574 OperandType type0(Type::BOOL, {}); 9575 OperandType type4(Type::INT32, {}); 9576 OperandType type68(Type::TENSOR_FLOAT16, {3}); 9577 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 9578 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 9579 // Phase 1, operands 9580 auto op15 = model->addOperand(&type88); 9581 auto op25 = model->addOperand(&type97); 9582 auto op35 = model->addOperand(&type68); 9583 auto param33 = model->addOperand(&type4); 9584 auto param34 = model->addOperand(&type4); 9585 auto param35 = model->addOperand(&type4); 9586 auto param36 = model->addOperand(&type4); 9587 auto layout = model->addOperand(&type0); 9588 auto op46 = model->addOperand(&type88); 9589 // Phase 2, operations 9590 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 9591 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 9592 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 9593 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 9594 static int32_t param33_init[] = {1}; 9595 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9596 static int32_t param34_init[] = {1}; 9597 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9598 static int32_t param35_init[] = {1}; 9599 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9600 static int32_t param36_init[] = {0}; 9601 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9602 static bool8 layout_init[] = {false}; 9603 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9604 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9605 // Phase 3, inputs and outputs 9606 model->identifyInputsAndOutputs( 9607 {op15}, 9608 {op46}); 9609 assert(model->isValid()); 9610 } 9611 9612 inline bool is_ignored_3_H3_W2_SAME_nhwc_float16(int i) { 9613 static std::set<int> ignore = {}; 9614 return ignore.find(i) != ignore.end(); 9615 } 9616 9617 void CreateModel_3_H3_W2_SAME_nchw(Model *model) { 9618 OperandType type0(Type::BOOL, {}); 9619 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9620 OperandType type4(Type::INT32, {}); 9621 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9622 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9623 // Phase 1, operands 9624 auto op15 = model->addOperand(&type90); 9625 auto op25 = model->addOperand(&type14); 9626 auto op35 = model->addOperand(&type8); 9627 auto param33 = model->addOperand(&type4); 9628 auto param34 = model->addOperand(&type4); 9629 auto param35 = model->addOperand(&type4); 9630 auto param36 = model->addOperand(&type4); 9631 auto layout = model->addOperand(&type0); 9632 auto op46 = model->addOperand(&type90); 9633 // Phase 2, operations 9634 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9635 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9636 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9637 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9638 static int32_t param33_init[] = {1}; 9639 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9640 static int32_t param34_init[] = {1}; 9641 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9642 static int32_t param35_init[] = {1}; 9643 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9644 static int32_t param36_init[] = {0}; 9645 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9646 static bool8 layout_init[] = {true}; 9647 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9648 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9649 // Phase 3, inputs and outputs 9650 model->identifyInputsAndOutputs( 9651 {op15}, 9652 {op46}); 9653 assert(model->isValid()); 9654 } 9655 9656 inline bool is_ignored_3_H3_W2_SAME_nchw(int i) { 9657 static std::set<int> ignore = {}; 9658 return ignore.find(i) != ignore.end(); 9659 } 9660 9661 void CreateModel_3_H3_W2_SAME_nchw_relaxed(Model *model) { 9662 OperandType type0(Type::BOOL, {}); 9663 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9664 OperandType type4(Type::INT32, {}); 9665 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9666 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9667 // Phase 1, operands 9668 auto op15 = model->addOperand(&type90); 9669 auto op25 = model->addOperand(&type14); 9670 auto op35 = model->addOperand(&type8); 9671 auto param33 = model->addOperand(&type4); 9672 auto param34 = model->addOperand(&type4); 9673 auto param35 = model->addOperand(&type4); 9674 auto param36 = model->addOperand(&type4); 9675 auto layout = model->addOperand(&type0); 9676 auto op46 = model->addOperand(&type90); 9677 // Phase 2, operations 9678 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9679 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9680 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9681 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9682 static int32_t param33_init[] = {1}; 9683 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9684 static int32_t param34_init[] = {1}; 9685 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9686 static int32_t param35_init[] = {1}; 9687 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9688 static int32_t param36_init[] = {0}; 9689 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9690 static bool8 layout_init[] = {true}; 9691 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9692 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9693 // Phase 3, inputs and outputs 9694 model->identifyInputsAndOutputs( 9695 {op15}, 9696 {op46}); 9697 // Phase 4: set relaxed execution 9698 model->relaxComputationFloat32toFloat16(true); 9699 assert(model->isValid()); 9700 } 9701 9702 inline bool is_ignored_3_H3_W2_SAME_nchw_relaxed(int i) { 9703 static std::set<int> ignore = {}; 9704 return ignore.find(i) != ignore.end(); 9705 } 9706 9707 void CreateModel_3_H3_W2_SAME_nchw_float16(Model *model) { 9708 OperandType type0(Type::BOOL, {}); 9709 OperandType type4(Type::INT32, {}); 9710 OperandType type68(Type::TENSOR_FLOAT16, {3}); 9711 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 9712 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 9713 // Phase 1, operands 9714 auto op15 = model->addOperand(&type92); 9715 auto op25 = model->addOperand(&type97); 9716 auto op35 = model->addOperand(&type68); 9717 auto param33 = model->addOperand(&type4); 9718 auto param34 = model->addOperand(&type4); 9719 auto param35 = model->addOperand(&type4); 9720 auto param36 = model->addOperand(&type4); 9721 auto layout = model->addOperand(&type0); 9722 auto op46 = model->addOperand(&type92); 9723 // Phase 2, operations 9724 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 9725 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 9726 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 9727 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 9728 static int32_t param33_init[] = {1}; 9729 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9730 static int32_t param34_init[] = {1}; 9731 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9732 static int32_t param35_init[] = {1}; 9733 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9734 static int32_t param36_init[] = {0}; 9735 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9736 static bool8 layout_init[] = {true}; 9737 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9738 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9739 // Phase 3, inputs and outputs 9740 model->identifyInputsAndOutputs( 9741 {op15}, 9742 {op46}); 9743 assert(model->isValid()); 9744 } 9745 9746 inline bool is_ignored_3_H3_W2_SAME_nchw_float16(int i) { 9747 static std::set<int> ignore = {}; 9748 return ignore.find(i) != ignore.end(); 9749 } 9750 9751 void CreateModel_3_H3_W2_SAME_dynamic_output_shape_nhwc(Model *model) { 9752 OperandType type0(Type::BOOL, {}); 9753 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 9754 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9755 OperandType type4(Type::INT32, {}); 9756 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9757 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9758 // Phase 1, operands 9759 auto op15 = model->addOperand(&type10); 9760 auto op25 = model->addOperand(&type14); 9761 auto op35 = model->addOperand(&type8); 9762 auto param33 = model->addOperand(&type4); 9763 auto param34 = model->addOperand(&type4); 9764 auto param35 = model->addOperand(&type4); 9765 auto param36 = model->addOperand(&type4); 9766 auto layout = model->addOperand(&type0); 9767 auto op46 = model->addOperand(&type46); 9768 // Phase 2, operations 9769 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9770 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9771 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9772 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9773 static int32_t param33_init[] = {1}; 9774 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9775 static int32_t param34_init[] = {1}; 9776 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9777 static int32_t param35_init[] = {1}; 9778 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9779 static int32_t param36_init[] = {0}; 9780 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9781 static bool8 layout_init[] = {false}; 9782 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9783 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9784 // Phase 3, inputs and outputs 9785 model->identifyInputsAndOutputs( 9786 {op15}, 9787 {op46}); 9788 assert(model->isValid()); 9789 } 9790 9791 inline bool is_ignored_3_H3_W2_SAME_dynamic_output_shape_nhwc(int i) { 9792 static std::set<int> ignore = {}; 9793 return ignore.find(i) != ignore.end(); 9794 } 9795 9796 void CreateModel_3_H3_W2_SAME_dynamic_output_shape_nhwc_relaxed(Model *model) { 9797 OperandType type0(Type::BOOL, {}); 9798 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 9799 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9800 OperandType type4(Type::INT32, {}); 9801 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9802 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9803 // Phase 1, operands 9804 auto op15 = model->addOperand(&type10); 9805 auto op25 = model->addOperand(&type14); 9806 auto op35 = model->addOperand(&type8); 9807 auto param33 = model->addOperand(&type4); 9808 auto param34 = model->addOperand(&type4); 9809 auto param35 = model->addOperand(&type4); 9810 auto param36 = model->addOperand(&type4); 9811 auto layout = model->addOperand(&type0); 9812 auto op46 = model->addOperand(&type46); 9813 // Phase 2, operations 9814 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9815 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9816 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9817 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9818 static int32_t param33_init[] = {1}; 9819 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9820 static int32_t param34_init[] = {1}; 9821 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9822 static int32_t param35_init[] = {1}; 9823 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9824 static int32_t param36_init[] = {0}; 9825 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9826 static bool8 layout_init[] = {false}; 9827 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9828 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9829 // Phase 3, inputs and outputs 9830 model->identifyInputsAndOutputs( 9831 {op15}, 9832 {op46}); 9833 // Phase 4: set relaxed execution 9834 model->relaxComputationFloat32toFloat16(true); 9835 assert(model->isValid()); 9836 } 9837 9838 inline bool is_ignored_3_H3_W2_SAME_dynamic_output_shape_nhwc_relaxed(int i) { 9839 static std::set<int> ignore = {}; 9840 return ignore.find(i) != ignore.end(); 9841 } 9842 9843 void CreateModel_3_H3_W2_SAME_dynamic_output_shape_nhwc_float16(Model *model) { 9844 OperandType type0(Type::BOOL, {}); 9845 OperandType type4(Type::INT32, {}); 9846 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9847 OperandType type68(Type::TENSOR_FLOAT16, {3}); 9848 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 9849 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 9850 // Phase 1, operands 9851 auto op15 = model->addOperand(&type88); 9852 auto op25 = model->addOperand(&type97); 9853 auto op35 = model->addOperand(&type68); 9854 auto param33 = model->addOperand(&type4); 9855 auto param34 = model->addOperand(&type4); 9856 auto param35 = model->addOperand(&type4); 9857 auto param36 = model->addOperand(&type4); 9858 auto layout = model->addOperand(&type0); 9859 auto op46 = model->addOperand(&type48); 9860 // Phase 2, operations 9861 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 9862 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 9863 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 9864 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 9865 static int32_t param33_init[] = {1}; 9866 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9867 static int32_t param34_init[] = {1}; 9868 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9869 static int32_t param35_init[] = {1}; 9870 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9871 static int32_t param36_init[] = {0}; 9872 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9873 static bool8 layout_init[] = {false}; 9874 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9875 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9876 // Phase 3, inputs and outputs 9877 model->identifyInputsAndOutputs( 9878 {op15}, 9879 {op46}); 9880 assert(model->isValid()); 9881 } 9882 9883 inline bool is_ignored_3_H3_W2_SAME_dynamic_output_shape_nhwc_float16(int i) { 9884 static std::set<int> ignore = {}; 9885 return ignore.find(i) != ignore.end(); 9886 } 9887 9888 void CreateModel_3_H3_W2_SAME_dynamic_output_shape_nchw(Model *model) { 9889 OperandType type0(Type::BOOL, {}); 9890 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9891 OperandType type4(Type::INT32, {}); 9892 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9893 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9894 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9895 // Phase 1, operands 9896 auto op15 = model->addOperand(&type90); 9897 auto op25 = model->addOperand(&type14); 9898 auto op35 = model->addOperand(&type8); 9899 auto param33 = model->addOperand(&type4); 9900 auto param34 = model->addOperand(&type4); 9901 auto param35 = model->addOperand(&type4); 9902 auto param36 = model->addOperand(&type4); 9903 auto layout = model->addOperand(&type0); 9904 auto op46 = model->addOperand(&type46); 9905 // Phase 2, operations 9906 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9907 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9908 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9909 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9910 static int32_t param33_init[] = {1}; 9911 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9912 static int32_t param34_init[] = {1}; 9913 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9914 static int32_t param35_init[] = {1}; 9915 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9916 static int32_t param36_init[] = {0}; 9917 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9918 static bool8 layout_init[] = {true}; 9919 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9920 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9921 // Phase 3, inputs and outputs 9922 model->identifyInputsAndOutputs( 9923 {op15}, 9924 {op46}); 9925 assert(model->isValid()); 9926 } 9927 9928 inline bool is_ignored_3_H3_W2_SAME_dynamic_output_shape_nchw(int i) { 9929 static std::set<int> ignore = {}; 9930 return ignore.find(i) != ignore.end(); 9931 } 9932 9933 void CreateModel_3_H3_W2_SAME_dynamic_output_shape_nchw_relaxed(Model *model) { 9934 OperandType type0(Type::BOOL, {}); 9935 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 9936 OperandType type4(Type::INT32, {}); 9937 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9938 OperandType type8(Type::TENSOR_FLOAT32, {3}); 9939 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 9940 // Phase 1, operands 9941 auto op15 = model->addOperand(&type90); 9942 auto op25 = model->addOperand(&type14); 9943 auto op35 = model->addOperand(&type8); 9944 auto param33 = model->addOperand(&type4); 9945 auto param34 = model->addOperand(&type4); 9946 auto param35 = model->addOperand(&type4); 9947 auto param36 = model->addOperand(&type4); 9948 auto layout = model->addOperand(&type0); 9949 auto op46 = model->addOperand(&type46); 9950 // Phase 2, operations 9951 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 9952 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 9953 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 9954 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 9955 static int32_t param33_init[] = {1}; 9956 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 9957 static int32_t param34_init[] = {1}; 9958 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 9959 static int32_t param35_init[] = {1}; 9960 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 9961 static int32_t param36_init[] = {0}; 9962 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 9963 static bool8 layout_init[] = {true}; 9964 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9965 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 9966 // Phase 3, inputs and outputs 9967 model->identifyInputsAndOutputs( 9968 {op15}, 9969 {op46}); 9970 // Phase 4: set relaxed execution 9971 model->relaxComputationFloat32toFloat16(true); 9972 assert(model->isValid()); 9973 } 9974 9975 inline bool is_ignored_3_H3_W2_SAME_dynamic_output_shape_nchw_relaxed(int i) { 9976 static std::set<int> ignore = {}; 9977 return ignore.find(i) != ignore.end(); 9978 } 9979 9980 void CreateModel_3_H3_W2_SAME_dynamic_output_shape_nchw_float16(Model *model) { 9981 OperandType type0(Type::BOOL, {}); 9982 OperandType type4(Type::INT32, {}); 9983 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9984 OperandType type68(Type::TENSOR_FLOAT16, {3}); 9985 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 9986 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 9987 // Phase 1, operands 9988 auto op15 = model->addOperand(&type92); 9989 auto op25 = model->addOperand(&type97); 9990 auto op35 = model->addOperand(&type68); 9991 auto param33 = model->addOperand(&type4); 9992 auto param34 = model->addOperand(&type4); 9993 auto param35 = model->addOperand(&type4); 9994 auto param36 = model->addOperand(&type4); 9995 auto layout = model->addOperand(&type0); 9996 auto op46 = model->addOperand(&type48); 9997 // Phase 2, operations 9998 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 9999 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 10000 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 10001 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 10002 static int32_t param33_init[] = {1}; 10003 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 10004 static int32_t param34_init[] = {1}; 10005 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 10006 static int32_t param35_init[] = {1}; 10007 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 10008 static int32_t param36_init[] = {0}; 10009 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 10010 static bool8 layout_init[] = {true}; 10011 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10012 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param33, param34, param35, param36, layout}, {op46}); 10013 // Phase 3, inputs and outputs 10014 model->identifyInputsAndOutputs( 10015 {op15}, 10016 {op46}); 10017 assert(model->isValid()); 10018 } 10019 10020 inline bool is_ignored_3_H3_W2_SAME_dynamic_output_shape_nchw_float16(int i) { 10021 static std::set<int> ignore = {}; 10022 return ignore.find(i) != ignore.end(); 10023 } 10024 10025 void CreateModel_3_H3_W2_VALID_nhwc(Model *model) { 10026 OperandType type0(Type::BOOL, {}); 10027 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 10028 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10029 OperandType type15(Type::TENSOR_FLOAT32, {1, 6, 7, 3}); 10030 OperandType type4(Type::INT32, {}); 10031 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10032 // Phase 1, operands 10033 auto op15 = model->addOperand(&type10); 10034 auto op25 = model->addOperand(&type14); 10035 auto op35 = model->addOperand(&type8); 10036 auto param37 = model->addOperand(&type4); 10037 auto param38 = model->addOperand(&type4); 10038 auto param39 = model->addOperand(&type4); 10039 auto param40 = model->addOperand(&type4); 10040 auto layout = model->addOperand(&type0); 10041 auto op47 = model->addOperand(&type15); 10042 // Phase 2, operations 10043 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10044 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10045 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10046 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10047 static int32_t param37_init[] = {2}; 10048 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10049 static int32_t param38_init[] = {1}; 10050 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10051 static int32_t param39_init[] = {1}; 10052 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10053 static int32_t param40_init[] = {0}; 10054 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10055 static bool8 layout_init[] = {false}; 10056 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10057 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10058 // Phase 3, inputs and outputs 10059 model->identifyInputsAndOutputs( 10060 {op15}, 10061 {op47}); 10062 assert(model->isValid()); 10063 } 10064 10065 inline bool is_ignored_3_H3_W2_VALID_nhwc(int i) { 10066 static std::set<int> ignore = {}; 10067 return ignore.find(i) != ignore.end(); 10068 } 10069 10070 void CreateModel_3_H3_W2_VALID_nhwc_relaxed(Model *model) { 10071 OperandType type0(Type::BOOL, {}); 10072 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 10073 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10074 OperandType type15(Type::TENSOR_FLOAT32, {1, 6, 7, 3}); 10075 OperandType type4(Type::INT32, {}); 10076 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10077 // Phase 1, operands 10078 auto op15 = model->addOperand(&type10); 10079 auto op25 = model->addOperand(&type14); 10080 auto op35 = model->addOperand(&type8); 10081 auto param37 = model->addOperand(&type4); 10082 auto param38 = model->addOperand(&type4); 10083 auto param39 = model->addOperand(&type4); 10084 auto param40 = model->addOperand(&type4); 10085 auto layout = model->addOperand(&type0); 10086 auto op47 = model->addOperand(&type15); 10087 // Phase 2, operations 10088 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10089 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10090 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10091 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10092 static int32_t param37_init[] = {2}; 10093 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10094 static int32_t param38_init[] = {1}; 10095 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10096 static int32_t param39_init[] = {1}; 10097 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10098 static int32_t param40_init[] = {0}; 10099 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10100 static bool8 layout_init[] = {false}; 10101 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10102 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10103 // Phase 3, inputs and outputs 10104 model->identifyInputsAndOutputs( 10105 {op15}, 10106 {op47}); 10107 // Phase 4: set relaxed execution 10108 model->relaxComputationFloat32toFloat16(true); 10109 assert(model->isValid()); 10110 } 10111 10112 inline bool is_ignored_3_H3_W2_VALID_nhwc_relaxed(int i) { 10113 static std::set<int> ignore = {}; 10114 return ignore.find(i) != ignore.end(); 10115 } 10116 10117 void CreateModel_3_H3_W2_VALID_nhwc_float16(Model *model) { 10118 OperandType type0(Type::BOOL, {}); 10119 OperandType type4(Type::INT32, {}); 10120 OperandType type68(Type::TENSOR_FLOAT16, {3}); 10121 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 10122 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 10123 OperandType type98(Type::TENSOR_FLOAT16, {1, 6, 7, 3}); 10124 // Phase 1, operands 10125 auto op15 = model->addOperand(&type88); 10126 auto op25 = model->addOperand(&type97); 10127 auto op35 = model->addOperand(&type68); 10128 auto param37 = model->addOperand(&type4); 10129 auto param38 = model->addOperand(&type4); 10130 auto param39 = model->addOperand(&type4); 10131 auto param40 = model->addOperand(&type4); 10132 auto layout = model->addOperand(&type0); 10133 auto op47 = model->addOperand(&type98); 10134 // Phase 2, operations 10135 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 10136 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 10137 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 10138 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 10139 static int32_t param37_init[] = {2}; 10140 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10141 static int32_t param38_init[] = {1}; 10142 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10143 static int32_t param39_init[] = {1}; 10144 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10145 static int32_t param40_init[] = {0}; 10146 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10147 static bool8 layout_init[] = {false}; 10148 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10149 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10150 // Phase 3, inputs and outputs 10151 model->identifyInputsAndOutputs( 10152 {op15}, 10153 {op47}); 10154 assert(model->isValid()); 10155 } 10156 10157 inline bool is_ignored_3_H3_W2_VALID_nhwc_float16(int i) { 10158 static std::set<int> ignore = {}; 10159 return ignore.find(i) != ignore.end(); 10160 } 10161 10162 void CreateModel_3_H3_W2_VALID_nchw(Model *model) { 10163 OperandType type0(Type::BOOL, {}); 10164 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10165 OperandType type4(Type::INT32, {}); 10166 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10167 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 10168 OperandType type99(Type::TENSOR_FLOAT32, {1, 3, 6, 7}); 10169 // Phase 1, operands 10170 auto op15 = model->addOperand(&type90); 10171 auto op25 = model->addOperand(&type14); 10172 auto op35 = model->addOperand(&type8); 10173 auto param37 = model->addOperand(&type4); 10174 auto param38 = model->addOperand(&type4); 10175 auto param39 = model->addOperand(&type4); 10176 auto param40 = model->addOperand(&type4); 10177 auto layout = model->addOperand(&type0); 10178 auto op47 = model->addOperand(&type99); 10179 // Phase 2, operations 10180 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10181 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10182 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10183 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10184 static int32_t param37_init[] = {2}; 10185 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10186 static int32_t param38_init[] = {1}; 10187 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10188 static int32_t param39_init[] = {1}; 10189 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10190 static int32_t param40_init[] = {0}; 10191 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10192 static bool8 layout_init[] = {true}; 10193 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10194 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10195 // Phase 3, inputs and outputs 10196 model->identifyInputsAndOutputs( 10197 {op15}, 10198 {op47}); 10199 assert(model->isValid()); 10200 } 10201 10202 inline bool is_ignored_3_H3_W2_VALID_nchw(int i) { 10203 static std::set<int> ignore = {}; 10204 return ignore.find(i) != ignore.end(); 10205 } 10206 10207 void CreateModel_3_H3_W2_VALID_nchw_relaxed(Model *model) { 10208 OperandType type0(Type::BOOL, {}); 10209 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10210 OperandType type4(Type::INT32, {}); 10211 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10212 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 10213 OperandType type99(Type::TENSOR_FLOAT32, {1, 3, 6, 7}); 10214 // Phase 1, operands 10215 auto op15 = model->addOperand(&type90); 10216 auto op25 = model->addOperand(&type14); 10217 auto op35 = model->addOperand(&type8); 10218 auto param37 = model->addOperand(&type4); 10219 auto param38 = model->addOperand(&type4); 10220 auto param39 = model->addOperand(&type4); 10221 auto param40 = model->addOperand(&type4); 10222 auto layout = model->addOperand(&type0); 10223 auto op47 = model->addOperand(&type99); 10224 // Phase 2, operations 10225 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10226 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10227 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10228 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10229 static int32_t param37_init[] = {2}; 10230 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10231 static int32_t param38_init[] = {1}; 10232 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10233 static int32_t param39_init[] = {1}; 10234 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10235 static int32_t param40_init[] = {0}; 10236 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10237 static bool8 layout_init[] = {true}; 10238 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10239 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10240 // Phase 3, inputs and outputs 10241 model->identifyInputsAndOutputs( 10242 {op15}, 10243 {op47}); 10244 // Phase 4: set relaxed execution 10245 model->relaxComputationFloat32toFloat16(true); 10246 assert(model->isValid()); 10247 } 10248 10249 inline bool is_ignored_3_H3_W2_VALID_nchw_relaxed(int i) { 10250 static std::set<int> ignore = {}; 10251 return ignore.find(i) != ignore.end(); 10252 } 10253 10254 void CreateModel_3_H3_W2_VALID_nchw_float16(Model *model) { 10255 OperandType type0(Type::BOOL, {}); 10256 OperandType type100(Type::TENSOR_FLOAT16, {1, 3, 6, 7}); 10257 OperandType type4(Type::INT32, {}); 10258 OperandType type68(Type::TENSOR_FLOAT16, {3}); 10259 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 10260 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 10261 // Phase 1, operands 10262 auto op15 = model->addOperand(&type92); 10263 auto op25 = model->addOperand(&type97); 10264 auto op35 = model->addOperand(&type68); 10265 auto param37 = model->addOperand(&type4); 10266 auto param38 = model->addOperand(&type4); 10267 auto param39 = model->addOperand(&type4); 10268 auto param40 = model->addOperand(&type4); 10269 auto layout = model->addOperand(&type0); 10270 auto op47 = model->addOperand(&type100); 10271 // Phase 2, operations 10272 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 10273 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 10274 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 10275 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 10276 static int32_t param37_init[] = {2}; 10277 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10278 static int32_t param38_init[] = {1}; 10279 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10280 static int32_t param39_init[] = {1}; 10281 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10282 static int32_t param40_init[] = {0}; 10283 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10284 static bool8 layout_init[] = {true}; 10285 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10286 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10287 // Phase 3, inputs and outputs 10288 model->identifyInputsAndOutputs( 10289 {op15}, 10290 {op47}); 10291 assert(model->isValid()); 10292 } 10293 10294 inline bool is_ignored_3_H3_W2_VALID_nchw_float16(int i) { 10295 static std::set<int> ignore = {}; 10296 return ignore.find(i) != ignore.end(); 10297 } 10298 10299 void CreateModel_3_H3_W2_VALID_dynamic_output_shape_nhwc(Model *model) { 10300 OperandType type0(Type::BOOL, {}); 10301 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 10302 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10303 OperandType type4(Type::INT32, {}); 10304 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 10305 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10306 // Phase 1, operands 10307 auto op15 = model->addOperand(&type10); 10308 auto op25 = model->addOperand(&type14); 10309 auto op35 = model->addOperand(&type8); 10310 auto param37 = model->addOperand(&type4); 10311 auto param38 = model->addOperand(&type4); 10312 auto param39 = model->addOperand(&type4); 10313 auto param40 = model->addOperand(&type4); 10314 auto layout = model->addOperand(&type0); 10315 auto op47 = model->addOperand(&type46); 10316 // Phase 2, operations 10317 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10318 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10319 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10320 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10321 static int32_t param37_init[] = {2}; 10322 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10323 static int32_t param38_init[] = {1}; 10324 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10325 static int32_t param39_init[] = {1}; 10326 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10327 static int32_t param40_init[] = {0}; 10328 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10329 static bool8 layout_init[] = {false}; 10330 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10331 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10332 // Phase 3, inputs and outputs 10333 model->identifyInputsAndOutputs( 10334 {op15}, 10335 {op47}); 10336 assert(model->isValid()); 10337 } 10338 10339 inline bool is_ignored_3_H3_W2_VALID_dynamic_output_shape_nhwc(int i) { 10340 static std::set<int> ignore = {}; 10341 return ignore.find(i) != ignore.end(); 10342 } 10343 10344 void CreateModel_3_H3_W2_VALID_dynamic_output_shape_nhwc_relaxed(Model *model) { 10345 OperandType type0(Type::BOOL, {}); 10346 OperandType type10(Type::TENSOR_FLOAT32, {1, 8, 8, 3}); 10347 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10348 OperandType type4(Type::INT32, {}); 10349 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 10350 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10351 // Phase 1, operands 10352 auto op15 = model->addOperand(&type10); 10353 auto op25 = model->addOperand(&type14); 10354 auto op35 = model->addOperand(&type8); 10355 auto param37 = model->addOperand(&type4); 10356 auto param38 = model->addOperand(&type4); 10357 auto param39 = model->addOperand(&type4); 10358 auto param40 = model->addOperand(&type4); 10359 auto layout = model->addOperand(&type0); 10360 auto op47 = model->addOperand(&type46); 10361 // Phase 2, operations 10362 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10363 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10364 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10365 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10366 static int32_t param37_init[] = {2}; 10367 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10368 static int32_t param38_init[] = {1}; 10369 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10370 static int32_t param39_init[] = {1}; 10371 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10372 static int32_t param40_init[] = {0}; 10373 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10374 static bool8 layout_init[] = {false}; 10375 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10376 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10377 // Phase 3, inputs and outputs 10378 model->identifyInputsAndOutputs( 10379 {op15}, 10380 {op47}); 10381 // Phase 4: set relaxed execution 10382 model->relaxComputationFloat32toFloat16(true); 10383 assert(model->isValid()); 10384 } 10385 10386 inline bool is_ignored_3_H3_W2_VALID_dynamic_output_shape_nhwc_relaxed(int i) { 10387 static std::set<int> ignore = {}; 10388 return ignore.find(i) != ignore.end(); 10389 } 10390 10391 void CreateModel_3_H3_W2_VALID_dynamic_output_shape_nhwc_float16(Model *model) { 10392 OperandType type0(Type::BOOL, {}); 10393 OperandType type4(Type::INT32, {}); 10394 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 10395 OperandType type68(Type::TENSOR_FLOAT16, {3}); 10396 OperandType type88(Type::TENSOR_FLOAT16, {1, 8, 8, 3}); 10397 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 10398 // Phase 1, operands 10399 auto op15 = model->addOperand(&type88); 10400 auto op25 = model->addOperand(&type97); 10401 auto op35 = model->addOperand(&type68); 10402 auto param37 = model->addOperand(&type4); 10403 auto param38 = model->addOperand(&type4); 10404 auto param39 = model->addOperand(&type4); 10405 auto param40 = model->addOperand(&type4); 10406 auto layout = model->addOperand(&type0); 10407 auto op47 = model->addOperand(&type48); 10408 // Phase 2, operations 10409 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 10410 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 10411 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 10412 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 10413 static int32_t param37_init[] = {2}; 10414 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10415 static int32_t param38_init[] = {1}; 10416 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10417 static int32_t param39_init[] = {1}; 10418 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10419 static int32_t param40_init[] = {0}; 10420 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10421 static bool8 layout_init[] = {false}; 10422 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10423 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10424 // Phase 3, inputs and outputs 10425 model->identifyInputsAndOutputs( 10426 {op15}, 10427 {op47}); 10428 assert(model->isValid()); 10429 } 10430 10431 inline bool is_ignored_3_H3_W2_VALID_dynamic_output_shape_nhwc_float16(int i) { 10432 static std::set<int> ignore = {}; 10433 return ignore.find(i) != ignore.end(); 10434 } 10435 10436 void CreateModel_3_H3_W2_VALID_dynamic_output_shape_nchw(Model *model) { 10437 OperandType type0(Type::BOOL, {}); 10438 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10439 OperandType type4(Type::INT32, {}); 10440 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 10441 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10442 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 10443 // Phase 1, operands 10444 auto op15 = model->addOperand(&type90); 10445 auto op25 = model->addOperand(&type14); 10446 auto op35 = model->addOperand(&type8); 10447 auto param37 = model->addOperand(&type4); 10448 auto param38 = model->addOperand(&type4); 10449 auto param39 = model->addOperand(&type4); 10450 auto param40 = model->addOperand(&type4); 10451 auto layout = model->addOperand(&type0); 10452 auto op47 = model->addOperand(&type46); 10453 // Phase 2, operations 10454 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10455 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10456 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10457 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10458 static int32_t param37_init[] = {2}; 10459 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10460 static int32_t param38_init[] = {1}; 10461 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10462 static int32_t param39_init[] = {1}; 10463 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10464 static int32_t param40_init[] = {0}; 10465 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10466 static bool8 layout_init[] = {true}; 10467 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10468 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10469 // Phase 3, inputs and outputs 10470 model->identifyInputsAndOutputs( 10471 {op15}, 10472 {op47}); 10473 assert(model->isValid()); 10474 } 10475 10476 inline bool is_ignored_3_H3_W2_VALID_dynamic_output_shape_nchw(int i) { 10477 static std::set<int> ignore = {}; 10478 return ignore.find(i) != ignore.end(); 10479 } 10480 10481 void CreateModel_3_H3_W2_VALID_dynamic_output_shape_nchw_relaxed(Model *model) { 10482 OperandType type0(Type::BOOL, {}); 10483 OperandType type14(Type::TENSOR_FLOAT32, {3, 3, 2, 3}); 10484 OperandType type4(Type::INT32, {}); 10485 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 10486 OperandType type8(Type::TENSOR_FLOAT32, {3}); 10487 OperandType type90(Type::TENSOR_FLOAT32, {1, 3, 8, 8}); 10488 // Phase 1, operands 10489 auto op15 = model->addOperand(&type90); 10490 auto op25 = model->addOperand(&type14); 10491 auto op35 = model->addOperand(&type8); 10492 auto param37 = model->addOperand(&type4); 10493 auto param38 = model->addOperand(&type4); 10494 auto param39 = model->addOperand(&type4); 10495 auto param40 = model->addOperand(&type4); 10496 auto layout = model->addOperand(&type0); 10497 auto op47 = model->addOperand(&type46); 10498 // Phase 2, operations 10499 static float op25_init[] = {-0.966213f, -0.579455f, -0.684259f, 0.738216f, 0.184325f, 0.0973683f, -0.176863f, -0.23936f, -0.000233404f, 0.055546f, -0.232658f, -0.316404f, -0.012904f, 0.320705f, -0.326657f, -0.919674f, 0.868081f, -0.824608f, -0.467474f, 0.0278809f, 0.563238f, 0.386045f, -0.270568f, -0.941308f, -0.779227f, -0.261492f, -0.774804f, -0.79665f, 0.22473f, -0.414312f, 0.685897f, -0.327792f, 0.77395f, -0.714578f, -0.972365f, 0.0696099f, -0.82203f, -0.79946f, 0.37289f, -0.917775f, 0.82236f, -0.144706f, -0.167188f, 0.268062f, 0.702641f, -0.412223f, 0.755759f, 0.721547f, -0.43637f, -0.274905f, -0.269165f, 0.16102f, 0.819857f, -0.312008f}; 10500 model->setOperandValue(op25, op25_init, sizeof(float) * 54); 10501 static float op35_init[] = {0.0f, 0.0f, 0.0f}; 10502 model->setOperandValue(op35, op35_init, sizeof(float) * 3); 10503 static int32_t param37_init[] = {2}; 10504 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10505 static int32_t param38_init[] = {1}; 10506 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10507 static int32_t param39_init[] = {1}; 10508 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10509 static int32_t param40_init[] = {0}; 10510 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10511 static bool8 layout_init[] = {true}; 10512 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10513 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10514 // Phase 3, inputs and outputs 10515 model->identifyInputsAndOutputs( 10516 {op15}, 10517 {op47}); 10518 // Phase 4: set relaxed execution 10519 model->relaxComputationFloat32toFloat16(true); 10520 assert(model->isValid()); 10521 } 10522 10523 inline bool is_ignored_3_H3_W2_VALID_dynamic_output_shape_nchw_relaxed(int i) { 10524 static std::set<int> ignore = {}; 10525 return ignore.find(i) != ignore.end(); 10526 } 10527 10528 void CreateModel_3_H3_W2_VALID_dynamic_output_shape_nchw_float16(Model *model) { 10529 OperandType type0(Type::BOOL, {}); 10530 OperandType type4(Type::INT32, {}); 10531 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 10532 OperandType type68(Type::TENSOR_FLOAT16, {3}); 10533 OperandType type92(Type::TENSOR_FLOAT16, {1, 3, 8, 8}); 10534 OperandType type97(Type::TENSOR_FLOAT16, {3, 3, 2, 3}); 10535 // Phase 1, operands 10536 auto op15 = model->addOperand(&type92); 10537 auto op25 = model->addOperand(&type97); 10538 auto op35 = model->addOperand(&type68); 10539 auto param37 = model->addOperand(&type4); 10540 auto param38 = model->addOperand(&type4); 10541 auto param39 = model->addOperand(&type4); 10542 auto param40 = model->addOperand(&type4); 10543 auto layout = model->addOperand(&type0); 10544 auto op47 = model->addOperand(&type48); 10545 // Phase 2, operations 10546 static _Float16 op25_init[] = {-0.9662129878997803f, -0.5794550180435181f, -0.6842589974403381f, 0.738215982913971f, 0.18432499468326569f, 0.09736829996109009f, -0.17686299979686737f, -0.2393600046634674f, -0.0002334040036657825f, 0.055546000599861145f, -0.2326579988002777f, -0.3164040148258209f, -0.012903999537229538f, 0.32070499658584595f, -0.3266569972038269f, -0.9196739792823792f, 0.8680809736251831f, -0.8246080279350281f, -0.4674740135669708f, 0.027880899608135223f, 0.5632380247116089f, 0.38604500889778137f, -0.27056801319122314f, -0.9413080215454102f, -0.7792270183563232f, -0.2614920139312744f, -0.7748039960861206f, -0.7966499924659729f, 0.2247299998998642f, -0.4143120050430298f, 0.6858969926834106f, -0.3277919888496399f, 0.7739499807357788f, -0.7145779728889465f, -0.9723650217056274f, 0.06960990279912949f, -0.8220300078392029f, -0.7994599938392639f, 0.37288999557495117f, -0.9177749752998352f, 0.8223599791526794f, -0.14470599591732025f, -0.16718800365924835f, 0.2680619955062866f, 0.7026410102844238f, -0.4122230112552643f, 0.7557590007781982f, 0.72154700756073f, -0.43636998534202576f, -0.2749049961566925f, -0.2691650092601776f, 0.16101999580860138f, 0.8198570013046265f, -0.31200799345970154f}; 10547 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 54); 10548 static _Float16 op35_init[] = {0.0f, 0.0f, 0.0f}; 10549 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 3); 10550 static int32_t param37_init[] = {2}; 10551 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 10552 static int32_t param38_init[] = {1}; 10553 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 10554 static int32_t param39_init[] = {1}; 10555 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 10556 static int32_t param40_init[] = {0}; 10557 model->setOperandValue(param40, param40_init, sizeof(int32_t) * 1); 10558 static bool8 layout_init[] = {true}; 10559 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10560 model->addOperation(ANEURALNETWORKS_CONV_2D, {op15, op25, op35, param37, param38, param39, param40, layout}, {op47}); 10561 // Phase 3, inputs and outputs 10562 model->identifyInputsAndOutputs( 10563 {op15}, 10564 {op47}); 10565 assert(model->isValid()); 10566 } 10567 10568 inline bool is_ignored_3_H3_W2_VALID_dynamic_output_shape_nchw_float16(int i) { 10569 static std::set<int> ignore = {}; 10570 return ignore.find(i) != ignore.end(); 10571 } 10572 10573 void CreateModel_quant_output_multiplier_gt_1(Model *model) { 10574 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10575 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10576 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10577 OperandType type19(Type::TENSOR_QUANT8_ASYMM, {2, 1, 2, 3}, 1.0f, 127); 10578 OperandType type4(Type::INT32, {}); 10579 // Phase 1, operands 10580 auto op16 = model->addOperand(&type16); 10581 auto op26 = model->addOperand(&type17); 10582 auto op36 = model->addOperand(&type18); 10583 auto param41 = model->addOperand(&type4); 10584 auto param42 = model->addOperand(&type4); 10585 auto param43 = model->addOperand(&type4); 10586 auto param44 = model->addOperand(&type4); 10587 auto op48 = model->addOperand(&type19); 10588 // Phase 2, operations 10589 static uint8_t op26_init[] = {129, 130, 131, 132, 127, 129, 127, 129, 127, 127, 129, 129}; 10590 model->setOperandValue(op26, op26_init, sizeof(uint8_t) * 12); 10591 static int32_t op36_init[] = {1, 2, 3}; 10592 model->setOperandValue(op36, op36_init, sizeof(int32_t) * 3); 10593 static int32_t param41_init[] = {2}; 10594 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10595 static int32_t param42_init[] = {2}; 10596 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10597 static int32_t param43_init[] = {2}; 10598 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10599 static int32_t param44_init[] = {0}; 10600 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10601 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10602 // Phase 3, inputs and outputs 10603 model->identifyInputsAndOutputs( 10604 {op16}, 10605 {op48}); 10606 assert(model->isValid()); 10607 } 10608 10609 inline bool is_ignored_quant_output_multiplier_gt_1(int i) { 10610 static std::set<int> ignore = {}; 10611 return ignore.find(i) != ignore.end(); 10612 } 10613 10614 void CreateModel_quant_output_multiplier_gt_1_relaxed(Model *model) { 10615 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10616 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10617 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10618 OperandType type19(Type::TENSOR_QUANT8_ASYMM, {2, 1, 2, 3}, 1.0f, 127); 10619 OperandType type4(Type::INT32, {}); 10620 // Phase 1, operands 10621 auto op16 = model->addOperand(&type16); 10622 auto op26 = model->addOperand(&type17); 10623 auto op36 = model->addOperand(&type18); 10624 auto param41 = model->addOperand(&type4); 10625 auto param42 = model->addOperand(&type4); 10626 auto param43 = model->addOperand(&type4); 10627 auto param44 = model->addOperand(&type4); 10628 auto op48 = model->addOperand(&type19); 10629 // Phase 2, operations 10630 static uint8_t op26_init[] = {129, 130, 131, 132, 127, 129, 127, 129, 127, 127, 129, 129}; 10631 model->setOperandValue(op26, op26_init, sizeof(uint8_t) * 12); 10632 static int32_t op36_init[] = {1, 2, 3}; 10633 model->setOperandValue(op36, op36_init, sizeof(int32_t) * 3); 10634 static int32_t param41_init[] = {2}; 10635 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10636 static int32_t param42_init[] = {2}; 10637 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10638 static int32_t param43_init[] = {2}; 10639 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10640 static int32_t param44_init[] = {0}; 10641 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10642 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10643 // Phase 3, inputs and outputs 10644 model->identifyInputsAndOutputs( 10645 {op16}, 10646 {op48}); 10647 // Phase 4: set relaxed execution 10648 model->relaxComputationFloat32toFloat16(true); 10649 assert(model->isValid()); 10650 } 10651 10652 inline bool is_ignored_quant_output_multiplier_gt_1_relaxed(int i) { 10653 static std::set<int> ignore = {}; 10654 return ignore.find(i) != ignore.end(); 10655 } 10656 10657 void CreateModel_quant_output_multiplier_gt_1_weight_as_input(Model *model) { 10658 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10659 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10660 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10661 OperandType type19(Type::TENSOR_QUANT8_ASYMM, {2, 1, 2, 3}, 1.0f, 127); 10662 OperandType type4(Type::INT32, {}); 10663 // Phase 1, operands 10664 auto op16 = model->addOperand(&type16); 10665 auto op26 = model->addOperand(&type17); 10666 auto op36 = model->addOperand(&type18); 10667 auto param41 = model->addOperand(&type4); 10668 auto param42 = model->addOperand(&type4); 10669 auto param43 = model->addOperand(&type4); 10670 auto param44 = model->addOperand(&type4); 10671 auto op48 = model->addOperand(&type19); 10672 // Phase 2, operations 10673 static int32_t param41_init[] = {2}; 10674 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10675 static int32_t param42_init[] = {2}; 10676 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10677 static int32_t param43_init[] = {2}; 10678 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10679 static int32_t param44_init[] = {0}; 10680 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10681 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10682 // Phase 3, inputs and outputs 10683 model->identifyInputsAndOutputs( 10684 {op16, op26, op36}, 10685 {op48}); 10686 assert(model->isValid()); 10687 } 10688 10689 inline bool is_ignored_quant_output_multiplier_gt_1_weight_as_input(int i) { 10690 static std::set<int> ignore = {}; 10691 return ignore.find(i) != ignore.end(); 10692 } 10693 10694 void CreateModel_quant_output_multiplier_gt_1_weight_as_input_relaxed(Model *model) { 10695 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10696 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10697 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10698 OperandType type19(Type::TENSOR_QUANT8_ASYMM, {2, 1, 2, 3}, 1.0f, 127); 10699 OperandType type4(Type::INT32, {}); 10700 // Phase 1, operands 10701 auto op16 = model->addOperand(&type16); 10702 auto op26 = model->addOperand(&type17); 10703 auto op36 = model->addOperand(&type18); 10704 auto param41 = model->addOperand(&type4); 10705 auto param42 = model->addOperand(&type4); 10706 auto param43 = model->addOperand(&type4); 10707 auto param44 = model->addOperand(&type4); 10708 auto op48 = model->addOperand(&type19); 10709 // Phase 2, operations 10710 static int32_t param41_init[] = {2}; 10711 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10712 static int32_t param42_init[] = {2}; 10713 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10714 static int32_t param43_init[] = {2}; 10715 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10716 static int32_t param44_init[] = {0}; 10717 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10718 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10719 // Phase 3, inputs and outputs 10720 model->identifyInputsAndOutputs( 10721 {op16, op26, op36}, 10722 {op48}); 10723 // Phase 4: set relaxed execution 10724 model->relaxComputationFloat32toFloat16(true); 10725 assert(model->isValid()); 10726 } 10727 10728 inline bool is_ignored_quant_output_multiplier_gt_1_weight_as_input_relaxed(int i) { 10729 static std::set<int> ignore = {}; 10730 return ignore.find(i) != ignore.end(); 10731 } 10732 10733 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape(Model *model) { 10734 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10735 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10736 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10737 OperandType type4(Type::INT32, {}); 10738 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 10739 // Phase 1, operands 10740 auto op16 = model->addOperand(&type16); 10741 auto op26 = model->addOperand(&type17); 10742 auto op36 = model->addOperand(&type18); 10743 auto param41 = model->addOperand(&type4); 10744 auto param42 = model->addOperand(&type4); 10745 auto param43 = model->addOperand(&type4); 10746 auto param44 = model->addOperand(&type4); 10747 auto op48 = model->addOperand(&type87); 10748 // Phase 2, operations 10749 static uint8_t op26_init[] = {129, 130, 131, 132, 127, 129, 127, 129, 127, 127, 129, 129}; 10750 model->setOperandValue(op26, op26_init, sizeof(uint8_t) * 12); 10751 static int32_t op36_init[] = {1, 2, 3}; 10752 model->setOperandValue(op36, op36_init, sizeof(int32_t) * 3); 10753 static int32_t param41_init[] = {2}; 10754 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10755 static int32_t param42_init[] = {2}; 10756 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10757 static int32_t param43_init[] = {2}; 10758 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10759 static int32_t param44_init[] = {0}; 10760 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10761 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10762 // Phase 3, inputs and outputs 10763 model->identifyInputsAndOutputs( 10764 {op16}, 10765 {op48}); 10766 assert(model->isValid()); 10767 } 10768 10769 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape(int i) { 10770 static std::set<int> ignore = {}; 10771 return ignore.find(i) != ignore.end(); 10772 } 10773 10774 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_relaxed(Model *model) { 10775 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10776 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10777 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10778 OperandType type4(Type::INT32, {}); 10779 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 10780 // Phase 1, operands 10781 auto op16 = model->addOperand(&type16); 10782 auto op26 = model->addOperand(&type17); 10783 auto op36 = model->addOperand(&type18); 10784 auto param41 = model->addOperand(&type4); 10785 auto param42 = model->addOperand(&type4); 10786 auto param43 = model->addOperand(&type4); 10787 auto param44 = model->addOperand(&type4); 10788 auto op48 = model->addOperand(&type87); 10789 // Phase 2, operations 10790 static uint8_t op26_init[] = {129, 130, 131, 132, 127, 129, 127, 129, 127, 127, 129, 129}; 10791 model->setOperandValue(op26, op26_init, sizeof(uint8_t) * 12); 10792 static int32_t op36_init[] = {1, 2, 3}; 10793 model->setOperandValue(op36, op36_init, sizeof(int32_t) * 3); 10794 static int32_t param41_init[] = {2}; 10795 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10796 static int32_t param42_init[] = {2}; 10797 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10798 static int32_t param43_init[] = {2}; 10799 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10800 static int32_t param44_init[] = {0}; 10801 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10802 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10803 // Phase 3, inputs and outputs 10804 model->identifyInputsAndOutputs( 10805 {op16}, 10806 {op48}); 10807 // Phase 4: set relaxed execution 10808 model->relaxComputationFloat32toFloat16(true); 10809 assert(model->isValid()); 10810 } 10811 10812 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_relaxed(int i) { 10813 static std::set<int> ignore = {}; 10814 return ignore.find(i) != ignore.end(); 10815 } 10816 10817 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input(Model *model) { 10818 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10819 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10820 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10821 OperandType type4(Type::INT32, {}); 10822 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 10823 // Phase 1, operands 10824 auto op16 = model->addOperand(&type16); 10825 auto op26 = model->addOperand(&type17); 10826 auto op36 = model->addOperand(&type18); 10827 auto param41 = model->addOperand(&type4); 10828 auto param42 = model->addOperand(&type4); 10829 auto param43 = model->addOperand(&type4); 10830 auto param44 = model->addOperand(&type4); 10831 auto op48 = model->addOperand(&type87); 10832 // Phase 2, operations 10833 static int32_t param41_init[] = {2}; 10834 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10835 static int32_t param42_init[] = {2}; 10836 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10837 static int32_t param43_init[] = {2}; 10838 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10839 static int32_t param44_init[] = {0}; 10840 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10841 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10842 // Phase 3, inputs and outputs 10843 model->identifyInputsAndOutputs( 10844 {op16, op26, op36}, 10845 {op48}); 10846 assert(model->isValid()); 10847 } 10848 10849 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input(int i) { 10850 static std::set<int> ignore = {}; 10851 return ignore.find(i) != ignore.end(); 10852 } 10853 10854 void CreateModel_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input_relaxed(Model *model) { 10855 OperandType type16(Type::TENSOR_QUANT8_ASYMM, {2, 2, 4, 1}, 1.0058823529411764f, 128); 10856 OperandType type17(Type::TENSOR_QUANT8_ASYMM, {3, 2, 2, 1}, 1.0058823529411764f, 128); 10857 OperandType type18(Type::TENSOR_INT32, {3}, 1.0117993079584775f, 0); 10858 OperandType type4(Type::INT32, {}); 10859 OperandType type87(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 1.0f, 127); 10860 // Phase 1, operands 10861 auto op16 = model->addOperand(&type16); 10862 auto op26 = model->addOperand(&type17); 10863 auto op36 = model->addOperand(&type18); 10864 auto param41 = model->addOperand(&type4); 10865 auto param42 = model->addOperand(&type4); 10866 auto param43 = model->addOperand(&type4); 10867 auto param44 = model->addOperand(&type4); 10868 auto op48 = model->addOperand(&type87); 10869 // Phase 2, operations 10870 static int32_t param41_init[] = {2}; 10871 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 10872 static int32_t param42_init[] = {2}; 10873 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 10874 static int32_t param43_init[] = {2}; 10875 model->setOperandValue(param43, param43_init, sizeof(int32_t) * 1); 10876 static int32_t param44_init[] = {0}; 10877 model->setOperandValue(param44, param44_init, sizeof(int32_t) * 1); 10878 model->addOperation(ANEURALNETWORKS_CONV_2D, {op16, op26, op36, param41, param42, param43, param44}, {op48}); 10879 // Phase 3, inputs and outputs 10880 model->identifyInputsAndOutputs( 10881 {op16, op26, op36}, 10882 {op48}); 10883 // Phase 4: set relaxed execution 10884 model->relaxComputationFloat32toFloat16(true); 10885 assert(model->isValid()); 10886 } 10887 10888 inline bool is_ignored_quant_output_multiplier_gt_1_dynamic_output_shape_weight_as_input_relaxed(int i) { 10889 static std::set<int> ignore = {}; 10890 return ignore.find(i) != ignore.end(); 10891 } 10892 10893 void CreateModel_zero_sized_nhwc(Model *model) { 10894 OperandType type0(Type::BOOL, {}); 10895 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 10896 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 10897 OperandType type22(Type::TENSOR_FLOAT32, {0}); 10898 OperandType type23(Type::TENSOR_INT32, {0}); 10899 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 10900 OperandType type25(Type::TENSOR_INT32, {1}); 10901 OperandType type26(Type::FLOAT32, {}); 10902 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 10903 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 10904 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 10905 OperandType type30(Type::TENSOR_FLOAT32, {2}); 10906 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 10907 OperandType type4(Type::INT32, {}); 10908 // Phase 1, operands 10909 auto scores = model->addOperand(&type20); 10910 auto roi = model->addOperand(&type21); 10911 auto param45 = model->addOperand(&type25); 10912 auto param46 = model->addOperand(&type26); 10913 auto param47 = model->addOperand(&type4); 10914 auto param48 = model->addOperand(&type4); 10915 auto param49 = model->addOperand(&type26); 10916 auto param50 = model->addOperand(&type26); 10917 auto param51 = model->addOperand(&type26); 10918 auto scoresOut = model->addOperand(&type22); 10919 auto roiOut = model->addOperand(&type24); 10920 auto classesOut = model->addOperand(&type23); 10921 auto batchSplitOut = model->addOperand(&type23); 10922 auto in = model->addOperand(&type27); 10923 auto param52 = model->addOperand(&type4); 10924 auto param53 = model->addOperand(&type4); 10925 auto param54 = model->addOperand(&type26); 10926 auto param55 = model->addOperand(&type26); 10927 auto param56 = model->addOperand(&type4); 10928 auto param57 = model->addOperand(&type4); 10929 auto layout = model->addOperand(&type0); 10930 auto featureMap = model->addOperand(&type28); 10931 auto weights = model->addOperand(&type29); 10932 auto bias = model->addOperand(&type30); 10933 auto param58 = model->addOperand(&type4); 10934 auto param59 = model->addOperand(&type4); 10935 auto param60 = model->addOperand(&type4); 10936 auto param61 = model->addOperand(&type4); 10937 auto param62 = model->addOperand(&type4); 10938 auto param63 = model->addOperand(&type4); 10939 auto param64 = model->addOperand(&type4); 10940 auto out = model->addOperand(&type31); 10941 // Phase 2, operations 10942 static float scores_init[] = {0.9f, 0.1f}; 10943 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 10944 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 10945 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 10946 static int32_t param45_init[] = {0}; 10947 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 10948 static float param46_init[] = {0.3f}; 10949 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 10950 static int32_t param47_init[] = {-1}; 10951 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 10952 static int32_t param48_init[] = {0}; 10953 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 10954 static float param49_init[] = {0.4f}; 10955 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 10956 static float param50_init[] = {1.0f}; 10957 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 10958 static float param51_init[] = {0.3f}; 10959 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 10960 static int32_t param52_init[] = {2}; 10961 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 10962 static int32_t param53_init[] = {2}; 10963 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 10964 static float param54_init[] = {2.0f}; 10965 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 10966 static float param55_init[] = {2.0f}; 10967 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 10968 static int32_t param56_init[] = {4}; 10969 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 10970 static int32_t param57_init[] = {4}; 10971 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 10972 static bool8 layout_init[] = {false}; 10973 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10974 static float weights_init[] = {3.0f, 4.0f}; 10975 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 10976 static float bias_init[] = {1.0f, 2.0f}; 10977 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 10978 static int32_t param58_init[] = {0}; 10979 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 10980 static int32_t param59_init[] = {0}; 10981 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 10982 static int32_t param60_init[] = {0}; 10983 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 10984 static int32_t param61_init[] = {0}; 10985 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 10986 static int32_t param62_init[] = {1}; 10987 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 10988 static int32_t param63_init[] = {1}; 10989 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 10990 static int32_t param64_init[] = {0}; 10991 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 10992 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 10993 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 10994 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 10995 // Phase 3, inputs and outputs 10996 model->identifyInputsAndOutputs( 10997 {in}, 10998 {scoresOut, classesOut, out}); 10999 assert(model->isValid()); 11000 } 11001 11002 inline bool is_ignored_zero_sized_nhwc(int i) { 11003 static std::set<int> ignore = {}; 11004 return ignore.find(i) != ignore.end(); 11005 } 11006 11007 void CreateModel_zero_sized_nhwc_relaxed(Model *model) { 11008 OperandType type0(Type::BOOL, {}); 11009 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 11010 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 11011 OperandType type22(Type::TENSOR_FLOAT32, {0}); 11012 OperandType type23(Type::TENSOR_INT32, {0}); 11013 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 11014 OperandType type25(Type::TENSOR_INT32, {1}); 11015 OperandType type26(Type::FLOAT32, {}); 11016 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 11017 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 11018 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 11019 OperandType type30(Type::TENSOR_FLOAT32, {2}); 11020 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 11021 OperandType type4(Type::INT32, {}); 11022 // Phase 1, operands 11023 auto scores = model->addOperand(&type20); 11024 auto roi = model->addOperand(&type21); 11025 auto param45 = model->addOperand(&type25); 11026 auto param46 = model->addOperand(&type26); 11027 auto param47 = model->addOperand(&type4); 11028 auto param48 = model->addOperand(&type4); 11029 auto param49 = model->addOperand(&type26); 11030 auto param50 = model->addOperand(&type26); 11031 auto param51 = model->addOperand(&type26); 11032 auto scoresOut = model->addOperand(&type22); 11033 auto roiOut = model->addOperand(&type24); 11034 auto classesOut = model->addOperand(&type23); 11035 auto batchSplitOut = model->addOperand(&type23); 11036 auto in = model->addOperand(&type27); 11037 auto param52 = model->addOperand(&type4); 11038 auto param53 = model->addOperand(&type4); 11039 auto param54 = model->addOperand(&type26); 11040 auto param55 = model->addOperand(&type26); 11041 auto param56 = model->addOperand(&type4); 11042 auto param57 = model->addOperand(&type4); 11043 auto layout = model->addOperand(&type0); 11044 auto featureMap = model->addOperand(&type28); 11045 auto weights = model->addOperand(&type29); 11046 auto bias = model->addOperand(&type30); 11047 auto param58 = model->addOperand(&type4); 11048 auto param59 = model->addOperand(&type4); 11049 auto param60 = model->addOperand(&type4); 11050 auto param61 = model->addOperand(&type4); 11051 auto param62 = model->addOperand(&type4); 11052 auto param63 = model->addOperand(&type4); 11053 auto param64 = model->addOperand(&type4); 11054 auto out = model->addOperand(&type31); 11055 // Phase 2, operations 11056 static float scores_init[] = {0.9f, 0.1f}; 11057 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 11058 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11059 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 11060 static int32_t param45_init[] = {0}; 11061 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11062 static float param46_init[] = {0.3f}; 11063 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11064 static int32_t param47_init[] = {-1}; 11065 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11066 static int32_t param48_init[] = {0}; 11067 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11068 static float param49_init[] = {0.4f}; 11069 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11070 static float param50_init[] = {1.0f}; 11071 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11072 static float param51_init[] = {0.3f}; 11073 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11074 static int32_t param52_init[] = {2}; 11075 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11076 static int32_t param53_init[] = {2}; 11077 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11078 static float param54_init[] = {2.0f}; 11079 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11080 static float param55_init[] = {2.0f}; 11081 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11082 static int32_t param56_init[] = {4}; 11083 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11084 static int32_t param57_init[] = {4}; 11085 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11086 static bool8 layout_init[] = {false}; 11087 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11088 static float weights_init[] = {3.0f, 4.0f}; 11089 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 11090 static float bias_init[] = {1.0f, 2.0f}; 11091 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 11092 static int32_t param58_init[] = {0}; 11093 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11094 static int32_t param59_init[] = {0}; 11095 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11096 static int32_t param60_init[] = {0}; 11097 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11098 static int32_t param61_init[] = {0}; 11099 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11100 static int32_t param62_init[] = {1}; 11101 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11102 static int32_t param63_init[] = {1}; 11103 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11104 static int32_t param64_init[] = {0}; 11105 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11106 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11107 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11108 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11109 // Phase 3, inputs and outputs 11110 model->identifyInputsAndOutputs( 11111 {in}, 11112 {scoresOut, classesOut, out}); 11113 // Phase 4: set relaxed execution 11114 model->relaxComputationFloat32toFloat16(true); 11115 assert(model->isValid()); 11116 } 11117 11118 inline bool is_ignored_zero_sized_nhwc_relaxed(int i) { 11119 static std::set<int> ignore = {}; 11120 return ignore.find(i) != ignore.end(); 11121 } 11122 11123 void CreateModel_zero_sized_nhwc_quant8(Model *model) { 11124 OperandType type0(Type::BOOL, {}); 11125 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 11126 OperandType type102(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); 11127 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 11128 OperandType type104(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 2}, 0.1f, 128); 11129 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 11130 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 11131 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 11132 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 11133 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 11134 OperandType type23(Type::TENSOR_INT32, {0}); 11135 OperandType type25(Type::TENSOR_INT32, {1}); 11136 OperandType type26(Type::FLOAT32, {}); 11137 OperandType type4(Type::INT32, {}); 11138 // Phase 1, operands 11139 auto scores = model->addOperand(&type107); 11140 auto roi = model->addOperand(&type105); 11141 auto param45 = model->addOperand(&type25); 11142 auto param46 = model->addOperand(&type26); 11143 auto param47 = model->addOperand(&type4); 11144 auto param48 = model->addOperand(&type4); 11145 auto param49 = model->addOperand(&type26); 11146 auto param50 = model->addOperand(&type26); 11147 auto param51 = model->addOperand(&type26); 11148 auto scoresOut = model->addOperand(&type108); 11149 auto roiOut = model->addOperand(&type106); 11150 auto classesOut = model->addOperand(&type23); 11151 auto batchSplitOut = model->addOperand(&type23); 11152 auto in = model->addOperand(&type103); 11153 auto param52 = model->addOperand(&type4); 11154 auto param53 = model->addOperand(&type4); 11155 auto param54 = model->addOperand(&type26); 11156 auto param55 = model->addOperand(&type26); 11157 auto param56 = model->addOperand(&type4); 11158 auto param57 = model->addOperand(&type4); 11159 auto layout = model->addOperand(&type0); 11160 auto featureMap = model->addOperand(&type102); 11161 auto weights = model->addOperand(&type109); 11162 auto bias = model->addOperand(&type101); 11163 auto param58 = model->addOperand(&type4); 11164 auto param59 = model->addOperand(&type4); 11165 auto param60 = model->addOperand(&type4); 11166 auto param61 = model->addOperand(&type4); 11167 auto param62 = model->addOperand(&type4); 11168 auto param63 = model->addOperand(&type4); 11169 auto param64 = model->addOperand(&type4); 11170 auto out = model->addOperand(&type104); 11171 // Phase 2, operations 11172 static uint8_t scores_init[] = {137, 129}; 11173 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 11174 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 11175 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 11176 static int32_t param45_init[] = {0}; 11177 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11178 static float param46_init[] = {0.3f}; 11179 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11180 static int32_t param47_init[] = {-1}; 11181 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11182 static int32_t param48_init[] = {0}; 11183 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11184 static float param49_init[] = {0.4f}; 11185 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11186 static float param50_init[] = {1.0f}; 11187 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11188 static float param51_init[] = {0.3f}; 11189 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11190 static int32_t param52_init[] = {2}; 11191 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11192 static int32_t param53_init[] = {2}; 11193 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11194 static float param54_init[] = {2.0f}; 11195 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11196 static float param55_init[] = {2.0f}; 11197 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11198 static int32_t param56_init[] = {4}; 11199 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11200 static int32_t param57_init[] = {4}; 11201 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11202 static bool8 layout_init[] = {false}; 11203 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11204 static uint8_t weights_init[] = {158, 168}; 11205 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 2); 11206 static int32_t bias_init[] = {100, 200}; 11207 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 11208 static int32_t param58_init[] = {0}; 11209 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11210 static int32_t param59_init[] = {0}; 11211 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11212 static int32_t param60_init[] = {0}; 11213 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11214 static int32_t param61_init[] = {0}; 11215 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11216 static int32_t param62_init[] = {1}; 11217 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11218 static int32_t param63_init[] = {1}; 11219 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11220 static int32_t param64_init[] = {0}; 11221 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11222 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11223 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11224 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11225 // Phase 3, inputs and outputs 11226 model->identifyInputsAndOutputs( 11227 {in}, 11228 {scoresOut, classesOut, out}); 11229 assert(model->isValid()); 11230 } 11231 11232 inline bool is_ignored_zero_sized_nhwc_quant8(int i) { 11233 static std::set<int> ignore = {}; 11234 return ignore.find(i) != ignore.end(); 11235 } 11236 11237 void CreateModel_zero_sized_nhwc_float16(Model *model) { 11238 OperandType type0(Type::BOOL, {}); 11239 OperandType type110(Type::TENSOR_FLOAT16, {2}); 11240 OperandType type111(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); 11241 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 11242 OperandType type113(Type::TENSOR_FLOAT16, {0, 2, 2, 2}); 11243 OperandType type114(Type::FLOAT16, {}); 11244 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 11245 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 11246 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 11247 OperandType type118(Type::TENSOR_FLOAT16, {0}); 11248 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 11249 OperandType type23(Type::TENSOR_INT32, {0}); 11250 OperandType type25(Type::TENSOR_INT32, {1}); 11251 OperandType type4(Type::INT32, {}); 11252 // Phase 1, operands 11253 auto scores = model->addOperand(&type117); 11254 auto roi = model->addOperand(&type115); 11255 auto param45 = model->addOperand(&type25); 11256 auto param46 = model->addOperand(&type114); 11257 auto param47 = model->addOperand(&type4); 11258 auto param48 = model->addOperand(&type4); 11259 auto param49 = model->addOperand(&type114); 11260 auto param50 = model->addOperand(&type114); 11261 auto param51 = model->addOperand(&type114); 11262 auto scoresOut = model->addOperand(&type118); 11263 auto roiOut = model->addOperand(&type116); 11264 auto classesOut = model->addOperand(&type23); 11265 auto batchSplitOut = model->addOperand(&type23); 11266 auto in = model->addOperand(&type112); 11267 auto param52 = model->addOperand(&type4); 11268 auto param53 = model->addOperand(&type4); 11269 auto param54 = model->addOperand(&type114); 11270 auto param55 = model->addOperand(&type114); 11271 auto param56 = model->addOperand(&type4); 11272 auto param57 = model->addOperand(&type4); 11273 auto layout = model->addOperand(&type0); 11274 auto featureMap = model->addOperand(&type111); 11275 auto weights = model->addOperand(&type119); 11276 auto bias = model->addOperand(&type110); 11277 auto param58 = model->addOperand(&type4); 11278 auto param59 = model->addOperand(&type4); 11279 auto param60 = model->addOperand(&type4); 11280 auto param61 = model->addOperand(&type4); 11281 auto param62 = model->addOperand(&type4); 11282 auto param63 = model->addOperand(&type4); 11283 auto param64 = model->addOperand(&type4); 11284 auto out = model->addOperand(&type113); 11285 // Phase 2, operations 11286 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 11287 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 11288 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11289 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 11290 static int32_t param45_init[] = {0}; 11291 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11292 static _Float16 param46_init[] = {0.30000001192092896f}; 11293 model->setOperandValue(param46, param46_init, sizeof(_Float16) * 1); 11294 static int32_t param47_init[] = {-1}; 11295 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11296 static int32_t param48_init[] = {0}; 11297 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11298 static _Float16 param49_init[] = {0.4000000059604645f}; 11299 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 11300 static _Float16 param50_init[] = {1.0f}; 11301 model->setOperandValue(param50, param50_init, sizeof(_Float16) * 1); 11302 static _Float16 param51_init[] = {0.30000001192092896f}; 11303 model->setOperandValue(param51, param51_init, sizeof(_Float16) * 1); 11304 static int32_t param52_init[] = {2}; 11305 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11306 static int32_t param53_init[] = {2}; 11307 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11308 static _Float16 param54_init[] = {2.0f}; 11309 model->setOperandValue(param54, param54_init, sizeof(_Float16) * 1); 11310 static _Float16 param55_init[] = {2.0f}; 11311 model->setOperandValue(param55, param55_init, sizeof(_Float16) * 1); 11312 static int32_t param56_init[] = {4}; 11313 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11314 static int32_t param57_init[] = {4}; 11315 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11316 static bool8 layout_init[] = {false}; 11317 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11318 static _Float16 weights_init[] = {3.0f, 4.0f}; 11319 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 2); 11320 static _Float16 bias_init[] = {1.0f, 2.0f}; 11321 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 11322 static int32_t param58_init[] = {0}; 11323 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11324 static int32_t param59_init[] = {0}; 11325 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11326 static int32_t param60_init[] = {0}; 11327 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11328 static int32_t param61_init[] = {0}; 11329 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11330 static int32_t param62_init[] = {1}; 11331 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11332 static int32_t param63_init[] = {1}; 11333 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11334 static int32_t param64_init[] = {0}; 11335 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11336 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11337 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11338 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11339 // Phase 3, inputs and outputs 11340 model->identifyInputsAndOutputs( 11341 {in}, 11342 {scoresOut, classesOut, out}); 11343 assert(model->isValid()); 11344 } 11345 11346 inline bool is_ignored_zero_sized_nhwc_float16(int i) { 11347 static std::set<int> ignore = {}; 11348 return ignore.find(i) != ignore.end(); 11349 } 11350 11351 void CreateModel_zero_sized_nchw(Model *model) { 11352 OperandType type0(Type::BOOL, {}); 11353 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 11354 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 11355 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 11356 OperandType type22(Type::TENSOR_FLOAT32, {0}); 11357 OperandType type23(Type::TENSOR_INT32, {0}); 11358 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 11359 OperandType type25(Type::TENSOR_INT32, {1}); 11360 OperandType type26(Type::FLOAT32, {}); 11361 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 11362 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 11363 OperandType type30(Type::TENSOR_FLOAT32, {2}); 11364 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 11365 OperandType type4(Type::INT32, {}); 11366 // Phase 1, operands 11367 auto scores = model->addOperand(&type20); 11368 auto roi = model->addOperand(&type21); 11369 auto param45 = model->addOperand(&type25); 11370 auto param46 = model->addOperand(&type26); 11371 auto param47 = model->addOperand(&type4); 11372 auto param48 = model->addOperand(&type4); 11373 auto param49 = model->addOperand(&type26); 11374 auto param50 = model->addOperand(&type26); 11375 auto param51 = model->addOperand(&type26); 11376 auto scoresOut = model->addOperand(&type22); 11377 auto roiOut = model->addOperand(&type24); 11378 auto classesOut = model->addOperand(&type23); 11379 auto batchSplitOut = model->addOperand(&type23); 11380 auto in = model->addOperand(&type27); 11381 auto param52 = model->addOperand(&type4); 11382 auto param53 = model->addOperand(&type4); 11383 auto param54 = model->addOperand(&type26); 11384 auto param55 = model->addOperand(&type26); 11385 auto param56 = model->addOperand(&type4); 11386 auto param57 = model->addOperand(&type4); 11387 auto layout = model->addOperand(&type0); 11388 auto featureMap = model->addOperand(&type120); 11389 auto weights = model->addOperand(&type29); 11390 auto bias = model->addOperand(&type30); 11391 auto param58 = model->addOperand(&type4); 11392 auto param59 = model->addOperand(&type4); 11393 auto param60 = model->addOperand(&type4); 11394 auto param61 = model->addOperand(&type4); 11395 auto param62 = model->addOperand(&type4); 11396 auto param63 = model->addOperand(&type4); 11397 auto param64 = model->addOperand(&type4); 11398 auto out = model->addOperand(&type31); 11399 // Phase 2, operations 11400 static float scores_init[] = {0.9f, 0.1f}; 11401 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 11402 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11403 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 11404 static int32_t param45_init[] = {0}; 11405 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11406 static float param46_init[] = {0.3f}; 11407 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11408 static int32_t param47_init[] = {-1}; 11409 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11410 static int32_t param48_init[] = {0}; 11411 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11412 static float param49_init[] = {0.4f}; 11413 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11414 static float param50_init[] = {1.0f}; 11415 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11416 static float param51_init[] = {0.3f}; 11417 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11418 static int32_t param52_init[] = {2}; 11419 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11420 static int32_t param53_init[] = {2}; 11421 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11422 static float param54_init[] = {2.0f}; 11423 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11424 static float param55_init[] = {2.0f}; 11425 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11426 static int32_t param56_init[] = {4}; 11427 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11428 static int32_t param57_init[] = {4}; 11429 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11430 static bool8 layout_init[] = {true}; 11431 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11432 static float weights_init[] = {3.0f, 4.0f}; 11433 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 11434 static float bias_init[] = {1.0f, 2.0f}; 11435 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 11436 static int32_t param58_init[] = {0}; 11437 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11438 static int32_t param59_init[] = {0}; 11439 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11440 static int32_t param60_init[] = {0}; 11441 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11442 static int32_t param61_init[] = {0}; 11443 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11444 static int32_t param62_init[] = {1}; 11445 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11446 static int32_t param63_init[] = {1}; 11447 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11448 static int32_t param64_init[] = {0}; 11449 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11450 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11451 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11452 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11453 // Phase 3, inputs and outputs 11454 model->identifyInputsAndOutputs( 11455 {in}, 11456 {scoresOut, classesOut, out}); 11457 assert(model->isValid()); 11458 } 11459 11460 inline bool is_ignored_zero_sized_nchw(int i) { 11461 static std::set<int> ignore = {}; 11462 return ignore.find(i) != ignore.end(); 11463 } 11464 11465 void CreateModel_zero_sized_nchw_relaxed(Model *model) { 11466 OperandType type0(Type::BOOL, {}); 11467 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 11468 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 11469 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 11470 OperandType type22(Type::TENSOR_FLOAT32, {0}); 11471 OperandType type23(Type::TENSOR_INT32, {0}); 11472 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 11473 OperandType type25(Type::TENSOR_INT32, {1}); 11474 OperandType type26(Type::FLOAT32, {}); 11475 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 11476 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 11477 OperandType type30(Type::TENSOR_FLOAT32, {2}); 11478 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 11479 OperandType type4(Type::INT32, {}); 11480 // Phase 1, operands 11481 auto scores = model->addOperand(&type20); 11482 auto roi = model->addOperand(&type21); 11483 auto param45 = model->addOperand(&type25); 11484 auto param46 = model->addOperand(&type26); 11485 auto param47 = model->addOperand(&type4); 11486 auto param48 = model->addOperand(&type4); 11487 auto param49 = model->addOperand(&type26); 11488 auto param50 = model->addOperand(&type26); 11489 auto param51 = model->addOperand(&type26); 11490 auto scoresOut = model->addOperand(&type22); 11491 auto roiOut = model->addOperand(&type24); 11492 auto classesOut = model->addOperand(&type23); 11493 auto batchSplitOut = model->addOperand(&type23); 11494 auto in = model->addOperand(&type27); 11495 auto param52 = model->addOperand(&type4); 11496 auto param53 = model->addOperand(&type4); 11497 auto param54 = model->addOperand(&type26); 11498 auto param55 = model->addOperand(&type26); 11499 auto param56 = model->addOperand(&type4); 11500 auto param57 = model->addOperand(&type4); 11501 auto layout = model->addOperand(&type0); 11502 auto featureMap = model->addOperand(&type120); 11503 auto weights = model->addOperand(&type29); 11504 auto bias = model->addOperand(&type30); 11505 auto param58 = model->addOperand(&type4); 11506 auto param59 = model->addOperand(&type4); 11507 auto param60 = model->addOperand(&type4); 11508 auto param61 = model->addOperand(&type4); 11509 auto param62 = model->addOperand(&type4); 11510 auto param63 = model->addOperand(&type4); 11511 auto param64 = model->addOperand(&type4); 11512 auto out = model->addOperand(&type31); 11513 // Phase 2, operations 11514 static float scores_init[] = {0.9f, 0.1f}; 11515 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 11516 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11517 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 11518 static int32_t param45_init[] = {0}; 11519 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11520 static float param46_init[] = {0.3f}; 11521 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11522 static int32_t param47_init[] = {-1}; 11523 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11524 static int32_t param48_init[] = {0}; 11525 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11526 static float param49_init[] = {0.4f}; 11527 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11528 static float param50_init[] = {1.0f}; 11529 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11530 static float param51_init[] = {0.3f}; 11531 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11532 static int32_t param52_init[] = {2}; 11533 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11534 static int32_t param53_init[] = {2}; 11535 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11536 static float param54_init[] = {2.0f}; 11537 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11538 static float param55_init[] = {2.0f}; 11539 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11540 static int32_t param56_init[] = {4}; 11541 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11542 static int32_t param57_init[] = {4}; 11543 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11544 static bool8 layout_init[] = {true}; 11545 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11546 static float weights_init[] = {3.0f, 4.0f}; 11547 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 11548 static float bias_init[] = {1.0f, 2.0f}; 11549 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 11550 static int32_t param58_init[] = {0}; 11551 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11552 static int32_t param59_init[] = {0}; 11553 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11554 static int32_t param60_init[] = {0}; 11555 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11556 static int32_t param61_init[] = {0}; 11557 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11558 static int32_t param62_init[] = {1}; 11559 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11560 static int32_t param63_init[] = {1}; 11561 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11562 static int32_t param64_init[] = {0}; 11563 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11564 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11565 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11566 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11567 // Phase 3, inputs and outputs 11568 model->identifyInputsAndOutputs( 11569 {in}, 11570 {scoresOut, classesOut, out}); 11571 // Phase 4: set relaxed execution 11572 model->relaxComputationFloat32toFloat16(true); 11573 assert(model->isValid()); 11574 } 11575 11576 inline bool is_ignored_zero_sized_nchw_relaxed(int i) { 11577 static std::set<int> ignore = {}; 11578 return ignore.find(i) != ignore.end(); 11579 } 11580 11581 void CreateModel_zero_sized_nchw_quant8(Model *model) { 11582 OperandType type0(Type::BOOL, {}); 11583 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 11584 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 11585 OperandType type104(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 2}, 0.1f, 128); 11586 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 11587 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 11588 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 11589 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 11590 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 11591 OperandType type121(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); 11592 OperandType type23(Type::TENSOR_INT32, {0}); 11593 OperandType type25(Type::TENSOR_INT32, {1}); 11594 OperandType type26(Type::FLOAT32, {}); 11595 OperandType type4(Type::INT32, {}); 11596 // Phase 1, operands 11597 auto scores = model->addOperand(&type107); 11598 auto roi = model->addOperand(&type105); 11599 auto param45 = model->addOperand(&type25); 11600 auto param46 = model->addOperand(&type26); 11601 auto param47 = model->addOperand(&type4); 11602 auto param48 = model->addOperand(&type4); 11603 auto param49 = model->addOperand(&type26); 11604 auto param50 = model->addOperand(&type26); 11605 auto param51 = model->addOperand(&type26); 11606 auto scoresOut = model->addOperand(&type108); 11607 auto roiOut = model->addOperand(&type106); 11608 auto classesOut = model->addOperand(&type23); 11609 auto batchSplitOut = model->addOperand(&type23); 11610 auto in = model->addOperand(&type103); 11611 auto param52 = model->addOperand(&type4); 11612 auto param53 = model->addOperand(&type4); 11613 auto param54 = model->addOperand(&type26); 11614 auto param55 = model->addOperand(&type26); 11615 auto param56 = model->addOperand(&type4); 11616 auto param57 = model->addOperand(&type4); 11617 auto layout = model->addOperand(&type0); 11618 auto featureMap = model->addOperand(&type121); 11619 auto weights = model->addOperand(&type109); 11620 auto bias = model->addOperand(&type101); 11621 auto param58 = model->addOperand(&type4); 11622 auto param59 = model->addOperand(&type4); 11623 auto param60 = model->addOperand(&type4); 11624 auto param61 = model->addOperand(&type4); 11625 auto param62 = model->addOperand(&type4); 11626 auto param63 = model->addOperand(&type4); 11627 auto param64 = model->addOperand(&type4); 11628 auto out = model->addOperand(&type104); 11629 // Phase 2, operations 11630 static uint8_t scores_init[] = {137, 129}; 11631 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 11632 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 11633 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 11634 static int32_t param45_init[] = {0}; 11635 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11636 static float param46_init[] = {0.3f}; 11637 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11638 static int32_t param47_init[] = {-1}; 11639 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11640 static int32_t param48_init[] = {0}; 11641 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11642 static float param49_init[] = {0.4f}; 11643 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11644 static float param50_init[] = {1.0f}; 11645 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11646 static float param51_init[] = {0.3f}; 11647 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11648 static int32_t param52_init[] = {2}; 11649 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11650 static int32_t param53_init[] = {2}; 11651 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11652 static float param54_init[] = {2.0f}; 11653 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11654 static float param55_init[] = {2.0f}; 11655 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11656 static int32_t param56_init[] = {4}; 11657 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11658 static int32_t param57_init[] = {4}; 11659 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11660 static bool8 layout_init[] = {true}; 11661 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11662 static uint8_t weights_init[] = {158, 168}; 11663 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 2); 11664 static int32_t bias_init[] = {100, 200}; 11665 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 11666 static int32_t param58_init[] = {0}; 11667 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11668 static int32_t param59_init[] = {0}; 11669 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11670 static int32_t param60_init[] = {0}; 11671 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11672 static int32_t param61_init[] = {0}; 11673 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11674 static int32_t param62_init[] = {1}; 11675 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11676 static int32_t param63_init[] = {1}; 11677 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11678 static int32_t param64_init[] = {0}; 11679 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11680 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11681 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11682 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11683 // Phase 3, inputs and outputs 11684 model->identifyInputsAndOutputs( 11685 {in}, 11686 {scoresOut, classesOut, out}); 11687 assert(model->isValid()); 11688 } 11689 11690 inline bool is_ignored_zero_sized_nchw_quant8(int i) { 11691 static std::set<int> ignore = {}; 11692 return ignore.find(i) != ignore.end(); 11693 } 11694 11695 void CreateModel_zero_sized_nchw_float16(Model *model) { 11696 OperandType type0(Type::BOOL, {}); 11697 OperandType type110(Type::TENSOR_FLOAT16, {2}); 11698 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 11699 OperandType type113(Type::TENSOR_FLOAT16, {0, 2, 2, 2}); 11700 OperandType type114(Type::FLOAT16, {}); 11701 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 11702 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 11703 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 11704 OperandType type118(Type::TENSOR_FLOAT16, {0}); 11705 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 11706 OperandType type122(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); 11707 OperandType type23(Type::TENSOR_INT32, {0}); 11708 OperandType type25(Type::TENSOR_INT32, {1}); 11709 OperandType type4(Type::INT32, {}); 11710 // Phase 1, operands 11711 auto scores = model->addOperand(&type117); 11712 auto roi = model->addOperand(&type115); 11713 auto param45 = model->addOperand(&type25); 11714 auto param46 = model->addOperand(&type114); 11715 auto param47 = model->addOperand(&type4); 11716 auto param48 = model->addOperand(&type4); 11717 auto param49 = model->addOperand(&type114); 11718 auto param50 = model->addOperand(&type114); 11719 auto param51 = model->addOperand(&type114); 11720 auto scoresOut = model->addOperand(&type118); 11721 auto roiOut = model->addOperand(&type116); 11722 auto classesOut = model->addOperand(&type23); 11723 auto batchSplitOut = model->addOperand(&type23); 11724 auto in = model->addOperand(&type112); 11725 auto param52 = model->addOperand(&type4); 11726 auto param53 = model->addOperand(&type4); 11727 auto param54 = model->addOperand(&type114); 11728 auto param55 = model->addOperand(&type114); 11729 auto param56 = model->addOperand(&type4); 11730 auto param57 = model->addOperand(&type4); 11731 auto layout = model->addOperand(&type0); 11732 auto featureMap = model->addOperand(&type122); 11733 auto weights = model->addOperand(&type119); 11734 auto bias = model->addOperand(&type110); 11735 auto param58 = model->addOperand(&type4); 11736 auto param59 = model->addOperand(&type4); 11737 auto param60 = model->addOperand(&type4); 11738 auto param61 = model->addOperand(&type4); 11739 auto param62 = model->addOperand(&type4); 11740 auto param63 = model->addOperand(&type4); 11741 auto param64 = model->addOperand(&type4); 11742 auto out = model->addOperand(&type113); 11743 // Phase 2, operations 11744 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 11745 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 11746 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11747 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 11748 static int32_t param45_init[] = {0}; 11749 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11750 static _Float16 param46_init[] = {0.30000001192092896f}; 11751 model->setOperandValue(param46, param46_init, sizeof(_Float16) * 1); 11752 static int32_t param47_init[] = {-1}; 11753 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11754 static int32_t param48_init[] = {0}; 11755 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11756 static _Float16 param49_init[] = {0.4000000059604645f}; 11757 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 11758 static _Float16 param50_init[] = {1.0f}; 11759 model->setOperandValue(param50, param50_init, sizeof(_Float16) * 1); 11760 static _Float16 param51_init[] = {0.30000001192092896f}; 11761 model->setOperandValue(param51, param51_init, sizeof(_Float16) * 1); 11762 static int32_t param52_init[] = {2}; 11763 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11764 static int32_t param53_init[] = {2}; 11765 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11766 static _Float16 param54_init[] = {2.0f}; 11767 model->setOperandValue(param54, param54_init, sizeof(_Float16) * 1); 11768 static _Float16 param55_init[] = {2.0f}; 11769 model->setOperandValue(param55, param55_init, sizeof(_Float16) * 1); 11770 static int32_t param56_init[] = {4}; 11771 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11772 static int32_t param57_init[] = {4}; 11773 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11774 static bool8 layout_init[] = {true}; 11775 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11776 static _Float16 weights_init[] = {3.0f, 4.0f}; 11777 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 2); 11778 static _Float16 bias_init[] = {1.0f, 2.0f}; 11779 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 11780 static int32_t param58_init[] = {0}; 11781 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11782 static int32_t param59_init[] = {0}; 11783 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11784 static int32_t param60_init[] = {0}; 11785 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11786 static int32_t param61_init[] = {0}; 11787 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11788 static int32_t param62_init[] = {1}; 11789 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11790 static int32_t param63_init[] = {1}; 11791 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11792 static int32_t param64_init[] = {0}; 11793 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11794 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11795 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11796 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11797 // Phase 3, inputs and outputs 11798 model->identifyInputsAndOutputs( 11799 {in}, 11800 {scoresOut, classesOut, out}); 11801 assert(model->isValid()); 11802 } 11803 11804 inline bool is_ignored_zero_sized_nchw_float16(int i) { 11805 static std::set<int> ignore = {}; 11806 return ignore.find(i) != ignore.end(); 11807 } 11808 11809 void CreateModel_zero_sized_dynamic_output_shape_nhwc(Model *model) { 11810 OperandType type0(Type::BOOL, {}); 11811 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 11812 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 11813 OperandType type22(Type::TENSOR_FLOAT32, {0}); 11814 OperandType type23(Type::TENSOR_INT32, {0}); 11815 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 11816 OperandType type25(Type::TENSOR_INT32, {1}); 11817 OperandType type26(Type::FLOAT32, {}); 11818 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 11819 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 11820 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 11821 OperandType type30(Type::TENSOR_FLOAT32, {2}); 11822 OperandType type4(Type::INT32, {}); 11823 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 11824 // Phase 1, operands 11825 auto scores = model->addOperand(&type20); 11826 auto roi = model->addOperand(&type21); 11827 auto param45 = model->addOperand(&type25); 11828 auto param46 = model->addOperand(&type26); 11829 auto param47 = model->addOperand(&type4); 11830 auto param48 = model->addOperand(&type4); 11831 auto param49 = model->addOperand(&type26); 11832 auto param50 = model->addOperand(&type26); 11833 auto param51 = model->addOperand(&type26); 11834 auto scoresOut = model->addOperand(&type22); 11835 auto roiOut = model->addOperand(&type24); 11836 auto classesOut = model->addOperand(&type23); 11837 auto batchSplitOut = model->addOperand(&type23); 11838 auto in = model->addOperand(&type27); 11839 auto param52 = model->addOperand(&type4); 11840 auto param53 = model->addOperand(&type4); 11841 auto param54 = model->addOperand(&type26); 11842 auto param55 = model->addOperand(&type26); 11843 auto param56 = model->addOperand(&type4); 11844 auto param57 = model->addOperand(&type4); 11845 auto layout = model->addOperand(&type0); 11846 auto featureMap = model->addOperand(&type28); 11847 auto weights = model->addOperand(&type29); 11848 auto bias = model->addOperand(&type30); 11849 auto param58 = model->addOperand(&type4); 11850 auto param59 = model->addOperand(&type4); 11851 auto param60 = model->addOperand(&type4); 11852 auto param61 = model->addOperand(&type4); 11853 auto param62 = model->addOperand(&type4); 11854 auto param63 = model->addOperand(&type4); 11855 auto param64 = model->addOperand(&type4); 11856 auto out = model->addOperand(&type46); 11857 // Phase 2, operations 11858 static float scores_init[] = {0.9f, 0.1f}; 11859 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 11860 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11861 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 11862 static int32_t param45_init[] = {0}; 11863 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11864 static float param46_init[] = {0.3f}; 11865 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11866 static int32_t param47_init[] = {-1}; 11867 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11868 static int32_t param48_init[] = {0}; 11869 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11870 static float param49_init[] = {0.4f}; 11871 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11872 static float param50_init[] = {1.0f}; 11873 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11874 static float param51_init[] = {0.3f}; 11875 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11876 static int32_t param52_init[] = {2}; 11877 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11878 static int32_t param53_init[] = {2}; 11879 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11880 static float param54_init[] = {2.0f}; 11881 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11882 static float param55_init[] = {2.0f}; 11883 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11884 static int32_t param56_init[] = {4}; 11885 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 11886 static int32_t param57_init[] = {4}; 11887 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 11888 static bool8 layout_init[] = {false}; 11889 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11890 static float weights_init[] = {3.0f, 4.0f}; 11891 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 11892 static float bias_init[] = {1.0f, 2.0f}; 11893 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 11894 static int32_t param58_init[] = {0}; 11895 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 11896 static int32_t param59_init[] = {0}; 11897 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 11898 static int32_t param60_init[] = {0}; 11899 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 11900 static int32_t param61_init[] = {0}; 11901 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 11902 static int32_t param62_init[] = {1}; 11903 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 11904 static int32_t param63_init[] = {1}; 11905 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 11906 static int32_t param64_init[] = {0}; 11907 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 11908 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 11909 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 11910 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 11911 // Phase 3, inputs and outputs 11912 model->identifyInputsAndOutputs( 11913 {in}, 11914 {scoresOut, classesOut, out}); 11915 assert(model->isValid()); 11916 } 11917 11918 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc(int i) { 11919 static std::set<int> ignore = {}; 11920 return ignore.find(i) != ignore.end(); 11921 } 11922 11923 void CreateModel_zero_sized_dynamic_output_shape_nhwc_relaxed(Model *model) { 11924 OperandType type0(Type::BOOL, {}); 11925 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 11926 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 11927 OperandType type22(Type::TENSOR_FLOAT32, {0}); 11928 OperandType type23(Type::TENSOR_INT32, {0}); 11929 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 11930 OperandType type25(Type::TENSOR_INT32, {1}); 11931 OperandType type26(Type::FLOAT32, {}); 11932 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 11933 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 11934 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 11935 OperandType type30(Type::TENSOR_FLOAT32, {2}); 11936 OperandType type4(Type::INT32, {}); 11937 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 11938 // Phase 1, operands 11939 auto scores = model->addOperand(&type20); 11940 auto roi = model->addOperand(&type21); 11941 auto param45 = model->addOperand(&type25); 11942 auto param46 = model->addOperand(&type26); 11943 auto param47 = model->addOperand(&type4); 11944 auto param48 = model->addOperand(&type4); 11945 auto param49 = model->addOperand(&type26); 11946 auto param50 = model->addOperand(&type26); 11947 auto param51 = model->addOperand(&type26); 11948 auto scoresOut = model->addOperand(&type22); 11949 auto roiOut = model->addOperand(&type24); 11950 auto classesOut = model->addOperand(&type23); 11951 auto batchSplitOut = model->addOperand(&type23); 11952 auto in = model->addOperand(&type27); 11953 auto param52 = model->addOperand(&type4); 11954 auto param53 = model->addOperand(&type4); 11955 auto param54 = model->addOperand(&type26); 11956 auto param55 = model->addOperand(&type26); 11957 auto param56 = model->addOperand(&type4); 11958 auto param57 = model->addOperand(&type4); 11959 auto layout = model->addOperand(&type0); 11960 auto featureMap = model->addOperand(&type28); 11961 auto weights = model->addOperand(&type29); 11962 auto bias = model->addOperand(&type30); 11963 auto param58 = model->addOperand(&type4); 11964 auto param59 = model->addOperand(&type4); 11965 auto param60 = model->addOperand(&type4); 11966 auto param61 = model->addOperand(&type4); 11967 auto param62 = model->addOperand(&type4); 11968 auto param63 = model->addOperand(&type4); 11969 auto param64 = model->addOperand(&type4); 11970 auto out = model->addOperand(&type46); 11971 // Phase 2, operations 11972 static float scores_init[] = {0.9f, 0.1f}; 11973 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 11974 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 11975 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 11976 static int32_t param45_init[] = {0}; 11977 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 11978 static float param46_init[] = {0.3f}; 11979 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 11980 static int32_t param47_init[] = {-1}; 11981 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 11982 static int32_t param48_init[] = {0}; 11983 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 11984 static float param49_init[] = {0.4f}; 11985 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 11986 static float param50_init[] = {1.0f}; 11987 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 11988 static float param51_init[] = {0.3f}; 11989 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 11990 static int32_t param52_init[] = {2}; 11991 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 11992 static int32_t param53_init[] = {2}; 11993 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 11994 static float param54_init[] = {2.0f}; 11995 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 11996 static float param55_init[] = {2.0f}; 11997 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 11998 static int32_t param56_init[] = {4}; 11999 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12000 static int32_t param57_init[] = {4}; 12001 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12002 static bool8 layout_init[] = {false}; 12003 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12004 static float weights_init[] = {3.0f, 4.0f}; 12005 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 12006 static float bias_init[] = {1.0f, 2.0f}; 12007 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 12008 static int32_t param58_init[] = {0}; 12009 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12010 static int32_t param59_init[] = {0}; 12011 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12012 static int32_t param60_init[] = {0}; 12013 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12014 static int32_t param61_init[] = {0}; 12015 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12016 static int32_t param62_init[] = {1}; 12017 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12018 static int32_t param63_init[] = {1}; 12019 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12020 static int32_t param64_init[] = {0}; 12021 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12022 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12023 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12024 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12025 // Phase 3, inputs and outputs 12026 model->identifyInputsAndOutputs( 12027 {in}, 12028 {scoresOut, classesOut, out}); 12029 // Phase 4: set relaxed execution 12030 model->relaxComputationFloat32toFloat16(true); 12031 assert(model->isValid()); 12032 } 12033 12034 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed(int i) { 12035 static std::set<int> ignore = {}; 12036 return ignore.find(i) != ignore.end(); 12037 } 12038 12039 void CreateModel_zero_sized_dynamic_output_shape_nhwc_quant8(Model *model) { 12040 OperandType type0(Type::BOOL, {}); 12041 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 12042 OperandType type102(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); 12043 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 12044 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 12045 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 12046 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 12047 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 12048 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 12049 OperandType type123(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 12050 OperandType type23(Type::TENSOR_INT32, {0}); 12051 OperandType type25(Type::TENSOR_INT32, {1}); 12052 OperandType type26(Type::FLOAT32, {}); 12053 OperandType type4(Type::INT32, {}); 12054 // Phase 1, operands 12055 auto scores = model->addOperand(&type107); 12056 auto roi = model->addOperand(&type105); 12057 auto param45 = model->addOperand(&type25); 12058 auto param46 = model->addOperand(&type26); 12059 auto param47 = model->addOperand(&type4); 12060 auto param48 = model->addOperand(&type4); 12061 auto param49 = model->addOperand(&type26); 12062 auto param50 = model->addOperand(&type26); 12063 auto param51 = model->addOperand(&type26); 12064 auto scoresOut = model->addOperand(&type108); 12065 auto roiOut = model->addOperand(&type106); 12066 auto classesOut = model->addOperand(&type23); 12067 auto batchSplitOut = model->addOperand(&type23); 12068 auto in = model->addOperand(&type103); 12069 auto param52 = model->addOperand(&type4); 12070 auto param53 = model->addOperand(&type4); 12071 auto param54 = model->addOperand(&type26); 12072 auto param55 = model->addOperand(&type26); 12073 auto param56 = model->addOperand(&type4); 12074 auto param57 = model->addOperand(&type4); 12075 auto layout = model->addOperand(&type0); 12076 auto featureMap = model->addOperand(&type102); 12077 auto weights = model->addOperand(&type109); 12078 auto bias = model->addOperand(&type101); 12079 auto param58 = model->addOperand(&type4); 12080 auto param59 = model->addOperand(&type4); 12081 auto param60 = model->addOperand(&type4); 12082 auto param61 = model->addOperand(&type4); 12083 auto param62 = model->addOperand(&type4); 12084 auto param63 = model->addOperand(&type4); 12085 auto param64 = model->addOperand(&type4); 12086 auto out = model->addOperand(&type123); 12087 // Phase 2, operations 12088 static uint8_t scores_init[] = {137, 129}; 12089 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 12090 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 12091 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 12092 static int32_t param45_init[] = {0}; 12093 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 12094 static float param46_init[] = {0.3f}; 12095 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 12096 static int32_t param47_init[] = {-1}; 12097 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 12098 static int32_t param48_init[] = {0}; 12099 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 12100 static float param49_init[] = {0.4f}; 12101 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 12102 static float param50_init[] = {1.0f}; 12103 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 12104 static float param51_init[] = {0.3f}; 12105 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 12106 static int32_t param52_init[] = {2}; 12107 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 12108 static int32_t param53_init[] = {2}; 12109 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 12110 static float param54_init[] = {2.0f}; 12111 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 12112 static float param55_init[] = {2.0f}; 12113 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 12114 static int32_t param56_init[] = {4}; 12115 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12116 static int32_t param57_init[] = {4}; 12117 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12118 static bool8 layout_init[] = {false}; 12119 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12120 static uint8_t weights_init[] = {158, 168}; 12121 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 2); 12122 static int32_t bias_init[] = {100, 200}; 12123 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 12124 static int32_t param58_init[] = {0}; 12125 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12126 static int32_t param59_init[] = {0}; 12127 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12128 static int32_t param60_init[] = {0}; 12129 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12130 static int32_t param61_init[] = {0}; 12131 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12132 static int32_t param62_init[] = {1}; 12133 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12134 static int32_t param63_init[] = {1}; 12135 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12136 static int32_t param64_init[] = {0}; 12137 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12138 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12139 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12140 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12141 // Phase 3, inputs and outputs 12142 model->identifyInputsAndOutputs( 12143 {in}, 12144 {scoresOut, classesOut, out}); 12145 assert(model->isValid()); 12146 } 12147 12148 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8(int i) { 12149 static std::set<int> ignore = {}; 12150 return ignore.find(i) != ignore.end(); 12151 } 12152 12153 void CreateModel_zero_sized_dynamic_output_shape_nhwc_float16(Model *model) { 12154 OperandType type0(Type::BOOL, {}); 12155 OperandType type110(Type::TENSOR_FLOAT16, {2}); 12156 OperandType type111(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); 12157 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 12158 OperandType type114(Type::FLOAT16, {}); 12159 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 12160 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 12161 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 12162 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 12163 OperandType type124(Type::TENSOR_FLOAT16, {0}); 12164 OperandType type23(Type::TENSOR_INT32, {0}); 12165 OperandType type25(Type::TENSOR_INT32, {1}); 12166 OperandType type4(Type::INT32, {}); 12167 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 12168 // Phase 1, operands 12169 auto scores = model->addOperand(&type117); 12170 auto roi = model->addOperand(&type115); 12171 auto param45 = model->addOperand(&type25); 12172 auto param46 = model->addOperand(&type114); 12173 auto param47 = model->addOperand(&type4); 12174 auto param48 = model->addOperand(&type4); 12175 auto param49 = model->addOperand(&type114); 12176 auto param50 = model->addOperand(&type114); 12177 auto param51 = model->addOperand(&type114); 12178 auto scoresOut = model->addOperand(&type124); 12179 auto roiOut = model->addOperand(&type116); 12180 auto classesOut = model->addOperand(&type23); 12181 auto batchSplitOut = model->addOperand(&type23); 12182 auto in = model->addOperand(&type112); 12183 auto param52 = model->addOperand(&type4); 12184 auto param53 = model->addOperand(&type4); 12185 auto param54 = model->addOperand(&type114); 12186 auto param55 = model->addOperand(&type114); 12187 auto param56 = model->addOperand(&type4); 12188 auto param57 = model->addOperand(&type4); 12189 auto layout = model->addOperand(&type0); 12190 auto featureMap = model->addOperand(&type111); 12191 auto weights = model->addOperand(&type119); 12192 auto bias = model->addOperand(&type110); 12193 auto param58 = model->addOperand(&type4); 12194 auto param59 = model->addOperand(&type4); 12195 auto param60 = model->addOperand(&type4); 12196 auto param61 = model->addOperand(&type4); 12197 auto param62 = model->addOperand(&type4); 12198 auto param63 = model->addOperand(&type4); 12199 auto param64 = model->addOperand(&type4); 12200 auto out = model->addOperand(&type48); 12201 // Phase 2, operations 12202 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 12203 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 12204 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 12205 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 12206 static int32_t param45_init[] = {0}; 12207 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 12208 static _Float16 param46_init[] = {0.30000001192092896f}; 12209 model->setOperandValue(param46, param46_init, sizeof(_Float16) * 1); 12210 static int32_t param47_init[] = {-1}; 12211 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 12212 static int32_t param48_init[] = {0}; 12213 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 12214 static _Float16 param49_init[] = {0.4000000059604645f}; 12215 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 12216 static _Float16 param50_init[] = {1.0f}; 12217 model->setOperandValue(param50, param50_init, sizeof(_Float16) * 1); 12218 static _Float16 param51_init[] = {0.30000001192092896f}; 12219 model->setOperandValue(param51, param51_init, sizeof(_Float16) * 1); 12220 static int32_t param52_init[] = {2}; 12221 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 12222 static int32_t param53_init[] = {2}; 12223 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 12224 static _Float16 param54_init[] = {2.0f}; 12225 model->setOperandValue(param54, param54_init, sizeof(_Float16) * 1); 12226 static _Float16 param55_init[] = {2.0f}; 12227 model->setOperandValue(param55, param55_init, sizeof(_Float16) * 1); 12228 static int32_t param56_init[] = {4}; 12229 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12230 static int32_t param57_init[] = {4}; 12231 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12232 static bool8 layout_init[] = {false}; 12233 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12234 static _Float16 weights_init[] = {3.0f, 4.0f}; 12235 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 2); 12236 static _Float16 bias_init[] = {1.0f, 2.0f}; 12237 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 12238 static int32_t param58_init[] = {0}; 12239 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12240 static int32_t param59_init[] = {0}; 12241 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12242 static int32_t param60_init[] = {0}; 12243 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12244 static int32_t param61_init[] = {0}; 12245 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12246 static int32_t param62_init[] = {1}; 12247 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12248 static int32_t param63_init[] = {1}; 12249 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12250 static int32_t param64_init[] = {0}; 12251 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12252 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12253 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12254 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12255 // Phase 3, inputs and outputs 12256 model->identifyInputsAndOutputs( 12257 {in}, 12258 {scoresOut, classesOut, out}); 12259 assert(model->isValid()); 12260 } 12261 12262 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16(int i) { 12263 static std::set<int> ignore = {}; 12264 return ignore.find(i) != ignore.end(); 12265 } 12266 12267 void CreateModel_zero_sized_dynamic_output_shape_nchw(Model *model) { 12268 OperandType type0(Type::BOOL, {}); 12269 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 12270 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 12271 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 12272 OperandType type22(Type::TENSOR_FLOAT32, {0}); 12273 OperandType type23(Type::TENSOR_INT32, {0}); 12274 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 12275 OperandType type25(Type::TENSOR_INT32, {1}); 12276 OperandType type26(Type::FLOAT32, {}); 12277 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 12278 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 12279 OperandType type30(Type::TENSOR_FLOAT32, {2}); 12280 OperandType type4(Type::INT32, {}); 12281 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 12282 // Phase 1, operands 12283 auto scores = model->addOperand(&type20); 12284 auto roi = model->addOperand(&type21); 12285 auto param45 = model->addOperand(&type25); 12286 auto param46 = model->addOperand(&type26); 12287 auto param47 = model->addOperand(&type4); 12288 auto param48 = model->addOperand(&type4); 12289 auto param49 = model->addOperand(&type26); 12290 auto param50 = model->addOperand(&type26); 12291 auto param51 = model->addOperand(&type26); 12292 auto scoresOut = model->addOperand(&type22); 12293 auto roiOut = model->addOperand(&type24); 12294 auto classesOut = model->addOperand(&type23); 12295 auto batchSplitOut = model->addOperand(&type23); 12296 auto in = model->addOperand(&type27); 12297 auto param52 = model->addOperand(&type4); 12298 auto param53 = model->addOperand(&type4); 12299 auto param54 = model->addOperand(&type26); 12300 auto param55 = model->addOperand(&type26); 12301 auto param56 = model->addOperand(&type4); 12302 auto param57 = model->addOperand(&type4); 12303 auto layout = model->addOperand(&type0); 12304 auto featureMap = model->addOperand(&type120); 12305 auto weights = model->addOperand(&type29); 12306 auto bias = model->addOperand(&type30); 12307 auto param58 = model->addOperand(&type4); 12308 auto param59 = model->addOperand(&type4); 12309 auto param60 = model->addOperand(&type4); 12310 auto param61 = model->addOperand(&type4); 12311 auto param62 = model->addOperand(&type4); 12312 auto param63 = model->addOperand(&type4); 12313 auto param64 = model->addOperand(&type4); 12314 auto out = model->addOperand(&type46); 12315 // Phase 2, operations 12316 static float scores_init[] = {0.9f, 0.1f}; 12317 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 12318 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 12319 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 12320 static int32_t param45_init[] = {0}; 12321 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 12322 static float param46_init[] = {0.3f}; 12323 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 12324 static int32_t param47_init[] = {-1}; 12325 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 12326 static int32_t param48_init[] = {0}; 12327 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 12328 static float param49_init[] = {0.4f}; 12329 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 12330 static float param50_init[] = {1.0f}; 12331 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 12332 static float param51_init[] = {0.3f}; 12333 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 12334 static int32_t param52_init[] = {2}; 12335 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 12336 static int32_t param53_init[] = {2}; 12337 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 12338 static float param54_init[] = {2.0f}; 12339 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 12340 static float param55_init[] = {2.0f}; 12341 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 12342 static int32_t param56_init[] = {4}; 12343 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12344 static int32_t param57_init[] = {4}; 12345 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12346 static bool8 layout_init[] = {true}; 12347 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12348 static float weights_init[] = {3.0f, 4.0f}; 12349 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 12350 static float bias_init[] = {1.0f, 2.0f}; 12351 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 12352 static int32_t param58_init[] = {0}; 12353 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12354 static int32_t param59_init[] = {0}; 12355 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12356 static int32_t param60_init[] = {0}; 12357 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12358 static int32_t param61_init[] = {0}; 12359 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12360 static int32_t param62_init[] = {1}; 12361 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12362 static int32_t param63_init[] = {1}; 12363 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12364 static int32_t param64_init[] = {0}; 12365 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12366 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12367 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12368 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12369 // Phase 3, inputs and outputs 12370 model->identifyInputsAndOutputs( 12371 {in}, 12372 {scoresOut, classesOut, out}); 12373 assert(model->isValid()); 12374 } 12375 12376 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw(int i) { 12377 static std::set<int> ignore = {}; 12378 return ignore.find(i) != ignore.end(); 12379 } 12380 12381 void CreateModel_zero_sized_dynamic_output_shape_nchw_relaxed(Model *model) { 12382 OperandType type0(Type::BOOL, {}); 12383 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 12384 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 12385 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 12386 OperandType type22(Type::TENSOR_FLOAT32, {0}); 12387 OperandType type23(Type::TENSOR_INT32, {0}); 12388 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 12389 OperandType type25(Type::TENSOR_INT32, {1}); 12390 OperandType type26(Type::FLOAT32, {}); 12391 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 12392 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 12393 OperandType type30(Type::TENSOR_FLOAT32, {2}); 12394 OperandType type4(Type::INT32, {}); 12395 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 12396 // Phase 1, operands 12397 auto scores = model->addOperand(&type20); 12398 auto roi = model->addOperand(&type21); 12399 auto param45 = model->addOperand(&type25); 12400 auto param46 = model->addOperand(&type26); 12401 auto param47 = model->addOperand(&type4); 12402 auto param48 = model->addOperand(&type4); 12403 auto param49 = model->addOperand(&type26); 12404 auto param50 = model->addOperand(&type26); 12405 auto param51 = model->addOperand(&type26); 12406 auto scoresOut = model->addOperand(&type22); 12407 auto roiOut = model->addOperand(&type24); 12408 auto classesOut = model->addOperand(&type23); 12409 auto batchSplitOut = model->addOperand(&type23); 12410 auto in = model->addOperand(&type27); 12411 auto param52 = model->addOperand(&type4); 12412 auto param53 = model->addOperand(&type4); 12413 auto param54 = model->addOperand(&type26); 12414 auto param55 = model->addOperand(&type26); 12415 auto param56 = model->addOperand(&type4); 12416 auto param57 = model->addOperand(&type4); 12417 auto layout = model->addOperand(&type0); 12418 auto featureMap = model->addOperand(&type120); 12419 auto weights = model->addOperand(&type29); 12420 auto bias = model->addOperand(&type30); 12421 auto param58 = model->addOperand(&type4); 12422 auto param59 = model->addOperand(&type4); 12423 auto param60 = model->addOperand(&type4); 12424 auto param61 = model->addOperand(&type4); 12425 auto param62 = model->addOperand(&type4); 12426 auto param63 = model->addOperand(&type4); 12427 auto param64 = model->addOperand(&type4); 12428 auto out = model->addOperand(&type46); 12429 // Phase 2, operations 12430 static float scores_init[] = {0.9f, 0.1f}; 12431 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 12432 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 12433 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 12434 static int32_t param45_init[] = {0}; 12435 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 12436 static float param46_init[] = {0.3f}; 12437 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 12438 static int32_t param47_init[] = {-1}; 12439 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 12440 static int32_t param48_init[] = {0}; 12441 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 12442 static float param49_init[] = {0.4f}; 12443 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 12444 static float param50_init[] = {1.0f}; 12445 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 12446 static float param51_init[] = {0.3f}; 12447 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 12448 static int32_t param52_init[] = {2}; 12449 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 12450 static int32_t param53_init[] = {2}; 12451 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 12452 static float param54_init[] = {2.0f}; 12453 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 12454 static float param55_init[] = {2.0f}; 12455 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 12456 static int32_t param56_init[] = {4}; 12457 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12458 static int32_t param57_init[] = {4}; 12459 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12460 static bool8 layout_init[] = {true}; 12461 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12462 static float weights_init[] = {3.0f, 4.0f}; 12463 model->setOperandValue(weights, weights_init, sizeof(float) * 2); 12464 static float bias_init[] = {1.0f, 2.0f}; 12465 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 12466 static int32_t param58_init[] = {0}; 12467 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12468 static int32_t param59_init[] = {0}; 12469 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12470 static int32_t param60_init[] = {0}; 12471 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12472 static int32_t param61_init[] = {0}; 12473 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12474 static int32_t param62_init[] = {1}; 12475 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12476 static int32_t param63_init[] = {1}; 12477 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12478 static int32_t param64_init[] = {0}; 12479 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12480 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12481 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12482 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12483 // Phase 3, inputs and outputs 12484 model->identifyInputsAndOutputs( 12485 {in}, 12486 {scoresOut, classesOut, out}); 12487 // Phase 4: set relaxed execution 12488 model->relaxComputationFloat32toFloat16(true); 12489 assert(model->isValid()); 12490 } 12491 12492 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed(int i) { 12493 static std::set<int> ignore = {}; 12494 return ignore.find(i) != ignore.end(); 12495 } 12496 12497 void CreateModel_zero_sized_dynamic_output_shape_nchw_quant8(Model *model) { 12498 OperandType type0(Type::BOOL, {}); 12499 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 12500 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 12501 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 12502 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 12503 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 12504 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 12505 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 12506 OperandType type121(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); 12507 OperandType type123(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 12508 OperandType type23(Type::TENSOR_INT32, {0}); 12509 OperandType type25(Type::TENSOR_INT32, {1}); 12510 OperandType type26(Type::FLOAT32, {}); 12511 OperandType type4(Type::INT32, {}); 12512 // Phase 1, operands 12513 auto scores = model->addOperand(&type107); 12514 auto roi = model->addOperand(&type105); 12515 auto param45 = model->addOperand(&type25); 12516 auto param46 = model->addOperand(&type26); 12517 auto param47 = model->addOperand(&type4); 12518 auto param48 = model->addOperand(&type4); 12519 auto param49 = model->addOperand(&type26); 12520 auto param50 = model->addOperand(&type26); 12521 auto param51 = model->addOperand(&type26); 12522 auto scoresOut = model->addOperand(&type108); 12523 auto roiOut = model->addOperand(&type106); 12524 auto classesOut = model->addOperand(&type23); 12525 auto batchSplitOut = model->addOperand(&type23); 12526 auto in = model->addOperand(&type103); 12527 auto param52 = model->addOperand(&type4); 12528 auto param53 = model->addOperand(&type4); 12529 auto param54 = model->addOperand(&type26); 12530 auto param55 = model->addOperand(&type26); 12531 auto param56 = model->addOperand(&type4); 12532 auto param57 = model->addOperand(&type4); 12533 auto layout = model->addOperand(&type0); 12534 auto featureMap = model->addOperand(&type121); 12535 auto weights = model->addOperand(&type109); 12536 auto bias = model->addOperand(&type101); 12537 auto param58 = model->addOperand(&type4); 12538 auto param59 = model->addOperand(&type4); 12539 auto param60 = model->addOperand(&type4); 12540 auto param61 = model->addOperand(&type4); 12541 auto param62 = model->addOperand(&type4); 12542 auto param63 = model->addOperand(&type4); 12543 auto param64 = model->addOperand(&type4); 12544 auto out = model->addOperand(&type123); 12545 // Phase 2, operations 12546 static uint8_t scores_init[] = {137, 129}; 12547 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 12548 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 12549 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 12550 static int32_t param45_init[] = {0}; 12551 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 12552 static float param46_init[] = {0.3f}; 12553 model->setOperandValue(param46, param46_init, sizeof(float) * 1); 12554 static int32_t param47_init[] = {-1}; 12555 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 12556 static int32_t param48_init[] = {0}; 12557 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 12558 static float param49_init[] = {0.4f}; 12559 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 12560 static float param50_init[] = {1.0f}; 12561 model->setOperandValue(param50, param50_init, sizeof(float) * 1); 12562 static float param51_init[] = {0.3f}; 12563 model->setOperandValue(param51, param51_init, sizeof(float) * 1); 12564 static int32_t param52_init[] = {2}; 12565 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 12566 static int32_t param53_init[] = {2}; 12567 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 12568 static float param54_init[] = {2.0f}; 12569 model->setOperandValue(param54, param54_init, sizeof(float) * 1); 12570 static float param55_init[] = {2.0f}; 12571 model->setOperandValue(param55, param55_init, sizeof(float) * 1); 12572 static int32_t param56_init[] = {4}; 12573 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12574 static int32_t param57_init[] = {4}; 12575 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12576 static bool8 layout_init[] = {true}; 12577 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12578 static uint8_t weights_init[] = {158, 168}; 12579 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 2); 12580 static int32_t bias_init[] = {100, 200}; 12581 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 12582 static int32_t param58_init[] = {0}; 12583 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12584 static int32_t param59_init[] = {0}; 12585 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12586 static int32_t param60_init[] = {0}; 12587 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12588 static int32_t param61_init[] = {0}; 12589 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12590 static int32_t param62_init[] = {1}; 12591 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12592 static int32_t param63_init[] = {1}; 12593 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12594 static int32_t param64_init[] = {0}; 12595 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12596 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12597 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12598 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12599 // Phase 3, inputs and outputs 12600 model->identifyInputsAndOutputs( 12601 {in}, 12602 {scoresOut, classesOut, out}); 12603 assert(model->isValid()); 12604 } 12605 12606 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8(int i) { 12607 static std::set<int> ignore = {}; 12608 return ignore.find(i) != ignore.end(); 12609 } 12610 12611 void CreateModel_zero_sized_dynamic_output_shape_nchw_float16(Model *model) { 12612 OperandType type0(Type::BOOL, {}); 12613 OperandType type110(Type::TENSOR_FLOAT16, {2}); 12614 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 12615 OperandType type114(Type::FLOAT16, {}); 12616 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 12617 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 12618 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 12619 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 12620 OperandType type122(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); 12621 OperandType type124(Type::TENSOR_FLOAT16, {0}); 12622 OperandType type23(Type::TENSOR_INT32, {0}); 12623 OperandType type25(Type::TENSOR_INT32, {1}); 12624 OperandType type4(Type::INT32, {}); 12625 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 12626 // Phase 1, operands 12627 auto scores = model->addOperand(&type117); 12628 auto roi = model->addOperand(&type115); 12629 auto param45 = model->addOperand(&type25); 12630 auto param46 = model->addOperand(&type114); 12631 auto param47 = model->addOperand(&type4); 12632 auto param48 = model->addOperand(&type4); 12633 auto param49 = model->addOperand(&type114); 12634 auto param50 = model->addOperand(&type114); 12635 auto param51 = model->addOperand(&type114); 12636 auto scoresOut = model->addOperand(&type124); 12637 auto roiOut = model->addOperand(&type116); 12638 auto classesOut = model->addOperand(&type23); 12639 auto batchSplitOut = model->addOperand(&type23); 12640 auto in = model->addOperand(&type112); 12641 auto param52 = model->addOperand(&type4); 12642 auto param53 = model->addOperand(&type4); 12643 auto param54 = model->addOperand(&type114); 12644 auto param55 = model->addOperand(&type114); 12645 auto param56 = model->addOperand(&type4); 12646 auto param57 = model->addOperand(&type4); 12647 auto layout = model->addOperand(&type0); 12648 auto featureMap = model->addOperand(&type122); 12649 auto weights = model->addOperand(&type119); 12650 auto bias = model->addOperand(&type110); 12651 auto param58 = model->addOperand(&type4); 12652 auto param59 = model->addOperand(&type4); 12653 auto param60 = model->addOperand(&type4); 12654 auto param61 = model->addOperand(&type4); 12655 auto param62 = model->addOperand(&type4); 12656 auto param63 = model->addOperand(&type4); 12657 auto param64 = model->addOperand(&type4); 12658 auto out = model->addOperand(&type48); 12659 // Phase 2, operations 12660 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 12661 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 12662 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 12663 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 12664 static int32_t param45_init[] = {0}; 12665 model->setOperandValue(param45, param45_init, sizeof(int32_t) * 1); 12666 static _Float16 param46_init[] = {0.30000001192092896f}; 12667 model->setOperandValue(param46, param46_init, sizeof(_Float16) * 1); 12668 static int32_t param47_init[] = {-1}; 12669 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 12670 static int32_t param48_init[] = {0}; 12671 model->setOperandValue(param48, param48_init, sizeof(int32_t) * 1); 12672 static _Float16 param49_init[] = {0.4000000059604645f}; 12673 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 12674 static _Float16 param50_init[] = {1.0f}; 12675 model->setOperandValue(param50, param50_init, sizeof(_Float16) * 1); 12676 static _Float16 param51_init[] = {0.30000001192092896f}; 12677 model->setOperandValue(param51, param51_init, sizeof(_Float16) * 1); 12678 static int32_t param52_init[] = {2}; 12679 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 12680 static int32_t param53_init[] = {2}; 12681 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 12682 static _Float16 param54_init[] = {2.0f}; 12683 model->setOperandValue(param54, param54_init, sizeof(_Float16) * 1); 12684 static _Float16 param55_init[] = {2.0f}; 12685 model->setOperandValue(param55, param55_init, sizeof(_Float16) * 1); 12686 static int32_t param56_init[] = {4}; 12687 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 12688 static int32_t param57_init[] = {4}; 12689 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 12690 static bool8 layout_init[] = {true}; 12691 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12692 static _Float16 weights_init[] = {3.0f, 4.0f}; 12693 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 2); 12694 static _Float16 bias_init[] = {1.0f, 2.0f}; 12695 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 12696 static int32_t param58_init[] = {0}; 12697 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 12698 static int32_t param59_init[] = {0}; 12699 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 12700 static int32_t param60_init[] = {0}; 12701 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 12702 static int32_t param61_init[] = {0}; 12703 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 12704 static int32_t param62_init[] = {1}; 12705 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 12706 static int32_t param63_init[] = {1}; 12707 model->setOperandValue(param63, param63_init, sizeof(int32_t) * 1); 12708 static int32_t param64_init[] = {0}; 12709 model->setOperandValue(param64, param64_init, sizeof(int32_t) * 1); 12710 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param45, param46, param47, param48, param49, param50, param51}, {scoresOut, roiOut, classesOut, batchSplitOut}); 12711 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param52, param53, param54, param55, param56, param57, layout}, {featureMap}); 12712 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap, weights, bias, param58, param59, param60, param61, param62, param63, param64, layout}, {out}); 12713 // Phase 3, inputs and outputs 12714 model->identifyInputsAndOutputs( 12715 {in}, 12716 {scoresOut, classesOut, out}); 12717 assert(model->isValid()); 12718 } 12719 12720 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16(int i) { 12721 static std::set<int> ignore = {}; 12722 return ignore.find(i) != ignore.end(); 12723 } 12724 12725 void CreateModel_zero_sized_nhwc_2(Model *model) { 12726 OperandType type0(Type::BOOL, {}); 12727 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 12728 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 12729 OperandType type22(Type::TENSOR_FLOAT32, {0}); 12730 OperandType type23(Type::TENSOR_INT32, {0}); 12731 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 12732 OperandType type25(Type::TENSOR_INT32, {1}); 12733 OperandType type26(Type::FLOAT32, {}); 12734 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 12735 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 12736 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 12737 OperandType type30(Type::TENSOR_FLOAT32, {2}); 12738 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 12739 OperandType type4(Type::INT32, {}); 12740 // Phase 1, operands 12741 auto scores1 = model->addOperand(&type20); 12742 auto roi1 = model->addOperand(&type21); 12743 auto param65 = model->addOperand(&type25); 12744 auto param66 = model->addOperand(&type26); 12745 auto param67 = model->addOperand(&type4); 12746 auto param68 = model->addOperand(&type4); 12747 auto param69 = model->addOperand(&type26); 12748 auto param70 = model->addOperand(&type26); 12749 auto param71 = model->addOperand(&type26); 12750 auto scoresOut1 = model->addOperand(&type22); 12751 auto roiOut1 = model->addOperand(&type24); 12752 auto classesOut1 = model->addOperand(&type23); 12753 auto batchSplitOut1 = model->addOperand(&type23); 12754 auto in1 = model->addOperand(&type27); 12755 auto param72 = model->addOperand(&type4); 12756 auto param73 = model->addOperand(&type4); 12757 auto param74 = model->addOperand(&type26); 12758 auto param75 = model->addOperand(&type26); 12759 auto param76 = model->addOperand(&type4); 12760 auto param77 = model->addOperand(&type4); 12761 auto layout = model->addOperand(&type0); 12762 auto featureMap1 = model->addOperand(&type28); 12763 auto weights1 = model->addOperand(&type29); 12764 auto bias1 = model->addOperand(&type30); 12765 auto param78 = model->addOperand(&type4); 12766 auto param79 = model->addOperand(&type4); 12767 auto param80 = model->addOperand(&type4); 12768 auto param81 = model->addOperand(&type4); 12769 auto out1 = model->addOperand(&type31); 12770 // Phase 2, operations 12771 static float scores1_init[] = {0.9f, 0.1f}; 12772 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 12773 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 12774 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 12775 static int32_t param65_init[] = {0}; 12776 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 12777 static float param66_init[] = {0.3f}; 12778 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 12779 static int32_t param67_init[] = {-1}; 12780 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 12781 static int32_t param68_init[] = {0}; 12782 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 12783 static float param69_init[] = {0.4f}; 12784 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 12785 static float param70_init[] = {1.0f}; 12786 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 12787 static float param71_init[] = {0.3f}; 12788 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 12789 static int32_t param72_init[] = {2}; 12790 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 12791 static int32_t param73_init[] = {2}; 12792 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 12793 static float param74_init[] = {2.0f}; 12794 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 12795 static float param75_init[] = {2.0f}; 12796 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 12797 static int32_t param76_init[] = {4}; 12798 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 12799 static int32_t param77_init[] = {4}; 12800 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 12801 static bool8 layout_init[] = {false}; 12802 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12803 static float weights1_init[] = {3.0f, 4.0f}; 12804 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 12805 static float bias1_init[] = {1.0f, 2.0f}; 12806 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 12807 static int32_t param78_init[] = {1}; 12808 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 12809 static int32_t param79_init[] = {1}; 12810 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 12811 static int32_t param80_init[] = {1}; 12812 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 12813 static int32_t param81_init[] = {0}; 12814 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 12815 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 12816 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 12817 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 12818 // Phase 3, inputs and outputs 12819 model->identifyInputsAndOutputs( 12820 {in1}, 12821 {scoresOut1, classesOut1, out1}); 12822 assert(model->isValid()); 12823 } 12824 12825 inline bool is_ignored_zero_sized_nhwc_2(int i) { 12826 static std::set<int> ignore = {}; 12827 return ignore.find(i) != ignore.end(); 12828 } 12829 12830 void CreateModel_zero_sized_nhwc_relaxed_2(Model *model) { 12831 OperandType type0(Type::BOOL, {}); 12832 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 12833 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 12834 OperandType type22(Type::TENSOR_FLOAT32, {0}); 12835 OperandType type23(Type::TENSOR_INT32, {0}); 12836 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 12837 OperandType type25(Type::TENSOR_INT32, {1}); 12838 OperandType type26(Type::FLOAT32, {}); 12839 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 12840 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 12841 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 12842 OperandType type30(Type::TENSOR_FLOAT32, {2}); 12843 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 12844 OperandType type4(Type::INT32, {}); 12845 // Phase 1, operands 12846 auto scores1 = model->addOperand(&type20); 12847 auto roi1 = model->addOperand(&type21); 12848 auto param65 = model->addOperand(&type25); 12849 auto param66 = model->addOperand(&type26); 12850 auto param67 = model->addOperand(&type4); 12851 auto param68 = model->addOperand(&type4); 12852 auto param69 = model->addOperand(&type26); 12853 auto param70 = model->addOperand(&type26); 12854 auto param71 = model->addOperand(&type26); 12855 auto scoresOut1 = model->addOperand(&type22); 12856 auto roiOut1 = model->addOperand(&type24); 12857 auto classesOut1 = model->addOperand(&type23); 12858 auto batchSplitOut1 = model->addOperand(&type23); 12859 auto in1 = model->addOperand(&type27); 12860 auto param72 = model->addOperand(&type4); 12861 auto param73 = model->addOperand(&type4); 12862 auto param74 = model->addOperand(&type26); 12863 auto param75 = model->addOperand(&type26); 12864 auto param76 = model->addOperand(&type4); 12865 auto param77 = model->addOperand(&type4); 12866 auto layout = model->addOperand(&type0); 12867 auto featureMap1 = model->addOperand(&type28); 12868 auto weights1 = model->addOperand(&type29); 12869 auto bias1 = model->addOperand(&type30); 12870 auto param78 = model->addOperand(&type4); 12871 auto param79 = model->addOperand(&type4); 12872 auto param80 = model->addOperand(&type4); 12873 auto param81 = model->addOperand(&type4); 12874 auto out1 = model->addOperand(&type31); 12875 // Phase 2, operations 12876 static float scores1_init[] = {0.9f, 0.1f}; 12877 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 12878 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 12879 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 12880 static int32_t param65_init[] = {0}; 12881 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 12882 static float param66_init[] = {0.3f}; 12883 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 12884 static int32_t param67_init[] = {-1}; 12885 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 12886 static int32_t param68_init[] = {0}; 12887 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 12888 static float param69_init[] = {0.4f}; 12889 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 12890 static float param70_init[] = {1.0f}; 12891 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 12892 static float param71_init[] = {0.3f}; 12893 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 12894 static int32_t param72_init[] = {2}; 12895 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 12896 static int32_t param73_init[] = {2}; 12897 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 12898 static float param74_init[] = {2.0f}; 12899 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 12900 static float param75_init[] = {2.0f}; 12901 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 12902 static int32_t param76_init[] = {4}; 12903 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 12904 static int32_t param77_init[] = {4}; 12905 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 12906 static bool8 layout_init[] = {false}; 12907 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12908 static float weights1_init[] = {3.0f, 4.0f}; 12909 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 12910 static float bias1_init[] = {1.0f, 2.0f}; 12911 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 12912 static int32_t param78_init[] = {1}; 12913 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 12914 static int32_t param79_init[] = {1}; 12915 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 12916 static int32_t param80_init[] = {1}; 12917 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 12918 static int32_t param81_init[] = {0}; 12919 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 12920 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 12921 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 12922 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 12923 // Phase 3, inputs and outputs 12924 model->identifyInputsAndOutputs( 12925 {in1}, 12926 {scoresOut1, classesOut1, out1}); 12927 // Phase 4: set relaxed execution 12928 model->relaxComputationFloat32toFloat16(true); 12929 assert(model->isValid()); 12930 } 12931 12932 inline bool is_ignored_zero_sized_nhwc_relaxed_2(int i) { 12933 static std::set<int> ignore = {}; 12934 return ignore.find(i) != ignore.end(); 12935 } 12936 12937 void CreateModel_zero_sized_nhwc_quant8_2(Model *model) { 12938 OperandType type0(Type::BOOL, {}); 12939 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 12940 OperandType type102(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); 12941 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 12942 OperandType type104(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 2}, 0.1f, 128); 12943 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 12944 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 12945 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 12946 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 12947 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 12948 OperandType type23(Type::TENSOR_INT32, {0}); 12949 OperandType type25(Type::TENSOR_INT32, {1}); 12950 OperandType type26(Type::FLOAT32, {}); 12951 OperandType type4(Type::INT32, {}); 12952 // Phase 1, operands 12953 auto scores1 = model->addOperand(&type107); 12954 auto roi1 = model->addOperand(&type105); 12955 auto param65 = model->addOperand(&type25); 12956 auto param66 = model->addOperand(&type26); 12957 auto param67 = model->addOperand(&type4); 12958 auto param68 = model->addOperand(&type4); 12959 auto param69 = model->addOperand(&type26); 12960 auto param70 = model->addOperand(&type26); 12961 auto param71 = model->addOperand(&type26); 12962 auto scoresOut1 = model->addOperand(&type108); 12963 auto roiOut1 = model->addOperand(&type106); 12964 auto classesOut1 = model->addOperand(&type23); 12965 auto batchSplitOut1 = model->addOperand(&type23); 12966 auto in1 = model->addOperand(&type103); 12967 auto param72 = model->addOperand(&type4); 12968 auto param73 = model->addOperand(&type4); 12969 auto param74 = model->addOperand(&type26); 12970 auto param75 = model->addOperand(&type26); 12971 auto param76 = model->addOperand(&type4); 12972 auto param77 = model->addOperand(&type4); 12973 auto layout = model->addOperand(&type0); 12974 auto featureMap1 = model->addOperand(&type102); 12975 auto weights1 = model->addOperand(&type109); 12976 auto bias1 = model->addOperand(&type101); 12977 auto param78 = model->addOperand(&type4); 12978 auto param79 = model->addOperand(&type4); 12979 auto param80 = model->addOperand(&type4); 12980 auto param81 = model->addOperand(&type4); 12981 auto out1 = model->addOperand(&type104); 12982 // Phase 2, operations 12983 static uint8_t scores1_init[] = {137, 129}; 12984 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 12985 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 12986 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 12987 static int32_t param65_init[] = {0}; 12988 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 12989 static float param66_init[] = {0.3f}; 12990 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 12991 static int32_t param67_init[] = {-1}; 12992 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 12993 static int32_t param68_init[] = {0}; 12994 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 12995 static float param69_init[] = {0.4f}; 12996 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 12997 static float param70_init[] = {1.0f}; 12998 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 12999 static float param71_init[] = {0.3f}; 13000 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13001 static int32_t param72_init[] = {2}; 13002 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13003 static int32_t param73_init[] = {2}; 13004 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13005 static float param74_init[] = {2.0f}; 13006 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13007 static float param75_init[] = {2.0f}; 13008 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13009 static int32_t param76_init[] = {4}; 13010 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13011 static int32_t param77_init[] = {4}; 13012 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13013 static bool8 layout_init[] = {false}; 13014 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13015 static uint8_t weights1_init[] = {158, 168}; 13016 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 2); 13017 static int32_t bias1_init[] = {100, 200}; 13018 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 2); 13019 static int32_t param78_init[] = {1}; 13020 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13021 static int32_t param79_init[] = {1}; 13022 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13023 static int32_t param80_init[] = {1}; 13024 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13025 static int32_t param81_init[] = {0}; 13026 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13027 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13028 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13029 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13030 // Phase 3, inputs and outputs 13031 model->identifyInputsAndOutputs( 13032 {in1}, 13033 {scoresOut1, classesOut1, out1}); 13034 assert(model->isValid()); 13035 } 13036 13037 inline bool is_ignored_zero_sized_nhwc_quant8_2(int i) { 13038 static std::set<int> ignore = {}; 13039 return ignore.find(i) != ignore.end(); 13040 } 13041 13042 void CreateModel_zero_sized_nhwc_float16_2(Model *model) { 13043 OperandType type0(Type::BOOL, {}); 13044 OperandType type110(Type::TENSOR_FLOAT16, {2}); 13045 OperandType type111(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); 13046 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 13047 OperandType type113(Type::TENSOR_FLOAT16, {0, 2, 2, 2}); 13048 OperandType type114(Type::FLOAT16, {}); 13049 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 13050 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 13051 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 13052 OperandType type118(Type::TENSOR_FLOAT16, {0}); 13053 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 13054 OperandType type23(Type::TENSOR_INT32, {0}); 13055 OperandType type25(Type::TENSOR_INT32, {1}); 13056 OperandType type4(Type::INT32, {}); 13057 // Phase 1, operands 13058 auto scores1 = model->addOperand(&type117); 13059 auto roi1 = model->addOperand(&type115); 13060 auto param65 = model->addOperand(&type25); 13061 auto param66 = model->addOperand(&type114); 13062 auto param67 = model->addOperand(&type4); 13063 auto param68 = model->addOperand(&type4); 13064 auto param69 = model->addOperand(&type114); 13065 auto param70 = model->addOperand(&type114); 13066 auto param71 = model->addOperand(&type114); 13067 auto scoresOut1 = model->addOperand(&type118); 13068 auto roiOut1 = model->addOperand(&type116); 13069 auto classesOut1 = model->addOperand(&type23); 13070 auto batchSplitOut1 = model->addOperand(&type23); 13071 auto in1 = model->addOperand(&type112); 13072 auto param72 = model->addOperand(&type4); 13073 auto param73 = model->addOperand(&type4); 13074 auto param74 = model->addOperand(&type114); 13075 auto param75 = model->addOperand(&type114); 13076 auto param76 = model->addOperand(&type4); 13077 auto param77 = model->addOperand(&type4); 13078 auto layout = model->addOperand(&type0); 13079 auto featureMap1 = model->addOperand(&type111); 13080 auto weights1 = model->addOperand(&type119); 13081 auto bias1 = model->addOperand(&type110); 13082 auto param78 = model->addOperand(&type4); 13083 auto param79 = model->addOperand(&type4); 13084 auto param80 = model->addOperand(&type4); 13085 auto param81 = model->addOperand(&type4); 13086 auto out1 = model->addOperand(&type113); 13087 // Phase 2, operations 13088 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 13089 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 13090 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13091 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 13092 static int32_t param65_init[] = {0}; 13093 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13094 static _Float16 param66_init[] = {0.30000001192092896f}; 13095 model->setOperandValue(param66, param66_init, sizeof(_Float16) * 1); 13096 static int32_t param67_init[] = {-1}; 13097 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13098 static int32_t param68_init[] = {0}; 13099 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13100 static _Float16 param69_init[] = {0.4000000059604645f}; 13101 model->setOperandValue(param69, param69_init, sizeof(_Float16) * 1); 13102 static _Float16 param70_init[] = {1.0f}; 13103 model->setOperandValue(param70, param70_init, sizeof(_Float16) * 1); 13104 static _Float16 param71_init[] = {0.30000001192092896f}; 13105 model->setOperandValue(param71, param71_init, sizeof(_Float16) * 1); 13106 static int32_t param72_init[] = {2}; 13107 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13108 static int32_t param73_init[] = {2}; 13109 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13110 static _Float16 param74_init[] = {2.0f}; 13111 model->setOperandValue(param74, param74_init, sizeof(_Float16) * 1); 13112 static _Float16 param75_init[] = {2.0f}; 13113 model->setOperandValue(param75, param75_init, sizeof(_Float16) * 1); 13114 static int32_t param76_init[] = {4}; 13115 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13116 static int32_t param77_init[] = {4}; 13117 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13118 static bool8 layout_init[] = {false}; 13119 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13120 static _Float16 weights1_init[] = {3.0f, 4.0f}; 13121 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 2); 13122 static _Float16 bias1_init[] = {1.0f, 2.0f}; 13123 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 2); 13124 static int32_t param78_init[] = {1}; 13125 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13126 static int32_t param79_init[] = {1}; 13127 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13128 static int32_t param80_init[] = {1}; 13129 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13130 static int32_t param81_init[] = {0}; 13131 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13132 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13133 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13134 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13135 // Phase 3, inputs and outputs 13136 model->identifyInputsAndOutputs( 13137 {in1}, 13138 {scoresOut1, classesOut1, out1}); 13139 assert(model->isValid()); 13140 } 13141 13142 inline bool is_ignored_zero_sized_nhwc_float16_2(int i) { 13143 static std::set<int> ignore = {}; 13144 return ignore.find(i) != ignore.end(); 13145 } 13146 13147 void CreateModel_zero_sized_nchw_2(Model *model) { 13148 OperandType type0(Type::BOOL, {}); 13149 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 13150 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 13151 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 13152 OperandType type22(Type::TENSOR_FLOAT32, {0}); 13153 OperandType type23(Type::TENSOR_INT32, {0}); 13154 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 13155 OperandType type25(Type::TENSOR_INT32, {1}); 13156 OperandType type26(Type::FLOAT32, {}); 13157 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 13158 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 13159 OperandType type30(Type::TENSOR_FLOAT32, {2}); 13160 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 13161 OperandType type4(Type::INT32, {}); 13162 // Phase 1, operands 13163 auto scores1 = model->addOperand(&type20); 13164 auto roi1 = model->addOperand(&type21); 13165 auto param65 = model->addOperand(&type25); 13166 auto param66 = model->addOperand(&type26); 13167 auto param67 = model->addOperand(&type4); 13168 auto param68 = model->addOperand(&type4); 13169 auto param69 = model->addOperand(&type26); 13170 auto param70 = model->addOperand(&type26); 13171 auto param71 = model->addOperand(&type26); 13172 auto scoresOut1 = model->addOperand(&type22); 13173 auto roiOut1 = model->addOperand(&type24); 13174 auto classesOut1 = model->addOperand(&type23); 13175 auto batchSplitOut1 = model->addOperand(&type23); 13176 auto in1 = model->addOperand(&type27); 13177 auto param72 = model->addOperand(&type4); 13178 auto param73 = model->addOperand(&type4); 13179 auto param74 = model->addOperand(&type26); 13180 auto param75 = model->addOperand(&type26); 13181 auto param76 = model->addOperand(&type4); 13182 auto param77 = model->addOperand(&type4); 13183 auto layout = model->addOperand(&type0); 13184 auto featureMap1 = model->addOperand(&type120); 13185 auto weights1 = model->addOperand(&type29); 13186 auto bias1 = model->addOperand(&type30); 13187 auto param78 = model->addOperand(&type4); 13188 auto param79 = model->addOperand(&type4); 13189 auto param80 = model->addOperand(&type4); 13190 auto param81 = model->addOperand(&type4); 13191 auto out1 = model->addOperand(&type31); 13192 // Phase 2, operations 13193 static float scores1_init[] = {0.9f, 0.1f}; 13194 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 13195 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13196 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 13197 static int32_t param65_init[] = {0}; 13198 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13199 static float param66_init[] = {0.3f}; 13200 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 13201 static int32_t param67_init[] = {-1}; 13202 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13203 static int32_t param68_init[] = {0}; 13204 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13205 static float param69_init[] = {0.4f}; 13206 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 13207 static float param70_init[] = {1.0f}; 13208 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 13209 static float param71_init[] = {0.3f}; 13210 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13211 static int32_t param72_init[] = {2}; 13212 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13213 static int32_t param73_init[] = {2}; 13214 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13215 static float param74_init[] = {2.0f}; 13216 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13217 static float param75_init[] = {2.0f}; 13218 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13219 static int32_t param76_init[] = {4}; 13220 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13221 static int32_t param77_init[] = {4}; 13222 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13223 static bool8 layout_init[] = {true}; 13224 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13225 static float weights1_init[] = {3.0f, 4.0f}; 13226 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 13227 static float bias1_init[] = {1.0f, 2.0f}; 13228 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 13229 static int32_t param78_init[] = {1}; 13230 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13231 static int32_t param79_init[] = {1}; 13232 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13233 static int32_t param80_init[] = {1}; 13234 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13235 static int32_t param81_init[] = {0}; 13236 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13237 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13238 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13239 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13240 // Phase 3, inputs and outputs 13241 model->identifyInputsAndOutputs( 13242 {in1}, 13243 {scoresOut1, classesOut1, out1}); 13244 assert(model->isValid()); 13245 } 13246 13247 inline bool is_ignored_zero_sized_nchw_2(int i) { 13248 static std::set<int> ignore = {}; 13249 return ignore.find(i) != ignore.end(); 13250 } 13251 13252 void CreateModel_zero_sized_nchw_relaxed_2(Model *model) { 13253 OperandType type0(Type::BOOL, {}); 13254 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 13255 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 13256 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 13257 OperandType type22(Type::TENSOR_FLOAT32, {0}); 13258 OperandType type23(Type::TENSOR_INT32, {0}); 13259 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 13260 OperandType type25(Type::TENSOR_INT32, {1}); 13261 OperandType type26(Type::FLOAT32, {}); 13262 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 13263 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 13264 OperandType type30(Type::TENSOR_FLOAT32, {2}); 13265 OperandType type31(Type::TENSOR_FLOAT32, {0, 2, 2, 2}); 13266 OperandType type4(Type::INT32, {}); 13267 // Phase 1, operands 13268 auto scores1 = model->addOperand(&type20); 13269 auto roi1 = model->addOperand(&type21); 13270 auto param65 = model->addOperand(&type25); 13271 auto param66 = model->addOperand(&type26); 13272 auto param67 = model->addOperand(&type4); 13273 auto param68 = model->addOperand(&type4); 13274 auto param69 = model->addOperand(&type26); 13275 auto param70 = model->addOperand(&type26); 13276 auto param71 = model->addOperand(&type26); 13277 auto scoresOut1 = model->addOperand(&type22); 13278 auto roiOut1 = model->addOperand(&type24); 13279 auto classesOut1 = model->addOperand(&type23); 13280 auto batchSplitOut1 = model->addOperand(&type23); 13281 auto in1 = model->addOperand(&type27); 13282 auto param72 = model->addOperand(&type4); 13283 auto param73 = model->addOperand(&type4); 13284 auto param74 = model->addOperand(&type26); 13285 auto param75 = model->addOperand(&type26); 13286 auto param76 = model->addOperand(&type4); 13287 auto param77 = model->addOperand(&type4); 13288 auto layout = model->addOperand(&type0); 13289 auto featureMap1 = model->addOperand(&type120); 13290 auto weights1 = model->addOperand(&type29); 13291 auto bias1 = model->addOperand(&type30); 13292 auto param78 = model->addOperand(&type4); 13293 auto param79 = model->addOperand(&type4); 13294 auto param80 = model->addOperand(&type4); 13295 auto param81 = model->addOperand(&type4); 13296 auto out1 = model->addOperand(&type31); 13297 // Phase 2, operations 13298 static float scores1_init[] = {0.9f, 0.1f}; 13299 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 13300 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13301 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 13302 static int32_t param65_init[] = {0}; 13303 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13304 static float param66_init[] = {0.3f}; 13305 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 13306 static int32_t param67_init[] = {-1}; 13307 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13308 static int32_t param68_init[] = {0}; 13309 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13310 static float param69_init[] = {0.4f}; 13311 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 13312 static float param70_init[] = {1.0f}; 13313 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 13314 static float param71_init[] = {0.3f}; 13315 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13316 static int32_t param72_init[] = {2}; 13317 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13318 static int32_t param73_init[] = {2}; 13319 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13320 static float param74_init[] = {2.0f}; 13321 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13322 static float param75_init[] = {2.0f}; 13323 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13324 static int32_t param76_init[] = {4}; 13325 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13326 static int32_t param77_init[] = {4}; 13327 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13328 static bool8 layout_init[] = {true}; 13329 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13330 static float weights1_init[] = {3.0f, 4.0f}; 13331 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 13332 static float bias1_init[] = {1.0f, 2.0f}; 13333 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 13334 static int32_t param78_init[] = {1}; 13335 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13336 static int32_t param79_init[] = {1}; 13337 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13338 static int32_t param80_init[] = {1}; 13339 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13340 static int32_t param81_init[] = {0}; 13341 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13342 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13343 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13344 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13345 // Phase 3, inputs and outputs 13346 model->identifyInputsAndOutputs( 13347 {in1}, 13348 {scoresOut1, classesOut1, out1}); 13349 // Phase 4: set relaxed execution 13350 model->relaxComputationFloat32toFloat16(true); 13351 assert(model->isValid()); 13352 } 13353 13354 inline bool is_ignored_zero_sized_nchw_relaxed_2(int i) { 13355 static std::set<int> ignore = {}; 13356 return ignore.find(i) != ignore.end(); 13357 } 13358 13359 void CreateModel_zero_sized_nchw_quant8_2(Model *model) { 13360 OperandType type0(Type::BOOL, {}); 13361 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 13362 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 13363 OperandType type104(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 2}, 0.1f, 128); 13364 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 13365 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 13366 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 13367 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 13368 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 13369 OperandType type121(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); 13370 OperandType type23(Type::TENSOR_INT32, {0}); 13371 OperandType type25(Type::TENSOR_INT32, {1}); 13372 OperandType type26(Type::FLOAT32, {}); 13373 OperandType type4(Type::INT32, {}); 13374 // Phase 1, operands 13375 auto scores1 = model->addOperand(&type107); 13376 auto roi1 = model->addOperand(&type105); 13377 auto param65 = model->addOperand(&type25); 13378 auto param66 = model->addOperand(&type26); 13379 auto param67 = model->addOperand(&type4); 13380 auto param68 = model->addOperand(&type4); 13381 auto param69 = model->addOperand(&type26); 13382 auto param70 = model->addOperand(&type26); 13383 auto param71 = model->addOperand(&type26); 13384 auto scoresOut1 = model->addOperand(&type108); 13385 auto roiOut1 = model->addOperand(&type106); 13386 auto classesOut1 = model->addOperand(&type23); 13387 auto batchSplitOut1 = model->addOperand(&type23); 13388 auto in1 = model->addOperand(&type103); 13389 auto param72 = model->addOperand(&type4); 13390 auto param73 = model->addOperand(&type4); 13391 auto param74 = model->addOperand(&type26); 13392 auto param75 = model->addOperand(&type26); 13393 auto param76 = model->addOperand(&type4); 13394 auto param77 = model->addOperand(&type4); 13395 auto layout = model->addOperand(&type0); 13396 auto featureMap1 = model->addOperand(&type121); 13397 auto weights1 = model->addOperand(&type109); 13398 auto bias1 = model->addOperand(&type101); 13399 auto param78 = model->addOperand(&type4); 13400 auto param79 = model->addOperand(&type4); 13401 auto param80 = model->addOperand(&type4); 13402 auto param81 = model->addOperand(&type4); 13403 auto out1 = model->addOperand(&type104); 13404 // Phase 2, operations 13405 static uint8_t scores1_init[] = {137, 129}; 13406 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 13407 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 13408 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 13409 static int32_t param65_init[] = {0}; 13410 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13411 static float param66_init[] = {0.3f}; 13412 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 13413 static int32_t param67_init[] = {-1}; 13414 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13415 static int32_t param68_init[] = {0}; 13416 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13417 static float param69_init[] = {0.4f}; 13418 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 13419 static float param70_init[] = {1.0f}; 13420 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 13421 static float param71_init[] = {0.3f}; 13422 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13423 static int32_t param72_init[] = {2}; 13424 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13425 static int32_t param73_init[] = {2}; 13426 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13427 static float param74_init[] = {2.0f}; 13428 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13429 static float param75_init[] = {2.0f}; 13430 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13431 static int32_t param76_init[] = {4}; 13432 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13433 static int32_t param77_init[] = {4}; 13434 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13435 static bool8 layout_init[] = {true}; 13436 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13437 static uint8_t weights1_init[] = {158, 168}; 13438 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 2); 13439 static int32_t bias1_init[] = {100, 200}; 13440 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 2); 13441 static int32_t param78_init[] = {1}; 13442 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13443 static int32_t param79_init[] = {1}; 13444 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13445 static int32_t param80_init[] = {1}; 13446 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13447 static int32_t param81_init[] = {0}; 13448 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13449 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13450 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13451 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13452 // Phase 3, inputs and outputs 13453 model->identifyInputsAndOutputs( 13454 {in1}, 13455 {scoresOut1, classesOut1, out1}); 13456 assert(model->isValid()); 13457 } 13458 13459 inline bool is_ignored_zero_sized_nchw_quant8_2(int i) { 13460 static std::set<int> ignore = {}; 13461 return ignore.find(i) != ignore.end(); 13462 } 13463 13464 void CreateModel_zero_sized_nchw_float16_2(Model *model) { 13465 OperandType type0(Type::BOOL, {}); 13466 OperandType type110(Type::TENSOR_FLOAT16, {2}); 13467 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 13468 OperandType type113(Type::TENSOR_FLOAT16, {0, 2, 2, 2}); 13469 OperandType type114(Type::FLOAT16, {}); 13470 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 13471 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 13472 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 13473 OperandType type118(Type::TENSOR_FLOAT16, {0}); 13474 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 13475 OperandType type122(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); 13476 OperandType type23(Type::TENSOR_INT32, {0}); 13477 OperandType type25(Type::TENSOR_INT32, {1}); 13478 OperandType type4(Type::INT32, {}); 13479 // Phase 1, operands 13480 auto scores1 = model->addOperand(&type117); 13481 auto roi1 = model->addOperand(&type115); 13482 auto param65 = model->addOperand(&type25); 13483 auto param66 = model->addOperand(&type114); 13484 auto param67 = model->addOperand(&type4); 13485 auto param68 = model->addOperand(&type4); 13486 auto param69 = model->addOperand(&type114); 13487 auto param70 = model->addOperand(&type114); 13488 auto param71 = model->addOperand(&type114); 13489 auto scoresOut1 = model->addOperand(&type118); 13490 auto roiOut1 = model->addOperand(&type116); 13491 auto classesOut1 = model->addOperand(&type23); 13492 auto batchSplitOut1 = model->addOperand(&type23); 13493 auto in1 = model->addOperand(&type112); 13494 auto param72 = model->addOperand(&type4); 13495 auto param73 = model->addOperand(&type4); 13496 auto param74 = model->addOperand(&type114); 13497 auto param75 = model->addOperand(&type114); 13498 auto param76 = model->addOperand(&type4); 13499 auto param77 = model->addOperand(&type4); 13500 auto layout = model->addOperand(&type0); 13501 auto featureMap1 = model->addOperand(&type122); 13502 auto weights1 = model->addOperand(&type119); 13503 auto bias1 = model->addOperand(&type110); 13504 auto param78 = model->addOperand(&type4); 13505 auto param79 = model->addOperand(&type4); 13506 auto param80 = model->addOperand(&type4); 13507 auto param81 = model->addOperand(&type4); 13508 auto out1 = model->addOperand(&type113); 13509 // Phase 2, operations 13510 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 13511 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 13512 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13513 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 13514 static int32_t param65_init[] = {0}; 13515 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13516 static _Float16 param66_init[] = {0.30000001192092896f}; 13517 model->setOperandValue(param66, param66_init, sizeof(_Float16) * 1); 13518 static int32_t param67_init[] = {-1}; 13519 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13520 static int32_t param68_init[] = {0}; 13521 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13522 static _Float16 param69_init[] = {0.4000000059604645f}; 13523 model->setOperandValue(param69, param69_init, sizeof(_Float16) * 1); 13524 static _Float16 param70_init[] = {1.0f}; 13525 model->setOperandValue(param70, param70_init, sizeof(_Float16) * 1); 13526 static _Float16 param71_init[] = {0.30000001192092896f}; 13527 model->setOperandValue(param71, param71_init, sizeof(_Float16) * 1); 13528 static int32_t param72_init[] = {2}; 13529 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13530 static int32_t param73_init[] = {2}; 13531 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13532 static _Float16 param74_init[] = {2.0f}; 13533 model->setOperandValue(param74, param74_init, sizeof(_Float16) * 1); 13534 static _Float16 param75_init[] = {2.0f}; 13535 model->setOperandValue(param75, param75_init, sizeof(_Float16) * 1); 13536 static int32_t param76_init[] = {4}; 13537 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13538 static int32_t param77_init[] = {4}; 13539 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13540 static bool8 layout_init[] = {true}; 13541 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13542 static _Float16 weights1_init[] = {3.0f, 4.0f}; 13543 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 2); 13544 static _Float16 bias1_init[] = {1.0f, 2.0f}; 13545 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 2); 13546 static int32_t param78_init[] = {1}; 13547 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13548 static int32_t param79_init[] = {1}; 13549 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13550 static int32_t param80_init[] = {1}; 13551 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13552 static int32_t param81_init[] = {0}; 13553 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13554 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13555 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13556 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13557 // Phase 3, inputs and outputs 13558 model->identifyInputsAndOutputs( 13559 {in1}, 13560 {scoresOut1, classesOut1, out1}); 13561 assert(model->isValid()); 13562 } 13563 13564 inline bool is_ignored_zero_sized_nchw_float16_2(int i) { 13565 static std::set<int> ignore = {}; 13566 return ignore.find(i) != ignore.end(); 13567 } 13568 13569 void CreateModel_zero_sized_dynamic_output_shape_nhwc_2(Model *model) { 13570 OperandType type0(Type::BOOL, {}); 13571 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 13572 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 13573 OperandType type22(Type::TENSOR_FLOAT32, {0}); 13574 OperandType type23(Type::TENSOR_INT32, {0}); 13575 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 13576 OperandType type25(Type::TENSOR_INT32, {1}); 13577 OperandType type26(Type::FLOAT32, {}); 13578 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 13579 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 13580 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 13581 OperandType type30(Type::TENSOR_FLOAT32, {2}); 13582 OperandType type4(Type::INT32, {}); 13583 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13584 // Phase 1, operands 13585 auto scores1 = model->addOperand(&type20); 13586 auto roi1 = model->addOperand(&type21); 13587 auto param65 = model->addOperand(&type25); 13588 auto param66 = model->addOperand(&type26); 13589 auto param67 = model->addOperand(&type4); 13590 auto param68 = model->addOperand(&type4); 13591 auto param69 = model->addOperand(&type26); 13592 auto param70 = model->addOperand(&type26); 13593 auto param71 = model->addOperand(&type26); 13594 auto scoresOut1 = model->addOperand(&type22); 13595 auto roiOut1 = model->addOperand(&type24); 13596 auto classesOut1 = model->addOperand(&type23); 13597 auto batchSplitOut1 = model->addOperand(&type23); 13598 auto in1 = model->addOperand(&type27); 13599 auto param72 = model->addOperand(&type4); 13600 auto param73 = model->addOperand(&type4); 13601 auto param74 = model->addOperand(&type26); 13602 auto param75 = model->addOperand(&type26); 13603 auto param76 = model->addOperand(&type4); 13604 auto param77 = model->addOperand(&type4); 13605 auto layout = model->addOperand(&type0); 13606 auto featureMap1 = model->addOperand(&type28); 13607 auto weights1 = model->addOperand(&type29); 13608 auto bias1 = model->addOperand(&type30); 13609 auto param78 = model->addOperand(&type4); 13610 auto param79 = model->addOperand(&type4); 13611 auto param80 = model->addOperand(&type4); 13612 auto param81 = model->addOperand(&type4); 13613 auto out1 = model->addOperand(&type46); 13614 // Phase 2, operations 13615 static float scores1_init[] = {0.9f, 0.1f}; 13616 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 13617 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13618 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 13619 static int32_t param65_init[] = {0}; 13620 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13621 static float param66_init[] = {0.3f}; 13622 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 13623 static int32_t param67_init[] = {-1}; 13624 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13625 static int32_t param68_init[] = {0}; 13626 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13627 static float param69_init[] = {0.4f}; 13628 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 13629 static float param70_init[] = {1.0f}; 13630 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 13631 static float param71_init[] = {0.3f}; 13632 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13633 static int32_t param72_init[] = {2}; 13634 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13635 static int32_t param73_init[] = {2}; 13636 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13637 static float param74_init[] = {2.0f}; 13638 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13639 static float param75_init[] = {2.0f}; 13640 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13641 static int32_t param76_init[] = {4}; 13642 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13643 static int32_t param77_init[] = {4}; 13644 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13645 static bool8 layout_init[] = {false}; 13646 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13647 static float weights1_init[] = {3.0f, 4.0f}; 13648 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 13649 static float bias1_init[] = {1.0f, 2.0f}; 13650 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 13651 static int32_t param78_init[] = {1}; 13652 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13653 static int32_t param79_init[] = {1}; 13654 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13655 static int32_t param80_init[] = {1}; 13656 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13657 static int32_t param81_init[] = {0}; 13658 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13659 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13660 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13661 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13662 // Phase 3, inputs and outputs 13663 model->identifyInputsAndOutputs( 13664 {in1}, 13665 {scoresOut1, classesOut1, out1}); 13666 assert(model->isValid()); 13667 } 13668 13669 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_2(int i) { 13670 static std::set<int> ignore = {}; 13671 return ignore.find(i) != ignore.end(); 13672 } 13673 13674 void CreateModel_zero_sized_dynamic_output_shape_nhwc_relaxed_2(Model *model) { 13675 OperandType type0(Type::BOOL, {}); 13676 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 13677 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 13678 OperandType type22(Type::TENSOR_FLOAT32, {0}); 13679 OperandType type23(Type::TENSOR_INT32, {0}); 13680 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 13681 OperandType type25(Type::TENSOR_INT32, {1}); 13682 OperandType type26(Type::FLOAT32, {}); 13683 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 13684 OperandType type28(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 13685 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 13686 OperandType type30(Type::TENSOR_FLOAT32, {2}); 13687 OperandType type4(Type::INT32, {}); 13688 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13689 // Phase 1, operands 13690 auto scores1 = model->addOperand(&type20); 13691 auto roi1 = model->addOperand(&type21); 13692 auto param65 = model->addOperand(&type25); 13693 auto param66 = model->addOperand(&type26); 13694 auto param67 = model->addOperand(&type4); 13695 auto param68 = model->addOperand(&type4); 13696 auto param69 = model->addOperand(&type26); 13697 auto param70 = model->addOperand(&type26); 13698 auto param71 = model->addOperand(&type26); 13699 auto scoresOut1 = model->addOperand(&type22); 13700 auto roiOut1 = model->addOperand(&type24); 13701 auto classesOut1 = model->addOperand(&type23); 13702 auto batchSplitOut1 = model->addOperand(&type23); 13703 auto in1 = model->addOperand(&type27); 13704 auto param72 = model->addOperand(&type4); 13705 auto param73 = model->addOperand(&type4); 13706 auto param74 = model->addOperand(&type26); 13707 auto param75 = model->addOperand(&type26); 13708 auto param76 = model->addOperand(&type4); 13709 auto param77 = model->addOperand(&type4); 13710 auto layout = model->addOperand(&type0); 13711 auto featureMap1 = model->addOperand(&type28); 13712 auto weights1 = model->addOperand(&type29); 13713 auto bias1 = model->addOperand(&type30); 13714 auto param78 = model->addOperand(&type4); 13715 auto param79 = model->addOperand(&type4); 13716 auto param80 = model->addOperand(&type4); 13717 auto param81 = model->addOperand(&type4); 13718 auto out1 = model->addOperand(&type46); 13719 // Phase 2, operations 13720 static float scores1_init[] = {0.9f, 0.1f}; 13721 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 13722 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13723 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 13724 static int32_t param65_init[] = {0}; 13725 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13726 static float param66_init[] = {0.3f}; 13727 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 13728 static int32_t param67_init[] = {-1}; 13729 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13730 static int32_t param68_init[] = {0}; 13731 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13732 static float param69_init[] = {0.4f}; 13733 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 13734 static float param70_init[] = {1.0f}; 13735 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 13736 static float param71_init[] = {0.3f}; 13737 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13738 static int32_t param72_init[] = {2}; 13739 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13740 static int32_t param73_init[] = {2}; 13741 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13742 static float param74_init[] = {2.0f}; 13743 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13744 static float param75_init[] = {2.0f}; 13745 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13746 static int32_t param76_init[] = {4}; 13747 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13748 static int32_t param77_init[] = {4}; 13749 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13750 static bool8 layout_init[] = {false}; 13751 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13752 static float weights1_init[] = {3.0f, 4.0f}; 13753 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 13754 static float bias1_init[] = {1.0f, 2.0f}; 13755 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 13756 static int32_t param78_init[] = {1}; 13757 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13758 static int32_t param79_init[] = {1}; 13759 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13760 static int32_t param80_init[] = {1}; 13761 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13762 static int32_t param81_init[] = {0}; 13763 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13764 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13765 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13766 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13767 // Phase 3, inputs and outputs 13768 model->identifyInputsAndOutputs( 13769 {in1}, 13770 {scoresOut1, classesOut1, out1}); 13771 // Phase 4: set relaxed execution 13772 model->relaxComputationFloat32toFloat16(true); 13773 assert(model->isValid()); 13774 } 13775 13776 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed_2(int i) { 13777 static std::set<int> ignore = {}; 13778 return ignore.find(i) != ignore.end(); 13779 } 13780 13781 void CreateModel_zero_sized_dynamic_output_shape_nhwc_quant8_2(Model *model) { 13782 OperandType type0(Type::BOOL, {}); 13783 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 13784 OperandType type102(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); 13785 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 13786 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 13787 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 13788 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 13789 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 13790 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 13791 OperandType type123(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 13792 OperandType type23(Type::TENSOR_INT32, {0}); 13793 OperandType type25(Type::TENSOR_INT32, {1}); 13794 OperandType type26(Type::FLOAT32, {}); 13795 OperandType type4(Type::INT32, {}); 13796 // Phase 1, operands 13797 auto scores1 = model->addOperand(&type107); 13798 auto roi1 = model->addOperand(&type105); 13799 auto param65 = model->addOperand(&type25); 13800 auto param66 = model->addOperand(&type26); 13801 auto param67 = model->addOperand(&type4); 13802 auto param68 = model->addOperand(&type4); 13803 auto param69 = model->addOperand(&type26); 13804 auto param70 = model->addOperand(&type26); 13805 auto param71 = model->addOperand(&type26); 13806 auto scoresOut1 = model->addOperand(&type108); 13807 auto roiOut1 = model->addOperand(&type106); 13808 auto classesOut1 = model->addOperand(&type23); 13809 auto batchSplitOut1 = model->addOperand(&type23); 13810 auto in1 = model->addOperand(&type103); 13811 auto param72 = model->addOperand(&type4); 13812 auto param73 = model->addOperand(&type4); 13813 auto param74 = model->addOperand(&type26); 13814 auto param75 = model->addOperand(&type26); 13815 auto param76 = model->addOperand(&type4); 13816 auto param77 = model->addOperand(&type4); 13817 auto layout = model->addOperand(&type0); 13818 auto featureMap1 = model->addOperand(&type102); 13819 auto weights1 = model->addOperand(&type109); 13820 auto bias1 = model->addOperand(&type101); 13821 auto param78 = model->addOperand(&type4); 13822 auto param79 = model->addOperand(&type4); 13823 auto param80 = model->addOperand(&type4); 13824 auto param81 = model->addOperand(&type4); 13825 auto out1 = model->addOperand(&type123); 13826 // Phase 2, operations 13827 static uint8_t scores1_init[] = {137, 129}; 13828 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 13829 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 13830 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 13831 static int32_t param65_init[] = {0}; 13832 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13833 static float param66_init[] = {0.3f}; 13834 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 13835 static int32_t param67_init[] = {-1}; 13836 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13837 static int32_t param68_init[] = {0}; 13838 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13839 static float param69_init[] = {0.4f}; 13840 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 13841 static float param70_init[] = {1.0f}; 13842 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 13843 static float param71_init[] = {0.3f}; 13844 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 13845 static int32_t param72_init[] = {2}; 13846 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13847 static int32_t param73_init[] = {2}; 13848 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13849 static float param74_init[] = {2.0f}; 13850 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 13851 static float param75_init[] = {2.0f}; 13852 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 13853 static int32_t param76_init[] = {4}; 13854 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13855 static int32_t param77_init[] = {4}; 13856 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13857 static bool8 layout_init[] = {false}; 13858 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13859 static uint8_t weights1_init[] = {158, 168}; 13860 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 2); 13861 static int32_t bias1_init[] = {100, 200}; 13862 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 2); 13863 static int32_t param78_init[] = {1}; 13864 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13865 static int32_t param79_init[] = {1}; 13866 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13867 static int32_t param80_init[] = {1}; 13868 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13869 static int32_t param81_init[] = {0}; 13870 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13871 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13872 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13873 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13874 // Phase 3, inputs and outputs 13875 model->identifyInputsAndOutputs( 13876 {in1}, 13877 {scoresOut1, classesOut1, out1}); 13878 assert(model->isValid()); 13879 } 13880 13881 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8_2(int i) { 13882 static std::set<int> ignore = {}; 13883 return ignore.find(i) != ignore.end(); 13884 } 13885 13886 void CreateModel_zero_sized_dynamic_output_shape_nhwc_float16_2(Model *model) { 13887 OperandType type0(Type::BOOL, {}); 13888 OperandType type110(Type::TENSOR_FLOAT16, {2}); 13889 OperandType type111(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); 13890 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 13891 OperandType type114(Type::FLOAT16, {}); 13892 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 13893 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 13894 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 13895 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 13896 OperandType type124(Type::TENSOR_FLOAT16, {0}); 13897 OperandType type23(Type::TENSOR_INT32, {0}); 13898 OperandType type25(Type::TENSOR_INT32, {1}); 13899 OperandType type4(Type::INT32, {}); 13900 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 13901 // Phase 1, operands 13902 auto scores1 = model->addOperand(&type117); 13903 auto roi1 = model->addOperand(&type115); 13904 auto param65 = model->addOperand(&type25); 13905 auto param66 = model->addOperand(&type114); 13906 auto param67 = model->addOperand(&type4); 13907 auto param68 = model->addOperand(&type4); 13908 auto param69 = model->addOperand(&type114); 13909 auto param70 = model->addOperand(&type114); 13910 auto param71 = model->addOperand(&type114); 13911 auto scoresOut1 = model->addOperand(&type124); 13912 auto roiOut1 = model->addOperand(&type116); 13913 auto classesOut1 = model->addOperand(&type23); 13914 auto batchSplitOut1 = model->addOperand(&type23); 13915 auto in1 = model->addOperand(&type112); 13916 auto param72 = model->addOperand(&type4); 13917 auto param73 = model->addOperand(&type4); 13918 auto param74 = model->addOperand(&type114); 13919 auto param75 = model->addOperand(&type114); 13920 auto param76 = model->addOperand(&type4); 13921 auto param77 = model->addOperand(&type4); 13922 auto layout = model->addOperand(&type0); 13923 auto featureMap1 = model->addOperand(&type111); 13924 auto weights1 = model->addOperand(&type119); 13925 auto bias1 = model->addOperand(&type110); 13926 auto param78 = model->addOperand(&type4); 13927 auto param79 = model->addOperand(&type4); 13928 auto param80 = model->addOperand(&type4); 13929 auto param81 = model->addOperand(&type4); 13930 auto out1 = model->addOperand(&type48); 13931 // Phase 2, operations 13932 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 13933 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 13934 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 13935 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 13936 static int32_t param65_init[] = {0}; 13937 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 13938 static _Float16 param66_init[] = {0.30000001192092896f}; 13939 model->setOperandValue(param66, param66_init, sizeof(_Float16) * 1); 13940 static int32_t param67_init[] = {-1}; 13941 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 13942 static int32_t param68_init[] = {0}; 13943 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 13944 static _Float16 param69_init[] = {0.4000000059604645f}; 13945 model->setOperandValue(param69, param69_init, sizeof(_Float16) * 1); 13946 static _Float16 param70_init[] = {1.0f}; 13947 model->setOperandValue(param70, param70_init, sizeof(_Float16) * 1); 13948 static _Float16 param71_init[] = {0.30000001192092896f}; 13949 model->setOperandValue(param71, param71_init, sizeof(_Float16) * 1); 13950 static int32_t param72_init[] = {2}; 13951 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 13952 static int32_t param73_init[] = {2}; 13953 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 13954 static _Float16 param74_init[] = {2.0f}; 13955 model->setOperandValue(param74, param74_init, sizeof(_Float16) * 1); 13956 static _Float16 param75_init[] = {2.0f}; 13957 model->setOperandValue(param75, param75_init, sizeof(_Float16) * 1); 13958 static int32_t param76_init[] = {4}; 13959 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 13960 static int32_t param77_init[] = {4}; 13961 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 13962 static bool8 layout_init[] = {false}; 13963 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13964 static _Float16 weights1_init[] = {3.0f, 4.0f}; 13965 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 2); 13966 static _Float16 bias1_init[] = {1.0f, 2.0f}; 13967 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 2); 13968 static int32_t param78_init[] = {1}; 13969 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 13970 static int32_t param79_init[] = {1}; 13971 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 13972 static int32_t param80_init[] = {1}; 13973 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 13974 static int32_t param81_init[] = {0}; 13975 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 13976 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 13977 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 13978 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 13979 // Phase 3, inputs and outputs 13980 model->identifyInputsAndOutputs( 13981 {in1}, 13982 {scoresOut1, classesOut1, out1}); 13983 assert(model->isValid()); 13984 } 13985 13986 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16_2(int i) { 13987 static std::set<int> ignore = {}; 13988 return ignore.find(i) != ignore.end(); 13989 } 13990 13991 void CreateModel_zero_sized_dynamic_output_shape_nchw_2(Model *model) { 13992 OperandType type0(Type::BOOL, {}); 13993 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 13994 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 13995 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 13996 OperandType type22(Type::TENSOR_FLOAT32, {0}); 13997 OperandType type23(Type::TENSOR_INT32, {0}); 13998 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 13999 OperandType type25(Type::TENSOR_INT32, {1}); 14000 OperandType type26(Type::FLOAT32, {}); 14001 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 14002 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 14003 OperandType type30(Type::TENSOR_FLOAT32, {2}); 14004 OperandType type4(Type::INT32, {}); 14005 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 14006 // Phase 1, operands 14007 auto scores1 = model->addOperand(&type20); 14008 auto roi1 = model->addOperand(&type21); 14009 auto param65 = model->addOperand(&type25); 14010 auto param66 = model->addOperand(&type26); 14011 auto param67 = model->addOperand(&type4); 14012 auto param68 = model->addOperand(&type4); 14013 auto param69 = model->addOperand(&type26); 14014 auto param70 = model->addOperand(&type26); 14015 auto param71 = model->addOperand(&type26); 14016 auto scoresOut1 = model->addOperand(&type22); 14017 auto roiOut1 = model->addOperand(&type24); 14018 auto classesOut1 = model->addOperand(&type23); 14019 auto batchSplitOut1 = model->addOperand(&type23); 14020 auto in1 = model->addOperand(&type27); 14021 auto param72 = model->addOperand(&type4); 14022 auto param73 = model->addOperand(&type4); 14023 auto param74 = model->addOperand(&type26); 14024 auto param75 = model->addOperand(&type26); 14025 auto param76 = model->addOperand(&type4); 14026 auto param77 = model->addOperand(&type4); 14027 auto layout = model->addOperand(&type0); 14028 auto featureMap1 = model->addOperand(&type120); 14029 auto weights1 = model->addOperand(&type29); 14030 auto bias1 = model->addOperand(&type30); 14031 auto param78 = model->addOperand(&type4); 14032 auto param79 = model->addOperand(&type4); 14033 auto param80 = model->addOperand(&type4); 14034 auto param81 = model->addOperand(&type4); 14035 auto out1 = model->addOperand(&type46); 14036 // Phase 2, operations 14037 static float scores1_init[] = {0.9f, 0.1f}; 14038 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 14039 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 14040 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 14041 static int32_t param65_init[] = {0}; 14042 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 14043 static float param66_init[] = {0.3f}; 14044 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 14045 static int32_t param67_init[] = {-1}; 14046 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 14047 static int32_t param68_init[] = {0}; 14048 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 14049 static float param69_init[] = {0.4f}; 14050 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 14051 static float param70_init[] = {1.0f}; 14052 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 14053 static float param71_init[] = {0.3f}; 14054 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 14055 static int32_t param72_init[] = {2}; 14056 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 14057 static int32_t param73_init[] = {2}; 14058 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 14059 static float param74_init[] = {2.0f}; 14060 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 14061 static float param75_init[] = {2.0f}; 14062 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 14063 static int32_t param76_init[] = {4}; 14064 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 14065 static int32_t param77_init[] = {4}; 14066 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 14067 static bool8 layout_init[] = {true}; 14068 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14069 static float weights1_init[] = {3.0f, 4.0f}; 14070 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 14071 static float bias1_init[] = {1.0f, 2.0f}; 14072 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 14073 static int32_t param78_init[] = {1}; 14074 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 14075 static int32_t param79_init[] = {1}; 14076 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 14077 static int32_t param80_init[] = {1}; 14078 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 14079 static int32_t param81_init[] = {0}; 14080 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 14081 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 14082 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 14083 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 14084 // Phase 3, inputs and outputs 14085 model->identifyInputsAndOutputs( 14086 {in1}, 14087 {scoresOut1, classesOut1, out1}); 14088 assert(model->isValid()); 14089 } 14090 14091 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_2(int i) { 14092 static std::set<int> ignore = {}; 14093 return ignore.find(i) != ignore.end(); 14094 } 14095 14096 void CreateModel_zero_sized_dynamic_output_shape_nchw_relaxed_2(Model *model) { 14097 OperandType type0(Type::BOOL, {}); 14098 OperandType type120(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 14099 OperandType type20(Type::TENSOR_FLOAT32, {1, 2}); 14100 OperandType type21(Type::TENSOR_FLOAT32, {1, 8}); 14101 OperandType type22(Type::TENSOR_FLOAT32, {0}); 14102 OperandType type23(Type::TENSOR_INT32, {0}); 14103 OperandType type24(Type::TENSOR_FLOAT32, {0, 4}); 14104 OperandType type25(Type::TENSOR_INT32, {1}); 14105 OperandType type26(Type::FLOAT32, {}); 14106 OperandType type27(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 14107 OperandType type29(Type::TENSOR_FLOAT32, {2, 1, 1, 1}); 14108 OperandType type30(Type::TENSOR_FLOAT32, {2}); 14109 OperandType type4(Type::INT32, {}); 14110 OperandType type46(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 14111 // Phase 1, operands 14112 auto scores1 = model->addOperand(&type20); 14113 auto roi1 = model->addOperand(&type21); 14114 auto param65 = model->addOperand(&type25); 14115 auto param66 = model->addOperand(&type26); 14116 auto param67 = model->addOperand(&type4); 14117 auto param68 = model->addOperand(&type4); 14118 auto param69 = model->addOperand(&type26); 14119 auto param70 = model->addOperand(&type26); 14120 auto param71 = model->addOperand(&type26); 14121 auto scoresOut1 = model->addOperand(&type22); 14122 auto roiOut1 = model->addOperand(&type24); 14123 auto classesOut1 = model->addOperand(&type23); 14124 auto batchSplitOut1 = model->addOperand(&type23); 14125 auto in1 = model->addOperand(&type27); 14126 auto param72 = model->addOperand(&type4); 14127 auto param73 = model->addOperand(&type4); 14128 auto param74 = model->addOperand(&type26); 14129 auto param75 = model->addOperand(&type26); 14130 auto param76 = model->addOperand(&type4); 14131 auto param77 = model->addOperand(&type4); 14132 auto layout = model->addOperand(&type0); 14133 auto featureMap1 = model->addOperand(&type120); 14134 auto weights1 = model->addOperand(&type29); 14135 auto bias1 = model->addOperand(&type30); 14136 auto param78 = model->addOperand(&type4); 14137 auto param79 = model->addOperand(&type4); 14138 auto param80 = model->addOperand(&type4); 14139 auto param81 = model->addOperand(&type4); 14140 auto out1 = model->addOperand(&type46); 14141 // Phase 2, operations 14142 static float scores1_init[] = {0.9f, 0.1f}; 14143 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 14144 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 14145 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 14146 static int32_t param65_init[] = {0}; 14147 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 14148 static float param66_init[] = {0.3f}; 14149 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 14150 static int32_t param67_init[] = {-1}; 14151 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 14152 static int32_t param68_init[] = {0}; 14153 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 14154 static float param69_init[] = {0.4f}; 14155 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 14156 static float param70_init[] = {1.0f}; 14157 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 14158 static float param71_init[] = {0.3f}; 14159 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 14160 static int32_t param72_init[] = {2}; 14161 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 14162 static int32_t param73_init[] = {2}; 14163 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 14164 static float param74_init[] = {2.0f}; 14165 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 14166 static float param75_init[] = {2.0f}; 14167 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 14168 static int32_t param76_init[] = {4}; 14169 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 14170 static int32_t param77_init[] = {4}; 14171 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 14172 static bool8 layout_init[] = {true}; 14173 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14174 static float weights1_init[] = {3.0f, 4.0f}; 14175 model->setOperandValue(weights1, weights1_init, sizeof(float) * 2); 14176 static float bias1_init[] = {1.0f, 2.0f}; 14177 model->setOperandValue(bias1, bias1_init, sizeof(float) * 2); 14178 static int32_t param78_init[] = {1}; 14179 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 14180 static int32_t param79_init[] = {1}; 14181 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 14182 static int32_t param80_init[] = {1}; 14183 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 14184 static int32_t param81_init[] = {0}; 14185 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 14186 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 14187 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 14188 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 14189 // Phase 3, inputs and outputs 14190 model->identifyInputsAndOutputs( 14191 {in1}, 14192 {scoresOut1, classesOut1, out1}); 14193 // Phase 4: set relaxed execution 14194 model->relaxComputationFloat32toFloat16(true); 14195 assert(model->isValid()); 14196 } 14197 14198 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed_2(int i) { 14199 static std::set<int> ignore = {}; 14200 return ignore.find(i) != ignore.end(); 14201 } 14202 14203 void CreateModel_zero_sized_dynamic_output_shape_nchw_quant8_2(Model *model) { 14204 OperandType type0(Type::BOOL, {}); 14205 OperandType type101(Type::TENSOR_INT32, {2}, 0.01f, 0); 14206 OperandType type103(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 14207 OperandType type105(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 14208 OperandType type106(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 14209 OperandType type107(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 14210 OperandType type108(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 14211 OperandType type109(Type::TENSOR_QUANT8_ASYMM, {2, 1, 1, 1}, 0.1f, 128); 14212 OperandType type121(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); 14213 OperandType type123(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 14214 OperandType type23(Type::TENSOR_INT32, {0}); 14215 OperandType type25(Type::TENSOR_INT32, {1}); 14216 OperandType type26(Type::FLOAT32, {}); 14217 OperandType type4(Type::INT32, {}); 14218 // Phase 1, operands 14219 auto scores1 = model->addOperand(&type107); 14220 auto roi1 = model->addOperand(&type105); 14221 auto param65 = model->addOperand(&type25); 14222 auto param66 = model->addOperand(&type26); 14223 auto param67 = model->addOperand(&type4); 14224 auto param68 = model->addOperand(&type4); 14225 auto param69 = model->addOperand(&type26); 14226 auto param70 = model->addOperand(&type26); 14227 auto param71 = model->addOperand(&type26); 14228 auto scoresOut1 = model->addOperand(&type108); 14229 auto roiOut1 = model->addOperand(&type106); 14230 auto classesOut1 = model->addOperand(&type23); 14231 auto batchSplitOut1 = model->addOperand(&type23); 14232 auto in1 = model->addOperand(&type103); 14233 auto param72 = model->addOperand(&type4); 14234 auto param73 = model->addOperand(&type4); 14235 auto param74 = model->addOperand(&type26); 14236 auto param75 = model->addOperand(&type26); 14237 auto param76 = model->addOperand(&type4); 14238 auto param77 = model->addOperand(&type4); 14239 auto layout = model->addOperand(&type0); 14240 auto featureMap1 = model->addOperand(&type121); 14241 auto weights1 = model->addOperand(&type109); 14242 auto bias1 = model->addOperand(&type101); 14243 auto param78 = model->addOperand(&type4); 14244 auto param79 = model->addOperand(&type4); 14245 auto param80 = model->addOperand(&type4); 14246 auto param81 = model->addOperand(&type4); 14247 auto out1 = model->addOperand(&type123); 14248 // Phase 2, operations 14249 static uint8_t scores1_init[] = {137, 129}; 14250 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 14251 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 14252 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 14253 static int32_t param65_init[] = {0}; 14254 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 14255 static float param66_init[] = {0.3f}; 14256 model->setOperandValue(param66, param66_init, sizeof(float) * 1); 14257 static int32_t param67_init[] = {-1}; 14258 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 14259 static int32_t param68_init[] = {0}; 14260 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 14261 static float param69_init[] = {0.4f}; 14262 model->setOperandValue(param69, param69_init, sizeof(float) * 1); 14263 static float param70_init[] = {1.0f}; 14264 model->setOperandValue(param70, param70_init, sizeof(float) * 1); 14265 static float param71_init[] = {0.3f}; 14266 model->setOperandValue(param71, param71_init, sizeof(float) * 1); 14267 static int32_t param72_init[] = {2}; 14268 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 14269 static int32_t param73_init[] = {2}; 14270 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 14271 static float param74_init[] = {2.0f}; 14272 model->setOperandValue(param74, param74_init, sizeof(float) * 1); 14273 static float param75_init[] = {2.0f}; 14274 model->setOperandValue(param75, param75_init, sizeof(float) * 1); 14275 static int32_t param76_init[] = {4}; 14276 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 14277 static int32_t param77_init[] = {4}; 14278 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 14279 static bool8 layout_init[] = {true}; 14280 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14281 static uint8_t weights1_init[] = {158, 168}; 14282 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 2); 14283 static int32_t bias1_init[] = {100, 200}; 14284 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 2); 14285 static int32_t param78_init[] = {1}; 14286 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 14287 static int32_t param79_init[] = {1}; 14288 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 14289 static int32_t param80_init[] = {1}; 14290 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 14291 static int32_t param81_init[] = {0}; 14292 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 14293 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 14294 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 14295 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 14296 // Phase 3, inputs and outputs 14297 model->identifyInputsAndOutputs( 14298 {in1}, 14299 {scoresOut1, classesOut1, out1}); 14300 assert(model->isValid()); 14301 } 14302 14303 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8_2(int i) { 14304 static std::set<int> ignore = {}; 14305 return ignore.find(i) != ignore.end(); 14306 } 14307 14308 void CreateModel_zero_sized_dynamic_output_shape_nchw_float16_2(Model *model) { 14309 OperandType type0(Type::BOOL, {}); 14310 OperandType type110(Type::TENSOR_FLOAT16, {2}); 14311 OperandType type112(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 14312 OperandType type114(Type::FLOAT16, {}); 14313 OperandType type115(Type::TENSOR_FLOAT16, {1, 8}); 14314 OperandType type116(Type::TENSOR_FLOAT16, {0, 4}); 14315 OperandType type117(Type::TENSOR_FLOAT16, {1, 2}); 14316 OperandType type119(Type::TENSOR_FLOAT16, {2, 1, 1, 1}); 14317 OperandType type122(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); 14318 OperandType type124(Type::TENSOR_FLOAT16, {0}); 14319 OperandType type23(Type::TENSOR_INT32, {0}); 14320 OperandType type25(Type::TENSOR_INT32, {1}); 14321 OperandType type4(Type::INT32, {}); 14322 OperandType type48(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 14323 // Phase 1, operands 14324 auto scores1 = model->addOperand(&type117); 14325 auto roi1 = model->addOperand(&type115); 14326 auto param65 = model->addOperand(&type25); 14327 auto param66 = model->addOperand(&type114); 14328 auto param67 = model->addOperand(&type4); 14329 auto param68 = model->addOperand(&type4); 14330 auto param69 = model->addOperand(&type114); 14331 auto param70 = model->addOperand(&type114); 14332 auto param71 = model->addOperand(&type114); 14333 auto scoresOut1 = model->addOperand(&type124); 14334 auto roiOut1 = model->addOperand(&type116); 14335 auto classesOut1 = model->addOperand(&type23); 14336 auto batchSplitOut1 = model->addOperand(&type23); 14337 auto in1 = model->addOperand(&type112); 14338 auto param72 = model->addOperand(&type4); 14339 auto param73 = model->addOperand(&type4); 14340 auto param74 = model->addOperand(&type114); 14341 auto param75 = model->addOperand(&type114); 14342 auto param76 = model->addOperand(&type4); 14343 auto param77 = model->addOperand(&type4); 14344 auto layout = model->addOperand(&type0); 14345 auto featureMap1 = model->addOperand(&type122); 14346 auto weights1 = model->addOperand(&type119); 14347 auto bias1 = model->addOperand(&type110); 14348 auto param78 = model->addOperand(&type4); 14349 auto param79 = model->addOperand(&type4); 14350 auto param80 = model->addOperand(&type4); 14351 auto param81 = model->addOperand(&type4); 14352 auto out1 = model->addOperand(&type48); 14353 // Phase 2, operations 14354 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 14355 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 14356 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 14357 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 14358 static int32_t param65_init[] = {0}; 14359 model->setOperandValue(param65, param65_init, sizeof(int32_t) * 1); 14360 static _Float16 param66_init[] = {0.30000001192092896f}; 14361 model->setOperandValue(param66, param66_init, sizeof(_Float16) * 1); 14362 static int32_t param67_init[] = {-1}; 14363 model->setOperandValue(param67, param67_init, sizeof(int32_t) * 1); 14364 static int32_t param68_init[] = {0}; 14365 model->setOperandValue(param68, param68_init, sizeof(int32_t) * 1); 14366 static _Float16 param69_init[] = {0.4000000059604645f}; 14367 model->setOperandValue(param69, param69_init, sizeof(_Float16) * 1); 14368 static _Float16 param70_init[] = {1.0f}; 14369 model->setOperandValue(param70, param70_init, sizeof(_Float16) * 1); 14370 static _Float16 param71_init[] = {0.30000001192092896f}; 14371 model->setOperandValue(param71, param71_init, sizeof(_Float16) * 1); 14372 static int32_t param72_init[] = {2}; 14373 model->setOperandValue(param72, param72_init, sizeof(int32_t) * 1); 14374 static int32_t param73_init[] = {2}; 14375 model->setOperandValue(param73, param73_init, sizeof(int32_t) * 1); 14376 static _Float16 param74_init[] = {2.0f}; 14377 model->setOperandValue(param74, param74_init, sizeof(_Float16) * 1); 14378 static _Float16 param75_init[] = {2.0f}; 14379 model->setOperandValue(param75, param75_init, sizeof(_Float16) * 1); 14380 static int32_t param76_init[] = {4}; 14381 model->setOperandValue(param76, param76_init, sizeof(int32_t) * 1); 14382 static int32_t param77_init[] = {4}; 14383 model->setOperandValue(param77, param77_init, sizeof(int32_t) * 1); 14384 static bool8 layout_init[] = {true}; 14385 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14386 static _Float16 weights1_init[] = {3.0f, 4.0f}; 14387 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 2); 14388 static _Float16 bias1_init[] = {1.0f, 2.0f}; 14389 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 2); 14390 static int32_t param78_init[] = {1}; 14391 model->setOperandValue(param78, param78_init, sizeof(int32_t) * 1); 14392 static int32_t param79_init[] = {1}; 14393 model->setOperandValue(param79, param79_init, sizeof(int32_t) * 1); 14394 static int32_t param80_init[] = {1}; 14395 model->setOperandValue(param80, param80_init, sizeof(int32_t) * 1); 14396 static int32_t param81_init[] = {0}; 14397 model->setOperandValue(param81, param81_init, sizeof(int32_t) * 1); 14398 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param65, param66, param67, param68, param69, param70, param71}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 14399 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param72, param73, param74, param75, param76, param77, layout}, {featureMap1}); 14400 model->addOperation(ANEURALNETWORKS_CONV_2D, {featureMap1, weights1, bias1, param78, param79, param80, param81, layout}, {out1}); 14401 // Phase 3, inputs and outputs 14402 model->identifyInputsAndOutputs( 14403 {in1}, 14404 {scoresOut1, classesOut1, out1}); 14405 assert(model->isValid()); 14406 } 14407 14408 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16_2(int i) { 14409 static std::set<int> ignore = {}; 14410 return ignore.find(i) != ignore.end(); 14411 } 14412 14413