1 // clang-format off 2 // Generated file (from: transpose_conv2d.mod.py). Do not edit 3 void CreateModel_nhwc_none(Model *model) { 4 OperandType type0(Type::BOOL, {}); 5 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8 OperandType type4(Type::TENSOR_INT32, {4}); 9 OperandType type5(Type::INT32, {}); 10 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 11 // Phase 1, operands 12 auto op1 = model->addOperand(&type1); 13 auto op2 = model->addOperand(&type2); 14 auto op3 = model->addOperand(&type3); 15 auto shape = model->addOperand(&type4); 16 auto param = model->addOperand(&type5); 17 auto param1 = model->addOperand(&type5); 18 auto param2 = model->addOperand(&type5); 19 auto act = model->addOperand(&type5); 20 auto layout = model->addOperand(&type0); 21 auto op4 = model->addOperand(&type6); 22 // Phase 2, operations 23 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 24 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 25 static float op3_init[] = {-1.5f, -2.0f}; 26 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 27 static int32_t shape_init[] = {1, 5, 5, 2}; 28 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 29 static int32_t param_init[] = {2}; 30 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 31 static int32_t param1_init[] = {2}; 32 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 33 static int32_t param2_init[] = {2}; 34 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 35 static int32_t act_init[] = {0}; 36 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 37 static bool8 layout_init[] = {false}; 38 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 39 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 40 // Phase 3, inputs and outputs 41 model->identifyInputsAndOutputs( 42 {op1}, 43 {op4}); 44 assert(model->isValid()); 45 } 46 47 inline bool is_ignored_nhwc_none(int i) { 48 static std::set<int> ignore = {}; 49 return ignore.find(i) != ignore.end(); 50 } 51 52 void CreateModel_nhwc_none_weight_as_input(Model *model) { 53 OperandType type0(Type::BOOL, {}); 54 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 55 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 56 OperandType type3(Type::TENSOR_FLOAT32, {2}); 57 OperandType type4(Type::TENSOR_INT32, {4}); 58 OperandType type5(Type::INT32, {}); 59 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 60 // Phase 1, operands 61 auto op1 = model->addOperand(&type1); 62 auto op2 = model->addOperand(&type2); 63 auto op3 = model->addOperand(&type3); 64 auto shape = model->addOperand(&type4); 65 auto param = model->addOperand(&type5); 66 auto param1 = model->addOperand(&type5); 67 auto param2 = model->addOperand(&type5); 68 auto act = model->addOperand(&type5); 69 auto layout = model->addOperand(&type0); 70 auto op4 = model->addOperand(&type6); 71 // Phase 2, operations 72 static int32_t shape_init[] = {1, 5, 5, 2}; 73 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 74 static int32_t param_init[] = {2}; 75 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 76 static int32_t param1_init[] = {2}; 77 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 78 static int32_t param2_init[] = {2}; 79 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 80 static int32_t act_init[] = {0}; 81 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 82 static bool8 layout_init[] = {false}; 83 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 84 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 85 // Phase 3, inputs and outputs 86 model->identifyInputsAndOutputs( 87 {op1, op2, op3}, 88 {op4}); 89 assert(model->isValid()); 90 } 91 92 inline bool is_ignored_nhwc_none_weight_as_input(int i) { 93 static std::set<int> ignore = {}; 94 return ignore.find(i) != ignore.end(); 95 } 96 97 void CreateModel_nhwc_none_relaxed(Model *model) { 98 OperandType type0(Type::BOOL, {}); 99 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 100 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 101 OperandType type3(Type::TENSOR_FLOAT32, {2}); 102 OperandType type4(Type::TENSOR_INT32, {4}); 103 OperandType type5(Type::INT32, {}); 104 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 105 // Phase 1, operands 106 auto op1 = model->addOperand(&type1); 107 auto op2 = model->addOperand(&type2); 108 auto op3 = model->addOperand(&type3); 109 auto shape = model->addOperand(&type4); 110 auto param = model->addOperand(&type5); 111 auto param1 = model->addOperand(&type5); 112 auto param2 = model->addOperand(&type5); 113 auto act = model->addOperand(&type5); 114 auto layout = model->addOperand(&type0); 115 auto op4 = model->addOperand(&type6); 116 // Phase 2, operations 117 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 118 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 119 static float op3_init[] = {-1.5f, -2.0f}; 120 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 121 static int32_t shape_init[] = {1, 5, 5, 2}; 122 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 123 static int32_t param_init[] = {2}; 124 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 125 static int32_t param1_init[] = {2}; 126 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 127 static int32_t param2_init[] = {2}; 128 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 129 static int32_t act_init[] = {0}; 130 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 131 static bool8 layout_init[] = {false}; 132 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 133 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 134 // Phase 3, inputs and outputs 135 model->identifyInputsAndOutputs( 136 {op1}, 137 {op4}); 138 // Phase 4: set relaxed execution 139 model->relaxComputationFloat32toFloat16(true); 140 assert(model->isValid()); 141 } 142 143 inline bool is_ignored_nhwc_none_relaxed(int i) { 144 static std::set<int> ignore = {}; 145 return ignore.find(i) != ignore.end(); 146 } 147 148 void CreateModel_nhwc_none_relaxed_weight_as_input(Model *model) { 149 OperandType type0(Type::BOOL, {}); 150 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 151 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 152 OperandType type3(Type::TENSOR_FLOAT32, {2}); 153 OperandType type4(Type::TENSOR_INT32, {4}); 154 OperandType type5(Type::INT32, {}); 155 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 156 // Phase 1, operands 157 auto op1 = model->addOperand(&type1); 158 auto op2 = model->addOperand(&type2); 159 auto op3 = model->addOperand(&type3); 160 auto shape = model->addOperand(&type4); 161 auto param = model->addOperand(&type5); 162 auto param1 = model->addOperand(&type5); 163 auto param2 = model->addOperand(&type5); 164 auto act = model->addOperand(&type5); 165 auto layout = model->addOperand(&type0); 166 auto op4 = model->addOperand(&type6); 167 // Phase 2, operations 168 static int32_t shape_init[] = {1, 5, 5, 2}; 169 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 170 static int32_t param_init[] = {2}; 171 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 172 static int32_t param1_init[] = {2}; 173 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 174 static int32_t param2_init[] = {2}; 175 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 176 static int32_t act_init[] = {0}; 177 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 178 static bool8 layout_init[] = {false}; 179 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 180 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 181 // Phase 3, inputs and outputs 182 model->identifyInputsAndOutputs( 183 {op1, op2, op3}, 184 {op4}); 185 // Phase 4: set relaxed execution 186 model->relaxComputationFloat32toFloat16(true); 187 assert(model->isValid()); 188 } 189 190 inline bool is_ignored_nhwc_none_relaxed_weight_as_input(int i) { 191 static std::set<int> ignore = {}; 192 return ignore.find(i) != ignore.end(); 193 } 194 195 void CreateModel_nhwc_none_quant8(Model *model) { 196 OperandType type0(Type::BOOL, {}); 197 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 198 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 199 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 200 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 201 OperandType type4(Type::TENSOR_INT32, {4}); 202 OperandType type5(Type::INT32, {}); 203 // Phase 1, operands 204 auto op1 = model->addOperand(&type27); 205 auto op2 = model->addOperand(&type28); 206 auto op3 = model->addOperand(&type29); 207 auto shape = model->addOperand(&type4); 208 auto param = model->addOperand(&type5); 209 auto param1 = model->addOperand(&type5); 210 auto param2 = model->addOperand(&type5); 211 auto act = model->addOperand(&type5); 212 auto layout = model->addOperand(&type0); 213 auto op4 = model->addOperand(&type30); 214 // Phase 2, operations 215 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 216 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 217 static int32_t op3_init[] = {-6, -8}; 218 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 219 static int32_t shape_init[] = {1, 5, 5, 2}; 220 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 221 static int32_t param_init[] = {2}; 222 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 223 static int32_t param1_init[] = {2}; 224 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 225 static int32_t param2_init[] = {2}; 226 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 227 static int32_t act_init[] = {0}; 228 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 229 static bool8 layout_init[] = {false}; 230 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 231 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 232 // Phase 3, inputs and outputs 233 model->identifyInputsAndOutputs( 234 {op1}, 235 {op4}); 236 assert(model->isValid()); 237 } 238 239 inline bool is_ignored_nhwc_none_quant8(int i) { 240 static std::set<int> ignore = {}; 241 return ignore.find(i) != ignore.end(); 242 } 243 244 void CreateModel_nhwc_none_quant8_weight_as_input(Model *model) { 245 OperandType type0(Type::BOOL, {}); 246 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 247 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 248 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 249 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 250 OperandType type4(Type::TENSOR_INT32, {4}); 251 OperandType type5(Type::INT32, {}); 252 // Phase 1, operands 253 auto op1 = model->addOperand(&type27); 254 auto op2 = model->addOperand(&type28); 255 auto op3 = model->addOperand(&type29); 256 auto shape = model->addOperand(&type4); 257 auto param = model->addOperand(&type5); 258 auto param1 = model->addOperand(&type5); 259 auto param2 = model->addOperand(&type5); 260 auto act = model->addOperand(&type5); 261 auto layout = model->addOperand(&type0); 262 auto op4 = model->addOperand(&type30); 263 // Phase 2, operations 264 static int32_t shape_init[] = {1, 5, 5, 2}; 265 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 266 static int32_t param_init[] = {2}; 267 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 268 static int32_t param1_init[] = {2}; 269 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 270 static int32_t param2_init[] = {2}; 271 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 272 static int32_t act_init[] = {0}; 273 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 274 static bool8 layout_init[] = {false}; 275 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 276 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 277 // Phase 3, inputs and outputs 278 model->identifyInputsAndOutputs( 279 {op1, op2, op3}, 280 {op4}); 281 assert(model->isValid()); 282 } 283 284 inline bool is_ignored_nhwc_none_quant8_weight_as_input(int i) { 285 static std::set<int> ignore = {}; 286 return ignore.find(i) != ignore.end(); 287 } 288 289 void CreateModel_nhwc_none_quant8_2(Model *model) { 290 OperandType type0(Type::BOOL, {}); 291 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 292 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 293 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 294 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 295 OperandType type4(Type::TENSOR_INT32, {4}); 296 OperandType type5(Type::INT32, {}); 297 // Phase 1, operands 298 auto op1 = model->addOperand(&type31); 299 auto op2 = model->addOperand(&type32); 300 auto op3 = model->addOperand(&type29); 301 auto shape = model->addOperand(&type4); 302 auto param = model->addOperand(&type5); 303 auto param1 = model->addOperand(&type5); 304 auto param2 = model->addOperand(&type5); 305 auto act = model->addOperand(&type5); 306 auto layout = model->addOperand(&type0); 307 auto op4 = model->addOperand(&type33); 308 // Phase 2, operations 309 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 310 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 311 static int32_t op3_init[] = {-6, -8}; 312 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 313 static int32_t shape_init[] = {1, 5, 5, 2}; 314 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 315 static int32_t param_init[] = {2}; 316 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 317 static int32_t param1_init[] = {2}; 318 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 319 static int32_t param2_init[] = {2}; 320 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 321 static int32_t act_init[] = {0}; 322 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 323 static bool8 layout_init[] = {false}; 324 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 325 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 326 // Phase 3, inputs and outputs 327 model->identifyInputsAndOutputs( 328 {op1}, 329 {op4}); 330 assert(model->isValid()); 331 } 332 333 inline bool is_ignored_nhwc_none_quant8_2(int i) { 334 static std::set<int> ignore = {}; 335 return ignore.find(i) != ignore.end(); 336 } 337 338 void CreateModel_nhwc_none_quant8_weight_as_input_2(Model *model) { 339 OperandType type0(Type::BOOL, {}); 340 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 341 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 342 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 343 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 344 OperandType type4(Type::TENSOR_INT32, {4}); 345 OperandType type5(Type::INT32, {}); 346 // Phase 1, operands 347 auto op1 = model->addOperand(&type31); 348 auto op2 = model->addOperand(&type32); 349 auto op3 = model->addOperand(&type29); 350 auto shape = model->addOperand(&type4); 351 auto param = model->addOperand(&type5); 352 auto param1 = model->addOperand(&type5); 353 auto param2 = model->addOperand(&type5); 354 auto act = model->addOperand(&type5); 355 auto layout = model->addOperand(&type0); 356 auto op4 = model->addOperand(&type33); 357 // Phase 2, operations 358 static int32_t shape_init[] = {1, 5, 5, 2}; 359 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 360 static int32_t param_init[] = {2}; 361 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 362 static int32_t param1_init[] = {2}; 363 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 364 static int32_t param2_init[] = {2}; 365 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 366 static int32_t act_init[] = {0}; 367 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 368 static bool8 layout_init[] = {false}; 369 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 370 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 371 // Phase 3, inputs and outputs 372 model->identifyInputsAndOutputs( 373 {op1, op2, op3}, 374 {op4}); 375 assert(model->isValid()); 376 } 377 378 inline bool is_ignored_nhwc_none_quant8_weight_as_input_2(int i) { 379 static std::set<int> ignore = {}; 380 return ignore.find(i) != ignore.end(); 381 } 382 383 void CreateModel_nhwc_none_channelQuant8(Model *model) { 384 OperandType type0(Type::BOOL, {}); 385 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 386 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 387 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 388 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 389 OperandType type4(Type::TENSOR_INT32, {4}); 390 OperandType type5(Type::INT32, {}); 391 // Phase 1, operands 392 auto op1 = model->addOperand(&type34); 393 auto op2 = model->addOperand(&type35); 394 auto op3 = model->addOperand(&type36); 395 auto shape = model->addOperand(&type4); 396 auto param = model->addOperand(&type5); 397 auto param1 = model->addOperand(&type5); 398 auto param2 = model->addOperand(&type5); 399 auto act = model->addOperand(&type5); 400 auto layout = model->addOperand(&type0); 401 auto op4 = model->addOperand(&type37); 402 // Phase 2, operations 403 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 404 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 405 static int32_t op3_init[] = {-24, -16}; 406 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 407 static int32_t shape_init[] = {1, 5, 5, 2}; 408 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 409 static int32_t param_init[] = {2}; 410 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 411 static int32_t param1_init[] = {2}; 412 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 413 static int32_t param2_init[] = {2}; 414 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 415 static int32_t act_init[] = {0}; 416 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 417 static bool8 layout_init[] = {false}; 418 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 419 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 420 // Phase 3, inputs and outputs 421 model->identifyInputsAndOutputs( 422 {op1}, 423 {op4}); 424 assert(model->isValid()); 425 } 426 427 inline bool is_ignored_nhwc_none_channelQuant8(int i) { 428 static std::set<int> ignore = {}; 429 return ignore.find(i) != ignore.end(); 430 } 431 432 void CreateModel_nhwc_none_channelQuant8_weight_as_input(Model *model) { 433 OperandType type0(Type::BOOL, {}); 434 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 435 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 436 OperandType type38(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 437 OperandType type39(Type::TENSOR_INT32, {2}, 0.0f, 0); 438 OperandType type4(Type::TENSOR_INT32, {4}); 439 OperandType type5(Type::INT32, {}); 440 // Phase 1, operands 441 auto op1 = model->addOperand(&type34); 442 auto op2 = model->addOperand(&type38); 443 auto op3 = model->addOperand(&type39); 444 auto shape = model->addOperand(&type4); 445 auto param = model->addOperand(&type5); 446 auto param1 = model->addOperand(&type5); 447 auto param2 = model->addOperand(&type5); 448 auto act = model->addOperand(&type5); 449 auto layout = model->addOperand(&type0); 450 auto op4 = model->addOperand(&type37); 451 // Phase 2, operations 452 static int32_t shape_init[] = {1, 5, 5, 2}; 453 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 454 static int32_t param_init[] = {2}; 455 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 456 static int32_t param1_init[] = {2}; 457 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 458 static int32_t param2_init[] = {2}; 459 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 460 static int32_t act_init[] = {0}; 461 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 462 static bool8 layout_init[] = {false}; 463 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 464 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 465 // Phase 3, inputs and outputs 466 model->identifyInputsAndOutputs( 467 {op1, op2, op3}, 468 {op4}); 469 assert(model->isValid()); 470 } 471 472 inline bool is_ignored_nhwc_none_channelQuant8_weight_as_input(int i) { 473 static std::set<int> ignore = {}; 474 return ignore.find(i) != ignore.end(); 475 } 476 477 void CreateModel_nhwc_none_channelQuant8_2(Model *model) { 478 OperandType type0(Type::BOOL, {}); 479 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 480 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 481 OperandType type4(Type::TENSOR_INT32, {4}); 482 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 483 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 484 OperandType type5(Type::INT32, {}); 485 // Phase 1, operands 486 auto op1 = model->addOperand(&type34); 487 auto op2 = model->addOperand(&type40); 488 auto op3 = model->addOperand(&type41); 489 auto shape = model->addOperand(&type4); 490 auto param = model->addOperand(&type5); 491 auto param1 = model->addOperand(&type5); 492 auto param2 = model->addOperand(&type5); 493 auto act = model->addOperand(&type5); 494 auto layout = model->addOperand(&type0); 495 auto op4 = model->addOperand(&type33); 496 // Phase 2, operations 497 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 498 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 499 static int32_t op3_init[] = {-24, -16}; 500 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 501 static int32_t shape_init[] = {1, 5, 5, 2}; 502 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 503 static int32_t param_init[] = {2}; 504 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 505 static int32_t param1_init[] = {2}; 506 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 507 static int32_t param2_init[] = {2}; 508 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 509 static int32_t act_init[] = {0}; 510 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 511 static bool8 layout_init[] = {false}; 512 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 513 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 514 // Phase 3, inputs and outputs 515 model->identifyInputsAndOutputs( 516 {op1}, 517 {op4}); 518 assert(model->isValid()); 519 } 520 521 inline bool is_ignored_nhwc_none_channelQuant8_2(int i) { 522 static std::set<int> ignore = {}; 523 return ignore.find(i) != ignore.end(); 524 } 525 526 void CreateModel_nhwc_none_channelQuant8_weight_as_input_2(Model *model) { 527 OperandType type0(Type::BOOL, {}); 528 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 529 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 530 OperandType type4(Type::TENSOR_INT32, {4}); 531 OperandType type42(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 532 OperandType type43(Type::TENSOR_INT32, {2}, 0.0f, 0); 533 OperandType type5(Type::INT32, {}); 534 // Phase 1, operands 535 auto op1 = model->addOperand(&type34); 536 auto op2 = model->addOperand(&type42); 537 auto op3 = model->addOperand(&type43); 538 auto shape = model->addOperand(&type4); 539 auto param = model->addOperand(&type5); 540 auto param1 = model->addOperand(&type5); 541 auto param2 = model->addOperand(&type5); 542 auto act = model->addOperand(&type5); 543 auto layout = model->addOperand(&type0); 544 auto op4 = model->addOperand(&type33); 545 // Phase 2, operations 546 static int32_t shape_init[] = {1, 5, 5, 2}; 547 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 548 static int32_t param_init[] = {2}; 549 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 550 static int32_t param1_init[] = {2}; 551 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 552 static int32_t param2_init[] = {2}; 553 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 554 static int32_t act_init[] = {0}; 555 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 556 static bool8 layout_init[] = {false}; 557 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 558 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 559 // Phase 3, inputs and outputs 560 model->identifyInputsAndOutputs( 561 {op1, op2, op3}, 562 {op4}); 563 assert(model->isValid()); 564 } 565 566 inline bool is_ignored_nhwc_none_channelQuant8_weight_as_input_2(int i) { 567 static std::set<int> ignore = {}; 568 return ignore.find(i) != ignore.end(); 569 } 570 571 void CreateModel_nhwc_none_float16(Model *model) { 572 OperandType type0(Type::BOOL, {}); 573 OperandType type4(Type::TENSOR_INT32, {4}); 574 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 575 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 576 OperandType type46(Type::TENSOR_FLOAT16, {2}); 577 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 578 OperandType type5(Type::INT32, {}); 579 // Phase 1, operands 580 auto op1 = model->addOperand(&type44); 581 auto op2 = model->addOperand(&type45); 582 auto op3 = model->addOperand(&type46); 583 auto shape = model->addOperand(&type4); 584 auto param = model->addOperand(&type5); 585 auto param1 = model->addOperand(&type5); 586 auto param2 = model->addOperand(&type5); 587 auto act = model->addOperand(&type5); 588 auto layout = model->addOperand(&type0); 589 auto op4 = model->addOperand(&type47); 590 // Phase 2, operations 591 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 592 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 593 static _Float16 op3_init[] = {-1.5f, -2.0f}; 594 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 595 static int32_t shape_init[] = {1, 5, 5, 2}; 596 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 597 static int32_t param_init[] = {2}; 598 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 599 static int32_t param1_init[] = {2}; 600 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 601 static int32_t param2_init[] = {2}; 602 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 603 static int32_t act_init[] = {0}; 604 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 605 static bool8 layout_init[] = {false}; 606 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 607 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 608 // Phase 3, inputs and outputs 609 model->identifyInputsAndOutputs( 610 {op1}, 611 {op4}); 612 assert(model->isValid()); 613 } 614 615 inline bool is_ignored_nhwc_none_float16(int i) { 616 static std::set<int> ignore = {}; 617 return ignore.find(i) != ignore.end(); 618 } 619 620 void CreateModel_nhwc_none_float16_weight_as_input(Model *model) { 621 OperandType type0(Type::BOOL, {}); 622 OperandType type4(Type::TENSOR_INT32, {4}); 623 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 624 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 625 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 626 OperandType type49(Type::TENSOR_FLOAT16, {2}); 627 OperandType type5(Type::INT32, {}); 628 // Phase 1, operands 629 auto op1 = model->addOperand(&type44); 630 auto op2 = model->addOperand(&type48); 631 auto op3 = model->addOperand(&type49); 632 auto shape = model->addOperand(&type4); 633 auto param = model->addOperand(&type5); 634 auto param1 = model->addOperand(&type5); 635 auto param2 = model->addOperand(&type5); 636 auto act = model->addOperand(&type5); 637 auto layout = model->addOperand(&type0); 638 auto op4 = model->addOperand(&type47); 639 // Phase 2, operations 640 static int32_t shape_init[] = {1, 5, 5, 2}; 641 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 642 static int32_t param_init[] = {2}; 643 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 644 static int32_t param1_init[] = {2}; 645 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 646 static int32_t param2_init[] = {2}; 647 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 648 static int32_t act_init[] = {0}; 649 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 650 static bool8 layout_init[] = {false}; 651 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 652 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 653 // Phase 3, inputs and outputs 654 model->identifyInputsAndOutputs( 655 {op1, op2, op3}, 656 {op4}); 657 assert(model->isValid()); 658 } 659 660 inline bool is_ignored_nhwc_none_float16_weight_as_input(int i) { 661 static std::set<int> ignore = {}; 662 return ignore.find(i) != ignore.end(); 663 } 664 665 void CreateModel_nhwc_relu(Model *model) { 666 OperandType type0(Type::BOOL, {}); 667 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 668 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 669 OperandType type3(Type::TENSOR_FLOAT32, {2}); 670 OperandType type4(Type::TENSOR_INT32, {4}); 671 OperandType type5(Type::INT32, {}); 672 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 673 // Phase 1, operands 674 auto op1 = model->addOperand(&type1); 675 auto op2 = model->addOperand(&type2); 676 auto op3 = model->addOperand(&type3); 677 auto shape = model->addOperand(&type4); 678 auto param = model->addOperand(&type5); 679 auto param1 = model->addOperand(&type5); 680 auto param2 = model->addOperand(&type5); 681 auto act = model->addOperand(&type5); 682 auto layout = model->addOperand(&type0); 683 auto op4 = model->addOperand(&type6); 684 // Phase 2, operations 685 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 686 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 687 static float op3_init[] = {-1.5f, -2.0f}; 688 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 689 static int32_t shape_init[] = {1, 5, 5, 2}; 690 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 691 static int32_t param_init[] = {2}; 692 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 693 static int32_t param1_init[] = {2}; 694 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 695 static int32_t param2_init[] = {2}; 696 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 697 static int32_t act_init[] = {1}; 698 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 699 static bool8 layout_init[] = {false}; 700 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 701 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 702 // Phase 3, inputs and outputs 703 model->identifyInputsAndOutputs( 704 {op1}, 705 {op4}); 706 assert(model->isValid()); 707 } 708 709 inline bool is_ignored_nhwc_relu(int i) { 710 static std::set<int> ignore = {}; 711 return ignore.find(i) != ignore.end(); 712 } 713 714 void CreateModel_nhwc_relu_weight_as_input(Model *model) { 715 OperandType type0(Type::BOOL, {}); 716 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 717 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 718 OperandType type3(Type::TENSOR_FLOAT32, {2}); 719 OperandType type4(Type::TENSOR_INT32, {4}); 720 OperandType type5(Type::INT32, {}); 721 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 722 // Phase 1, operands 723 auto op1 = model->addOperand(&type1); 724 auto op2 = model->addOperand(&type2); 725 auto op3 = model->addOperand(&type3); 726 auto shape = model->addOperand(&type4); 727 auto param = model->addOperand(&type5); 728 auto param1 = model->addOperand(&type5); 729 auto param2 = model->addOperand(&type5); 730 auto act = model->addOperand(&type5); 731 auto layout = model->addOperand(&type0); 732 auto op4 = model->addOperand(&type6); 733 // Phase 2, operations 734 static int32_t shape_init[] = {1, 5, 5, 2}; 735 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 736 static int32_t param_init[] = {2}; 737 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 738 static int32_t param1_init[] = {2}; 739 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 740 static int32_t param2_init[] = {2}; 741 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 742 static int32_t act_init[] = {1}; 743 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 744 static bool8 layout_init[] = {false}; 745 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 746 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 747 // Phase 3, inputs and outputs 748 model->identifyInputsAndOutputs( 749 {op1, op2, op3}, 750 {op4}); 751 assert(model->isValid()); 752 } 753 754 inline bool is_ignored_nhwc_relu_weight_as_input(int i) { 755 static std::set<int> ignore = {}; 756 return ignore.find(i) != ignore.end(); 757 } 758 759 void CreateModel_nhwc_relu_relaxed(Model *model) { 760 OperandType type0(Type::BOOL, {}); 761 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 762 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 763 OperandType type3(Type::TENSOR_FLOAT32, {2}); 764 OperandType type4(Type::TENSOR_INT32, {4}); 765 OperandType type5(Type::INT32, {}); 766 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 767 // Phase 1, operands 768 auto op1 = model->addOperand(&type1); 769 auto op2 = model->addOperand(&type2); 770 auto op3 = model->addOperand(&type3); 771 auto shape = model->addOperand(&type4); 772 auto param = model->addOperand(&type5); 773 auto param1 = model->addOperand(&type5); 774 auto param2 = model->addOperand(&type5); 775 auto act = model->addOperand(&type5); 776 auto layout = model->addOperand(&type0); 777 auto op4 = model->addOperand(&type6); 778 // Phase 2, operations 779 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 780 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 781 static float op3_init[] = {-1.5f, -2.0f}; 782 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 783 static int32_t shape_init[] = {1, 5, 5, 2}; 784 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 785 static int32_t param_init[] = {2}; 786 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 787 static int32_t param1_init[] = {2}; 788 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 789 static int32_t param2_init[] = {2}; 790 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 791 static int32_t act_init[] = {1}; 792 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 793 static bool8 layout_init[] = {false}; 794 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 795 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 796 // Phase 3, inputs and outputs 797 model->identifyInputsAndOutputs( 798 {op1}, 799 {op4}); 800 // Phase 4: set relaxed execution 801 model->relaxComputationFloat32toFloat16(true); 802 assert(model->isValid()); 803 } 804 805 inline bool is_ignored_nhwc_relu_relaxed(int i) { 806 static std::set<int> ignore = {}; 807 return ignore.find(i) != ignore.end(); 808 } 809 810 void CreateModel_nhwc_relu_relaxed_weight_as_input(Model *model) { 811 OperandType type0(Type::BOOL, {}); 812 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 813 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 814 OperandType type3(Type::TENSOR_FLOAT32, {2}); 815 OperandType type4(Type::TENSOR_INT32, {4}); 816 OperandType type5(Type::INT32, {}); 817 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 818 // Phase 1, operands 819 auto op1 = model->addOperand(&type1); 820 auto op2 = model->addOperand(&type2); 821 auto op3 = model->addOperand(&type3); 822 auto shape = model->addOperand(&type4); 823 auto param = model->addOperand(&type5); 824 auto param1 = model->addOperand(&type5); 825 auto param2 = model->addOperand(&type5); 826 auto act = model->addOperand(&type5); 827 auto layout = model->addOperand(&type0); 828 auto op4 = model->addOperand(&type6); 829 // Phase 2, operations 830 static int32_t shape_init[] = {1, 5, 5, 2}; 831 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 832 static int32_t param_init[] = {2}; 833 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 834 static int32_t param1_init[] = {2}; 835 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 836 static int32_t param2_init[] = {2}; 837 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 838 static int32_t act_init[] = {1}; 839 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 840 static bool8 layout_init[] = {false}; 841 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 842 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 843 // Phase 3, inputs and outputs 844 model->identifyInputsAndOutputs( 845 {op1, op2, op3}, 846 {op4}); 847 // Phase 4: set relaxed execution 848 model->relaxComputationFloat32toFloat16(true); 849 assert(model->isValid()); 850 } 851 852 inline bool is_ignored_nhwc_relu_relaxed_weight_as_input(int i) { 853 static std::set<int> ignore = {}; 854 return ignore.find(i) != ignore.end(); 855 } 856 857 void CreateModel_nhwc_relu_quant8(Model *model) { 858 OperandType type0(Type::BOOL, {}); 859 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 860 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 861 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 862 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 863 OperandType type4(Type::TENSOR_INT32, {4}); 864 OperandType type5(Type::INT32, {}); 865 // Phase 1, operands 866 auto op1 = model->addOperand(&type27); 867 auto op2 = model->addOperand(&type28); 868 auto op3 = model->addOperand(&type29); 869 auto shape = model->addOperand(&type4); 870 auto param = model->addOperand(&type5); 871 auto param1 = model->addOperand(&type5); 872 auto param2 = model->addOperand(&type5); 873 auto act = model->addOperand(&type5); 874 auto layout = model->addOperand(&type0); 875 auto op4 = model->addOperand(&type30); 876 // Phase 2, operations 877 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 878 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 879 static int32_t op3_init[] = {-6, -8}; 880 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 881 static int32_t shape_init[] = {1, 5, 5, 2}; 882 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 883 static int32_t param_init[] = {2}; 884 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 885 static int32_t param1_init[] = {2}; 886 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 887 static int32_t param2_init[] = {2}; 888 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 889 static int32_t act_init[] = {1}; 890 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 891 static bool8 layout_init[] = {false}; 892 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 893 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 894 // Phase 3, inputs and outputs 895 model->identifyInputsAndOutputs( 896 {op1}, 897 {op4}); 898 assert(model->isValid()); 899 } 900 901 inline bool is_ignored_nhwc_relu_quant8(int i) { 902 static std::set<int> ignore = {}; 903 return ignore.find(i) != ignore.end(); 904 } 905 906 void CreateModel_nhwc_relu_quant8_weight_as_input(Model *model) { 907 OperandType type0(Type::BOOL, {}); 908 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 909 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 910 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 911 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 912 OperandType type4(Type::TENSOR_INT32, {4}); 913 OperandType type5(Type::INT32, {}); 914 // Phase 1, operands 915 auto op1 = model->addOperand(&type27); 916 auto op2 = model->addOperand(&type28); 917 auto op3 = model->addOperand(&type29); 918 auto shape = model->addOperand(&type4); 919 auto param = model->addOperand(&type5); 920 auto param1 = model->addOperand(&type5); 921 auto param2 = model->addOperand(&type5); 922 auto act = model->addOperand(&type5); 923 auto layout = model->addOperand(&type0); 924 auto op4 = model->addOperand(&type30); 925 // Phase 2, operations 926 static int32_t shape_init[] = {1, 5, 5, 2}; 927 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 928 static int32_t param_init[] = {2}; 929 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 930 static int32_t param1_init[] = {2}; 931 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 932 static int32_t param2_init[] = {2}; 933 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 934 static int32_t act_init[] = {1}; 935 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 936 static bool8 layout_init[] = {false}; 937 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 938 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 939 // Phase 3, inputs and outputs 940 model->identifyInputsAndOutputs( 941 {op1, op2, op3}, 942 {op4}); 943 assert(model->isValid()); 944 } 945 946 inline bool is_ignored_nhwc_relu_quant8_weight_as_input(int i) { 947 static std::set<int> ignore = {}; 948 return ignore.find(i) != ignore.end(); 949 } 950 951 void CreateModel_nhwc_relu_quant8_2(Model *model) { 952 OperandType type0(Type::BOOL, {}); 953 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 954 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 955 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 956 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 957 OperandType type4(Type::TENSOR_INT32, {4}); 958 OperandType type5(Type::INT32, {}); 959 // Phase 1, operands 960 auto op1 = model->addOperand(&type31); 961 auto op2 = model->addOperand(&type32); 962 auto op3 = model->addOperand(&type29); 963 auto shape = model->addOperand(&type4); 964 auto param = model->addOperand(&type5); 965 auto param1 = model->addOperand(&type5); 966 auto param2 = model->addOperand(&type5); 967 auto act = model->addOperand(&type5); 968 auto layout = model->addOperand(&type0); 969 auto op4 = model->addOperand(&type33); 970 // Phase 2, operations 971 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 972 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 973 static int32_t op3_init[] = {-6, -8}; 974 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 975 static int32_t shape_init[] = {1, 5, 5, 2}; 976 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 977 static int32_t param_init[] = {2}; 978 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 979 static int32_t param1_init[] = {2}; 980 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 981 static int32_t param2_init[] = {2}; 982 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 983 static int32_t act_init[] = {1}; 984 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 985 static bool8 layout_init[] = {false}; 986 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 987 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 988 // Phase 3, inputs and outputs 989 model->identifyInputsAndOutputs( 990 {op1}, 991 {op4}); 992 assert(model->isValid()); 993 } 994 995 inline bool is_ignored_nhwc_relu_quant8_2(int i) { 996 static std::set<int> ignore = {}; 997 return ignore.find(i) != ignore.end(); 998 } 999 1000 void CreateModel_nhwc_relu_quant8_weight_as_input_2(Model *model) { 1001 OperandType type0(Type::BOOL, {}); 1002 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 1003 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 1004 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 1005 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1006 OperandType type4(Type::TENSOR_INT32, {4}); 1007 OperandType type5(Type::INT32, {}); 1008 // Phase 1, operands 1009 auto op1 = model->addOperand(&type31); 1010 auto op2 = model->addOperand(&type32); 1011 auto op3 = model->addOperand(&type29); 1012 auto shape = model->addOperand(&type4); 1013 auto param = model->addOperand(&type5); 1014 auto param1 = model->addOperand(&type5); 1015 auto param2 = model->addOperand(&type5); 1016 auto act = model->addOperand(&type5); 1017 auto layout = model->addOperand(&type0); 1018 auto op4 = model->addOperand(&type33); 1019 // Phase 2, operations 1020 static int32_t shape_init[] = {1, 5, 5, 2}; 1021 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1022 static int32_t param_init[] = {2}; 1023 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1024 static int32_t param1_init[] = {2}; 1025 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1026 static int32_t param2_init[] = {2}; 1027 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1028 static int32_t act_init[] = {1}; 1029 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1030 static bool8 layout_init[] = {false}; 1031 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1032 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1033 // Phase 3, inputs and outputs 1034 model->identifyInputsAndOutputs( 1035 {op1, op2, op3}, 1036 {op4}); 1037 assert(model->isValid()); 1038 } 1039 1040 inline bool is_ignored_nhwc_relu_quant8_weight_as_input_2(int i) { 1041 static std::set<int> ignore = {}; 1042 return ignore.find(i) != ignore.end(); 1043 } 1044 1045 void CreateModel_nhwc_relu_channelQuant8(Model *model) { 1046 OperandType type0(Type::BOOL, {}); 1047 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1048 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1049 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 1050 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 1051 OperandType type4(Type::TENSOR_INT32, {4}); 1052 OperandType type5(Type::INT32, {}); 1053 // Phase 1, operands 1054 auto op1 = model->addOperand(&type34); 1055 auto op2 = model->addOperand(&type35); 1056 auto op3 = model->addOperand(&type36); 1057 auto shape = model->addOperand(&type4); 1058 auto param = model->addOperand(&type5); 1059 auto param1 = model->addOperand(&type5); 1060 auto param2 = model->addOperand(&type5); 1061 auto act = model->addOperand(&type5); 1062 auto layout = model->addOperand(&type0); 1063 auto op4 = model->addOperand(&type37); 1064 // Phase 2, operations 1065 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 1066 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 1067 static int32_t op3_init[] = {-24, -16}; 1068 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 1069 static int32_t shape_init[] = {1, 5, 5, 2}; 1070 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1071 static int32_t param_init[] = {2}; 1072 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1073 static int32_t param1_init[] = {2}; 1074 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1075 static int32_t param2_init[] = {2}; 1076 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1077 static int32_t act_init[] = {1}; 1078 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1079 static bool8 layout_init[] = {false}; 1080 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1081 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1082 // Phase 3, inputs and outputs 1083 model->identifyInputsAndOutputs( 1084 {op1}, 1085 {op4}); 1086 assert(model->isValid()); 1087 } 1088 1089 inline bool is_ignored_nhwc_relu_channelQuant8(int i) { 1090 static std::set<int> ignore = {}; 1091 return ignore.find(i) != ignore.end(); 1092 } 1093 1094 void CreateModel_nhwc_relu_channelQuant8_weight_as_input(Model *model) { 1095 OperandType type0(Type::BOOL, {}); 1096 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1097 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 1098 OperandType type4(Type::TENSOR_INT32, {4}); 1099 OperandType type5(Type::INT32, {}); 1100 OperandType type50(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1101 OperandType type51(Type::TENSOR_INT32, {2}, 0.0f, 0); 1102 // Phase 1, operands 1103 auto op1 = model->addOperand(&type34); 1104 auto op2 = model->addOperand(&type50); 1105 auto op3 = model->addOperand(&type51); 1106 auto shape = model->addOperand(&type4); 1107 auto param = model->addOperand(&type5); 1108 auto param1 = model->addOperand(&type5); 1109 auto param2 = model->addOperand(&type5); 1110 auto act = model->addOperand(&type5); 1111 auto layout = model->addOperand(&type0); 1112 auto op4 = model->addOperand(&type37); 1113 // Phase 2, operations 1114 static int32_t shape_init[] = {1, 5, 5, 2}; 1115 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1116 static int32_t param_init[] = {2}; 1117 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1118 static int32_t param1_init[] = {2}; 1119 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1120 static int32_t param2_init[] = {2}; 1121 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1122 static int32_t act_init[] = {1}; 1123 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1124 static bool8 layout_init[] = {false}; 1125 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1126 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1127 // Phase 3, inputs and outputs 1128 model->identifyInputsAndOutputs( 1129 {op1, op2, op3}, 1130 {op4}); 1131 assert(model->isValid()); 1132 } 1133 1134 inline bool is_ignored_nhwc_relu_channelQuant8_weight_as_input(int i) { 1135 static std::set<int> ignore = {}; 1136 return ignore.find(i) != ignore.end(); 1137 } 1138 1139 void CreateModel_nhwc_relu_channelQuant8_2(Model *model) { 1140 OperandType type0(Type::BOOL, {}); 1141 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1142 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1143 OperandType type4(Type::TENSOR_INT32, {4}); 1144 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1145 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 1146 OperandType type5(Type::INT32, {}); 1147 // Phase 1, operands 1148 auto op1 = model->addOperand(&type34); 1149 auto op2 = model->addOperand(&type40); 1150 auto op3 = model->addOperand(&type41); 1151 auto shape = model->addOperand(&type4); 1152 auto param = model->addOperand(&type5); 1153 auto param1 = model->addOperand(&type5); 1154 auto param2 = model->addOperand(&type5); 1155 auto act = model->addOperand(&type5); 1156 auto layout = model->addOperand(&type0); 1157 auto op4 = model->addOperand(&type33); 1158 // Phase 2, operations 1159 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 1160 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 1161 static int32_t op3_init[] = {-24, -16}; 1162 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 1163 static int32_t shape_init[] = {1, 5, 5, 2}; 1164 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1165 static int32_t param_init[] = {2}; 1166 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1167 static int32_t param1_init[] = {2}; 1168 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1169 static int32_t param2_init[] = {2}; 1170 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1171 static int32_t act_init[] = {1}; 1172 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1173 static bool8 layout_init[] = {false}; 1174 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1175 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1176 // Phase 3, inputs and outputs 1177 model->identifyInputsAndOutputs( 1178 {op1}, 1179 {op4}); 1180 assert(model->isValid()); 1181 } 1182 1183 inline bool is_ignored_nhwc_relu_channelQuant8_2(int i) { 1184 static std::set<int> ignore = {}; 1185 return ignore.find(i) != ignore.end(); 1186 } 1187 1188 void CreateModel_nhwc_relu_channelQuant8_weight_as_input_2(Model *model) { 1189 OperandType type0(Type::BOOL, {}); 1190 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1191 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1192 OperandType type4(Type::TENSOR_INT32, {4}); 1193 OperandType type5(Type::INT32, {}); 1194 OperandType type52(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1195 OperandType type53(Type::TENSOR_INT32, {2}, 0.0f, 0); 1196 // Phase 1, operands 1197 auto op1 = model->addOperand(&type34); 1198 auto op2 = model->addOperand(&type52); 1199 auto op3 = model->addOperand(&type53); 1200 auto shape = model->addOperand(&type4); 1201 auto param = model->addOperand(&type5); 1202 auto param1 = model->addOperand(&type5); 1203 auto param2 = model->addOperand(&type5); 1204 auto act = model->addOperand(&type5); 1205 auto layout = model->addOperand(&type0); 1206 auto op4 = model->addOperand(&type33); 1207 // Phase 2, operations 1208 static int32_t shape_init[] = {1, 5, 5, 2}; 1209 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1210 static int32_t param_init[] = {2}; 1211 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1212 static int32_t param1_init[] = {2}; 1213 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1214 static int32_t param2_init[] = {2}; 1215 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1216 static int32_t act_init[] = {1}; 1217 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1218 static bool8 layout_init[] = {false}; 1219 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1220 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1221 // Phase 3, inputs and outputs 1222 model->identifyInputsAndOutputs( 1223 {op1, op2, op3}, 1224 {op4}); 1225 assert(model->isValid()); 1226 } 1227 1228 inline bool is_ignored_nhwc_relu_channelQuant8_weight_as_input_2(int i) { 1229 static std::set<int> ignore = {}; 1230 return ignore.find(i) != ignore.end(); 1231 } 1232 1233 void CreateModel_nhwc_relu_float16(Model *model) { 1234 OperandType type0(Type::BOOL, {}); 1235 OperandType type4(Type::TENSOR_INT32, {4}); 1236 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1237 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 1238 OperandType type46(Type::TENSOR_FLOAT16, {2}); 1239 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 1240 OperandType type5(Type::INT32, {}); 1241 // Phase 1, operands 1242 auto op1 = model->addOperand(&type44); 1243 auto op2 = model->addOperand(&type45); 1244 auto op3 = model->addOperand(&type46); 1245 auto shape = model->addOperand(&type4); 1246 auto param = model->addOperand(&type5); 1247 auto param1 = model->addOperand(&type5); 1248 auto param2 = model->addOperand(&type5); 1249 auto act = model->addOperand(&type5); 1250 auto layout = model->addOperand(&type0); 1251 auto op4 = model->addOperand(&type47); 1252 // Phase 2, operations 1253 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 1254 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 1255 static _Float16 op3_init[] = {-1.5f, -2.0f}; 1256 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 1257 static int32_t shape_init[] = {1, 5, 5, 2}; 1258 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1259 static int32_t param_init[] = {2}; 1260 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1261 static int32_t param1_init[] = {2}; 1262 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1263 static int32_t param2_init[] = {2}; 1264 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1265 static int32_t act_init[] = {1}; 1266 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1267 static bool8 layout_init[] = {false}; 1268 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1269 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1270 // Phase 3, inputs and outputs 1271 model->identifyInputsAndOutputs( 1272 {op1}, 1273 {op4}); 1274 assert(model->isValid()); 1275 } 1276 1277 inline bool is_ignored_nhwc_relu_float16(int i) { 1278 static std::set<int> ignore = {}; 1279 return ignore.find(i) != ignore.end(); 1280 } 1281 1282 void CreateModel_nhwc_relu_float16_weight_as_input(Model *model) { 1283 OperandType type0(Type::BOOL, {}); 1284 OperandType type4(Type::TENSOR_INT32, {4}); 1285 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1286 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 1287 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 1288 OperandType type49(Type::TENSOR_FLOAT16, {2}); 1289 OperandType type5(Type::INT32, {}); 1290 // Phase 1, operands 1291 auto op1 = model->addOperand(&type44); 1292 auto op2 = model->addOperand(&type48); 1293 auto op3 = model->addOperand(&type49); 1294 auto shape = model->addOperand(&type4); 1295 auto param = model->addOperand(&type5); 1296 auto param1 = model->addOperand(&type5); 1297 auto param2 = model->addOperand(&type5); 1298 auto act = model->addOperand(&type5); 1299 auto layout = model->addOperand(&type0); 1300 auto op4 = model->addOperand(&type47); 1301 // Phase 2, operations 1302 static int32_t shape_init[] = {1, 5, 5, 2}; 1303 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1304 static int32_t param_init[] = {2}; 1305 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1306 static int32_t param1_init[] = {2}; 1307 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1308 static int32_t param2_init[] = {2}; 1309 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1310 static int32_t act_init[] = {1}; 1311 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1312 static bool8 layout_init[] = {false}; 1313 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1314 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1315 // Phase 3, inputs and outputs 1316 model->identifyInputsAndOutputs( 1317 {op1, op2, op3}, 1318 {op4}); 1319 assert(model->isValid()); 1320 } 1321 1322 inline bool is_ignored_nhwc_relu_float16_weight_as_input(int i) { 1323 static std::set<int> ignore = {}; 1324 return ignore.find(i) != ignore.end(); 1325 } 1326 1327 void CreateModel_nhwc_relu1(Model *model) { 1328 OperandType type0(Type::BOOL, {}); 1329 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1330 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 1331 OperandType type3(Type::TENSOR_FLOAT32, {2}); 1332 OperandType type4(Type::TENSOR_INT32, {4}); 1333 OperandType type5(Type::INT32, {}); 1334 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 1335 // Phase 1, operands 1336 auto op1 = model->addOperand(&type1); 1337 auto op2 = model->addOperand(&type2); 1338 auto op3 = model->addOperand(&type3); 1339 auto shape = model->addOperand(&type4); 1340 auto param = model->addOperand(&type5); 1341 auto param1 = model->addOperand(&type5); 1342 auto param2 = model->addOperand(&type5); 1343 auto act = model->addOperand(&type5); 1344 auto layout = model->addOperand(&type0); 1345 auto op4 = model->addOperand(&type6); 1346 // Phase 2, operations 1347 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 1348 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 1349 static float op3_init[] = {-1.5f, -2.0f}; 1350 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 1351 static int32_t shape_init[] = {1, 5, 5, 2}; 1352 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1353 static int32_t param_init[] = {2}; 1354 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1355 static int32_t param1_init[] = {2}; 1356 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1357 static int32_t param2_init[] = {2}; 1358 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1359 static int32_t act_init[] = {2}; 1360 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1361 static bool8 layout_init[] = {false}; 1362 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1363 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1364 // Phase 3, inputs and outputs 1365 model->identifyInputsAndOutputs( 1366 {op1}, 1367 {op4}); 1368 assert(model->isValid()); 1369 } 1370 1371 inline bool is_ignored_nhwc_relu1(int i) { 1372 static std::set<int> ignore = {}; 1373 return ignore.find(i) != ignore.end(); 1374 } 1375 1376 void CreateModel_nhwc_relu1_weight_as_input(Model *model) { 1377 OperandType type0(Type::BOOL, {}); 1378 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1379 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 1380 OperandType type3(Type::TENSOR_FLOAT32, {2}); 1381 OperandType type4(Type::TENSOR_INT32, {4}); 1382 OperandType type5(Type::INT32, {}); 1383 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 1384 // Phase 1, operands 1385 auto op1 = model->addOperand(&type1); 1386 auto op2 = model->addOperand(&type2); 1387 auto op3 = model->addOperand(&type3); 1388 auto shape = model->addOperand(&type4); 1389 auto param = model->addOperand(&type5); 1390 auto param1 = model->addOperand(&type5); 1391 auto param2 = model->addOperand(&type5); 1392 auto act = model->addOperand(&type5); 1393 auto layout = model->addOperand(&type0); 1394 auto op4 = model->addOperand(&type6); 1395 // Phase 2, operations 1396 static int32_t shape_init[] = {1, 5, 5, 2}; 1397 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1398 static int32_t param_init[] = {2}; 1399 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1400 static int32_t param1_init[] = {2}; 1401 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1402 static int32_t param2_init[] = {2}; 1403 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1404 static int32_t act_init[] = {2}; 1405 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1406 static bool8 layout_init[] = {false}; 1407 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1408 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1409 // Phase 3, inputs and outputs 1410 model->identifyInputsAndOutputs( 1411 {op1, op2, op3}, 1412 {op4}); 1413 assert(model->isValid()); 1414 } 1415 1416 inline bool is_ignored_nhwc_relu1_weight_as_input(int i) { 1417 static std::set<int> ignore = {}; 1418 return ignore.find(i) != ignore.end(); 1419 } 1420 1421 void CreateModel_nhwc_relu1_relaxed(Model *model) { 1422 OperandType type0(Type::BOOL, {}); 1423 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1424 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 1425 OperandType type3(Type::TENSOR_FLOAT32, {2}); 1426 OperandType type4(Type::TENSOR_INT32, {4}); 1427 OperandType type5(Type::INT32, {}); 1428 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 1429 // Phase 1, operands 1430 auto op1 = model->addOperand(&type1); 1431 auto op2 = model->addOperand(&type2); 1432 auto op3 = model->addOperand(&type3); 1433 auto shape = model->addOperand(&type4); 1434 auto param = model->addOperand(&type5); 1435 auto param1 = model->addOperand(&type5); 1436 auto param2 = model->addOperand(&type5); 1437 auto act = model->addOperand(&type5); 1438 auto layout = model->addOperand(&type0); 1439 auto op4 = model->addOperand(&type6); 1440 // Phase 2, operations 1441 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 1442 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 1443 static float op3_init[] = {-1.5f, -2.0f}; 1444 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 1445 static int32_t shape_init[] = {1, 5, 5, 2}; 1446 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1447 static int32_t param_init[] = {2}; 1448 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1449 static int32_t param1_init[] = {2}; 1450 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1451 static int32_t param2_init[] = {2}; 1452 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1453 static int32_t act_init[] = {2}; 1454 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1455 static bool8 layout_init[] = {false}; 1456 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1457 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1458 // Phase 3, inputs and outputs 1459 model->identifyInputsAndOutputs( 1460 {op1}, 1461 {op4}); 1462 // Phase 4: set relaxed execution 1463 model->relaxComputationFloat32toFloat16(true); 1464 assert(model->isValid()); 1465 } 1466 1467 inline bool is_ignored_nhwc_relu1_relaxed(int i) { 1468 static std::set<int> ignore = {}; 1469 return ignore.find(i) != ignore.end(); 1470 } 1471 1472 void CreateModel_nhwc_relu1_relaxed_weight_as_input(Model *model) { 1473 OperandType type0(Type::BOOL, {}); 1474 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1475 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 1476 OperandType type3(Type::TENSOR_FLOAT32, {2}); 1477 OperandType type4(Type::TENSOR_INT32, {4}); 1478 OperandType type5(Type::INT32, {}); 1479 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 1480 // Phase 1, operands 1481 auto op1 = model->addOperand(&type1); 1482 auto op2 = model->addOperand(&type2); 1483 auto op3 = model->addOperand(&type3); 1484 auto shape = model->addOperand(&type4); 1485 auto param = model->addOperand(&type5); 1486 auto param1 = model->addOperand(&type5); 1487 auto param2 = model->addOperand(&type5); 1488 auto act = model->addOperand(&type5); 1489 auto layout = model->addOperand(&type0); 1490 auto op4 = model->addOperand(&type6); 1491 // Phase 2, operations 1492 static int32_t shape_init[] = {1, 5, 5, 2}; 1493 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1494 static int32_t param_init[] = {2}; 1495 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1496 static int32_t param1_init[] = {2}; 1497 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1498 static int32_t param2_init[] = {2}; 1499 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1500 static int32_t act_init[] = {2}; 1501 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1502 static bool8 layout_init[] = {false}; 1503 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1504 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1505 // Phase 3, inputs and outputs 1506 model->identifyInputsAndOutputs( 1507 {op1, op2, op3}, 1508 {op4}); 1509 // Phase 4: set relaxed execution 1510 model->relaxComputationFloat32toFloat16(true); 1511 assert(model->isValid()); 1512 } 1513 1514 inline bool is_ignored_nhwc_relu1_relaxed_weight_as_input(int i) { 1515 static std::set<int> ignore = {}; 1516 return ignore.find(i) != ignore.end(); 1517 } 1518 1519 void CreateModel_nhwc_relu1_quant8(Model *model) { 1520 OperandType type0(Type::BOOL, {}); 1521 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 1522 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 1523 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 1524 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 1525 OperandType type4(Type::TENSOR_INT32, {4}); 1526 OperandType type5(Type::INT32, {}); 1527 // Phase 1, operands 1528 auto op1 = model->addOperand(&type27); 1529 auto op2 = model->addOperand(&type28); 1530 auto op3 = model->addOperand(&type29); 1531 auto shape = model->addOperand(&type4); 1532 auto param = model->addOperand(&type5); 1533 auto param1 = model->addOperand(&type5); 1534 auto param2 = model->addOperand(&type5); 1535 auto act = model->addOperand(&type5); 1536 auto layout = model->addOperand(&type0); 1537 auto op4 = model->addOperand(&type30); 1538 // Phase 2, operations 1539 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 1540 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 1541 static int32_t op3_init[] = {-6, -8}; 1542 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 1543 static int32_t shape_init[] = {1, 5, 5, 2}; 1544 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1545 static int32_t param_init[] = {2}; 1546 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1547 static int32_t param1_init[] = {2}; 1548 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1549 static int32_t param2_init[] = {2}; 1550 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1551 static int32_t act_init[] = {2}; 1552 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1553 static bool8 layout_init[] = {false}; 1554 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1555 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1556 // Phase 3, inputs and outputs 1557 model->identifyInputsAndOutputs( 1558 {op1}, 1559 {op4}); 1560 assert(model->isValid()); 1561 } 1562 1563 inline bool is_ignored_nhwc_relu1_quant8(int i) { 1564 static std::set<int> ignore = {}; 1565 return ignore.find(i) != ignore.end(); 1566 } 1567 1568 void CreateModel_nhwc_relu1_quant8_weight_as_input(Model *model) { 1569 OperandType type0(Type::BOOL, {}); 1570 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 1571 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 1572 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 1573 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 1574 OperandType type4(Type::TENSOR_INT32, {4}); 1575 OperandType type5(Type::INT32, {}); 1576 // Phase 1, operands 1577 auto op1 = model->addOperand(&type27); 1578 auto op2 = model->addOperand(&type28); 1579 auto op3 = model->addOperand(&type29); 1580 auto shape = model->addOperand(&type4); 1581 auto param = model->addOperand(&type5); 1582 auto param1 = model->addOperand(&type5); 1583 auto param2 = model->addOperand(&type5); 1584 auto act = model->addOperand(&type5); 1585 auto layout = model->addOperand(&type0); 1586 auto op4 = model->addOperand(&type30); 1587 // Phase 2, operations 1588 static int32_t shape_init[] = {1, 5, 5, 2}; 1589 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1590 static int32_t param_init[] = {2}; 1591 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1592 static int32_t param1_init[] = {2}; 1593 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1594 static int32_t param2_init[] = {2}; 1595 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1596 static int32_t act_init[] = {2}; 1597 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1598 static bool8 layout_init[] = {false}; 1599 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1600 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1601 // Phase 3, inputs and outputs 1602 model->identifyInputsAndOutputs( 1603 {op1, op2, op3}, 1604 {op4}); 1605 assert(model->isValid()); 1606 } 1607 1608 inline bool is_ignored_nhwc_relu1_quant8_weight_as_input(int i) { 1609 static std::set<int> ignore = {}; 1610 return ignore.find(i) != ignore.end(); 1611 } 1612 1613 void CreateModel_nhwc_relu1_quant8_2(Model *model) { 1614 OperandType type0(Type::BOOL, {}); 1615 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 1616 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 1617 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 1618 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1619 OperandType type4(Type::TENSOR_INT32, {4}); 1620 OperandType type5(Type::INT32, {}); 1621 // Phase 1, operands 1622 auto op1 = model->addOperand(&type31); 1623 auto op2 = model->addOperand(&type32); 1624 auto op3 = model->addOperand(&type29); 1625 auto shape = model->addOperand(&type4); 1626 auto param = model->addOperand(&type5); 1627 auto param1 = model->addOperand(&type5); 1628 auto param2 = model->addOperand(&type5); 1629 auto act = model->addOperand(&type5); 1630 auto layout = model->addOperand(&type0); 1631 auto op4 = model->addOperand(&type33); 1632 // Phase 2, operations 1633 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 1634 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 1635 static int32_t op3_init[] = {-6, -8}; 1636 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 1637 static int32_t shape_init[] = {1, 5, 5, 2}; 1638 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1639 static int32_t param_init[] = {2}; 1640 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1641 static int32_t param1_init[] = {2}; 1642 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1643 static int32_t param2_init[] = {2}; 1644 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1645 static int32_t act_init[] = {2}; 1646 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1647 static bool8 layout_init[] = {false}; 1648 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1649 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1650 // Phase 3, inputs and outputs 1651 model->identifyInputsAndOutputs( 1652 {op1}, 1653 {op4}); 1654 assert(model->isValid()); 1655 } 1656 1657 inline bool is_ignored_nhwc_relu1_quant8_2(int i) { 1658 static std::set<int> ignore = {}; 1659 return ignore.find(i) != ignore.end(); 1660 } 1661 1662 void CreateModel_nhwc_relu1_quant8_weight_as_input_2(Model *model) { 1663 OperandType type0(Type::BOOL, {}); 1664 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 1665 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 1666 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 1667 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1668 OperandType type4(Type::TENSOR_INT32, {4}); 1669 OperandType type5(Type::INT32, {}); 1670 // Phase 1, operands 1671 auto op1 = model->addOperand(&type31); 1672 auto op2 = model->addOperand(&type32); 1673 auto op3 = model->addOperand(&type29); 1674 auto shape = model->addOperand(&type4); 1675 auto param = model->addOperand(&type5); 1676 auto param1 = model->addOperand(&type5); 1677 auto param2 = model->addOperand(&type5); 1678 auto act = model->addOperand(&type5); 1679 auto layout = model->addOperand(&type0); 1680 auto op4 = model->addOperand(&type33); 1681 // Phase 2, operations 1682 static int32_t shape_init[] = {1, 5, 5, 2}; 1683 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1684 static int32_t param_init[] = {2}; 1685 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1686 static int32_t param1_init[] = {2}; 1687 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1688 static int32_t param2_init[] = {2}; 1689 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1690 static int32_t act_init[] = {2}; 1691 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1692 static bool8 layout_init[] = {false}; 1693 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1694 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1695 // Phase 3, inputs and outputs 1696 model->identifyInputsAndOutputs( 1697 {op1, op2, op3}, 1698 {op4}); 1699 assert(model->isValid()); 1700 } 1701 1702 inline bool is_ignored_nhwc_relu1_quant8_weight_as_input_2(int i) { 1703 static std::set<int> ignore = {}; 1704 return ignore.find(i) != ignore.end(); 1705 } 1706 1707 void CreateModel_nhwc_relu1_channelQuant8(Model *model) { 1708 OperandType type0(Type::BOOL, {}); 1709 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1710 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1711 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 1712 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 1713 OperandType type4(Type::TENSOR_INT32, {4}); 1714 OperandType type5(Type::INT32, {}); 1715 // Phase 1, operands 1716 auto op1 = model->addOperand(&type34); 1717 auto op2 = model->addOperand(&type35); 1718 auto op3 = model->addOperand(&type36); 1719 auto shape = model->addOperand(&type4); 1720 auto param = model->addOperand(&type5); 1721 auto param1 = model->addOperand(&type5); 1722 auto param2 = model->addOperand(&type5); 1723 auto act = model->addOperand(&type5); 1724 auto layout = model->addOperand(&type0); 1725 auto op4 = model->addOperand(&type37); 1726 // Phase 2, operations 1727 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 1728 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 1729 static int32_t op3_init[] = {-24, -16}; 1730 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 1731 static int32_t shape_init[] = {1, 5, 5, 2}; 1732 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1733 static int32_t param_init[] = {2}; 1734 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1735 static int32_t param1_init[] = {2}; 1736 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1737 static int32_t param2_init[] = {2}; 1738 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1739 static int32_t act_init[] = {2}; 1740 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1741 static bool8 layout_init[] = {false}; 1742 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1743 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1744 // Phase 3, inputs and outputs 1745 model->identifyInputsAndOutputs( 1746 {op1}, 1747 {op4}); 1748 assert(model->isValid()); 1749 } 1750 1751 inline bool is_ignored_nhwc_relu1_channelQuant8(int i) { 1752 static std::set<int> ignore = {}; 1753 return ignore.find(i) != ignore.end(); 1754 } 1755 1756 void CreateModel_nhwc_relu1_channelQuant8_weight_as_input(Model *model) { 1757 OperandType type0(Type::BOOL, {}); 1758 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1759 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 1760 OperandType type4(Type::TENSOR_INT32, {4}); 1761 OperandType type5(Type::INT32, {}); 1762 OperandType type54(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1763 OperandType type55(Type::TENSOR_INT32, {2}, 0.0f, 0); 1764 // Phase 1, operands 1765 auto op1 = model->addOperand(&type34); 1766 auto op2 = model->addOperand(&type54); 1767 auto op3 = model->addOperand(&type55); 1768 auto shape = model->addOperand(&type4); 1769 auto param = model->addOperand(&type5); 1770 auto param1 = model->addOperand(&type5); 1771 auto param2 = model->addOperand(&type5); 1772 auto act = model->addOperand(&type5); 1773 auto layout = model->addOperand(&type0); 1774 auto op4 = model->addOperand(&type37); 1775 // Phase 2, operations 1776 static int32_t shape_init[] = {1, 5, 5, 2}; 1777 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1778 static int32_t param_init[] = {2}; 1779 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1780 static int32_t param1_init[] = {2}; 1781 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1782 static int32_t param2_init[] = {2}; 1783 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1784 static int32_t act_init[] = {2}; 1785 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1786 static bool8 layout_init[] = {false}; 1787 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1788 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1789 // Phase 3, inputs and outputs 1790 model->identifyInputsAndOutputs( 1791 {op1, op2, op3}, 1792 {op4}); 1793 assert(model->isValid()); 1794 } 1795 1796 inline bool is_ignored_nhwc_relu1_channelQuant8_weight_as_input(int i) { 1797 static std::set<int> ignore = {}; 1798 return ignore.find(i) != ignore.end(); 1799 } 1800 1801 void CreateModel_nhwc_relu1_channelQuant8_2(Model *model) { 1802 OperandType type0(Type::BOOL, {}); 1803 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1804 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1805 OperandType type4(Type::TENSOR_INT32, {4}); 1806 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1807 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 1808 OperandType type5(Type::INT32, {}); 1809 // Phase 1, operands 1810 auto op1 = model->addOperand(&type34); 1811 auto op2 = model->addOperand(&type40); 1812 auto op3 = model->addOperand(&type41); 1813 auto shape = model->addOperand(&type4); 1814 auto param = model->addOperand(&type5); 1815 auto param1 = model->addOperand(&type5); 1816 auto param2 = model->addOperand(&type5); 1817 auto act = model->addOperand(&type5); 1818 auto layout = model->addOperand(&type0); 1819 auto op4 = model->addOperand(&type33); 1820 // Phase 2, operations 1821 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 1822 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 1823 static int32_t op3_init[] = {-24, -16}; 1824 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 1825 static int32_t shape_init[] = {1, 5, 5, 2}; 1826 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1827 static int32_t param_init[] = {2}; 1828 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1829 static int32_t param1_init[] = {2}; 1830 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1831 static int32_t param2_init[] = {2}; 1832 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1833 static int32_t act_init[] = {2}; 1834 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1835 static bool8 layout_init[] = {false}; 1836 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1837 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1838 // Phase 3, inputs and outputs 1839 model->identifyInputsAndOutputs( 1840 {op1}, 1841 {op4}); 1842 assert(model->isValid()); 1843 } 1844 1845 inline bool is_ignored_nhwc_relu1_channelQuant8_2(int i) { 1846 static std::set<int> ignore = {}; 1847 return ignore.find(i) != ignore.end(); 1848 } 1849 1850 void CreateModel_nhwc_relu1_channelQuant8_weight_as_input_2(Model *model) { 1851 OperandType type0(Type::BOOL, {}); 1852 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 1853 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 1854 OperandType type4(Type::TENSOR_INT32, {4}); 1855 OperandType type5(Type::INT32, {}); 1856 OperandType type56(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 1857 OperandType type57(Type::TENSOR_INT32, {2}, 0.0f, 0); 1858 // Phase 1, operands 1859 auto op1 = model->addOperand(&type34); 1860 auto op2 = model->addOperand(&type56); 1861 auto op3 = model->addOperand(&type57); 1862 auto shape = model->addOperand(&type4); 1863 auto param = model->addOperand(&type5); 1864 auto param1 = model->addOperand(&type5); 1865 auto param2 = model->addOperand(&type5); 1866 auto act = model->addOperand(&type5); 1867 auto layout = model->addOperand(&type0); 1868 auto op4 = model->addOperand(&type33); 1869 // Phase 2, operations 1870 static int32_t shape_init[] = {1, 5, 5, 2}; 1871 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1872 static int32_t param_init[] = {2}; 1873 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1874 static int32_t param1_init[] = {2}; 1875 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1876 static int32_t param2_init[] = {2}; 1877 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1878 static int32_t act_init[] = {2}; 1879 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1880 static bool8 layout_init[] = {false}; 1881 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1882 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1883 // Phase 3, inputs and outputs 1884 model->identifyInputsAndOutputs( 1885 {op1, op2, op3}, 1886 {op4}); 1887 assert(model->isValid()); 1888 } 1889 1890 inline bool is_ignored_nhwc_relu1_channelQuant8_weight_as_input_2(int i) { 1891 static std::set<int> ignore = {}; 1892 return ignore.find(i) != ignore.end(); 1893 } 1894 1895 void CreateModel_nhwc_relu1_float16(Model *model) { 1896 OperandType type0(Type::BOOL, {}); 1897 OperandType type4(Type::TENSOR_INT32, {4}); 1898 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1899 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 1900 OperandType type46(Type::TENSOR_FLOAT16, {2}); 1901 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 1902 OperandType type5(Type::INT32, {}); 1903 // Phase 1, operands 1904 auto op1 = model->addOperand(&type44); 1905 auto op2 = model->addOperand(&type45); 1906 auto op3 = model->addOperand(&type46); 1907 auto shape = model->addOperand(&type4); 1908 auto param = model->addOperand(&type5); 1909 auto param1 = model->addOperand(&type5); 1910 auto param2 = model->addOperand(&type5); 1911 auto act = model->addOperand(&type5); 1912 auto layout = model->addOperand(&type0); 1913 auto op4 = model->addOperand(&type47); 1914 // Phase 2, operations 1915 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 1916 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 1917 static _Float16 op3_init[] = {-1.5f, -2.0f}; 1918 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 1919 static int32_t shape_init[] = {1, 5, 5, 2}; 1920 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1921 static int32_t param_init[] = {2}; 1922 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1923 static int32_t param1_init[] = {2}; 1924 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1925 static int32_t param2_init[] = {2}; 1926 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1927 static int32_t act_init[] = {2}; 1928 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1929 static bool8 layout_init[] = {false}; 1930 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1931 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1932 // Phase 3, inputs and outputs 1933 model->identifyInputsAndOutputs( 1934 {op1}, 1935 {op4}); 1936 assert(model->isValid()); 1937 } 1938 1939 inline bool is_ignored_nhwc_relu1_float16(int i) { 1940 static std::set<int> ignore = {}; 1941 return ignore.find(i) != ignore.end(); 1942 } 1943 1944 void CreateModel_nhwc_relu1_float16_weight_as_input(Model *model) { 1945 OperandType type0(Type::BOOL, {}); 1946 OperandType type4(Type::TENSOR_INT32, {4}); 1947 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 1948 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 1949 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 1950 OperandType type49(Type::TENSOR_FLOAT16, {2}); 1951 OperandType type5(Type::INT32, {}); 1952 // Phase 1, operands 1953 auto op1 = model->addOperand(&type44); 1954 auto op2 = model->addOperand(&type48); 1955 auto op3 = model->addOperand(&type49); 1956 auto shape = model->addOperand(&type4); 1957 auto param = model->addOperand(&type5); 1958 auto param1 = model->addOperand(&type5); 1959 auto param2 = model->addOperand(&type5); 1960 auto act = model->addOperand(&type5); 1961 auto layout = model->addOperand(&type0); 1962 auto op4 = model->addOperand(&type47); 1963 // Phase 2, operations 1964 static int32_t shape_init[] = {1, 5, 5, 2}; 1965 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 1966 static int32_t param_init[] = {2}; 1967 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 1968 static int32_t param1_init[] = {2}; 1969 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 1970 static int32_t param2_init[] = {2}; 1971 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 1972 static int32_t act_init[] = {2}; 1973 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 1974 static bool8 layout_init[] = {false}; 1975 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 1976 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 1977 // Phase 3, inputs and outputs 1978 model->identifyInputsAndOutputs( 1979 {op1, op2, op3}, 1980 {op4}); 1981 assert(model->isValid()); 1982 } 1983 1984 inline bool is_ignored_nhwc_relu1_float16_weight_as_input(int i) { 1985 static std::set<int> ignore = {}; 1986 return ignore.find(i) != ignore.end(); 1987 } 1988 1989 void CreateModel_nhwc_relu6(Model *model) { 1990 OperandType type0(Type::BOOL, {}); 1991 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 1992 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 1993 OperandType type3(Type::TENSOR_FLOAT32, {2}); 1994 OperandType type4(Type::TENSOR_INT32, {4}); 1995 OperandType type5(Type::INT32, {}); 1996 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 1997 // Phase 1, operands 1998 auto op1 = model->addOperand(&type1); 1999 auto op2 = model->addOperand(&type2); 2000 auto op3 = model->addOperand(&type3); 2001 auto shape = model->addOperand(&type4); 2002 auto param = model->addOperand(&type5); 2003 auto param1 = model->addOperand(&type5); 2004 auto param2 = model->addOperand(&type5); 2005 auto act = model->addOperand(&type5); 2006 auto layout = model->addOperand(&type0); 2007 auto op4 = model->addOperand(&type6); 2008 // Phase 2, operations 2009 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 2010 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 2011 static float op3_init[] = {-1.5f, -2.0f}; 2012 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 2013 static int32_t shape_init[] = {1, 5, 5, 2}; 2014 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2015 static int32_t param_init[] = {2}; 2016 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2017 static int32_t param1_init[] = {2}; 2018 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2019 static int32_t param2_init[] = {2}; 2020 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2021 static int32_t act_init[] = {3}; 2022 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2023 static bool8 layout_init[] = {false}; 2024 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2025 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2026 // Phase 3, inputs and outputs 2027 model->identifyInputsAndOutputs( 2028 {op1}, 2029 {op4}); 2030 assert(model->isValid()); 2031 } 2032 2033 inline bool is_ignored_nhwc_relu6(int i) { 2034 static std::set<int> ignore = {}; 2035 return ignore.find(i) != ignore.end(); 2036 } 2037 2038 void CreateModel_nhwc_relu6_weight_as_input(Model *model) { 2039 OperandType type0(Type::BOOL, {}); 2040 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 2041 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2042 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2043 OperandType type4(Type::TENSOR_INT32, {4}); 2044 OperandType type5(Type::INT32, {}); 2045 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 2046 // Phase 1, operands 2047 auto op1 = model->addOperand(&type1); 2048 auto op2 = model->addOperand(&type2); 2049 auto op3 = model->addOperand(&type3); 2050 auto shape = model->addOperand(&type4); 2051 auto param = model->addOperand(&type5); 2052 auto param1 = model->addOperand(&type5); 2053 auto param2 = model->addOperand(&type5); 2054 auto act = model->addOperand(&type5); 2055 auto layout = model->addOperand(&type0); 2056 auto op4 = model->addOperand(&type6); 2057 // Phase 2, operations 2058 static int32_t shape_init[] = {1, 5, 5, 2}; 2059 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2060 static int32_t param_init[] = {2}; 2061 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2062 static int32_t param1_init[] = {2}; 2063 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2064 static int32_t param2_init[] = {2}; 2065 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2066 static int32_t act_init[] = {3}; 2067 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2068 static bool8 layout_init[] = {false}; 2069 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2070 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2071 // Phase 3, inputs and outputs 2072 model->identifyInputsAndOutputs( 2073 {op1, op2, op3}, 2074 {op4}); 2075 assert(model->isValid()); 2076 } 2077 2078 inline bool is_ignored_nhwc_relu6_weight_as_input(int i) { 2079 static std::set<int> ignore = {}; 2080 return ignore.find(i) != ignore.end(); 2081 } 2082 2083 void CreateModel_nhwc_relu6_relaxed(Model *model) { 2084 OperandType type0(Type::BOOL, {}); 2085 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 2086 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2087 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2088 OperandType type4(Type::TENSOR_INT32, {4}); 2089 OperandType type5(Type::INT32, {}); 2090 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 2091 // Phase 1, operands 2092 auto op1 = model->addOperand(&type1); 2093 auto op2 = model->addOperand(&type2); 2094 auto op3 = model->addOperand(&type3); 2095 auto shape = model->addOperand(&type4); 2096 auto param = model->addOperand(&type5); 2097 auto param1 = model->addOperand(&type5); 2098 auto param2 = model->addOperand(&type5); 2099 auto act = model->addOperand(&type5); 2100 auto layout = model->addOperand(&type0); 2101 auto op4 = model->addOperand(&type6); 2102 // Phase 2, operations 2103 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 2104 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 2105 static float op3_init[] = {-1.5f, -2.0f}; 2106 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 2107 static int32_t shape_init[] = {1, 5, 5, 2}; 2108 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2109 static int32_t param_init[] = {2}; 2110 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2111 static int32_t param1_init[] = {2}; 2112 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2113 static int32_t param2_init[] = {2}; 2114 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2115 static int32_t act_init[] = {3}; 2116 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2117 static bool8 layout_init[] = {false}; 2118 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2119 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2120 // Phase 3, inputs and outputs 2121 model->identifyInputsAndOutputs( 2122 {op1}, 2123 {op4}); 2124 // Phase 4: set relaxed execution 2125 model->relaxComputationFloat32toFloat16(true); 2126 assert(model->isValid()); 2127 } 2128 2129 inline bool is_ignored_nhwc_relu6_relaxed(int i) { 2130 static std::set<int> ignore = {}; 2131 return ignore.find(i) != ignore.end(); 2132 } 2133 2134 void CreateModel_nhwc_relu6_relaxed_weight_as_input(Model *model) { 2135 OperandType type0(Type::BOOL, {}); 2136 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 2137 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2138 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2139 OperandType type4(Type::TENSOR_INT32, {4}); 2140 OperandType type5(Type::INT32, {}); 2141 OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); 2142 // Phase 1, operands 2143 auto op1 = model->addOperand(&type1); 2144 auto op2 = model->addOperand(&type2); 2145 auto op3 = model->addOperand(&type3); 2146 auto shape = model->addOperand(&type4); 2147 auto param = model->addOperand(&type5); 2148 auto param1 = model->addOperand(&type5); 2149 auto param2 = model->addOperand(&type5); 2150 auto act = model->addOperand(&type5); 2151 auto layout = model->addOperand(&type0); 2152 auto op4 = model->addOperand(&type6); 2153 // Phase 2, operations 2154 static int32_t shape_init[] = {1, 5, 5, 2}; 2155 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2156 static int32_t param_init[] = {2}; 2157 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2158 static int32_t param1_init[] = {2}; 2159 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2160 static int32_t param2_init[] = {2}; 2161 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2162 static int32_t act_init[] = {3}; 2163 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2164 static bool8 layout_init[] = {false}; 2165 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2166 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2167 // Phase 3, inputs and outputs 2168 model->identifyInputsAndOutputs( 2169 {op1, op2, op3}, 2170 {op4}); 2171 // Phase 4: set relaxed execution 2172 model->relaxComputationFloat32toFloat16(true); 2173 assert(model->isValid()); 2174 } 2175 2176 inline bool is_ignored_nhwc_relu6_relaxed_weight_as_input(int i) { 2177 static std::set<int> ignore = {}; 2178 return ignore.find(i) != ignore.end(); 2179 } 2180 2181 void CreateModel_nhwc_relu6_quant8(Model *model) { 2182 OperandType type0(Type::BOOL, {}); 2183 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 2184 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 2185 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2186 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 2187 OperandType type4(Type::TENSOR_INT32, {4}); 2188 OperandType type5(Type::INT32, {}); 2189 // Phase 1, operands 2190 auto op1 = model->addOperand(&type27); 2191 auto op2 = model->addOperand(&type28); 2192 auto op3 = model->addOperand(&type29); 2193 auto shape = model->addOperand(&type4); 2194 auto param = model->addOperand(&type5); 2195 auto param1 = model->addOperand(&type5); 2196 auto param2 = model->addOperand(&type5); 2197 auto act = model->addOperand(&type5); 2198 auto layout = model->addOperand(&type0); 2199 auto op4 = model->addOperand(&type30); 2200 // Phase 2, operations 2201 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 2202 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 2203 static int32_t op3_init[] = {-6, -8}; 2204 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 2205 static int32_t shape_init[] = {1, 5, 5, 2}; 2206 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2207 static int32_t param_init[] = {2}; 2208 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2209 static int32_t param1_init[] = {2}; 2210 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2211 static int32_t param2_init[] = {2}; 2212 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2213 static int32_t act_init[] = {3}; 2214 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2215 static bool8 layout_init[] = {false}; 2216 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2217 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2218 // Phase 3, inputs and outputs 2219 model->identifyInputsAndOutputs( 2220 {op1}, 2221 {op4}); 2222 assert(model->isValid()); 2223 } 2224 2225 inline bool is_ignored_nhwc_relu6_quant8(int i) { 2226 static std::set<int> ignore = {}; 2227 return ignore.find(i) != ignore.end(); 2228 } 2229 2230 void CreateModel_nhwc_relu6_quant8_weight_as_input(Model *model) { 2231 OperandType type0(Type::BOOL, {}); 2232 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 2233 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 2234 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2235 OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); 2236 OperandType type4(Type::TENSOR_INT32, {4}); 2237 OperandType type5(Type::INT32, {}); 2238 // Phase 1, operands 2239 auto op1 = model->addOperand(&type27); 2240 auto op2 = model->addOperand(&type28); 2241 auto op3 = model->addOperand(&type29); 2242 auto shape = model->addOperand(&type4); 2243 auto param = model->addOperand(&type5); 2244 auto param1 = model->addOperand(&type5); 2245 auto param2 = model->addOperand(&type5); 2246 auto act = model->addOperand(&type5); 2247 auto layout = model->addOperand(&type0); 2248 auto op4 = model->addOperand(&type30); 2249 // Phase 2, operations 2250 static int32_t shape_init[] = {1, 5, 5, 2}; 2251 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2252 static int32_t param_init[] = {2}; 2253 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2254 static int32_t param1_init[] = {2}; 2255 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2256 static int32_t param2_init[] = {2}; 2257 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2258 static int32_t act_init[] = {3}; 2259 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2260 static bool8 layout_init[] = {false}; 2261 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2262 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2263 // Phase 3, inputs and outputs 2264 model->identifyInputsAndOutputs( 2265 {op1, op2, op3}, 2266 {op4}); 2267 assert(model->isValid()); 2268 } 2269 2270 inline bool is_ignored_nhwc_relu6_quant8_weight_as_input(int i) { 2271 static std::set<int> ignore = {}; 2272 return ignore.find(i) != ignore.end(); 2273 } 2274 2275 void CreateModel_nhwc_relu6_quant8_2(Model *model) { 2276 OperandType type0(Type::BOOL, {}); 2277 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2278 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 2279 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 2280 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 2281 OperandType type4(Type::TENSOR_INT32, {4}); 2282 OperandType type5(Type::INT32, {}); 2283 // Phase 1, operands 2284 auto op1 = model->addOperand(&type31); 2285 auto op2 = model->addOperand(&type32); 2286 auto op3 = model->addOperand(&type29); 2287 auto shape = model->addOperand(&type4); 2288 auto param = model->addOperand(&type5); 2289 auto param1 = model->addOperand(&type5); 2290 auto param2 = model->addOperand(&type5); 2291 auto act = model->addOperand(&type5); 2292 auto layout = model->addOperand(&type0); 2293 auto op4 = model->addOperand(&type33); 2294 // Phase 2, operations 2295 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 2296 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 2297 static int32_t op3_init[] = {-6, -8}; 2298 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 2299 static int32_t shape_init[] = {1, 5, 5, 2}; 2300 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2301 static int32_t param_init[] = {2}; 2302 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2303 static int32_t param1_init[] = {2}; 2304 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2305 static int32_t param2_init[] = {2}; 2306 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2307 static int32_t act_init[] = {3}; 2308 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2309 static bool8 layout_init[] = {false}; 2310 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2311 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2312 // Phase 3, inputs and outputs 2313 model->identifyInputsAndOutputs( 2314 {op1}, 2315 {op4}); 2316 assert(model->isValid()); 2317 } 2318 2319 inline bool is_ignored_nhwc_relu6_quant8_2(int i) { 2320 static std::set<int> ignore = {}; 2321 return ignore.find(i) != ignore.end(); 2322 } 2323 2324 void CreateModel_nhwc_relu6_quant8_weight_as_input_2(Model *model) { 2325 OperandType type0(Type::BOOL, {}); 2326 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2327 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 2328 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 2329 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 2330 OperandType type4(Type::TENSOR_INT32, {4}); 2331 OperandType type5(Type::INT32, {}); 2332 // Phase 1, operands 2333 auto op1 = model->addOperand(&type31); 2334 auto op2 = model->addOperand(&type32); 2335 auto op3 = model->addOperand(&type29); 2336 auto shape = model->addOperand(&type4); 2337 auto param = model->addOperand(&type5); 2338 auto param1 = model->addOperand(&type5); 2339 auto param2 = model->addOperand(&type5); 2340 auto act = model->addOperand(&type5); 2341 auto layout = model->addOperand(&type0); 2342 auto op4 = model->addOperand(&type33); 2343 // Phase 2, operations 2344 static int32_t shape_init[] = {1, 5, 5, 2}; 2345 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2346 static int32_t param_init[] = {2}; 2347 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2348 static int32_t param1_init[] = {2}; 2349 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2350 static int32_t param2_init[] = {2}; 2351 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2352 static int32_t act_init[] = {3}; 2353 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2354 static bool8 layout_init[] = {false}; 2355 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2356 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2357 // Phase 3, inputs and outputs 2358 model->identifyInputsAndOutputs( 2359 {op1, op2, op3}, 2360 {op4}); 2361 assert(model->isValid()); 2362 } 2363 2364 inline bool is_ignored_nhwc_relu6_quant8_weight_as_input_2(int i) { 2365 static std::set<int> ignore = {}; 2366 return ignore.find(i) != ignore.end(); 2367 } 2368 2369 void CreateModel_nhwc_relu6_channelQuant8(Model *model) { 2370 OperandType type0(Type::BOOL, {}); 2371 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 2372 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 2373 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 2374 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 2375 OperandType type4(Type::TENSOR_INT32, {4}); 2376 OperandType type5(Type::INT32, {}); 2377 // Phase 1, operands 2378 auto op1 = model->addOperand(&type34); 2379 auto op2 = model->addOperand(&type35); 2380 auto op3 = model->addOperand(&type36); 2381 auto shape = model->addOperand(&type4); 2382 auto param = model->addOperand(&type5); 2383 auto param1 = model->addOperand(&type5); 2384 auto param2 = model->addOperand(&type5); 2385 auto act = model->addOperand(&type5); 2386 auto layout = model->addOperand(&type0); 2387 auto op4 = model->addOperand(&type37); 2388 // Phase 2, operations 2389 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 2390 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 2391 static int32_t op3_init[] = {-24, -16}; 2392 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 2393 static int32_t shape_init[] = {1, 5, 5, 2}; 2394 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2395 static int32_t param_init[] = {2}; 2396 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2397 static int32_t param1_init[] = {2}; 2398 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2399 static int32_t param2_init[] = {2}; 2400 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2401 static int32_t act_init[] = {3}; 2402 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2403 static bool8 layout_init[] = {false}; 2404 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2405 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2406 // Phase 3, inputs and outputs 2407 model->identifyInputsAndOutputs( 2408 {op1}, 2409 {op4}); 2410 assert(model->isValid()); 2411 } 2412 2413 inline bool is_ignored_nhwc_relu6_channelQuant8(int i) { 2414 static std::set<int> ignore = {}; 2415 return ignore.find(i) != ignore.end(); 2416 } 2417 2418 void CreateModel_nhwc_relu6_channelQuant8_weight_as_input(Model *model) { 2419 OperandType type0(Type::BOOL, {}); 2420 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 2421 OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); 2422 OperandType type4(Type::TENSOR_INT32, {4}); 2423 OperandType type5(Type::INT32, {}); 2424 OperandType type58(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 2425 OperandType type59(Type::TENSOR_INT32, {2}, 0.0f, 0); 2426 // Phase 1, operands 2427 auto op1 = model->addOperand(&type34); 2428 auto op2 = model->addOperand(&type58); 2429 auto op3 = model->addOperand(&type59); 2430 auto shape = model->addOperand(&type4); 2431 auto param = model->addOperand(&type5); 2432 auto param1 = model->addOperand(&type5); 2433 auto param2 = model->addOperand(&type5); 2434 auto act = model->addOperand(&type5); 2435 auto layout = model->addOperand(&type0); 2436 auto op4 = model->addOperand(&type37); 2437 // Phase 2, operations 2438 static int32_t shape_init[] = {1, 5, 5, 2}; 2439 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2440 static int32_t param_init[] = {2}; 2441 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2442 static int32_t param1_init[] = {2}; 2443 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2444 static int32_t param2_init[] = {2}; 2445 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2446 static int32_t act_init[] = {3}; 2447 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2448 static bool8 layout_init[] = {false}; 2449 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2450 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2451 // Phase 3, inputs and outputs 2452 model->identifyInputsAndOutputs( 2453 {op1, op2, op3}, 2454 {op4}); 2455 assert(model->isValid()); 2456 } 2457 2458 inline bool is_ignored_nhwc_relu6_channelQuant8_weight_as_input(int i) { 2459 static std::set<int> ignore = {}; 2460 return ignore.find(i) != ignore.end(); 2461 } 2462 2463 void CreateModel_nhwc_relu6_channelQuant8_2(Model *model) { 2464 OperandType type0(Type::BOOL, {}); 2465 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 2466 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 2467 OperandType type4(Type::TENSOR_INT32, {4}); 2468 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 2469 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 2470 OperandType type5(Type::INT32, {}); 2471 // Phase 1, operands 2472 auto op1 = model->addOperand(&type34); 2473 auto op2 = model->addOperand(&type40); 2474 auto op3 = model->addOperand(&type41); 2475 auto shape = model->addOperand(&type4); 2476 auto param = model->addOperand(&type5); 2477 auto param1 = model->addOperand(&type5); 2478 auto param2 = model->addOperand(&type5); 2479 auto act = model->addOperand(&type5); 2480 auto layout = model->addOperand(&type0); 2481 auto op4 = model->addOperand(&type33); 2482 // Phase 2, operations 2483 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 2484 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 2485 static int32_t op3_init[] = {-24, -16}; 2486 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 2487 static int32_t shape_init[] = {1, 5, 5, 2}; 2488 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2489 static int32_t param_init[] = {2}; 2490 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2491 static int32_t param1_init[] = {2}; 2492 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2493 static int32_t param2_init[] = {2}; 2494 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2495 static int32_t act_init[] = {3}; 2496 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2497 static bool8 layout_init[] = {false}; 2498 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2499 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2500 // Phase 3, inputs and outputs 2501 model->identifyInputsAndOutputs( 2502 {op1}, 2503 {op4}); 2504 assert(model->isValid()); 2505 } 2506 2507 inline bool is_ignored_nhwc_relu6_channelQuant8_2(int i) { 2508 static std::set<int> ignore = {}; 2509 return ignore.find(i) != ignore.end(); 2510 } 2511 2512 void CreateModel_nhwc_relu6_channelQuant8_weight_as_input_2(Model *model) { 2513 OperandType type0(Type::BOOL, {}); 2514 OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); 2515 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 2516 OperandType type4(Type::TENSOR_INT32, {4}); 2517 OperandType type5(Type::INT32, {}); 2518 OperandType type60(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 2519 OperandType type61(Type::TENSOR_INT32, {2}, 0.0f, 0); 2520 // Phase 1, operands 2521 auto op1 = model->addOperand(&type34); 2522 auto op2 = model->addOperand(&type60); 2523 auto op3 = model->addOperand(&type61); 2524 auto shape = model->addOperand(&type4); 2525 auto param = model->addOperand(&type5); 2526 auto param1 = model->addOperand(&type5); 2527 auto param2 = model->addOperand(&type5); 2528 auto act = model->addOperand(&type5); 2529 auto layout = model->addOperand(&type0); 2530 auto op4 = model->addOperand(&type33); 2531 // Phase 2, operations 2532 static int32_t shape_init[] = {1, 5, 5, 2}; 2533 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2534 static int32_t param_init[] = {2}; 2535 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2536 static int32_t param1_init[] = {2}; 2537 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2538 static int32_t param2_init[] = {2}; 2539 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2540 static int32_t act_init[] = {3}; 2541 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2542 static bool8 layout_init[] = {false}; 2543 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2544 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2545 // Phase 3, inputs and outputs 2546 model->identifyInputsAndOutputs( 2547 {op1, op2, op3}, 2548 {op4}); 2549 assert(model->isValid()); 2550 } 2551 2552 inline bool is_ignored_nhwc_relu6_channelQuant8_weight_as_input_2(int i) { 2553 static std::set<int> ignore = {}; 2554 return ignore.find(i) != ignore.end(); 2555 } 2556 2557 void CreateModel_nhwc_relu6_float16(Model *model) { 2558 OperandType type0(Type::BOOL, {}); 2559 OperandType type4(Type::TENSOR_INT32, {4}); 2560 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 2561 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 2562 OperandType type46(Type::TENSOR_FLOAT16, {2}); 2563 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 2564 OperandType type5(Type::INT32, {}); 2565 // Phase 1, operands 2566 auto op1 = model->addOperand(&type44); 2567 auto op2 = model->addOperand(&type45); 2568 auto op3 = model->addOperand(&type46); 2569 auto shape = model->addOperand(&type4); 2570 auto param = model->addOperand(&type5); 2571 auto param1 = model->addOperand(&type5); 2572 auto param2 = model->addOperand(&type5); 2573 auto act = model->addOperand(&type5); 2574 auto layout = model->addOperand(&type0); 2575 auto op4 = model->addOperand(&type47); 2576 // Phase 2, operations 2577 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 2578 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 2579 static _Float16 op3_init[] = {-1.5f, -2.0f}; 2580 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 2581 static int32_t shape_init[] = {1, 5, 5, 2}; 2582 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2583 static int32_t param_init[] = {2}; 2584 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2585 static int32_t param1_init[] = {2}; 2586 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2587 static int32_t param2_init[] = {2}; 2588 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2589 static int32_t act_init[] = {3}; 2590 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2591 static bool8 layout_init[] = {false}; 2592 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2593 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2594 // Phase 3, inputs and outputs 2595 model->identifyInputsAndOutputs( 2596 {op1}, 2597 {op4}); 2598 assert(model->isValid()); 2599 } 2600 2601 inline bool is_ignored_nhwc_relu6_float16(int i) { 2602 static std::set<int> ignore = {}; 2603 return ignore.find(i) != ignore.end(); 2604 } 2605 2606 void CreateModel_nhwc_relu6_float16_weight_as_input(Model *model) { 2607 OperandType type0(Type::BOOL, {}); 2608 OperandType type4(Type::TENSOR_INT32, {4}); 2609 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 2610 OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); 2611 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 2612 OperandType type49(Type::TENSOR_FLOAT16, {2}); 2613 OperandType type5(Type::INT32, {}); 2614 // Phase 1, operands 2615 auto op1 = model->addOperand(&type44); 2616 auto op2 = model->addOperand(&type48); 2617 auto op3 = model->addOperand(&type49); 2618 auto shape = model->addOperand(&type4); 2619 auto param = model->addOperand(&type5); 2620 auto param1 = model->addOperand(&type5); 2621 auto param2 = model->addOperand(&type5); 2622 auto act = model->addOperand(&type5); 2623 auto layout = model->addOperand(&type0); 2624 auto op4 = model->addOperand(&type47); 2625 // Phase 2, operations 2626 static int32_t shape_init[] = {1, 5, 5, 2}; 2627 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2628 static int32_t param_init[] = {2}; 2629 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2630 static int32_t param1_init[] = {2}; 2631 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2632 static int32_t param2_init[] = {2}; 2633 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2634 static int32_t act_init[] = {3}; 2635 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2636 static bool8 layout_init[] = {false}; 2637 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2638 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2639 // Phase 3, inputs and outputs 2640 model->identifyInputsAndOutputs( 2641 {op1, op2, op3}, 2642 {op4}); 2643 assert(model->isValid()); 2644 } 2645 2646 inline bool is_ignored_nhwc_relu6_float16_weight_as_input(int i) { 2647 static std::set<int> ignore = {}; 2648 return ignore.find(i) != ignore.end(); 2649 } 2650 2651 void CreateModel_nchw_none(Model *model) { 2652 OperandType type0(Type::BOOL, {}); 2653 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2654 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2655 OperandType type4(Type::TENSOR_INT32, {4}); 2656 OperandType type5(Type::INT32, {}); 2657 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 2658 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 2659 // Phase 1, operands 2660 auto op1 = model->addOperand(&type62); 2661 auto op2 = model->addOperand(&type2); 2662 auto op3 = model->addOperand(&type3); 2663 auto shape = model->addOperand(&type4); 2664 auto param = model->addOperand(&type5); 2665 auto param1 = model->addOperand(&type5); 2666 auto param2 = model->addOperand(&type5); 2667 auto act = model->addOperand(&type5); 2668 auto layout = model->addOperand(&type0); 2669 auto op4 = model->addOperand(&type63); 2670 // Phase 2, operations 2671 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 2672 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 2673 static float op3_init[] = {-1.5f, -2.0f}; 2674 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 2675 static int32_t shape_init[] = {1, 2, 5, 5}; 2676 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2677 static int32_t param_init[] = {2}; 2678 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2679 static int32_t param1_init[] = {2}; 2680 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2681 static int32_t param2_init[] = {2}; 2682 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2683 static int32_t act_init[] = {0}; 2684 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2685 static bool8 layout_init[] = {true}; 2686 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2687 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2688 // Phase 3, inputs and outputs 2689 model->identifyInputsAndOutputs( 2690 {op1}, 2691 {op4}); 2692 assert(model->isValid()); 2693 } 2694 2695 inline bool is_ignored_nchw_none(int i) { 2696 static std::set<int> ignore = {}; 2697 return ignore.find(i) != ignore.end(); 2698 } 2699 2700 void CreateModel_nchw_none_weight_as_input(Model *model) { 2701 OperandType type0(Type::BOOL, {}); 2702 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2703 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2704 OperandType type4(Type::TENSOR_INT32, {4}); 2705 OperandType type5(Type::INT32, {}); 2706 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 2707 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 2708 // Phase 1, operands 2709 auto op1 = model->addOperand(&type62); 2710 auto op2 = model->addOperand(&type2); 2711 auto op3 = model->addOperand(&type3); 2712 auto shape = model->addOperand(&type4); 2713 auto param = model->addOperand(&type5); 2714 auto param1 = model->addOperand(&type5); 2715 auto param2 = model->addOperand(&type5); 2716 auto act = model->addOperand(&type5); 2717 auto layout = model->addOperand(&type0); 2718 auto op4 = model->addOperand(&type63); 2719 // Phase 2, operations 2720 static int32_t shape_init[] = {1, 2, 5, 5}; 2721 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2722 static int32_t param_init[] = {2}; 2723 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2724 static int32_t param1_init[] = {2}; 2725 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2726 static int32_t param2_init[] = {2}; 2727 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2728 static int32_t act_init[] = {0}; 2729 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2730 static bool8 layout_init[] = {true}; 2731 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2732 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2733 // Phase 3, inputs and outputs 2734 model->identifyInputsAndOutputs( 2735 {op1, op2, op3}, 2736 {op4}); 2737 assert(model->isValid()); 2738 } 2739 2740 inline bool is_ignored_nchw_none_weight_as_input(int i) { 2741 static std::set<int> ignore = {}; 2742 return ignore.find(i) != ignore.end(); 2743 } 2744 2745 void CreateModel_nchw_none_relaxed(Model *model) { 2746 OperandType type0(Type::BOOL, {}); 2747 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2748 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2749 OperandType type4(Type::TENSOR_INT32, {4}); 2750 OperandType type5(Type::INT32, {}); 2751 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 2752 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 2753 // Phase 1, operands 2754 auto op1 = model->addOperand(&type62); 2755 auto op2 = model->addOperand(&type2); 2756 auto op3 = model->addOperand(&type3); 2757 auto shape = model->addOperand(&type4); 2758 auto param = model->addOperand(&type5); 2759 auto param1 = model->addOperand(&type5); 2760 auto param2 = model->addOperand(&type5); 2761 auto act = model->addOperand(&type5); 2762 auto layout = model->addOperand(&type0); 2763 auto op4 = model->addOperand(&type63); 2764 // Phase 2, operations 2765 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 2766 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 2767 static float op3_init[] = {-1.5f, -2.0f}; 2768 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 2769 static int32_t shape_init[] = {1, 2, 5, 5}; 2770 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2771 static int32_t param_init[] = {2}; 2772 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2773 static int32_t param1_init[] = {2}; 2774 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2775 static int32_t param2_init[] = {2}; 2776 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2777 static int32_t act_init[] = {0}; 2778 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2779 static bool8 layout_init[] = {true}; 2780 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2781 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2782 // Phase 3, inputs and outputs 2783 model->identifyInputsAndOutputs( 2784 {op1}, 2785 {op4}); 2786 // Phase 4: set relaxed execution 2787 model->relaxComputationFloat32toFloat16(true); 2788 assert(model->isValid()); 2789 } 2790 2791 inline bool is_ignored_nchw_none_relaxed(int i) { 2792 static std::set<int> ignore = {}; 2793 return ignore.find(i) != ignore.end(); 2794 } 2795 2796 void CreateModel_nchw_none_relaxed_weight_as_input(Model *model) { 2797 OperandType type0(Type::BOOL, {}); 2798 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 2799 OperandType type3(Type::TENSOR_FLOAT32, {2}); 2800 OperandType type4(Type::TENSOR_INT32, {4}); 2801 OperandType type5(Type::INT32, {}); 2802 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 2803 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 2804 // Phase 1, operands 2805 auto op1 = model->addOperand(&type62); 2806 auto op2 = model->addOperand(&type2); 2807 auto op3 = model->addOperand(&type3); 2808 auto shape = model->addOperand(&type4); 2809 auto param = model->addOperand(&type5); 2810 auto param1 = model->addOperand(&type5); 2811 auto param2 = model->addOperand(&type5); 2812 auto act = model->addOperand(&type5); 2813 auto layout = model->addOperand(&type0); 2814 auto op4 = model->addOperand(&type63); 2815 // Phase 2, operations 2816 static int32_t shape_init[] = {1, 2, 5, 5}; 2817 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2818 static int32_t param_init[] = {2}; 2819 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2820 static int32_t param1_init[] = {2}; 2821 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2822 static int32_t param2_init[] = {2}; 2823 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2824 static int32_t act_init[] = {0}; 2825 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2826 static bool8 layout_init[] = {true}; 2827 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2828 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2829 // Phase 3, inputs and outputs 2830 model->identifyInputsAndOutputs( 2831 {op1, op2, op3}, 2832 {op4}); 2833 // Phase 4: set relaxed execution 2834 model->relaxComputationFloat32toFloat16(true); 2835 assert(model->isValid()); 2836 } 2837 2838 inline bool is_ignored_nchw_none_relaxed_weight_as_input(int i) { 2839 static std::set<int> ignore = {}; 2840 return ignore.find(i) != ignore.end(); 2841 } 2842 2843 void CreateModel_nchw_none_quant8(Model *model) { 2844 OperandType type0(Type::BOOL, {}); 2845 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 2846 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2847 OperandType type4(Type::TENSOR_INT32, {4}); 2848 OperandType type5(Type::INT32, {}); 2849 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 2850 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 2851 // Phase 1, operands 2852 auto op1 = model->addOperand(&type64); 2853 auto op2 = model->addOperand(&type28); 2854 auto op3 = model->addOperand(&type29); 2855 auto shape = model->addOperand(&type4); 2856 auto param = model->addOperand(&type5); 2857 auto param1 = model->addOperand(&type5); 2858 auto param2 = model->addOperand(&type5); 2859 auto act = model->addOperand(&type5); 2860 auto layout = model->addOperand(&type0); 2861 auto op4 = model->addOperand(&type65); 2862 // Phase 2, operations 2863 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 2864 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 2865 static int32_t op3_init[] = {-6, -8}; 2866 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 2867 static int32_t shape_init[] = {1, 2, 5, 5}; 2868 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2869 static int32_t param_init[] = {2}; 2870 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2871 static int32_t param1_init[] = {2}; 2872 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2873 static int32_t param2_init[] = {2}; 2874 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2875 static int32_t act_init[] = {0}; 2876 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2877 static bool8 layout_init[] = {true}; 2878 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2879 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2880 // Phase 3, inputs and outputs 2881 model->identifyInputsAndOutputs( 2882 {op1}, 2883 {op4}); 2884 assert(model->isValid()); 2885 } 2886 2887 inline bool is_ignored_nchw_none_quant8(int i) { 2888 static std::set<int> ignore = {}; 2889 return ignore.find(i) != ignore.end(); 2890 } 2891 2892 void CreateModel_nchw_none_quant8_weight_as_input(Model *model) { 2893 OperandType type0(Type::BOOL, {}); 2894 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 2895 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2896 OperandType type4(Type::TENSOR_INT32, {4}); 2897 OperandType type5(Type::INT32, {}); 2898 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 2899 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 2900 // Phase 1, operands 2901 auto op1 = model->addOperand(&type64); 2902 auto op2 = model->addOperand(&type28); 2903 auto op3 = model->addOperand(&type29); 2904 auto shape = model->addOperand(&type4); 2905 auto param = model->addOperand(&type5); 2906 auto param1 = model->addOperand(&type5); 2907 auto param2 = model->addOperand(&type5); 2908 auto act = model->addOperand(&type5); 2909 auto layout = model->addOperand(&type0); 2910 auto op4 = model->addOperand(&type65); 2911 // Phase 2, operations 2912 static int32_t shape_init[] = {1, 2, 5, 5}; 2913 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2914 static int32_t param_init[] = {2}; 2915 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2916 static int32_t param1_init[] = {2}; 2917 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2918 static int32_t param2_init[] = {2}; 2919 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2920 static int32_t act_init[] = {0}; 2921 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2922 static bool8 layout_init[] = {true}; 2923 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2924 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2925 // Phase 3, inputs and outputs 2926 model->identifyInputsAndOutputs( 2927 {op1, op2, op3}, 2928 {op4}); 2929 assert(model->isValid()); 2930 } 2931 2932 inline bool is_ignored_nchw_none_quant8_weight_as_input(int i) { 2933 static std::set<int> ignore = {}; 2934 return ignore.find(i) != ignore.end(); 2935 } 2936 2937 void CreateModel_nchw_none_quant8_2(Model *model) { 2938 OperandType type0(Type::BOOL, {}); 2939 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2940 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 2941 OperandType type4(Type::TENSOR_INT32, {4}); 2942 OperandType type5(Type::INT32, {}); 2943 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 2944 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 2945 // Phase 1, operands 2946 auto op1 = model->addOperand(&type66); 2947 auto op2 = model->addOperand(&type32); 2948 auto op3 = model->addOperand(&type29); 2949 auto shape = model->addOperand(&type4); 2950 auto param = model->addOperand(&type5); 2951 auto param1 = model->addOperand(&type5); 2952 auto param2 = model->addOperand(&type5); 2953 auto act = model->addOperand(&type5); 2954 auto layout = model->addOperand(&type0); 2955 auto op4 = model->addOperand(&type67); 2956 // Phase 2, operations 2957 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 2958 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 2959 static int32_t op3_init[] = {-6, -8}; 2960 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 2961 static int32_t shape_init[] = {1, 2, 5, 5}; 2962 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 2963 static int32_t param_init[] = {2}; 2964 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 2965 static int32_t param1_init[] = {2}; 2966 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 2967 static int32_t param2_init[] = {2}; 2968 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 2969 static int32_t act_init[] = {0}; 2970 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 2971 static bool8 layout_init[] = {true}; 2972 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 2973 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 2974 // Phase 3, inputs and outputs 2975 model->identifyInputsAndOutputs( 2976 {op1}, 2977 {op4}); 2978 assert(model->isValid()); 2979 } 2980 2981 inline bool is_ignored_nchw_none_quant8_2(int i) { 2982 static std::set<int> ignore = {}; 2983 return ignore.find(i) != ignore.end(); 2984 } 2985 2986 void CreateModel_nchw_none_quant8_weight_as_input_2(Model *model) { 2987 OperandType type0(Type::BOOL, {}); 2988 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 2989 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 2990 OperandType type4(Type::TENSOR_INT32, {4}); 2991 OperandType type5(Type::INT32, {}); 2992 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 2993 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 2994 // Phase 1, operands 2995 auto op1 = model->addOperand(&type66); 2996 auto op2 = model->addOperand(&type32); 2997 auto op3 = model->addOperand(&type29); 2998 auto shape = model->addOperand(&type4); 2999 auto param = model->addOperand(&type5); 3000 auto param1 = model->addOperand(&type5); 3001 auto param2 = model->addOperand(&type5); 3002 auto act = model->addOperand(&type5); 3003 auto layout = model->addOperand(&type0); 3004 auto op4 = model->addOperand(&type67); 3005 // Phase 2, operations 3006 static int32_t shape_init[] = {1, 2, 5, 5}; 3007 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3008 static int32_t param_init[] = {2}; 3009 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3010 static int32_t param1_init[] = {2}; 3011 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3012 static int32_t param2_init[] = {2}; 3013 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3014 static int32_t act_init[] = {0}; 3015 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3016 static bool8 layout_init[] = {true}; 3017 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3018 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3019 // Phase 3, inputs and outputs 3020 model->identifyInputsAndOutputs( 3021 {op1, op2, op3}, 3022 {op4}); 3023 assert(model->isValid()); 3024 } 3025 3026 inline bool is_ignored_nchw_none_quant8_weight_as_input_2(int i) { 3027 static std::set<int> ignore = {}; 3028 return ignore.find(i) != ignore.end(); 3029 } 3030 3031 void CreateModel_nchw_none_channelQuant8(Model *model) { 3032 OperandType type0(Type::BOOL, {}); 3033 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3034 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 3035 OperandType type4(Type::TENSOR_INT32, {4}); 3036 OperandType type5(Type::INT32, {}); 3037 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3038 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 3039 // Phase 1, operands 3040 auto op1 = model->addOperand(&type68); 3041 auto op2 = model->addOperand(&type35); 3042 auto op3 = model->addOperand(&type36); 3043 auto shape = model->addOperand(&type4); 3044 auto param = model->addOperand(&type5); 3045 auto param1 = model->addOperand(&type5); 3046 auto param2 = model->addOperand(&type5); 3047 auto act = model->addOperand(&type5); 3048 auto layout = model->addOperand(&type0); 3049 auto op4 = model->addOperand(&type69); 3050 // Phase 2, operations 3051 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 3052 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 3053 static int32_t op3_init[] = {-24, -16}; 3054 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 3055 static int32_t shape_init[] = {1, 2, 5, 5}; 3056 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3057 static int32_t param_init[] = {2}; 3058 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3059 static int32_t param1_init[] = {2}; 3060 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3061 static int32_t param2_init[] = {2}; 3062 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3063 static int32_t act_init[] = {0}; 3064 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3065 static bool8 layout_init[] = {true}; 3066 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3067 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3068 // Phase 3, inputs and outputs 3069 model->identifyInputsAndOutputs( 3070 {op1}, 3071 {op4}); 3072 assert(model->isValid()); 3073 } 3074 3075 inline bool is_ignored_nchw_none_channelQuant8(int i) { 3076 static std::set<int> ignore = {}; 3077 return ignore.find(i) != ignore.end(); 3078 } 3079 3080 void CreateModel_nchw_none_channelQuant8_weight_as_input(Model *model) { 3081 OperandType type0(Type::BOOL, {}); 3082 OperandType type4(Type::TENSOR_INT32, {4}); 3083 OperandType type5(Type::INT32, {}); 3084 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3085 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 3086 OperandType type70(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3087 OperandType type71(Type::TENSOR_INT32, {2}, 0.0f, 0); 3088 // Phase 1, operands 3089 auto op1 = model->addOperand(&type68); 3090 auto op2 = model->addOperand(&type70); 3091 auto op3 = model->addOperand(&type71); 3092 auto shape = model->addOperand(&type4); 3093 auto param = model->addOperand(&type5); 3094 auto param1 = model->addOperand(&type5); 3095 auto param2 = model->addOperand(&type5); 3096 auto act = model->addOperand(&type5); 3097 auto layout = model->addOperand(&type0); 3098 auto op4 = model->addOperand(&type69); 3099 // Phase 2, operations 3100 static int32_t shape_init[] = {1, 2, 5, 5}; 3101 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3102 static int32_t param_init[] = {2}; 3103 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3104 static int32_t param1_init[] = {2}; 3105 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3106 static int32_t param2_init[] = {2}; 3107 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3108 static int32_t act_init[] = {0}; 3109 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3110 static bool8 layout_init[] = {true}; 3111 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3112 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3113 // Phase 3, inputs and outputs 3114 model->identifyInputsAndOutputs( 3115 {op1, op2, op3}, 3116 {op4}); 3117 assert(model->isValid()); 3118 } 3119 3120 inline bool is_ignored_nchw_none_channelQuant8_weight_as_input(int i) { 3121 static std::set<int> ignore = {}; 3122 return ignore.find(i) != ignore.end(); 3123 } 3124 3125 void CreateModel_nchw_none_channelQuant8_2(Model *model) { 3126 OperandType type0(Type::BOOL, {}); 3127 OperandType type4(Type::TENSOR_INT32, {4}); 3128 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3129 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 3130 OperandType type5(Type::INT32, {}); 3131 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 3132 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3133 // Phase 1, operands 3134 auto op1 = model->addOperand(&type68); 3135 auto op2 = model->addOperand(&type40); 3136 auto op3 = model->addOperand(&type41); 3137 auto shape = model->addOperand(&type4); 3138 auto param = model->addOperand(&type5); 3139 auto param1 = model->addOperand(&type5); 3140 auto param2 = model->addOperand(&type5); 3141 auto act = model->addOperand(&type5); 3142 auto layout = model->addOperand(&type0); 3143 auto op4 = model->addOperand(&type67); 3144 // Phase 2, operations 3145 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 3146 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 3147 static int32_t op3_init[] = {-24, -16}; 3148 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 3149 static int32_t shape_init[] = {1, 2, 5, 5}; 3150 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3151 static int32_t param_init[] = {2}; 3152 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3153 static int32_t param1_init[] = {2}; 3154 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3155 static int32_t param2_init[] = {2}; 3156 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3157 static int32_t act_init[] = {0}; 3158 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3159 static bool8 layout_init[] = {true}; 3160 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3161 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3162 // Phase 3, inputs and outputs 3163 model->identifyInputsAndOutputs( 3164 {op1}, 3165 {op4}); 3166 assert(model->isValid()); 3167 } 3168 3169 inline bool is_ignored_nchw_none_channelQuant8_2(int i) { 3170 static std::set<int> ignore = {}; 3171 return ignore.find(i) != ignore.end(); 3172 } 3173 3174 void CreateModel_nchw_none_channelQuant8_weight_as_input_2(Model *model) { 3175 OperandType type0(Type::BOOL, {}); 3176 OperandType type4(Type::TENSOR_INT32, {4}); 3177 OperandType type5(Type::INT32, {}); 3178 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 3179 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3180 OperandType type72(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3181 OperandType type73(Type::TENSOR_INT32, {2}, 0.0f, 0); 3182 // Phase 1, operands 3183 auto op1 = model->addOperand(&type68); 3184 auto op2 = model->addOperand(&type72); 3185 auto op3 = model->addOperand(&type73); 3186 auto shape = model->addOperand(&type4); 3187 auto param = model->addOperand(&type5); 3188 auto param1 = model->addOperand(&type5); 3189 auto param2 = model->addOperand(&type5); 3190 auto act = model->addOperand(&type5); 3191 auto layout = model->addOperand(&type0); 3192 auto op4 = model->addOperand(&type67); 3193 // Phase 2, operations 3194 static int32_t shape_init[] = {1, 2, 5, 5}; 3195 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3196 static int32_t param_init[] = {2}; 3197 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3198 static int32_t param1_init[] = {2}; 3199 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3200 static int32_t param2_init[] = {2}; 3201 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3202 static int32_t act_init[] = {0}; 3203 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3204 static bool8 layout_init[] = {true}; 3205 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3206 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3207 // Phase 3, inputs and outputs 3208 model->identifyInputsAndOutputs( 3209 {op1, op2, op3}, 3210 {op4}); 3211 assert(model->isValid()); 3212 } 3213 3214 inline bool is_ignored_nchw_none_channelQuant8_weight_as_input_2(int i) { 3215 static std::set<int> ignore = {}; 3216 return ignore.find(i) != ignore.end(); 3217 } 3218 3219 void CreateModel_nchw_none_float16(Model *model) { 3220 OperandType type0(Type::BOOL, {}); 3221 OperandType type4(Type::TENSOR_INT32, {4}); 3222 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 3223 OperandType type46(Type::TENSOR_FLOAT16, {2}); 3224 OperandType type5(Type::INT32, {}); 3225 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 3226 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 3227 // Phase 1, operands 3228 auto op1 = model->addOperand(&type74); 3229 auto op2 = model->addOperand(&type45); 3230 auto op3 = model->addOperand(&type46); 3231 auto shape = model->addOperand(&type4); 3232 auto param = model->addOperand(&type5); 3233 auto param1 = model->addOperand(&type5); 3234 auto param2 = model->addOperand(&type5); 3235 auto act = model->addOperand(&type5); 3236 auto layout = model->addOperand(&type0); 3237 auto op4 = model->addOperand(&type75); 3238 // Phase 2, operations 3239 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 3240 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 3241 static _Float16 op3_init[] = {-1.5f, -2.0f}; 3242 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 3243 static int32_t shape_init[] = {1, 2, 5, 5}; 3244 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3245 static int32_t param_init[] = {2}; 3246 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3247 static int32_t param1_init[] = {2}; 3248 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3249 static int32_t param2_init[] = {2}; 3250 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3251 static int32_t act_init[] = {0}; 3252 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3253 static bool8 layout_init[] = {true}; 3254 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3255 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3256 // Phase 3, inputs and outputs 3257 model->identifyInputsAndOutputs( 3258 {op1}, 3259 {op4}); 3260 assert(model->isValid()); 3261 } 3262 3263 inline bool is_ignored_nchw_none_float16(int i) { 3264 static std::set<int> ignore = {}; 3265 return ignore.find(i) != ignore.end(); 3266 } 3267 3268 void CreateModel_nchw_none_float16_weight_as_input(Model *model) { 3269 OperandType type0(Type::BOOL, {}); 3270 OperandType type4(Type::TENSOR_INT32, {4}); 3271 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 3272 OperandType type49(Type::TENSOR_FLOAT16, {2}); 3273 OperandType type5(Type::INT32, {}); 3274 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 3275 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 3276 // Phase 1, operands 3277 auto op1 = model->addOperand(&type74); 3278 auto op2 = model->addOperand(&type48); 3279 auto op3 = model->addOperand(&type49); 3280 auto shape = model->addOperand(&type4); 3281 auto param = model->addOperand(&type5); 3282 auto param1 = model->addOperand(&type5); 3283 auto param2 = model->addOperand(&type5); 3284 auto act = model->addOperand(&type5); 3285 auto layout = model->addOperand(&type0); 3286 auto op4 = model->addOperand(&type75); 3287 // Phase 2, operations 3288 static int32_t shape_init[] = {1, 2, 5, 5}; 3289 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3290 static int32_t param_init[] = {2}; 3291 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3292 static int32_t param1_init[] = {2}; 3293 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3294 static int32_t param2_init[] = {2}; 3295 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3296 static int32_t act_init[] = {0}; 3297 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3298 static bool8 layout_init[] = {true}; 3299 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3300 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3301 // Phase 3, inputs and outputs 3302 model->identifyInputsAndOutputs( 3303 {op1, op2, op3}, 3304 {op4}); 3305 assert(model->isValid()); 3306 } 3307 3308 inline bool is_ignored_nchw_none_float16_weight_as_input(int i) { 3309 static std::set<int> ignore = {}; 3310 return ignore.find(i) != ignore.end(); 3311 } 3312 3313 void CreateModel_nchw_relu(Model *model) { 3314 OperandType type0(Type::BOOL, {}); 3315 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 3316 OperandType type3(Type::TENSOR_FLOAT32, {2}); 3317 OperandType type4(Type::TENSOR_INT32, {4}); 3318 OperandType type5(Type::INT32, {}); 3319 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 3320 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 3321 // Phase 1, operands 3322 auto op1 = model->addOperand(&type62); 3323 auto op2 = model->addOperand(&type2); 3324 auto op3 = model->addOperand(&type3); 3325 auto shape = model->addOperand(&type4); 3326 auto param = model->addOperand(&type5); 3327 auto param1 = model->addOperand(&type5); 3328 auto param2 = model->addOperand(&type5); 3329 auto act = model->addOperand(&type5); 3330 auto layout = model->addOperand(&type0); 3331 auto op4 = model->addOperand(&type63); 3332 // Phase 2, operations 3333 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 3334 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 3335 static float op3_init[] = {-1.5f, -2.0f}; 3336 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 3337 static int32_t shape_init[] = {1, 2, 5, 5}; 3338 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3339 static int32_t param_init[] = {2}; 3340 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3341 static int32_t param1_init[] = {2}; 3342 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3343 static int32_t param2_init[] = {2}; 3344 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3345 static int32_t act_init[] = {1}; 3346 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3347 static bool8 layout_init[] = {true}; 3348 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3349 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3350 // Phase 3, inputs and outputs 3351 model->identifyInputsAndOutputs( 3352 {op1}, 3353 {op4}); 3354 assert(model->isValid()); 3355 } 3356 3357 inline bool is_ignored_nchw_relu(int i) { 3358 static std::set<int> ignore = {}; 3359 return ignore.find(i) != ignore.end(); 3360 } 3361 3362 void CreateModel_nchw_relu_weight_as_input(Model *model) { 3363 OperandType type0(Type::BOOL, {}); 3364 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 3365 OperandType type3(Type::TENSOR_FLOAT32, {2}); 3366 OperandType type4(Type::TENSOR_INT32, {4}); 3367 OperandType type5(Type::INT32, {}); 3368 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 3369 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 3370 // Phase 1, operands 3371 auto op1 = model->addOperand(&type62); 3372 auto op2 = model->addOperand(&type2); 3373 auto op3 = model->addOperand(&type3); 3374 auto shape = model->addOperand(&type4); 3375 auto param = model->addOperand(&type5); 3376 auto param1 = model->addOperand(&type5); 3377 auto param2 = model->addOperand(&type5); 3378 auto act = model->addOperand(&type5); 3379 auto layout = model->addOperand(&type0); 3380 auto op4 = model->addOperand(&type63); 3381 // Phase 2, operations 3382 static int32_t shape_init[] = {1, 2, 5, 5}; 3383 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3384 static int32_t param_init[] = {2}; 3385 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3386 static int32_t param1_init[] = {2}; 3387 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3388 static int32_t param2_init[] = {2}; 3389 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3390 static int32_t act_init[] = {1}; 3391 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3392 static bool8 layout_init[] = {true}; 3393 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3394 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3395 // Phase 3, inputs and outputs 3396 model->identifyInputsAndOutputs( 3397 {op1, op2, op3}, 3398 {op4}); 3399 assert(model->isValid()); 3400 } 3401 3402 inline bool is_ignored_nchw_relu_weight_as_input(int i) { 3403 static std::set<int> ignore = {}; 3404 return ignore.find(i) != ignore.end(); 3405 } 3406 3407 void CreateModel_nchw_relu_relaxed(Model *model) { 3408 OperandType type0(Type::BOOL, {}); 3409 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 3410 OperandType type3(Type::TENSOR_FLOAT32, {2}); 3411 OperandType type4(Type::TENSOR_INT32, {4}); 3412 OperandType type5(Type::INT32, {}); 3413 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 3414 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 3415 // Phase 1, operands 3416 auto op1 = model->addOperand(&type62); 3417 auto op2 = model->addOperand(&type2); 3418 auto op3 = model->addOperand(&type3); 3419 auto shape = model->addOperand(&type4); 3420 auto param = model->addOperand(&type5); 3421 auto param1 = model->addOperand(&type5); 3422 auto param2 = model->addOperand(&type5); 3423 auto act = model->addOperand(&type5); 3424 auto layout = model->addOperand(&type0); 3425 auto op4 = model->addOperand(&type63); 3426 // Phase 2, operations 3427 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 3428 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 3429 static float op3_init[] = {-1.5f, -2.0f}; 3430 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 3431 static int32_t shape_init[] = {1, 2, 5, 5}; 3432 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3433 static int32_t param_init[] = {2}; 3434 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3435 static int32_t param1_init[] = {2}; 3436 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3437 static int32_t param2_init[] = {2}; 3438 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3439 static int32_t act_init[] = {1}; 3440 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3441 static bool8 layout_init[] = {true}; 3442 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3443 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3444 // Phase 3, inputs and outputs 3445 model->identifyInputsAndOutputs( 3446 {op1}, 3447 {op4}); 3448 // Phase 4: set relaxed execution 3449 model->relaxComputationFloat32toFloat16(true); 3450 assert(model->isValid()); 3451 } 3452 3453 inline bool is_ignored_nchw_relu_relaxed(int i) { 3454 static std::set<int> ignore = {}; 3455 return ignore.find(i) != ignore.end(); 3456 } 3457 3458 void CreateModel_nchw_relu_relaxed_weight_as_input(Model *model) { 3459 OperandType type0(Type::BOOL, {}); 3460 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 3461 OperandType type3(Type::TENSOR_FLOAT32, {2}); 3462 OperandType type4(Type::TENSOR_INT32, {4}); 3463 OperandType type5(Type::INT32, {}); 3464 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 3465 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 3466 // Phase 1, operands 3467 auto op1 = model->addOperand(&type62); 3468 auto op2 = model->addOperand(&type2); 3469 auto op3 = model->addOperand(&type3); 3470 auto shape = model->addOperand(&type4); 3471 auto param = model->addOperand(&type5); 3472 auto param1 = model->addOperand(&type5); 3473 auto param2 = model->addOperand(&type5); 3474 auto act = model->addOperand(&type5); 3475 auto layout = model->addOperand(&type0); 3476 auto op4 = model->addOperand(&type63); 3477 // Phase 2, operations 3478 static int32_t shape_init[] = {1, 2, 5, 5}; 3479 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3480 static int32_t param_init[] = {2}; 3481 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3482 static int32_t param1_init[] = {2}; 3483 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3484 static int32_t param2_init[] = {2}; 3485 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3486 static int32_t act_init[] = {1}; 3487 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3488 static bool8 layout_init[] = {true}; 3489 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3490 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3491 // Phase 3, inputs and outputs 3492 model->identifyInputsAndOutputs( 3493 {op1, op2, op3}, 3494 {op4}); 3495 // Phase 4: set relaxed execution 3496 model->relaxComputationFloat32toFloat16(true); 3497 assert(model->isValid()); 3498 } 3499 3500 inline bool is_ignored_nchw_relu_relaxed_weight_as_input(int i) { 3501 static std::set<int> ignore = {}; 3502 return ignore.find(i) != ignore.end(); 3503 } 3504 3505 void CreateModel_nchw_relu_quant8(Model *model) { 3506 OperandType type0(Type::BOOL, {}); 3507 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 3508 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 3509 OperandType type4(Type::TENSOR_INT32, {4}); 3510 OperandType type5(Type::INT32, {}); 3511 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 3512 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 3513 // Phase 1, operands 3514 auto op1 = model->addOperand(&type64); 3515 auto op2 = model->addOperand(&type28); 3516 auto op3 = model->addOperand(&type29); 3517 auto shape = model->addOperand(&type4); 3518 auto param = model->addOperand(&type5); 3519 auto param1 = model->addOperand(&type5); 3520 auto param2 = model->addOperand(&type5); 3521 auto act = model->addOperand(&type5); 3522 auto layout = model->addOperand(&type0); 3523 auto op4 = model->addOperand(&type65); 3524 // Phase 2, operations 3525 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 3526 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 3527 static int32_t op3_init[] = {-6, -8}; 3528 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 3529 static int32_t shape_init[] = {1, 2, 5, 5}; 3530 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3531 static int32_t param_init[] = {2}; 3532 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3533 static int32_t param1_init[] = {2}; 3534 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3535 static int32_t param2_init[] = {2}; 3536 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3537 static int32_t act_init[] = {1}; 3538 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3539 static bool8 layout_init[] = {true}; 3540 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3541 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3542 // Phase 3, inputs and outputs 3543 model->identifyInputsAndOutputs( 3544 {op1}, 3545 {op4}); 3546 assert(model->isValid()); 3547 } 3548 3549 inline bool is_ignored_nchw_relu_quant8(int i) { 3550 static std::set<int> ignore = {}; 3551 return ignore.find(i) != ignore.end(); 3552 } 3553 3554 void CreateModel_nchw_relu_quant8_weight_as_input(Model *model) { 3555 OperandType type0(Type::BOOL, {}); 3556 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 3557 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 3558 OperandType type4(Type::TENSOR_INT32, {4}); 3559 OperandType type5(Type::INT32, {}); 3560 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 3561 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 3562 // Phase 1, operands 3563 auto op1 = model->addOperand(&type64); 3564 auto op2 = model->addOperand(&type28); 3565 auto op3 = model->addOperand(&type29); 3566 auto shape = model->addOperand(&type4); 3567 auto param = model->addOperand(&type5); 3568 auto param1 = model->addOperand(&type5); 3569 auto param2 = model->addOperand(&type5); 3570 auto act = model->addOperand(&type5); 3571 auto layout = model->addOperand(&type0); 3572 auto op4 = model->addOperand(&type65); 3573 // Phase 2, operations 3574 static int32_t shape_init[] = {1, 2, 5, 5}; 3575 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3576 static int32_t param_init[] = {2}; 3577 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3578 static int32_t param1_init[] = {2}; 3579 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3580 static int32_t param2_init[] = {2}; 3581 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3582 static int32_t act_init[] = {1}; 3583 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3584 static bool8 layout_init[] = {true}; 3585 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3586 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3587 // Phase 3, inputs and outputs 3588 model->identifyInputsAndOutputs( 3589 {op1, op2, op3}, 3590 {op4}); 3591 assert(model->isValid()); 3592 } 3593 3594 inline bool is_ignored_nchw_relu_quant8_weight_as_input(int i) { 3595 static std::set<int> ignore = {}; 3596 return ignore.find(i) != ignore.end(); 3597 } 3598 3599 void CreateModel_nchw_relu_quant8_2(Model *model) { 3600 OperandType type0(Type::BOOL, {}); 3601 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 3602 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 3603 OperandType type4(Type::TENSOR_INT32, {4}); 3604 OperandType type5(Type::INT32, {}); 3605 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 3606 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 3607 // Phase 1, operands 3608 auto op1 = model->addOperand(&type66); 3609 auto op2 = model->addOperand(&type32); 3610 auto op3 = model->addOperand(&type29); 3611 auto shape = model->addOperand(&type4); 3612 auto param = model->addOperand(&type5); 3613 auto param1 = model->addOperand(&type5); 3614 auto param2 = model->addOperand(&type5); 3615 auto act = model->addOperand(&type5); 3616 auto layout = model->addOperand(&type0); 3617 auto op4 = model->addOperand(&type67); 3618 // Phase 2, operations 3619 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 3620 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 3621 static int32_t op3_init[] = {-6, -8}; 3622 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 3623 static int32_t shape_init[] = {1, 2, 5, 5}; 3624 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3625 static int32_t param_init[] = {2}; 3626 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3627 static int32_t param1_init[] = {2}; 3628 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3629 static int32_t param2_init[] = {2}; 3630 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3631 static int32_t act_init[] = {1}; 3632 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3633 static bool8 layout_init[] = {true}; 3634 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3635 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3636 // Phase 3, inputs and outputs 3637 model->identifyInputsAndOutputs( 3638 {op1}, 3639 {op4}); 3640 assert(model->isValid()); 3641 } 3642 3643 inline bool is_ignored_nchw_relu_quant8_2(int i) { 3644 static std::set<int> ignore = {}; 3645 return ignore.find(i) != ignore.end(); 3646 } 3647 3648 void CreateModel_nchw_relu_quant8_weight_as_input_2(Model *model) { 3649 OperandType type0(Type::BOOL, {}); 3650 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 3651 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 3652 OperandType type4(Type::TENSOR_INT32, {4}); 3653 OperandType type5(Type::INT32, {}); 3654 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 3655 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 3656 // Phase 1, operands 3657 auto op1 = model->addOperand(&type66); 3658 auto op2 = model->addOperand(&type32); 3659 auto op3 = model->addOperand(&type29); 3660 auto shape = model->addOperand(&type4); 3661 auto param = model->addOperand(&type5); 3662 auto param1 = model->addOperand(&type5); 3663 auto param2 = model->addOperand(&type5); 3664 auto act = model->addOperand(&type5); 3665 auto layout = model->addOperand(&type0); 3666 auto op4 = model->addOperand(&type67); 3667 // Phase 2, operations 3668 static int32_t shape_init[] = {1, 2, 5, 5}; 3669 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3670 static int32_t param_init[] = {2}; 3671 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3672 static int32_t param1_init[] = {2}; 3673 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3674 static int32_t param2_init[] = {2}; 3675 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3676 static int32_t act_init[] = {1}; 3677 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3678 static bool8 layout_init[] = {true}; 3679 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3680 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3681 // Phase 3, inputs and outputs 3682 model->identifyInputsAndOutputs( 3683 {op1, op2, op3}, 3684 {op4}); 3685 assert(model->isValid()); 3686 } 3687 3688 inline bool is_ignored_nchw_relu_quant8_weight_as_input_2(int i) { 3689 static std::set<int> ignore = {}; 3690 return ignore.find(i) != ignore.end(); 3691 } 3692 3693 void CreateModel_nchw_relu_channelQuant8(Model *model) { 3694 OperandType type0(Type::BOOL, {}); 3695 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3696 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 3697 OperandType type4(Type::TENSOR_INT32, {4}); 3698 OperandType type5(Type::INT32, {}); 3699 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3700 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 3701 // Phase 1, operands 3702 auto op1 = model->addOperand(&type68); 3703 auto op2 = model->addOperand(&type35); 3704 auto op3 = model->addOperand(&type36); 3705 auto shape = model->addOperand(&type4); 3706 auto param = model->addOperand(&type5); 3707 auto param1 = model->addOperand(&type5); 3708 auto param2 = model->addOperand(&type5); 3709 auto act = model->addOperand(&type5); 3710 auto layout = model->addOperand(&type0); 3711 auto op4 = model->addOperand(&type69); 3712 // Phase 2, operations 3713 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 3714 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 3715 static int32_t op3_init[] = {-24, -16}; 3716 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 3717 static int32_t shape_init[] = {1, 2, 5, 5}; 3718 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3719 static int32_t param_init[] = {2}; 3720 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3721 static int32_t param1_init[] = {2}; 3722 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3723 static int32_t param2_init[] = {2}; 3724 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3725 static int32_t act_init[] = {1}; 3726 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3727 static bool8 layout_init[] = {true}; 3728 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3729 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3730 // Phase 3, inputs and outputs 3731 model->identifyInputsAndOutputs( 3732 {op1}, 3733 {op4}); 3734 assert(model->isValid()); 3735 } 3736 3737 inline bool is_ignored_nchw_relu_channelQuant8(int i) { 3738 static std::set<int> ignore = {}; 3739 return ignore.find(i) != ignore.end(); 3740 } 3741 3742 void CreateModel_nchw_relu_channelQuant8_weight_as_input(Model *model) { 3743 OperandType type0(Type::BOOL, {}); 3744 OperandType type4(Type::TENSOR_INT32, {4}); 3745 OperandType type5(Type::INT32, {}); 3746 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3747 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 3748 OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3749 OperandType type77(Type::TENSOR_INT32, {2}, 0.0f, 0); 3750 // Phase 1, operands 3751 auto op1 = model->addOperand(&type68); 3752 auto op2 = model->addOperand(&type76); 3753 auto op3 = model->addOperand(&type77); 3754 auto shape = model->addOperand(&type4); 3755 auto param = model->addOperand(&type5); 3756 auto param1 = model->addOperand(&type5); 3757 auto param2 = model->addOperand(&type5); 3758 auto act = model->addOperand(&type5); 3759 auto layout = model->addOperand(&type0); 3760 auto op4 = model->addOperand(&type69); 3761 // Phase 2, operations 3762 static int32_t shape_init[] = {1, 2, 5, 5}; 3763 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3764 static int32_t param_init[] = {2}; 3765 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3766 static int32_t param1_init[] = {2}; 3767 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3768 static int32_t param2_init[] = {2}; 3769 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3770 static int32_t act_init[] = {1}; 3771 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3772 static bool8 layout_init[] = {true}; 3773 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3774 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3775 // Phase 3, inputs and outputs 3776 model->identifyInputsAndOutputs( 3777 {op1, op2, op3}, 3778 {op4}); 3779 assert(model->isValid()); 3780 } 3781 3782 inline bool is_ignored_nchw_relu_channelQuant8_weight_as_input(int i) { 3783 static std::set<int> ignore = {}; 3784 return ignore.find(i) != ignore.end(); 3785 } 3786 3787 void CreateModel_nchw_relu_channelQuant8_2(Model *model) { 3788 OperandType type0(Type::BOOL, {}); 3789 OperandType type4(Type::TENSOR_INT32, {4}); 3790 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3791 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 3792 OperandType type5(Type::INT32, {}); 3793 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 3794 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3795 // Phase 1, operands 3796 auto op1 = model->addOperand(&type68); 3797 auto op2 = model->addOperand(&type40); 3798 auto op3 = model->addOperand(&type41); 3799 auto shape = model->addOperand(&type4); 3800 auto param = model->addOperand(&type5); 3801 auto param1 = model->addOperand(&type5); 3802 auto param2 = model->addOperand(&type5); 3803 auto act = model->addOperand(&type5); 3804 auto layout = model->addOperand(&type0); 3805 auto op4 = model->addOperand(&type67); 3806 // Phase 2, operations 3807 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 3808 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 3809 static int32_t op3_init[] = {-24, -16}; 3810 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 3811 static int32_t shape_init[] = {1, 2, 5, 5}; 3812 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3813 static int32_t param_init[] = {2}; 3814 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3815 static int32_t param1_init[] = {2}; 3816 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3817 static int32_t param2_init[] = {2}; 3818 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3819 static int32_t act_init[] = {1}; 3820 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3821 static bool8 layout_init[] = {true}; 3822 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3823 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3824 // Phase 3, inputs and outputs 3825 model->identifyInputsAndOutputs( 3826 {op1}, 3827 {op4}); 3828 assert(model->isValid()); 3829 } 3830 3831 inline bool is_ignored_nchw_relu_channelQuant8_2(int i) { 3832 static std::set<int> ignore = {}; 3833 return ignore.find(i) != ignore.end(); 3834 } 3835 3836 void CreateModel_nchw_relu_channelQuant8_weight_as_input_2(Model *model) { 3837 OperandType type0(Type::BOOL, {}); 3838 OperandType type4(Type::TENSOR_INT32, {4}); 3839 OperandType type5(Type::INT32, {}); 3840 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 3841 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 3842 OperandType type78(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 3843 OperandType type79(Type::TENSOR_INT32, {2}, 0.0f, 0); 3844 // Phase 1, operands 3845 auto op1 = model->addOperand(&type68); 3846 auto op2 = model->addOperand(&type78); 3847 auto op3 = model->addOperand(&type79); 3848 auto shape = model->addOperand(&type4); 3849 auto param = model->addOperand(&type5); 3850 auto param1 = model->addOperand(&type5); 3851 auto param2 = model->addOperand(&type5); 3852 auto act = model->addOperand(&type5); 3853 auto layout = model->addOperand(&type0); 3854 auto op4 = model->addOperand(&type67); 3855 // Phase 2, operations 3856 static int32_t shape_init[] = {1, 2, 5, 5}; 3857 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3858 static int32_t param_init[] = {2}; 3859 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3860 static int32_t param1_init[] = {2}; 3861 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3862 static int32_t param2_init[] = {2}; 3863 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3864 static int32_t act_init[] = {1}; 3865 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3866 static bool8 layout_init[] = {true}; 3867 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3868 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3869 // Phase 3, inputs and outputs 3870 model->identifyInputsAndOutputs( 3871 {op1, op2, op3}, 3872 {op4}); 3873 assert(model->isValid()); 3874 } 3875 3876 inline bool is_ignored_nchw_relu_channelQuant8_weight_as_input_2(int i) { 3877 static std::set<int> ignore = {}; 3878 return ignore.find(i) != ignore.end(); 3879 } 3880 3881 void CreateModel_nchw_relu_float16(Model *model) { 3882 OperandType type0(Type::BOOL, {}); 3883 OperandType type4(Type::TENSOR_INT32, {4}); 3884 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 3885 OperandType type46(Type::TENSOR_FLOAT16, {2}); 3886 OperandType type5(Type::INT32, {}); 3887 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 3888 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 3889 // Phase 1, operands 3890 auto op1 = model->addOperand(&type74); 3891 auto op2 = model->addOperand(&type45); 3892 auto op3 = model->addOperand(&type46); 3893 auto shape = model->addOperand(&type4); 3894 auto param = model->addOperand(&type5); 3895 auto param1 = model->addOperand(&type5); 3896 auto param2 = model->addOperand(&type5); 3897 auto act = model->addOperand(&type5); 3898 auto layout = model->addOperand(&type0); 3899 auto op4 = model->addOperand(&type75); 3900 // Phase 2, operations 3901 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 3902 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 3903 static _Float16 op3_init[] = {-1.5f, -2.0f}; 3904 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 3905 static int32_t shape_init[] = {1, 2, 5, 5}; 3906 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3907 static int32_t param_init[] = {2}; 3908 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3909 static int32_t param1_init[] = {2}; 3910 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3911 static int32_t param2_init[] = {2}; 3912 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3913 static int32_t act_init[] = {1}; 3914 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3915 static bool8 layout_init[] = {true}; 3916 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3917 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3918 // Phase 3, inputs and outputs 3919 model->identifyInputsAndOutputs( 3920 {op1}, 3921 {op4}); 3922 assert(model->isValid()); 3923 } 3924 3925 inline bool is_ignored_nchw_relu_float16(int i) { 3926 static std::set<int> ignore = {}; 3927 return ignore.find(i) != ignore.end(); 3928 } 3929 3930 void CreateModel_nchw_relu_float16_weight_as_input(Model *model) { 3931 OperandType type0(Type::BOOL, {}); 3932 OperandType type4(Type::TENSOR_INT32, {4}); 3933 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 3934 OperandType type49(Type::TENSOR_FLOAT16, {2}); 3935 OperandType type5(Type::INT32, {}); 3936 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 3937 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 3938 // Phase 1, operands 3939 auto op1 = model->addOperand(&type74); 3940 auto op2 = model->addOperand(&type48); 3941 auto op3 = model->addOperand(&type49); 3942 auto shape = model->addOperand(&type4); 3943 auto param = model->addOperand(&type5); 3944 auto param1 = model->addOperand(&type5); 3945 auto param2 = model->addOperand(&type5); 3946 auto act = model->addOperand(&type5); 3947 auto layout = model->addOperand(&type0); 3948 auto op4 = model->addOperand(&type75); 3949 // Phase 2, operations 3950 static int32_t shape_init[] = {1, 2, 5, 5}; 3951 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 3952 static int32_t param_init[] = {2}; 3953 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 3954 static int32_t param1_init[] = {2}; 3955 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 3956 static int32_t param2_init[] = {2}; 3957 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 3958 static int32_t act_init[] = {1}; 3959 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 3960 static bool8 layout_init[] = {true}; 3961 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 3962 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 3963 // Phase 3, inputs and outputs 3964 model->identifyInputsAndOutputs( 3965 {op1, op2, op3}, 3966 {op4}); 3967 assert(model->isValid()); 3968 } 3969 3970 inline bool is_ignored_nchw_relu_float16_weight_as_input(int i) { 3971 static std::set<int> ignore = {}; 3972 return ignore.find(i) != ignore.end(); 3973 } 3974 3975 void CreateModel_nchw_relu1(Model *model) { 3976 OperandType type0(Type::BOOL, {}); 3977 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 3978 OperandType type3(Type::TENSOR_FLOAT32, {2}); 3979 OperandType type4(Type::TENSOR_INT32, {4}); 3980 OperandType type5(Type::INT32, {}); 3981 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 3982 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 3983 // Phase 1, operands 3984 auto op1 = model->addOperand(&type62); 3985 auto op2 = model->addOperand(&type2); 3986 auto op3 = model->addOperand(&type3); 3987 auto shape = model->addOperand(&type4); 3988 auto param = model->addOperand(&type5); 3989 auto param1 = model->addOperand(&type5); 3990 auto param2 = model->addOperand(&type5); 3991 auto act = model->addOperand(&type5); 3992 auto layout = model->addOperand(&type0); 3993 auto op4 = model->addOperand(&type63); 3994 // Phase 2, operations 3995 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 3996 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 3997 static float op3_init[] = {-1.5f, -2.0f}; 3998 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 3999 static int32_t shape_init[] = {1, 2, 5, 5}; 4000 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4001 static int32_t param_init[] = {2}; 4002 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4003 static int32_t param1_init[] = {2}; 4004 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4005 static int32_t param2_init[] = {2}; 4006 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4007 static int32_t act_init[] = {2}; 4008 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4009 static bool8 layout_init[] = {true}; 4010 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4011 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4012 // Phase 3, inputs and outputs 4013 model->identifyInputsAndOutputs( 4014 {op1}, 4015 {op4}); 4016 assert(model->isValid()); 4017 } 4018 4019 inline bool is_ignored_nchw_relu1(int i) { 4020 static std::set<int> ignore = {}; 4021 return ignore.find(i) != ignore.end(); 4022 } 4023 4024 void CreateModel_nchw_relu1_weight_as_input(Model *model) { 4025 OperandType type0(Type::BOOL, {}); 4026 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4027 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4028 OperandType type4(Type::TENSOR_INT32, {4}); 4029 OperandType type5(Type::INT32, {}); 4030 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4031 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4032 // Phase 1, operands 4033 auto op1 = model->addOperand(&type62); 4034 auto op2 = model->addOperand(&type2); 4035 auto op3 = model->addOperand(&type3); 4036 auto shape = model->addOperand(&type4); 4037 auto param = model->addOperand(&type5); 4038 auto param1 = model->addOperand(&type5); 4039 auto param2 = model->addOperand(&type5); 4040 auto act = model->addOperand(&type5); 4041 auto layout = model->addOperand(&type0); 4042 auto op4 = model->addOperand(&type63); 4043 // Phase 2, operations 4044 static int32_t shape_init[] = {1, 2, 5, 5}; 4045 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4046 static int32_t param_init[] = {2}; 4047 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4048 static int32_t param1_init[] = {2}; 4049 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4050 static int32_t param2_init[] = {2}; 4051 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4052 static int32_t act_init[] = {2}; 4053 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4054 static bool8 layout_init[] = {true}; 4055 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4056 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4057 // Phase 3, inputs and outputs 4058 model->identifyInputsAndOutputs( 4059 {op1, op2, op3}, 4060 {op4}); 4061 assert(model->isValid()); 4062 } 4063 4064 inline bool is_ignored_nchw_relu1_weight_as_input(int i) { 4065 static std::set<int> ignore = {}; 4066 return ignore.find(i) != ignore.end(); 4067 } 4068 4069 void CreateModel_nchw_relu1_relaxed(Model *model) { 4070 OperandType type0(Type::BOOL, {}); 4071 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4072 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4073 OperandType type4(Type::TENSOR_INT32, {4}); 4074 OperandType type5(Type::INT32, {}); 4075 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4076 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4077 // Phase 1, operands 4078 auto op1 = model->addOperand(&type62); 4079 auto op2 = model->addOperand(&type2); 4080 auto op3 = model->addOperand(&type3); 4081 auto shape = model->addOperand(&type4); 4082 auto param = model->addOperand(&type5); 4083 auto param1 = model->addOperand(&type5); 4084 auto param2 = model->addOperand(&type5); 4085 auto act = model->addOperand(&type5); 4086 auto layout = model->addOperand(&type0); 4087 auto op4 = model->addOperand(&type63); 4088 // Phase 2, operations 4089 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 4090 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 4091 static float op3_init[] = {-1.5f, -2.0f}; 4092 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 4093 static int32_t shape_init[] = {1, 2, 5, 5}; 4094 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4095 static int32_t param_init[] = {2}; 4096 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4097 static int32_t param1_init[] = {2}; 4098 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4099 static int32_t param2_init[] = {2}; 4100 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4101 static int32_t act_init[] = {2}; 4102 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4103 static bool8 layout_init[] = {true}; 4104 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4105 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4106 // Phase 3, inputs and outputs 4107 model->identifyInputsAndOutputs( 4108 {op1}, 4109 {op4}); 4110 // Phase 4: set relaxed execution 4111 model->relaxComputationFloat32toFloat16(true); 4112 assert(model->isValid()); 4113 } 4114 4115 inline bool is_ignored_nchw_relu1_relaxed(int i) { 4116 static std::set<int> ignore = {}; 4117 return ignore.find(i) != ignore.end(); 4118 } 4119 4120 void CreateModel_nchw_relu1_relaxed_weight_as_input(Model *model) { 4121 OperandType type0(Type::BOOL, {}); 4122 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4123 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4124 OperandType type4(Type::TENSOR_INT32, {4}); 4125 OperandType type5(Type::INT32, {}); 4126 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4127 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4128 // Phase 1, operands 4129 auto op1 = model->addOperand(&type62); 4130 auto op2 = model->addOperand(&type2); 4131 auto op3 = model->addOperand(&type3); 4132 auto shape = model->addOperand(&type4); 4133 auto param = model->addOperand(&type5); 4134 auto param1 = model->addOperand(&type5); 4135 auto param2 = model->addOperand(&type5); 4136 auto act = model->addOperand(&type5); 4137 auto layout = model->addOperand(&type0); 4138 auto op4 = model->addOperand(&type63); 4139 // Phase 2, operations 4140 static int32_t shape_init[] = {1, 2, 5, 5}; 4141 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4142 static int32_t param_init[] = {2}; 4143 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4144 static int32_t param1_init[] = {2}; 4145 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4146 static int32_t param2_init[] = {2}; 4147 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4148 static int32_t act_init[] = {2}; 4149 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4150 static bool8 layout_init[] = {true}; 4151 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4152 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4153 // Phase 3, inputs and outputs 4154 model->identifyInputsAndOutputs( 4155 {op1, op2, op3}, 4156 {op4}); 4157 // Phase 4: set relaxed execution 4158 model->relaxComputationFloat32toFloat16(true); 4159 assert(model->isValid()); 4160 } 4161 4162 inline bool is_ignored_nchw_relu1_relaxed_weight_as_input(int i) { 4163 static std::set<int> ignore = {}; 4164 return ignore.find(i) != ignore.end(); 4165 } 4166 4167 void CreateModel_nchw_relu1_quant8(Model *model) { 4168 OperandType type0(Type::BOOL, {}); 4169 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 4170 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4171 OperandType type4(Type::TENSOR_INT32, {4}); 4172 OperandType type5(Type::INT32, {}); 4173 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 4174 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 4175 // Phase 1, operands 4176 auto op1 = model->addOperand(&type64); 4177 auto op2 = model->addOperand(&type28); 4178 auto op3 = model->addOperand(&type29); 4179 auto shape = model->addOperand(&type4); 4180 auto param = model->addOperand(&type5); 4181 auto param1 = model->addOperand(&type5); 4182 auto param2 = model->addOperand(&type5); 4183 auto act = model->addOperand(&type5); 4184 auto layout = model->addOperand(&type0); 4185 auto op4 = model->addOperand(&type65); 4186 // Phase 2, operations 4187 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 4188 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 4189 static int32_t op3_init[] = {-6, -8}; 4190 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 4191 static int32_t shape_init[] = {1, 2, 5, 5}; 4192 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4193 static int32_t param_init[] = {2}; 4194 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4195 static int32_t param1_init[] = {2}; 4196 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4197 static int32_t param2_init[] = {2}; 4198 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4199 static int32_t act_init[] = {2}; 4200 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4201 static bool8 layout_init[] = {true}; 4202 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4203 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4204 // Phase 3, inputs and outputs 4205 model->identifyInputsAndOutputs( 4206 {op1}, 4207 {op4}); 4208 assert(model->isValid()); 4209 } 4210 4211 inline bool is_ignored_nchw_relu1_quant8(int i) { 4212 static std::set<int> ignore = {}; 4213 return ignore.find(i) != ignore.end(); 4214 } 4215 4216 void CreateModel_nchw_relu1_quant8_weight_as_input(Model *model) { 4217 OperandType type0(Type::BOOL, {}); 4218 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 4219 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4220 OperandType type4(Type::TENSOR_INT32, {4}); 4221 OperandType type5(Type::INT32, {}); 4222 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 4223 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 4224 // Phase 1, operands 4225 auto op1 = model->addOperand(&type64); 4226 auto op2 = model->addOperand(&type28); 4227 auto op3 = model->addOperand(&type29); 4228 auto shape = model->addOperand(&type4); 4229 auto param = model->addOperand(&type5); 4230 auto param1 = model->addOperand(&type5); 4231 auto param2 = model->addOperand(&type5); 4232 auto act = model->addOperand(&type5); 4233 auto layout = model->addOperand(&type0); 4234 auto op4 = model->addOperand(&type65); 4235 // Phase 2, operations 4236 static int32_t shape_init[] = {1, 2, 5, 5}; 4237 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4238 static int32_t param_init[] = {2}; 4239 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4240 static int32_t param1_init[] = {2}; 4241 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4242 static int32_t param2_init[] = {2}; 4243 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4244 static int32_t act_init[] = {2}; 4245 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4246 static bool8 layout_init[] = {true}; 4247 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4248 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4249 // Phase 3, inputs and outputs 4250 model->identifyInputsAndOutputs( 4251 {op1, op2, op3}, 4252 {op4}); 4253 assert(model->isValid()); 4254 } 4255 4256 inline bool is_ignored_nchw_relu1_quant8_weight_as_input(int i) { 4257 static std::set<int> ignore = {}; 4258 return ignore.find(i) != ignore.end(); 4259 } 4260 4261 void CreateModel_nchw_relu1_quant8_2(Model *model) { 4262 OperandType type0(Type::BOOL, {}); 4263 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4264 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 4265 OperandType type4(Type::TENSOR_INT32, {4}); 4266 OperandType type5(Type::INT32, {}); 4267 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 4268 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 4269 // Phase 1, operands 4270 auto op1 = model->addOperand(&type66); 4271 auto op2 = model->addOperand(&type32); 4272 auto op3 = model->addOperand(&type29); 4273 auto shape = model->addOperand(&type4); 4274 auto param = model->addOperand(&type5); 4275 auto param1 = model->addOperand(&type5); 4276 auto param2 = model->addOperand(&type5); 4277 auto act = model->addOperand(&type5); 4278 auto layout = model->addOperand(&type0); 4279 auto op4 = model->addOperand(&type67); 4280 // Phase 2, operations 4281 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 4282 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 4283 static int32_t op3_init[] = {-6, -8}; 4284 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 4285 static int32_t shape_init[] = {1, 2, 5, 5}; 4286 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4287 static int32_t param_init[] = {2}; 4288 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4289 static int32_t param1_init[] = {2}; 4290 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4291 static int32_t param2_init[] = {2}; 4292 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4293 static int32_t act_init[] = {2}; 4294 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4295 static bool8 layout_init[] = {true}; 4296 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4297 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4298 // Phase 3, inputs and outputs 4299 model->identifyInputsAndOutputs( 4300 {op1}, 4301 {op4}); 4302 assert(model->isValid()); 4303 } 4304 4305 inline bool is_ignored_nchw_relu1_quant8_2(int i) { 4306 static std::set<int> ignore = {}; 4307 return ignore.find(i) != ignore.end(); 4308 } 4309 4310 void CreateModel_nchw_relu1_quant8_weight_as_input_2(Model *model) { 4311 OperandType type0(Type::BOOL, {}); 4312 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4313 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 4314 OperandType type4(Type::TENSOR_INT32, {4}); 4315 OperandType type5(Type::INT32, {}); 4316 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 4317 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 4318 // Phase 1, operands 4319 auto op1 = model->addOperand(&type66); 4320 auto op2 = model->addOperand(&type32); 4321 auto op3 = model->addOperand(&type29); 4322 auto shape = model->addOperand(&type4); 4323 auto param = model->addOperand(&type5); 4324 auto param1 = model->addOperand(&type5); 4325 auto param2 = model->addOperand(&type5); 4326 auto act = model->addOperand(&type5); 4327 auto layout = model->addOperand(&type0); 4328 auto op4 = model->addOperand(&type67); 4329 // Phase 2, operations 4330 static int32_t shape_init[] = {1, 2, 5, 5}; 4331 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4332 static int32_t param_init[] = {2}; 4333 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4334 static int32_t param1_init[] = {2}; 4335 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4336 static int32_t param2_init[] = {2}; 4337 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4338 static int32_t act_init[] = {2}; 4339 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4340 static bool8 layout_init[] = {true}; 4341 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4342 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4343 // Phase 3, inputs and outputs 4344 model->identifyInputsAndOutputs( 4345 {op1, op2, op3}, 4346 {op4}); 4347 assert(model->isValid()); 4348 } 4349 4350 inline bool is_ignored_nchw_relu1_quant8_weight_as_input_2(int i) { 4351 static std::set<int> ignore = {}; 4352 return ignore.find(i) != ignore.end(); 4353 } 4354 4355 void CreateModel_nchw_relu1_channelQuant8(Model *model) { 4356 OperandType type0(Type::BOOL, {}); 4357 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 4358 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 4359 OperandType type4(Type::TENSOR_INT32, {4}); 4360 OperandType type5(Type::INT32, {}); 4361 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 4362 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 4363 // Phase 1, operands 4364 auto op1 = model->addOperand(&type68); 4365 auto op2 = model->addOperand(&type35); 4366 auto op3 = model->addOperand(&type36); 4367 auto shape = model->addOperand(&type4); 4368 auto param = model->addOperand(&type5); 4369 auto param1 = model->addOperand(&type5); 4370 auto param2 = model->addOperand(&type5); 4371 auto act = model->addOperand(&type5); 4372 auto layout = model->addOperand(&type0); 4373 auto op4 = model->addOperand(&type69); 4374 // Phase 2, operations 4375 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 4376 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 4377 static int32_t op3_init[] = {-24, -16}; 4378 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 4379 static int32_t shape_init[] = {1, 2, 5, 5}; 4380 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4381 static int32_t param_init[] = {2}; 4382 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4383 static int32_t param1_init[] = {2}; 4384 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4385 static int32_t param2_init[] = {2}; 4386 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4387 static int32_t act_init[] = {2}; 4388 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4389 static bool8 layout_init[] = {true}; 4390 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4391 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4392 // Phase 3, inputs and outputs 4393 model->identifyInputsAndOutputs( 4394 {op1}, 4395 {op4}); 4396 assert(model->isValid()); 4397 } 4398 4399 inline bool is_ignored_nchw_relu1_channelQuant8(int i) { 4400 static std::set<int> ignore = {}; 4401 return ignore.find(i) != ignore.end(); 4402 } 4403 4404 void CreateModel_nchw_relu1_channelQuant8_weight_as_input(Model *model) { 4405 OperandType type0(Type::BOOL, {}); 4406 OperandType type4(Type::TENSOR_INT32, {4}); 4407 OperandType type5(Type::INT32, {}); 4408 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 4409 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 4410 OperandType type80(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 4411 OperandType type81(Type::TENSOR_INT32, {2}, 0.0f, 0); 4412 // Phase 1, operands 4413 auto op1 = model->addOperand(&type68); 4414 auto op2 = model->addOperand(&type80); 4415 auto op3 = model->addOperand(&type81); 4416 auto shape = model->addOperand(&type4); 4417 auto param = model->addOperand(&type5); 4418 auto param1 = model->addOperand(&type5); 4419 auto param2 = model->addOperand(&type5); 4420 auto act = model->addOperand(&type5); 4421 auto layout = model->addOperand(&type0); 4422 auto op4 = model->addOperand(&type69); 4423 // Phase 2, operations 4424 static int32_t shape_init[] = {1, 2, 5, 5}; 4425 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4426 static int32_t param_init[] = {2}; 4427 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4428 static int32_t param1_init[] = {2}; 4429 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4430 static int32_t param2_init[] = {2}; 4431 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4432 static int32_t act_init[] = {2}; 4433 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4434 static bool8 layout_init[] = {true}; 4435 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4436 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4437 // Phase 3, inputs and outputs 4438 model->identifyInputsAndOutputs( 4439 {op1, op2, op3}, 4440 {op4}); 4441 assert(model->isValid()); 4442 } 4443 4444 inline bool is_ignored_nchw_relu1_channelQuant8_weight_as_input(int i) { 4445 static std::set<int> ignore = {}; 4446 return ignore.find(i) != ignore.end(); 4447 } 4448 4449 void CreateModel_nchw_relu1_channelQuant8_2(Model *model) { 4450 OperandType type0(Type::BOOL, {}); 4451 OperandType type4(Type::TENSOR_INT32, {4}); 4452 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 4453 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 4454 OperandType type5(Type::INT32, {}); 4455 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 4456 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 4457 // Phase 1, operands 4458 auto op1 = model->addOperand(&type68); 4459 auto op2 = model->addOperand(&type40); 4460 auto op3 = model->addOperand(&type41); 4461 auto shape = model->addOperand(&type4); 4462 auto param = model->addOperand(&type5); 4463 auto param1 = model->addOperand(&type5); 4464 auto param2 = model->addOperand(&type5); 4465 auto act = model->addOperand(&type5); 4466 auto layout = model->addOperand(&type0); 4467 auto op4 = model->addOperand(&type67); 4468 // Phase 2, operations 4469 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 4470 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 4471 static int32_t op3_init[] = {-24, -16}; 4472 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 4473 static int32_t shape_init[] = {1, 2, 5, 5}; 4474 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4475 static int32_t param_init[] = {2}; 4476 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4477 static int32_t param1_init[] = {2}; 4478 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4479 static int32_t param2_init[] = {2}; 4480 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4481 static int32_t act_init[] = {2}; 4482 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4483 static bool8 layout_init[] = {true}; 4484 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4485 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4486 // Phase 3, inputs and outputs 4487 model->identifyInputsAndOutputs( 4488 {op1}, 4489 {op4}); 4490 assert(model->isValid()); 4491 } 4492 4493 inline bool is_ignored_nchw_relu1_channelQuant8_2(int i) { 4494 static std::set<int> ignore = {}; 4495 return ignore.find(i) != ignore.end(); 4496 } 4497 4498 void CreateModel_nchw_relu1_channelQuant8_weight_as_input_2(Model *model) { 4499 OperandType type0(Type::BOOL, {}); 4500 OperandType type4(Type::TENSOR_INT32, {4}); 4501 OperandType type5(Type::INT32, {}); 4502 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 4503 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 4504 OperandType type82(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 4505 OperandType type83(Type::TENSOR_INT32, {2}, 0.0f, 0); 4506 // Phase 1, operands 4507 auto op1 = model->addOperand(&type68); 4508 auto op2 = model->addOperand(&type82); 4509 auto op3 = model->addOperand(&type83); 4510 auto shape = model->addOperand(&type4); 4511 auto param = model->addOperand(&type5); 4512 auto param1 = model->addOperand(&type5); 4513 auto param2 = model->addOperand(&type5); 4514 auto act = model->addOperand(&type5); 4515 auto layout = model->addOperand(&type0); 4516 auto op4 = model->addOperand(&type67); 4517 // Phase 2, operations 4518 static int32_t shape_init[] = {1, 2, 5, 5}; 4519 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4520 static int32_t param_init[] = {2}; 4521 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4522 static int32_t param1_init[] = {2}; 4523 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4524 static int32_t param2_init[] = {2}; 4525 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4526 static int32_t act_init[] = {2}; 4527 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4528 static bool8 layout_init[] = {true}; 4529 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4530 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4531 // Phase 3, inputs and outputs 4532 model->identifyInputsAndOutputs( 4533 {op1, op2, op3}, 4534 {op4}); 4535 assert(model->isValid()); 4536 } 4537 4538 inline bool is_ignored_nchw_relu1_channelQuant8_weight_as_input_2(int i) { 4539 static std::set<int> ignore = {}; 4540 return ignore.find(i) != ignore.end(); 4541 } 4542 4543 void CreateModel_nchw_relu1_float16(Model *model) { 4544 OperandType type0(Type::BOOL, {}); 4545 OperandType type4(Type::TENSOR_INT32, {4}); 4546 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 4547 OperandType type46(Type::TENSOR_FLOAT16, {2}); 4548 OperandType type5(Type::INT32, {}); 4549 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 4550 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 4551 // Phase 1, operands 4552 auto op1 = model->addOperand(&type74); 4553 auto op2 = model->addOperand(&type45); 4554 auto op3 = model->addOperand(&type46); 4555 auto shape = model->addOperand(&type4); 4556 auto param = model->addOperand(&type5); 4557 auto param1 = model->addOperand(&type5); 4558 auto param2 = model->addOperand(&type5); 4559 auto act = model->addOperand(&type5); 4560 auto layout = model->addOperand(&type0); 4561 auto op4 = model->addOperand(&type75); 4562 // Phase 2, operations 4563 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 4564 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 4565 static _Float16 op3_init[] = {-1.5f, -2.0f}; 4566 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 4567 static int32_t shape_init[] = {1, 2, 5, 5}; 4568 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4569 static int32_t param_init[] = {2}; 4570 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4571 static int32_t param1_init[] = {2}; 4572 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4573 static int32_t param2_init[] = {2}; 4574 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4575 static int32_t act_init[] = {2}; 4576 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4577 static bool8 layout_init[] = {true}; 4578 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4579 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4580 // Phase 3, inputs and outputs 4581 model->identifyInputsAndOutputs( 4582 {op1}, 4583 {op4}); 4584 assert(model->isValid()); 4585 } 4586 4587 inline bool is_ignored_nchw_relu1_float16(int i) { 4588 static std::set<int> ignore = {}; 4589 return ignore.find(i) != ignore.end(); 4590 } 4591 4592 void CreateModel_nchw_relu1_float16_weight_as_input(Model *model) { 4593 OperandType type0(Type::BOOL, {}); 4594 OperandType type4(Type::TENSOR_INT32, {4}); 4595 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 4596 OperandType type49(Type::TENSOR_FLOAT16, {2}); 4597 OperandType type5(Type::INT32, {}); 4598 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 4599 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 4600 // Phase 1, operands 4601 auto op1 = model->addOperand(&type74); 4602 auto op2 = model->addOperand(&type48); 4603 auto op3 = model->addOperand(&type49); 4604 auto shape = model->addOperand(&type4); 4605 auto param = model->addOperand(&type5); 4606 auto param1 = model->addOperand(&type5); 4607 auto param2 = model->addOperand(&type5); 4608 auto act = model->addOperand(&type5); 4609 auto layout = model->addOperand(&type0); 4610 auto op4 = model->addOperand(&type75); 4611 // Phase 2, operations 4612 static int32_t shape_init[] = {1, 2, 5, 5}; 4613 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4614 static int32_t param_init[] = {2}; 4615 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4616 static int32_t param1_init[] = {2}; 4617 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4618 static int32_t param2_init[] = {2}; 4619 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4620 static int32_t act_init[] = {2}; 4621 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4622 static bool8 layout_init[] = {true}; 4623 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4624 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4625 // Phase 3, inputs and outputs 4626 model->identifyInputsAndOutputs( 4627 {op1, op2, op3}, 4628 {op4}); 4629 assert(model->isValid()); 4630 } 4631 4632 inline bool is_ignored_nchw_relu1_float16_weight_as_input(int i) { 4633 static std::set<int> ignore = {}; 4634 return ignore.find(i) != ignore.end(); 4635 } 4636 4637 void CreateModel_nchw_relu6(Model *model) { 4638 OperandType type0(Type::BOOL, {}); 4639 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4640 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4641 OperandType type4(Type::TENSOR_INT32, {4}); 4642 OperandType type5(Type::INT32, {}); 4643 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4644 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4645 // Phase 1, operands 4646 auto op1 = model->addOperand(&type62); 4647 auto op2 = model->addOperand(&type2); 4648 auto op3 = model->addOperand(&type3); 4649 auto shape = model->addOperand(&type4); 4650 auto param = model->addOperand(&type5); 4651 auto param1 = model->addOperand(&type5); 4652 auto param2 = model->addOperand(&type5); 4653 auto act = model->addOperand(&type5); 4654 auto layout = model->addOperand(&type0); 4655 auto op4 = model->addOperand(&type63); 4656 // Phase 2, operations 4657 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 4658 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 4659 static float op3_init[] = {-1.5f, -2.0f}; 4660 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 4661 static int32_t shape_init[] = {1, 2, 5, 5}; 4662 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4663 static int32_t param_init[] = {2}; 4664 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4665 static int32_t param1_init[] = {2}; 4666 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4667 static int32_t param2_init[] = {2}; 4668 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4669 static int32_t act_init[] = {3}; 4670 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4671 static bool8 layout_init[] = {true}; 4672 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4673 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4674 // Phase 3, inputs and outputs 4675 model->identifyInputsAndOutputs( 4676 {op1}, 4677 {op4}); 4678 assert(model->isValid()); 4679 } 4680 4681 inline bool is_ignored_nchw_relu6(int i) { 4682 static std::set<int> ignore = {}; 4683 return ignore.find(i) != ignore.end(); 4684 } 4685 4686 void CreateModel_nchw_relu6_weight_as_input(Model *model) { 4687 OperandType type0(Type::BOOL, {}); 4688 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4689 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4690 OperandType type4(Type::TENSOR_INT32, {4}); 4691 OperandType type5(Type::INT32, {}); 4692 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4693 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4694 // Phase 1, operands 4695 auto op1 = model->addOperand(&type62); 4696 auto op2 = model->addOperand(&type2); 4697 auto op3 = model->addOperand(&type3); 4698 auto shape = model->addOperand(&type4); 4699 auto param = model->addOperand(&type5); 4700 auto param1 = model->addOperand(&type5); 4701 auto param2 = model->addOperand(&type5); 4702 auto act = model->addOperand(&type5); 4703 auto layout = model->addOperand(&type0); 4704 auto op4 = model->addOperand(&type63); 4705 // Phase 2, operations 4706 static int32_t shape_init[] = {1, 2, 5, 5}; 4707 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4708 static int32_t param_init[] = {2}; 4709 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4710 static int32_t param1_init[] = {2}; 4711 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4712 static int32_t param2_init[] = {2}; 4713 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4714 static int32_t act_init[] = {3}; 4715 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4716 static bool8 layout_init[] = {true}; 4717 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4718 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4719 // Phase 3, inputs and outputs 4720 model->identifyInputsAndOutputs( 4721 {op1, op2, op3}, 4722 {op4}); 4723 assert(model->isValid()); 4724 } 4725 4726 inline bool is_ignored_nchw_relu6_weight_as_input(int i) { 4727 static std::set<int> ignore = {}; 4728 return ignore.find(i) != ignore.end(); 4729 } 4730 4731 void CreateModel_nchw_relu6_relaxed(Model *model) { 4732 OperandType type0(Type::BOOL, {}); 4733 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4734 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4735 OperandType type4(Type::TENSOR_INT32, {4}); 4736 OperandType type5(Type::INT32, {}); 4737 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4738 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4739 // Phase 1, operands 4740 auto op1 = model->addOperand(&type62); 4741 auto op2 = model->addOperand(&type2); 4742 auto op3 = model->addOperand(&type3); 4743 auto shape = model->addOperand(&type4); 4744 auto param = model->addOperand(&type5); 4745 auto param1 = model->addOperand(&type5); 4746 auto param2 = model->addOperand(&type5); 4747 auto act = model->addOperand(&type5); 4748 auto layout = model->addOperand(&type0); 4749 auto op4 = model->addOperand(&type63); 4750 // Phase 2, operations 4751 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 4752 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 4753 static float op3_init[] = {-1.5f, -2.0f}; 4754 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 4755 static int32_t shape_init[] = {1, 2, 5, 5}; 4756 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4757 static int32_t param_init[] = {2}; 4758 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4759 static int32_t param1_init[] = {2}; 4760 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4761 static int32_t param2_init[] = {2}; 4762 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4763 static int32_t act_init[] = {3}; 4764 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4765 static bool8 layout_init[] = {true}; 4766 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4767 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4768 // Phase 3, inputs and outputs 4769 model->identifyInputsAndOutputs( 4770 {op1}, 4771 {op4}); 4772 // Phase 4: set relaxed execution 4773 model->relaxComputationFloat32toFloat16(true); 4774 assert(model->isValid()); 4775 } 4776 4777 inline bool is_ignored_nchw_relu6_relaxed(int i) { 4778 static std::set<int> ignore = {}; 4779 return ignore.find(i) != ignore.end(); 4780 } 4781 4782 void CreateModel_nchw_relu6_relaxed_weight_as_input(Model *model) { 4783 OperandType type0(Type::BOOL, {}); 4784 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 4785 OperandType type3(Type::TENSOR_FLOAT32, {2}); 4786 OperandType type4(Type::TENSOR_INT32, {4}); 4787 OperandType type5(Type::INT32, {}); 4788 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 4789 OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); 4790 // Phase 1, operands 4791 auto op1 = model->addOperand(&type62); 4792 auto op2 = model->addOperand(&type2); 4793 auto op3 = model->addOperand(&type3); 4794 auto shape = model->addOperand(&type4); 4795 auto param = model->addOperand(&type5); 4796 auto param1 = model->addOperand(&type5); 4797 auto param2 = model->addOperand(&type5); 4798 auto act = model->addOperand(&type5); 4799 auto layout = model->addOperand(&type0); 4800 auto op4 = model->addOperand(&type63); 4801 // Phase 2, operations 4802 static int32_t shape_init[] = {1, 2, 5, 5}; 4803 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4804 static int32_t param_init[] = {2}; 4805 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4806 static int32_t param1_init[] = {2}; 4807 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4808 static int32_t param2_init[] = {2}; 4809 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4810 static int32_t act_init[] = {3}; 4811 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4812 static bool8 layout_init[] = {true}; 4813 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4814 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4815 // Phase 3, inputs and outputs 4816 model->identifyInputsAndOutputs( 4817 {op1, op2, op3}, 4818 {op4}); 4819 // Phase 4: set relaxed execution 4820 model->relaxComputationFloat32toFloat16(true); 4821 assert(model->isValid()); 4822 } 4823 4824 inline bool is_ignored_nchw_relu6_relaxed_weight_as_input(int i) { 4825 static std::set<int> ignore = {}; 4826 return ignore.find(i) != ignore.end(); 4827 } 4828 4829 void CreateModel_nchw_relu6_quant8(Model *model) { 4830 OperandType type0(Type::BOOL, {}); 4831 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 4832 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4833 OperandType type4(Type::TENSOR_INT32, {4}); 4834 OperandType type5(Type::INT32, {}); 4835 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 4836 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 4837 // Phase 1, operands 4838 auto op1 = model->addOperand(&type64); 4839 auto op2 = model->addOperand(&type28); 4840 auto op3 = model->addOperand(&type29); 4841 auto shape = model->addOperand(&type4); 4842 auto param = model->addOperand(&type5); 4843 auto param1 = model->addOperand(&type5); 4844 auto param2 = model->addOperand(&type5); 4845 auto act = model->addOperand(&type5); 4846 auto layout = model->addOperand(&type0); 4847 auto op4 = model->addOperand(&type65); 4848 // Phase 2, operations 4849 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 4850 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 4851 static int32_t op3_init[] = {-6, -8}; 4852 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 4853 static int32_t shape_init[] = {1, 2, 5, 5}; 4854 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4855 static int32_t param_init[] = {2}; 4856 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4857 static int32_t param1_init[] = {2}; 4858 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4859 static int32_t param2_init[] = {2}; 4860 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4861 static int32_t act_init[] = {3}; 4862 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4863 static bool8 layout_init[] = {true}; 4864 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4865 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4866 // Phase 3, inputs and outputs 4867 model->identifyInputsAndOutputs( 4868 {op1}, 4869 {op4}); 4870 assert(model->isValid()); 4871 } 4872 4873 inline bool is_ignored_nchw_relu6_quant8(int i) { 4874 static std::set<int> ignore = {}; 4875 return ignore.find(i) != ignore.end(); 4876 } 4877 4878 void CreateModel_nchw_relu6_quant8_weight_as_input(Model *model) { 4879 OperandType type0(Type::BOOL, {}); 4880 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 4881 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4882 OperandType type4(Type::TENSOR_INT32, {4}); 4883 OperandType type5(Type::INT32, {}); 4884 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 4885 OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); 4886 // Phase 1, operands 4887 auto op1 = model->addOperand(&type64); 4888 auto op2 = model->addOperand(&type28); 4889 auto op3 = model->addOperand(&type29); 4890 auto shape = model->addOperand(&type4); 4891 auto param = model->addOperand(&type5); 4892 auto param1 = model->addOperand(&type5); 4893 auto param2 = model->addOperand(&type5); 4894 auto act = model->addOperand(&type5); 4895 auto layout = model->addOperand(&type0); 4896 auto op4 = model->addOperand(&type65); 4897 // Phase 2, operations 4898 static int32_t shape_init[] = {1, 2, 5, 5}; 4899 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4900 static int32_t param_init[] = {2}; 4901 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4902 static int32_t param1_init[] = {2}; 4903 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4904 static int32_t param2_init[] = {2}; 4905 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4906 static int32_t act_init[] = {3}; 4907 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4908 static bool8 layout_init[] = {true}; 4909 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4910 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4911 // Phase 3, inputs and outputs 4912 model->identifyInputsAndOutputs( 4913 {op1, op2, op3}, 4914 {op4}); 4915 assert(model->isValid()); 4916 } 4917 4918 inline bool is_ignored_nchw_relu6_quant8_weight_as_input(int i) { 4919 static std::set<int> ignore = {}; 4920 return ignore.find(i) != ignore.end(); 4921 } 4922 4923 void CreateModel_nchw_relu6_quant8_2(Model *model) { 4924 OperandType type0(Type::BOOL, {}); 4925 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4926 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 4927 OperandType type4(Type::TENSOR_INT32, {4}); 4928 OperandType type5(Type::INT32, {}); 4929 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 4930 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 4931 // Phase 1, operands 4932 auto op1 = model->addOperand(&type66); 4933 auto op2 = model->addOperand(&type32); 4934 auto op3 = model->addOperand(&type29); 4935 auto shape = model->addOperand(&type4); 4936 auto param = model->addOperand(&type5); 4937 auto param1 = model->addOperand(&type5); 4938 auto param2 = model->addOperand(&type5); 4939 auto act = model->addOperand(&type5); 4940 auto layout = model->addOperand(&type0); 4941 auto op4 = model->addOperand(&type67); 4942 // Phase 2, operations 4943 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 4944 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 4945 static int32_t op3_init[] = {-6, -8}; 4946 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 4947 static int32_t shape_init[] = {1, 2, 5, 5}; 4948 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4949 static int32_t param_init[] = {2}; 4950 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4951 static int32_t param1_init[] = {2}; 4952 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4953 static int32_t param2_init[] = {2}; 4954 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 4955 static int32_t act_init[] = {3}; 4956 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 4957 static bool8 layout_init[] = {true}; 4958 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 4959 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 4960 // Phase 3, inputs and outputs 4961 model->identifyInputsAndOutputs( 4962 {op1}, 4963 {op4}); 4964 assert(model->isValid()); 4965 } 4966 4967 inline bool is_ignored_nchw_relu6_quant8_2(int i) { 4968 static std::set<int> ignore = {}; 4969 return ignore.find(i) != ignore.end(); 4970 } 4971 4972 void CreateModel_nchw_relu6_quant8_weight_as_input_2(Model *model) { 4973 OperandType type0(Type::BOOL, {}); 4974 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 4975 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 4976 OperandType type4(Type::TENSOR_INT32, {4}); 4977 OperandType type5(Type::INT32, {}); 4978 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 4979 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 4980 // Phase 1, operands 4981 auto op1 = model->addOperand(&type66); 4982 auto op2 = model->addOperand(&type32); 4983 auto op3 = model->addOperand(&type29); 4984 auto shape = model->addOperand(&type4); 4985 auto param = model->addOperand(&type5); 4986 auto param1 = model->addOperand(&type5); 4987 auto param2 = model->addOperand(&type5); 4988 auto act = model->addOperand(&type5); 4989 auto layout = model->addOperand(&type0); 4990 auto op4 = model->addOperand(&type67); 4991 // Phase 2, operations 4992 static int32_t shape_init[] = {1, 2, 5, 5}; 4993 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 4994 static int32_t param_init[] = {2}; 4995 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 4996 static int32_t param1_init[] = {2}; 4997 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 4998 static int32_t param2_init[] = {2}; 4999 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5000 static int32_t act_init[] = {3}; 5001 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5002 static bool8 layout_init[] = {true}; 5003 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5004 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5005 // Phase 3, inputs and outputs 5006 model->identifyInputsAndOutputs( 5007 {op1, op2, op3}, 5008 {op4}); 5009 assert(model->isValid()); 5010 } 5011 5012 inline bool is_ignored_nchw_relu6_quant8_weight_as_input_2(int i) { 5013 static std::set<int> ignore = {}; 5014 return ignore.find(i) != ignore.end(); 5015 } 5016 5017 void CreateModel_nchw_relu6_channelQuant8(Model *model) { 5018 OperandType type0(Type::BOOL, {}); 5019 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5020 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 5021 OperandType type4(Type::TENSOR_INT32, {4}); 5022 OperandType type5(Type::INT32, {}); 5023 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 5024 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 5025 // Phase 1, operands 5026 auto op1 = model->addOperand(&type68); 5027 auto op2 = model->addOperand(&type35); 5028 auto op3 = model->addOperand(&type36); 5029 auto shape = model->addOperand(&type4); 5030 auto param = model->addOperand(&type5); 5031 auto param1 = model->addOperand(&type5); 5032 auto param2 = model->addOperand(&type5); 5033 auto act = model->addOperand(&type5); 5034 auto layout = model->addOperand(&type0); 5035 auto op4 = model->addOperand(&type69); 5036 // Phase 2, operations 5037 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 5038 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 5039 static int32_t op3_init[] = {-24, -16}; 5040 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 5041 static int32_t shape_init[] = {1, 2, 5, 5}; 5042 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5043 static int32_t param_init[] = {2}; 5044 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5045 static int32_t param1_init[] = {2}; 5046 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5047 static int32_t param2_init[] = {2}; 5048 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5049 static int32_t act_init[] = {3}; 5050 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5051 static bool8 layout_init[] = {true}; 5052 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5053 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5054 // Phase 3, inputs and outputs 5055 model->identifyInputsAndOutputs( 5056 {op1}, 5057 {op4}); 5058 assert(model->isValid()); 5059 } 5060 5061 inline bool is_ignored_nchw_relu6_channelQuant8(int i) { 5062 static std::set<int> ignore = {}; 5063 return ignore.find(i) != ignore.end(); 5064 } 5065 5066 void CreateModel_nchw_relu6_channelQuant8_weight_as_input(Model *model) { 5067 OperandType type0(Type::BOOL, {}); 5068 OperandType type4(Type::TENSOR_INT32, {4}); 5069 OperandType type5(Type::INT32, {}); 5070 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 5071 OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); 5072 OperandType type84(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5073 OperandType type85(Type::TENSOR_INT32, {2}, 0.0f, 0); 5074 // Phase 1, operands 5075 auto op1 = model->addOperand(&type68); 5076 auto op2 = model->addOperand(&type84); 5077 auto op3 = model->addOperand(&type85); 5078 auto shape = model->addOperand(&type4); 5079 auto param = model->addOperand(&type5); 5080 auto param1 = model->addOperand(&type5); 5081 auto param2 = model->addOperand(&type5); 5082 auto act = model->addOperand(&type5); 5083 auto layout = model->addOperand(&type0); 5084 auto op4 = model->addOperand(&type69); 5085 // Phase 2, operations 5086 static int32_t shape_init[] = {1, 2, 5, 5}; 5087 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5088 static int32_t param_init[] = {2}; 5089 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5090 static int32_t param1_init[] = {2}; 5091 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5092 static int32_t param2_init[] = {2}; 5093 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5094 static int32_t act_init[] = {3}; 5095 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5096 static bool8 layout_init[] = {true}; 5097 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5098 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5099 // Phase 3, inputs and outputs 5100 model->identifyInputsAndOutputs( 5101 {op1, op2, op3}, 5102 {op4}); 5103 assert(model->isValid()); 5104 } 5105 5106 inline bool is_ignored_nchw_relu6_channelQuant8_weight_as_input(int i) { 5107 static std::set<int> ignore = {}; 5108 return ignore.find(i) != ignore.end(); 5109 } 5110 5111 void CreateModel_nchw_relu6_channelQuant8_2(Model *model) { 5112 OperandType type0(Type::BOOL, {}); 5113 OperandType type4(Type::TENSOR_INT32, {4}); 5114 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5115 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 5116 OperandType type5(Type::INT32, {}); 5117 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 5118 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 5119 // Phase 1, operands 5120 auto op1 = model->addOperand(&type68); 5121 auto op2 = model->addOperand(&type40); 5122 auto op3 = model->addOperand(&type41); 5123 auto shape = model->addOperand(&type4); 5124 auto param = model->addOperand(&type5); 5125 auto param1 = model->addOperand(&type5); 5126 auto param2 = model->addOperand(&type5); 5127 auto act = model->addOperand(&type5); 5128 auto layout = model->addOperand(&type0); 5129 auto op4 = model->addOperand(&type67); 5130 // Phase 2, operations 5131 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 5132 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 5133 static int32_t op3_init[] = {-24, -16}; 5134 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 5135 static int32_t shape_init[] = {1, 2, 5, 5}; 5136 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5137 static int32_t param_init[] = {2}; 5138 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5139 static int32_t param1_init[] = {2}; 5140 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5141 static int32_t param2_init[] = {2}; 5142 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5143 static int32_t act_init[] = {3}; 5144 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5145 static bool8 layout_init[] = {true}; 5146 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5147 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5148 // Phase 3, inputs and outputs 5149 model->identifyInputsAndOutputs( 5150 {op1}, 5151 {op4}); 5152 assert(model->isValid()); 5153 } 5154 5155 inline bool is_ignored_nchw_relu6_channelQuant8_2(int i) { 5156 static std::set<int> ignore = {}; 5157 return ignore.find(i) != ignore.end(); 5158 } 5159 5160 void CreateModel_nchw_relu6_channelQuant8_weight_as_input_2(Model *model) { 5161 OperandType type0(Type::BOOL, {}); 5162 OperandType type4(Type::TENSOR_INT32, {4}); 5163 OperandType type5(Type::INT32, {}); 5164 OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); 5165 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 5166 OperandType type86(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5167 OperandType type87(Type::TENSOR_INT32, {2}, 0.0f, 0); 5168 // Phase 1, operands 5169 auto op1 = model->addOperand(&type68); 5170 auto op2 = model->addOperand(&type86); 5171 auto op3 = model->addOperand(&type87); 5172 auto shape = model->addOperand(&type4); 5173 auto param = model->addOperand(&type5); 5174 auto param1 = model->addOperand(&type5); 5175 auto param2 = model->addOperand(&type5); 5176 auto act = model->addOperand(&type5); 5177 auto layout = model->addOperand(&type0); 5178 auto op4 = model->addOperand(&type67); 5179 // Phase 2, operations 5180 static int32_t shape_init[] = {1, 2, 5, 5}; 5181 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5182 static int32_t param_init[] = {2}; 5183 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5184 static int32_t param1_init[] = {2}; 5185 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5186 static int32_t param2_init[] = {2}; 5187 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5188 static int32_t act_init[] = {3}; 5189 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5190 static bool8 layout_init[] = {true}; 5191 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5192 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5193 // Phase 3, inputs and outputs 5194 model->identifyInputsAndOutputs( 5195 {op1, op2, op3}, 5196 {op4}); 5197 assert(model->isValid()); 5198 } 5199 5200 inline bool is_ignored_nchw_relu6_channelQuant8_weight_as_input_2(int i) { 5201 static std::set<int> ignore = {}; 5202 return ignore.find(i) != ignore.end(); 5203 } 5204 5205 void CreateModel_nchw_relu6_float16(Model *model) { 5206 OperandType type0(Type::BOOL, {}); 5207 OperandType type4(Type::TENSOR_INT32, {4}); 5208 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 5209 OperandType type46(Type::TENSOR_FLOAT16, {2}); 5210 OperandType type5(Type::INT32, {}); 5211 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 5212 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 5213 // Phase 1, operands 5214 auto op1 = model->addOperand(&type74); 5215 auto op2 = model->addOperand(&type45); 5216 auto op3 = model->addOperand(&type46); 5217 auto shape = model->addOperand(&type4); 5218 auto param = model->addOperand(&type5); 5219 auto param1 = model->addOperand(&type5); 5220 auto param2 = model->addOperand(&type5); 5221 auto act = model->addOperand(&type5); 5222 auto layout = model->addOperand(&type0); 5223 auto op4 = model->addOperand(&type75); 5224 // Phase 2, operations 5225 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 5226 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 5227 static _Float16 op3_init[] = {-1.5f, -2.0f}; 5228 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 5229 static int32_t shape_init[] = {1, 2, 5, 5}; 5230 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5231 static int32_t param_init[] = {2}; 5232 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5233 static int32_t param1_init[] = {2}; 5234 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5235 static int32_t param2_init[] = {2}; 5236 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5237 static int32_t act_init[] = {3}; 5238 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5239 static bool8 layout_init[] = {true}; 5240 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5241 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5242 // Phase 3, inputs and outputs 5243 model->identifyInputsAndOutputs( 5244 {op1}, 5245 {op4}); 5246 assert(model->isValid()); 5247 } 5248 5249 inline bool is_ignored_nchw_relu6_float16(int i) { 5250 static std::set<int> ignore = {}; 5251 return ignore.find(i) != ignore.end(); 5252 } 5253 5254 void CreateModel_nchw_relu6_float16_weight_as_input(Model *model) { 5255 OperandType type0(Type::BOOL, {}); 5256 OperandType type4(Type::TENSOR_INT32, {4}); 5257 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 5258 OperandType type49(Type::TENSOR_FLOAT16, {2}); 5259 OperandType type5(Type::INT32, {}); 5260 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 5261 OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); 5262 // Phase 1, operands 5263 auto op1 = model->addOperand(&type74); 5264 auto op2 = model->addOperand(&type48); 5265 auto op3 = model->addOperand(&type49); 5266 auto shape = model->addOperand(&type4); 5267 auto param = model->addOperand(&type5); 5268 auto param1 = model->addOperand(&type5); 5269 auto param2 = model->addOperand(&type5); 5270 auto act = model->addOperand(&type5); 5271 auto layout = model->addOperand(&type0); 5272 auto op4 = model->addOperand(&type75); 5273 // Phase 2, operations 5274 static int32_t shape_init[] = {1, 2, 5, 5}; 5275 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5276 static int32_t param_init[] = {2}; 5277 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5278 static int32_t param1_init[] = {2}; 5279 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5280 static int32_t param2_init[] = {2}; 5281 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5282 static int32_t act_init[] = {3}; 5283 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5284 static bool8 layout_init[] = {true}; 5285 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5286 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5287 // Phase 3, inputs and outputs 5288 model->identifyInputsAndOutputs( 5289 {op1, op2, op3}, 5290 {op4}); 5291 assert(model->isValid()); 5292 } 5293 5294 inline bool is_ignored_nchw_relu6_float16_weight_as_input(int i) { 5295 static std::set<int> ignore = {}; 5296 return ignore.find(i) != ignore.end(); 5297 } 5298 5299 void CreateModel_dynamic_output_shape_nhwc_none(Model *model) { 5300 OperandType type0(Type::BOOL, {}); 5301 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 5302 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 5303 OperandType type3(Type::TENSOR_FLOAT32, {2}); 5304 OperandType type4(Type::TENSOR_INT32, {4}); 5305 OperandType type5(Type::INT32, {}); 5306 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5307 // Phase 1, operands 5308 auto op1 = model->addOperand(&type1); 5309 auto op2 = model->addOperand(&type2); 5310 auto op3 = model->addOperand(&type3); 5311 auto shape = model->addOperand(&type4); 5312 auto param = model->addOperand(&type5); 5313 auto param1 = model->addOperand(&type5); 5314 auto param2 = model->addOperand(&type5); 5315 auto act = model->addOperand(&type5); 5316 auto layout = model->addOperand(&type0); 5317 auto op4 = model->addOperand(&type88); 5318 // Phase 2, operations 5319 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 5320 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 5321 static float op3_init[] = {-1.5f, -2.0f}; 5322 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 5323 static int32_t shape_init[] = {1, 5, 5, 2}; 5324 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5325 static int32_t param_init[] = {2}; 5326 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5327 static int32_t param1_init[] = {2}; 5328 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5329 static int32_t param2_init[] = {2}; 5330 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5331 static int32_t act_init[] = {0}; 5332 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5333 static bool8 layout_init[] = {false}; 5334 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5335 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5336 // Phase 3, inputs and outputs 5337 model->identifyInputsAndOutputs( 5338 {op1}, 5339 {op4}); 5340 assert(model->isValid()); 5341 } 5342 5343 inline bool is_ignored_dynamic_output_shape_nhwc_none(int i) { 5344 static std::set<int> ignore = {}; 5345 return ignore.find(i) != ignore.end(); 5346 } 5347 5348 void CreateModel_dynamic_output_shape_nhwc_none_weight_as_input(Model *model) { 5349 OperandType type0(Type::BOOL, {}); 5350 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 5351 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 5352 OperandType type3(Type::TENSOR_FLOAT32, {2}); 5353 OperandType type4(Type::TENSOR_INT32, {4}); 5354 OperandType type5(Type::INT32, {}); 5355 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5356 // Phase 1, operands 5357 auto op1 = model->addOperand(&type1); 5358 auto op2 = model->addOperand(&type2); 5359 auto op3 = model->addOperand(&type3); 5360 auto shape = model->addOperand(&type4); 5361 auto param = model->addOperand(&type5); 5362 auto param1 = model->addOperand(&type5); 5363 auto param2 = model->addOperand(&type5); 5364 auto act = model->addOperand(&type5); 5365 auto layout = model->addOperand(&type0); 5366 auto op4 = model->addOperand(&type88); 5367 // Phase 2, operations 5368 static int32_t shape_init[] = {1, 5, 5, 2}; 5369 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5370 static int32_t param_init[] = {2}; 5371 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5372 static int32_t param1_init[] = {2}; 5373 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5374 static int32_t param2_init[] = {2}; 5375 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5376 static int32_t act_init[] = {0}; 5377 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5378 static bool8 layout_init[] = {false}; 5379 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5380 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5381 // Phase 3, inputs and outputs 5382 model->identifyInputsAndOutputs( 5383 {op1, op2, op3}, 5384 {op4}); 5385 assert(model->isValid()); 5386 } 5387 5388 inline bool is_ignored_dynamic_output_shape_nhwc_none_weight_as_input(int i) { 5389 static std::set<int> ignore = {}; 5390 return ignore.find(i) != ignore.end(); 5391 } 5392 5393 void CreateModel_dynamic_output_shape_nhwc_none_relaxed(Model *model) { 5394 OperandType type0(Type::BOOL, {}); 5395 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 5396 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 5397 OperandType type3(Type::TENSOR_FLOAT32, {2}); 5398 OperandType type4(Type::TENSOR_INT32, {4}); 5399 OperandType type5(Type::INT32, {}); 5400 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5401 // Phase 1, operands 5402 auto op1 = model->addOperand(&type1); 5403 auto op2 = model->addOperand(&type2); 5404 auto op3 = model->addOperand(&type3); 5405 auto shape = model->addOperand(&type4); 5406 auto param = model->addOperand(&type5); 5407 auto param1 = model->addOperand(&type5); 5408 auto param2 = model->addOperand(&type5); 5409 auto act = model->addOperand(&type5); 5410 auto layout = model->addOperand(&type0); 5411 auto op4 = model->addOperand(&type88); 5412 // Phase 2, operations 5413 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 5414 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 5415 static float op3_init[] = {-1.5f, -2.0f}; 5416 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 5417 static int32_t shape_init[] = {1, 5, 5, 2}; 5418 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5419 static int32_t param_init[] = {2}; 5420 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5421 static int32_t param1_init[] = {2}; 5422 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5423 static int32_t param2_init[] = {2}; 5424 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5425 static int32_t act_init[] = {0}; 5426 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5427 static bool8 layout_init[] = {false}; 5428 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5429 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5430 // Phase 3, inputs and outputs 5431 model->identifyInputsAndOutputs( 5432 {op1}, 5433 {op4}); 5434 // Phase 4: set relaxed execution 5435 model->relaxComputationFloat32toFloat16(true); 5436 assert(model->isValid()); 5437 } 5438 5439 inline bool is_ignored_dynamic_output_shape_nhwc_none_relaxed(int i) { 5440 static std::set<int> ignore = {}; 5441 return ignore.find(i) != ignore.end(); 5442 } 5443 5444 void CreateModel_dynamic_output_shape_nhwc_none_relaxed_weight_as_input(Model *model) { 5445 OperandType type0(Type::BOOL, {}); 5446 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 5447 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 5448 OperandType type3(Type::TENSOR_FLOAT32, {2}); 5449 OperandType type4(Type::TENSOR_INT32, {4}); 5450 OperandType type5(Type::INT32, {}); 5451 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5452 // Phase 1, operands 5453 auto op1 = model->addOperand(&type1); 5454 auto op2 = model->addOperand(&type2); 5455 auto op3 = model->addOperand(&type3); 5456 auto shape = model->addOperand(&type4); 5457 auto param = model->addOperand(&type5); 5458 auto param1 = model->addOperand(&type5); 5459 auto param2 = model->addOperand(&type5); 5460 auto act = model->addOperand(&type5); 5461 auto layout = model->addOperand(&type0); 5462 auto op4 = model->addOperand(&type88); 5463 // Phase 2, operations 5464 static int32_t shape_init[] = {1, 5, 5, 2}; 5465 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5466 static int32_t param_init[] = {2}; 5467 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5468 static int32_t param1_init[] = {2}; 5469 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5470 static int32_t param2_init[] = {2}; 5471 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5472 static int32_t act_init[] = {0}; 5473 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5474 static bool8 layout_init[] = {false}; 5475 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5476 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5477 // Phase 3, inputs and outputs 5478 model->identifyInputsAndOutputs( 5479 {op1, op2, op3}, 5480 {op4}); 5481 // Phase 4: set relaxed execution 5482 model->relaxComputationFloat32toFloat16(true); 5483 assert(model->isValid()); 5484 } 5485 5486 inline bool is_ignored_dynamic_output_shape_nhwc_none_relaxed_weight_as_input(int i) { 5487 static std::set<int> ignore = {}; 5488 return ignore.find(i) != ignore.end(); 5489 } 5490 5491 void CreateModel_dynamic_output_shape_nhwc_none_quant8(Model *model) { 5492 OperandType type0(Type::BOOL, {}); 5493 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 5494 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 5495 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 5496 OperandType type4(Type::TENSOR_INT32, {4}); 5497 OperandType type5(Type::INT32, {}); 5498 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5499 // Phase 1, operands 5500 auto op1 = model->addOperand(&type27); 5501 auto op2 = model->addOperand(&type28); 5502 auto op3 = model->addOperand(&type29); 5503 auto shape = model->addOperand(&type4); 5504 auto param = model->addOperand(&type5); 5505 auto param1 = model->addOperand(&type5); 5506 auto param2 = model->addOperand(&type5); 5507 auto act = model->addOperand(&type5); 5508 auto layout = model->addOperand(&type0); 5509 auto op4 = model->addOperand(&type89); 5510 // Phase 2, operations 5511 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 5512 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 5513 static int32_t op3_init[] = {-6, -8}; 5514 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 5515 static int32_t shape_init[] = {1, 5, 5, 2}; 5516 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5517 static int32_t param_init[] = {2}; 5518 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5519 static int32_t param1_init[] = {2}; 5520 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5521 static int32_t param2_init[] = {2}; 5522 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5523 static int32_t act_init[] = {0}; 5524 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5525 static bool8 layout_init[] = {false}; 5526 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5527 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5528 // Phase 3, inputs and outputs 5529 model->identifyInputsAndOutputs( 5530 {op1}, 5531 {op4}); 5532 assert(model->isValid()); 5533 } 5534 5535 inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8(int i) { 5536 static std::set<int> ignore = {}; 5537 return ignore.find(i) != ignore.end(); 5538 } 5539 5540 void CreateModel_dynamic_output_shape_nhwc_none_quant8_weight_as_input(Model *model) { 5541 OperandType type0(Type::BOOL, {}); 5542 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 5543 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 5544 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 5545 OperandType type4(Type::TENSOR_INT32, {4}); 5546 OperandType type5(Type::INT32, {}); 5547 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 5548 // Phase 1, operands 5549 auto op1 = model->addOperand(&type27); 5550 auto op2 = model->addOperand(&type28); 5551 auto op3 = model->addOperand(&type29); 5552 auto shape = model->addOperand(&type4); 5553 auto param = model->addOperand(&type5); 5554 auto param1 = model->addOperand(&type5); 5555 auto param2 = model->addOperand(&type5); 5556 auto act = model->addOperand(&type5); 5557 auto layout = model->addOperand(&type0); 5558 auto op4 = model->addOperand(&type89); 5559 // Phase 2, operations 5560 static int32_t shape_init[] = {1, 5, 5, 2}; 5561 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5562 static int32_t param_init[] = {2}; 5563 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5564 static int32_t param1_init[] = {2}; 5565 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5566 static int32_t param2_init[] = {2}; 5567 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5568 static int32_t act_init[] = {0}; 5569 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5570 static bool8 layout_init[] = {false}; 5571 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5572 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5573 // Phase 3, inputs and outputs 5574 model->identifyInputsAndOutputs( 5575 {op1, op2, op3}, 5576 {op4}); 5577 assert(model->isValid()); 5578 } 5579 5580 inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8_weight_as_input(int i) { 5581 static std::set<int> ignore = {}; 5582 return ignore.find(i) != ignore.end(); 5583 } 5584 5585 void CreateModel_dynamic_output_shape_nhwc_none_quant8_2(Model *model) { 5586 OperandType type0(Type::BOOL, {}); 5587 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 5588 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 5589 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 5590 OperandType type4(Type::TENSOR_INT32, {4}); 5591 OperandType type5(Type::INT32, {}); 5592 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 5593 // Phase 1, operands 5594 auto op1 = model->addOperand(&type31); 5595 auto op2 = model->addOperand(&type32); 5596 auto op3 = model->addOperand(&type29); 5597 auto shape = model->addOperand(&type4); 5598 auto param = model->addOperand(&type5); 5599 auto param1 = model->addOperand(&type5); 5600 auto param2 = model->addOperand(&type5); 5601 auto act = model->addOperand(&type5); 5602 auto layout = model->addOperand(&type0); 5603 auto op4 = model->addOperand(&type90); 5604 // Phase 2, operations 5605 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 5606 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 5607 static int32_t op3_init[] = {-6, -8}; 5608 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 5609 static int32_t shape_init[] = {1, 5, 5, 2}; 5610 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5611 static int32_t param_init[] = {2}; 5612 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5613 static int32_t param1_init[] = {2}; 5614 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5615 static int32_t param2_init[] = {2}; 5616 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5617 static int32_t act_init[] = {0}; 5618 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5619 static bool8 layout_init[] = {false}; 5620 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5621 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5622 // Phase 3, inputs and outputs 5623 model->identifyInputsAndOutputs( 5624 {op1}, 5625 {op4}); 5626 assert(model->isValid()); 5627 } 5628 5629 inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8_2(int i) { 5630 static std::set<int> ignore = {}; 5631 return ignore.find(i) != ignore.end(); 5632 } 5633 5634 void CreateModel_dynamic_output_shape_nhwc_none_quant8_weight_as_input_2(Model *model) { 5635 OperandType type0(Type::BOOL, {}); 5636 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 5637 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 5638 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 5639 OperandType type4(Type::TENSOR_INT32, {4}); 5640 OperandType type5(Type::INT32, {}); 5641 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 5642 // Phase 1, operands 5643 auto op1 = model->addOperand(&type31); 5644 auto op2 = model->addOperand(&type32); 5645 auto op3 = model->addOperand(&type29); 5646 auto shape = model->addOperand(&type4); 5647 auto param = model->addOperand(&type5); 5648 auto param1 = model->addOperand(&type5); 5649 auto param2 = model->addOperand(&type5); 5650 auto act = model->addOperand(&type5); 5651 auto layout = model->addOperand(&type0); 5652 auto op4 = model->addOperand(&type90); 5653 // Phase 2, operations 5654 static int32_t shape_init[] = {1, 5, 5, 2}; 5655 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5656 static int32_t param_init[] = {2}; 5657 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5658 static int32_t param1_init[] = {2}; 5659 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5660 static int32_t param2_init[] = {2}; 5661 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5662 static int32_t act_init[] = {0}; 5663 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5664 static bool8 layout_init[] = {false}; 5665 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5666 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5667 // Phase 3, inputs and outputs 5668 model->identifyInputsAndOutputs( 5669 {op1, op2, op3}, 5670 {op4}); 5671 assert(model->isValid()); 5672 } 5673 5674 inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8_weight_as_input_2(int i) { 5675 static std::set<int> ignore = {}; 5676 return ignore.find(i) != ignore.end(); 5677 } 5678 5679 void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8(Model *model) { 5680 OperandType type0(Type::BOOL, {}); 5681 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 5682 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5683 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 5684 OperandType type4(Type::TENSOR_INT32, {4}); 5685 OperandType type5(Type::INT32, {}); 5686 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 5687 // Phase 1, operands 5688 auto op1 = model->addOperand(&type34); 5689 auto op2 = model->addOperand(&type35); 5690 auto op3 = model->addOperand(&type36); 5691 auto shape = model->addOperand(&type4); 5692 auto param = model->addOperand(&type5); 5693 auto param1 = model->addOperand(&type5); 5694 auto param2 = model->addOperand(&type5); 5695 auto act = model->addOperand(&type5); 5696 auto layout = model->addOperand(&type0); 5697 auto op4 = model->addOperand(&type91); 5698 // Phase 2, operations 5699 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 5700 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 5701 static int32_t op3_init[] = {-24, -16}; 5702 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 5703 static int32_t shape_init[] = {1, 5, 5, 2}; 5704 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5705 static int32_t param_init[] = {2}; 5706 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5707 static int32_t param1_init[] = {2}; 5708 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5709 static int32_t param2_init[] = {2}; 5710 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5711 static int32_t act_init[] = {0}; 5712 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5713 static bool8 layout_init[] = {false}; 5714 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5715 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5716 // Phase 3, inputs and outputs 5717 model->identifyInputsAndOutputs( 5718 {op1}, 5719 {op4}); 5720 assert(model->isValid()); 5721 } 5722 5723 inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8(int i) { 5724 static std::set<int> ignore = {}; 5725 return ignore.find(i) != ignore.end(); 5726 } 5727 5728 void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input(Model *model) { 5729 OperandType type0(Type::BOOL, {}); 5730 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 5731 OperandType type4(Type::TENSOR_INT32, {4}); 5732 OperandType type5(Type::INT32, {}); 5733 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 5734 OperandType type92(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5735 OperandType type93(Type::TENSOR_INT32, {2}, 0.0f, 0); 5736 // Phase 1, operands 5737 auto op1 = model->addOperand(&type34); 5738 auto op2 = model->addOperand(&type92); 5739 auto op3 = model->addOperand(&type93); 5740 auto shape = model->addOperand(&type4); 5741 auto param = model->addOperand(&type5); 5742 auto param1 = model->addOperand(&type5); 5743 auto param2 = model->addOperand(&type5); 5744 auto act = model->addOperand(&type5); 5745 auto layout = model->addOperand(&type0); 5746 auto op4 = model->addOperand(&type91); 5747 // Phase 2, operations 5748 static int32_t shape_init[] = {1, 5, 5, 2}; 5749 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5750 static int32_t param_init[] = {2}; 5751 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5752 static int32_t param1_init[] = {2}; 5753 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5754 static int32_t param2_init[] = {2}; 5755 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5756 static int32_t act_init[] = {0}; 5757 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5758 static bool8 layout_init[] = {false}; 5759 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5760 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5761 // Phase 3, inputs and outputs 5762 model->identifyInputsAndOutputs( 5763 {op1, op2, op3}, 5764 {op4}); 5765 assert(model->isValid()); 5766 } 5767 5768 inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input(int i) { 5769 static std::set<int> ignore = {}; 5770 return ignore.find(i) != ignore.end(); 5771 } 5772 5773 void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8_2(Model *model) { 5774 OperandType type0(Type::BOOL, {}); 5775 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 5776 OperandType type4(Type::TENSOR_INT32, {4}); 5777 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5778 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 5779 OperandType type5(Type::INT32, {}); 5780 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 5781 // Phase 1, operands 5782 auto op1 = model->addOperand(&type34); 5783 auto op2 = model->addOperand(&type40); 5784 auto op3 = model->addOperand(&type41); 5785 auto shape = model->addOperand(&type4); 5786 auto param = model->addOperand(&type5); 5787 auto param1 = model->addOperand(&type5); 5788 auto param2 = model->addOperand(&type5); 5789 auto act = model->addOperand(&type5); 5790 auto layout = model->addOperand(&type0); 5791 auto op4 = model->addOperand(&type90); 5792 // Phase 2, operations 5793 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 5794 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 5795 static int32_t op3_init[] = {-24, -16}; 5796 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 5797 static int32_t shape_init[] = {1, 5, 5, 2}; 5798 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5799 static int32_t param_init[] = {2}; 5800 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5801 static int32_t param1_init[] = {2}; 5802 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5803 static int32_t param2_init[] = {2}; 5804 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5805 static int32_t act_init[] = {0}; 5806 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5807 static bool8 layout_init[] = {false}; 5808 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5809 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5810 // Phase 3, inputs and outputs 5811 model->identifyInputsAndOutputs( 5812 {op1}, 5813 {op4}); 5814 assert(model->isValid()); 5815 } 5816 5817 inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8_2(int i) { 5818 static std::set<int> ignore = {}; 5819 return ignore.find(i) != ignore.end(); 5820 } 5821 5822 void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input_2(Model *model) { 5823 OperandType type0(Type::BOOL, {}); 5824 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 5825 OperandType type4(Type::TENSOR_INT32, {4}); 5826 OperandType type5(Type::INT32, {}); 5827 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 5828 OperandType type94(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 5829 OperandType type95(Type::TENSOR_INT32, {2}, 0.0f, 0); 5830 // Phase 1, operands 5831 auto op1 = model->addOperand(&type34); 5832 auto op2 = model->addOperand(&type94); 5833 auto op3 = model->addOperand(&type95); 5834 auto shape = model->addOperand(&type4); 5835 auto param = model->addOperand(&type5); 5836 auto param1 = model->addOperand(&type5); 5837 auto param2 = model->addOperand(&type5); 5838 auto act = model->addOperand(&type5); 5839 auto layout = model->addOperand(&type0); 5840 auto op4 = model->addOperand(&type90); 5841 // Phase 2, operations 5842 static int32_t shape_init[] = {1, 5, 5, 2}; 5843 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5844 static int32_t param_init[] = {2}; 5845 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5846 static int32_t param1_init[] = {2}; 5847 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5848 static int32_t param2_init[] = {2}; 5849 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5850 static int32_t act_init[] = {0}; 5851 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5852 static bool8 layout_init[] = {false}; 5853 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5854 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5855 // Phase 3, inputs and outputs 5856 model->identifyInputsAndOutputs( 5857 {op1, op2, op3}, 5858 {op4}); 5859 assert(model->isValid()); 5860 } 5861 5862 inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input_2(int i) { 5863 static std::set<int> ignore = {}; 5864 return ignore.find(i) != ignore.end(); 5865 } 5866 5867 void CreateModel_dynamic_output_shape_nhwc_none_float16(Model *model) { 5868 OperandType type0(Type::BOOL, {}); 5869 OperandType type4(Type::TENSOR_INT32, {4}); 5870 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 5871 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 5872 OperandType type46(Type::TENSOR_FLOAT16, {2}); 5873 OperandType type5(Type::INT32, {}); 5874 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 5875 // Phase 1, operands 5876 auto op1 = model->addOperand(&type44); 5877 auto op2 = model->addOperand(&type45); 5878 auto op3 = model->addOperand(&type46); 5879 auto shape = model->addOperand(&type4); 5880 auto param = model->addOperand(&type5); 5881 auto param1 = model->addOperand(&type5); 5882 auto param2 = model->addOperand(&type5); 5883 auto act = model->addOperand(&type5); 5884 auto layout = model->addOperand(&type0); 5885 auto op4 = model->addOperand(&type96); 5886 // Phase 2, operations 5887 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 5888 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 5889 static _Float16 op3_init[] = {-1.5f, -2.0f}; 5890 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 5891 static int32_t shape_init[] = {1, 5, 5, 2}; 5892 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5893 static int32_t param_init[] = {2}; 5894 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5895 static int32_t param1_init[] = {2}; 5896 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5897 static int32_t param2_init[] = {2}; 5898 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5899 static int32_t act_init[] = {0}; 5900 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5901 static bool8 layout_init[] = {false}; 5902 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5903 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5904 // Phase 3, inputs and outputs 5905 model->identifyInputsAndOutputs( 5906 {op1}, 5907 {op4}); 5908 assert(model->isValid()); 5909 } 5910 5911 inline bool is_ignored_dynamic_output_shape_nhwc_none_float16(int i) { 5912 static std::set<int> ignore = {}; 5913 return ignore.find(i) != ignore.end(); 5914 } 5915 5916 void CreateModel_dynamic_output_shape_nhwc_none_float16_weight_as_input(Model *model) { 5917 OperandType type0(Type::BOOL, {}); 5918 OperandType type4(Type::TENSOR_INT32, {4}); 5919 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 5920 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 5921 OperandType type49(Type::TENSOR_FLOAT16, {2}); 5922 OperandType type5(Type::INT32, {}); 5923 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 5924 // Phase 1, operands 5925 auto op1 = model->addOperand(&type44); 5926 auto op2 = model->addOperand(&type48); 5927 auto op3 = model->addOperand(&type49); 5928 auto shape = model->addOperand(&type4); 5929 auto param = model->addOperand(&type5); 5930 auto param1 = model->addOperand(&type5); 5931 auto param2 = model->addOperand(&type5); 5932 auto act = model->addOperand(&type5); 5933 auto layout = model->addOperand(&type0); 5934 auto op4 = model->addOperand(&type96); 5935 // Phase 2, operations 5936 static int32_t shape_init[] = {1, 5, 5, 2}; 5937 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5938 static int32_t param_init[] = {2}; 5939 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5940 static int32_t param1_init[] = {2}; 5941 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5942 static int32_t param2_init[] = {2}; 5943 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5944 static int32_t act_init[] = {0}; 5945 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5946 static bool8 layout_init[] = {false}; 5947 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5948 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5949 // Phase 3, inputs and outputs 5950 model->identifyInputsAndOutputs( 5951 {op1, op2, op3}, 5952 {op4}); 5953 assert(model->isValid()); 5954 } 5955 5956 inline bool is_ignored_dynamic_output_shape_nhwc_none_float16_weight_as_input(int i) { 5957 static std::set<int> ignore = {}; 5958 return ignore.find(i) != ignore.end(); 5959 } 5960 5961 void CreateModel_dynamic_output_shape_nhwc_relu(Model *model) { 5962 OperandType type0(Type::BOOL, {}); 5963 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 5964 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 5965 OperandType type3(Type::TENSOR_FLOAT32, {2}); 5966 OperandType type4(Type::TENSOR_INT32, {4}); 5967 OperandType type5(Type::INT32, {}); 5968 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 5969 // Phase 1, operands 5970 auto op1 = model->addOperand(&type1); 5971 auto op2 = model->addOperand(&type2); 5972 auto op3 = model->addOperand(&type3); 5973 auto shape = model->addOperand(&type4); 5974 auto param = model->addOperand(&type5); 5975 auto param1 = model->addOperand(&type5); 5976 auto param2 = model->addOperand(&type5); 5977 auto act = model->addOperand(&type5); 5978 auto layout = model->addOperand(&type0); 5979 auto op4 = model->addOperand(&type88); 5980 // Phase 2, operations 5981 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 5982 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 5983 static float op3_init[] = {-1.5f, -2.0f}; 5984 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 5985 static int32_t shape_init[] = {1, 5, 5, 2}; 5986 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 5987 static int32_t param_init[] = {2}; 5988 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 5989 static int32_t param1_init[] = {2}; 5990 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 5991 static int32_t param2_init[] = {2}; 5992 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 5993 static int32_t act_init[] = {1}; 5994 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 5995 static bool8 layout_init[] = {false}; 5996 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 5997 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 5998 // Phase 3, inputs and outputs 5999 model->identifyInputsAndOutputs( 6000 {op1}, 6001 {op4}); 6002 assert(model->isValid()); 6003 } 6004 6005 inline bool is_ignored_dynamic_output_shape_nhwc_relu(int i) { 6006 static std::set<int> ignore = {}; 6007 return ignore.find(i) != ignore.end(); 6008 } 6009 6010 void CreateModel_dynamic_output_shape_nhwc_relu_weight_as_input(Model *model) { 6011 OperandType type0(Type::BOOL, {}); 6012 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6013 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6014 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6015 OperandType type4(Type::TENSOR_INT32, {4}); 6016 OperandType type5(Type::INT32, {}); 6017 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6018 // Phase 1, operands 6019 auto op1 = model->addOperand(&type1); 6020 auto op2 = model->addOperand(&type2); 6021 auto op3 = model->addOperand(&type3); 6022 auto shape = model->addOperand(&type4); 6023 auto param = model->addOperand(&type5); 6024 auto param1 = model->addOperand(&type5); 6025 auto param2 = model->addOperand(&type5); 6026 auto act = model->addOperand(&type5); 6027 auto layout = model->addOperand(&type0); 6028 auto op4 = model->addOperand(&type88); 6029 // Phase 2, operations 6030 static int32_t shape_init[] = {1, 5, 5, 2}; 6031 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6032 static int32_t param_init[] = {2}; 6033 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6034 static int32_t param1_init[] = {2}; 6035 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6036 static int32_t param2_init[] = {2}; 6037 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6038 static int32_t act_init[] = {1}; 6039 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6040 static bool8 layout_init[] = {false}; 6041 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6042 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6043 // Phase 3, inputs and outputs 6044 model->identifyInputsAndOutputs( 6045 {op1, op2, op3}, 6046 {op4}); 6047 assert(model->isValid()); 6048 } 6049 6050 inline bool is_ignored_dynamic_output_shape_nhwc_relu_weight_as_input(int i) { 6051 static std::set<int> ignore = {}; 6052 return ignore.find(i) != ignore.end(); 6053 } 6054 6055 void CreateModel_dynamic_output_shape_nhwc_relu_relaxed(Model *model) { 6056 OperandType type0(Type::BOOL, {}); 6057 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6058 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6059 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6060 OperandType type4(Type::TENSOR_INT32, {4}); 6061 OperandType type5(Type::INT32, {}); 6062 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6063 // Phase 1, operands 6064 auto op1 = model->addOperand(&type1); 6065 auto op2 = model->addOperand(&type2); 6066 auto op3 = model->addOperand(&type3); 6067 auto shape = model->addOperand(&type4); 6068 auto param = model->addOperand(&type5); 6069 auto param1 = model->addOperand(&type5); 6070 auto param2 = model->addOperand(&type5); 6071 auto act = model->addOperand(&type5); 6072 auto layout = model->addOperand(&type0); 6073 auto op4 = model->addOperand(&type88); 6074 // Phase 2, operations 6075 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 6076 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 6077 static float op3_init[] = {-1.5f, -2.0f}; 6078 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 6079 static int32_t shape_init[] = {1, 5, 5, 2}; 6080 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6081 static int32_t param_init[] = {2}; 6082 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6083 static int32_t param1_init[] = {2}; 6084 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6085 static int32_t param2_init[] = {2}; 6086 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6087 static int32_t act_init[] = {1}; 6088 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6089 static bool8 layout_init[] = {false}; 6090 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6091 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6092 // Phase 3, inputs and outputs 6093 model->identifyInputsAndOutputs( 6094 {op1}, 6095 {op4}); 6096 // Phase 4: set relaxed execution 6097 model->relaxComputationFloat32toFloat16(true); 6098 assert(model->isValid()); 6099 } 6100 6101 inline bool is_ignored_dynamic_output_shape_nhwc_relu_relaxed(int i) { 6102 static std::set<int> ignore = {}; 6103 return ignore.find(i) != ignore.end(); 6104 } 6105 6106 void CreateModel_dynamic_output_shape_nhwc_relu_relaxed_weight_as_input(Model *model) { 6107 OperandType type0(Type::BOOL, {}); 6108 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6109 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6110 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6111 OperandType type4(Type::TENSOR_INT32, {4}); 6112 OperandType type5(Type::INT32, {}); 6113 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6114 // Phase 1, operands 6115 auto op1 = model->addOperand(&type1); 6116 auto op2 = model->addOperand(&type2); 6117 auto op3 = model->addOperand(&type3); 6118 auto shape = model->addOperand(&type4); 6119 auto param = model->addOperand(&type5); 6120 auto param1 = model->addOperand(&type5); 6121 auto param2 = model->addOperand(&type5); 6122 auto act = model->addOperand(&type5); 6123 auto layout = model->addOperand(&type0); 6124 auto op4 = model->addOperand(&type88); 6125 // Phase 2, operations 6126 static int32_t shape_init[] = {1, 5, 5, 2}; 6127 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6128 static int32_t param_init[] = {2}; 6129 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6130 static int32_t param1_init[] = {2}; 6131 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6132 static int32_t param2_init[] = {2}; 6133 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6134 static int32_t act_init[] = {1}; 6135 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6136 static bool8 layout_init[] = {false}; 6137 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6138 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6139 // Phase 3, inputs and outputs 6140 model->identifyInputsAndOutputs( 6141 {op1, op2, op3}, 6142 {op4}); 6143 // Phase 4: set relaxed execution 6144 model->relaxComputationFloat32toFloat16(true); 6145 assert(model->isValid()); 6146 } 6147 6148 inline bool is_ignored_dynamic_output_shape_nhwc_relu_relaxed_weight_as_input(int i) { 6149 static std::set<int> ignore = {}; 6150 return ignore.find(i) != ignore.end(); 6151 } 6152 6153 void CreateModel_dynamic_output_shape_nhwc_relu_quant8(Model *model) { 6154 OperandType type0(Type::BOOL, {}); 6155 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 6156 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 6157 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6158 OperandType type4(Type::TENSOR_INT32, {4}); 6159 OperandType type5(Type::INT32, {}); 6160 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 6161 // Phase 1, operands 6162 auto op1 = model->addOperand(&type27); 6163 auto op2 = model->addOperand(&type28); 6164 auto op3 = model->addOperand(&type29); 6165 auto shape = model->addOperand(&type4); 6166 auto param = model->addOperand(&type5); 6167 auto param1 = model->addOperand(&type5); 6168 auto param2 = model->addOperand(&type5); 6169 auto act = model->addOperand(&type5); 6170 auto layout = model->addOperand(&type0); 6171 auto op4 = model->addOperand(&type89); 6172 // Phase 2, operations 6173 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 6174 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 6175 static int32_t op3_init[] = {-6, -8}; 6176 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 6177 static int32_t shape_init[] = {1, 5, 5, 2}; 6178 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6179 static int32_t param_init[] = {2}; 6180 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6181 static int32_t param1_init[] = {2}; 6182 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6183 static int32_t param2_init[] = {2}; 6184 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6185 static int32_t act_init[] = {1}; 6186 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6187 static bool8 layout_init[] = {false}; 6188 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6189 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6190 // Phase 3, inputs and outputs 6191 model->identifyInputsAndOutputs( 6192 {op1}, 6193 {op4}); 6194 assert(model->isValid()); 6195 } 6196 6197 inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8(int i) { 6198 static std::set<int> ignore = {}; 6199 return ignore.find(i) != ignore.end(); 6200 } 6201 6202 void CreateModel_dynamic_output_shape_nhwc_relu_quant8_weight_as_input(Model *model) { 6203 OperandType type0(Type::BOOL, {}); 6204 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 6205 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 6206 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6207 OperandType type4(Type::TENSOR_INT32, {4}); 6208 OperandType type5(Type::INT32, {}); 6209 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 6210 // Phase 1, operands 6211 auto op1 = model->addOperand(&type27); 6212 auto op2 = model->addOperand(&type28); 6213 auto op3 = model->addOperand(&type29); 6214 auto shape = model->addOperand(&type4); 6215 auto param = model->addOperand(&type5); 6216 auto param1 = model->addOperand(&type5); 6217 auto param2 = model->addOperand(&type5); 6218 auto act = model->addOperand(&type5); 6219 auto layout = model->addOperand(&type0); 6220 auto op4 = model->addOperand(&type89); 6221 // Phase 2, operations 6222 static int32_t shape_init[] = {1, 5, 5, 2}; 6223 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6224 static int32_t param_init[] = {2}; 6225 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6226 static int32_t param1_init[] = {2}; 6227 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6228 static int32_t param2_init[] = {2}; 6229 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6230 static int32_t act_init[] = {1}; 6231 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6232 static bool8 layout_init[] = {false}; 6233 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6234 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6235 // Phase 3, inputs and outputs 6236 model->identifyInputsAndOutputs( 6237 {op1, op2, op3}, 6238 {op4}); 6239 assert(model->isValid()); 6240 } 6241 6242 inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8_weight_as_input(int i) { 6243 static std::set<int> ignore = {}; 6244 return ignore.find(i) != ignore.end(); 6245 } 6246 6247 void CreateModel_dynamic_output_shape_nhwc_relu_quant8_2(Model *model) { 6248 OperandType type0(Type::BOOL, {}); 6249 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6250 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 6251 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 6252 OperandType type4(Type::TENSOR_INT32, {4}); 6253 OperandType type5(Type::INT32, {}); 6254 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 6255 // Phase 1, operands 6256 auto op1 = model->addOperand(&type31); 6257 auto op2 = model->addOperand(&type32); 6258 auto op3 = model->addOperand(&type29); 6259 auto shape = model->addOperand(&type4); 6260 auto param = model->addOperand(&type5); 6261 auto param1 = model->addOperand(&type5); 6262 auto param2 = model->addOperand(&type5); 6263 auto act = model->addOperand(&type5); 6264 auto layout = model->addOperand(&type0); 6265 auto op4 = model->addOperand(&type90); 6266 // Phase 2, operations 6267 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 6268 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 6269 static int32_t op3_init[] = {-6, -8}; 6270 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 6271 static int32_t shape_init[] = {1, 5, 5, 2}; 6272 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6273 static int32_t param_init[] = {2}; 6274 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6275 static int32_t param1_init[] = {2}; 6276 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6277 static int32_t param2_init[] = {2}; 6278 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6279 static int32_t act_init[] = {1}; 6280 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6281 static bool8 layout_init[] = {false}; 6282 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6283 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6284 // Phase 3, inputs and outputs 6285 model->identifyInputsAndOutputs( 6286 {op1}, 6287 {op4}); 6288 assert(model->isValid()); 6289 } 6290 6291 inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8_2(int i) { 6292 static std::set<int> ignore = {}; 6293 return ignore.find(i) != ignore.end(); 6294 } 6295 6296 void CreateModel_dynamic_output_shape_nhwc_relu_quant8_weight_as_input_2(Model *model) { 6297 OperandType type0(Type::BOOL, {}); 6298 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6299 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 6300 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 6301 OperandType type4(Type::TENSOR_INT32, {4}); 6302 OperandType type5(Type::INT32, {}); 6303 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 6304 // Phase 1, operands 6305 auto op1 = model->addOperand(&type31); 6306 auto op2 = model->addOperand(&type32); 6307 auto op3 = model->addOperand(&type29); 6308 auto shape = model->addOperand(&type4); 6309 auto param = model->addOperand(&type5); 6310 auto param1 = model->addOperand(&type5); 6311 auto param2 = model->addOperand(&type5); 6312 auto act = model->addOperand(&type5); 6313 auto layout = model->addOperand(&type0); 6314 auto op4 = model->addOperand(&type90); 6315 // Phase 2, operations 6316 static int32_t shape_init[] = {1, 5, 5, 2}; 6317 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6318 static int32_t param_init[] = {2}; 6319 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6320 static int32_t param1_init[] = {2}; 6321 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6322 static int32_t param2_init[] = {2}; 6323 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6324 static int32_t act_init[] = {1}; 6325 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6326 static bool8 layout_init[] = {false}; 6327 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6328 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6329 // Phase 3, inputs and outputs 6330 model->identifyInputsAndOutputs( 6331 {op1, op2, op3}, 6332 {op4}); 6333 assert(model->isValid()); 6334 } 6335 6336 inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8_weight_as_input_2(int i) { 6337 static std::set<int> ignore = {}; 6338 return ignore.find(i) != ignore.end(); 6339 } 6340 6341 void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8(Model *model) { 6342 OperandType type0(Type::BOOL, {}); 6343 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 6344 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 6345 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 6346 OperandType type4(Type::TENSOR_INT32, {4}); 6347 OperandType type5(Type::INT32, {}); 6348 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 6349 // Phase 1, operands 6350 auto op1 = model->addOperand(&type34); 6351 auto op2 = model->addOperand(&type35); 6352 auto op3 = model->addOperand(&type36); 6353 auto shape = model->addOperand(&type4); 6354 auto param = model->addOperand(&type5); 6355 auto param1 = model->addOperand(&type5); 6356 auto param2 = model->addOperand(&type5); 6357 auto act = model->addOperand(&type5); 6358 auto layout = model->addOperand(&type0); 6359 auto op4 = model->addOperand(&type91); 6360 // Phase 2, operations 6361 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 6362 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 6363 static int32_t op3_init[] = {-24, -16}; 6364 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 6365 static int32_t shape_init[] = {1, 5, 5, 2}; 6366 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6367 static int32_t param_init[] = {2}; 6368 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6369 static int32_t param1_init[] = {2}; 6370 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6371 static int32_t param2_init[] = {2}; 6372 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6373 static int32_t act_init[] = {1}; 6374 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6375 static bool8 layout_init[] = {false}; 6376 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6377 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6378 // Phase 3, inputs and outputs 6379 model->identifyInputsAndOutputs( 6380 {op1}, 6381 {op4}); 6382 assert(model->isValid()); 6383 } 6384 6385 inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8(int i) { 6386 static std::set<int> ignore = {}; 6387 return ignore.find(i) != ignore.end(); 6388 } 6389 6390 void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input(Model *model) { 6391 OperandType type0(Type::BOOL, {}); 6392 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 6393 OperandType type4(Type::TENSOR_INT32, {4}); 6394 OperandType type5(Type::INT32, {}); 6395 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 6396 OperandType type97(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 6397 OperandType type98(Type::TENSOR_INT32, {2}, 0.0f, 0); 6398 // Phase 1, operands 6399 auto op1 = model->addOperand(&type34); 6400 auto op2 = model->addOperand(&type97); 6401 auto op3 = model->addOperand(&type98); 6402 auto shape = model->addOperand(&type4); 6403 auto param = model->addOperand(&type5); 6404 auto param1 = model->addOperand(&type5); 6405 auto param2 = model->addOperand(&type5); 6406 auto act = model->addOperand(&type5); 6407 auto layout = model->addOperand(&type0); 6408 auto op4 = model->addOperand(&type91); 6409 // Phase 2, operations 6410 static int32_t shape_init[] = {1, 5, 5, 2}; 6411 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6412 static int32_t param_init[] = {2}; 6413 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6414 static int32_t param1_init[] = {2}; 6415 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6416 static int32_t param2_init[] = {2}; 6417 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6418 static int32_t act_init[] = {1}; 6419 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6420 static bool8 layout_init[] = {false}; 6421 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6422 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6423 // Phase 3, inputs and outputs 6424 model->identifyInputsAndOutputs( 6425 {op1, op2, op3}, 6426 {op4}); 6427 assert(model->isValid()); 6428 } 6429 6430 inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input(int i) { 6431 static std::set<int> ignore = {}; 6432 return ignore.find(i) != ignore.end(); 6433 } 6434 6435 void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8_2(Model *model) { 6436 OperandType type0(Type::BOOL, {}); 6437 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 6438 OperandType type4(Type::TENSOR_INT32, {4}); 6439 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 6440 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 6441 OperandType type5(Type::INT32, {}); 6442 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 6443 // Phase 1, operands 6444 auto op1 = model->addOperand(&type34); 6445 auto op2 = model->addOperand(&type40); 6446 auto op3 = model->addOperand(&type41); 6447 auto shape = model->addOperand(&type4); 6448 auto param = model->addOperand(&type5); 6449 auto param1 = model->addOperand(&type5); 6450 auto param2 = model->addOperand(&type5); 6451 auto act = model->addOperand(&type5); 6452 auto layout = model->addOperand(&type0); 6453 auto op4 = model->addOperand(&type90); 6454 // Phase 2, operations 6455 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 6456 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 6457 static int32_t op3_init[] = {-24, -16}; 6458 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 6459 static int32_t shape_init[] = {1, 5, 5, 2}; 6460 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6461 static int32_t param_init[] = {2}; 6462 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6463 static int32_t param1_init[] = {2}; 6464 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6465 static int32_t param2_init[] = {2}; 6466 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6467 static int32_t act_init[] = {1}; 6468 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6469 static bool8 layout_init[] = {false}; 6470 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6471 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6472 // Phase 3, inputs and outputs 6473 model->identifyInputsAndOutputs( 6474 {op1}, 6475 {op4}); 6476 assert(model->isValid()); 6477 } 6478 6479 inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8_2(int i) { 6480 static std::set<int> ignore = {}; 6481 return ignore.find(i) != ignore.end(); 6482 } 6483 6484 void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input_2(Model *model) { 6485 OperandType type0(Type::BOOL, {}); 6486 OperandType type100(Type::TENSOR_INT32, {2}, 0.0f, 0); 6487 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 6488 OperandType type4(Type::TENSOR_INT32, {4}); 6489 OperandType type5(Type::INT32, {}); 6490 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 6491 OperandType type99(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 6492 // Phase 1, operands 6493 auto op1 = model->addOperand(&type34); 6494 auto op2 = model->addOperand(&type99); 6495 auto op3 = model->addOperand(&type100); 6496 auto shape = model->addOperand(&type4); 6497 auto param = model->addOperand(&type5); 6498 auto param1 = model->addOperand(&type5); 6499 auto param2 = model->addOperand(&type5); 6500 auto act = model->addOperand(&type5); 6501 auto layout = model->addOperand(&type0); 6502 auto op4 = model->addOperand(&type90); 6503 // Phase 2, operations 6504 static int32_t shape_init[] = {1, 5, 5, 2}; 6505 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6506 static int32_t param_init[] = {2}; 6507 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6508 static int32_t param1_init[] = {2}; 6509 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6510 static int32_t param2_init[] = {2}; 6511 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6512 static int32_t act_init[] = {1}; 6513 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6514 static bool8 layout_init[] = {false}; 6515 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6516 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6517 // Phase 3, inputs and outputs 6518 model->identifyInputsAndOutputs( 6519 {op1, op2, op3}, 6520 {op4}); 6521 assert(model->isValid()); 6522 } 6523 6524 inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input_2(int i) { 6525 static std::set<int> ignore = {}; 6526 return ignore.find(i) != ignore.end(); 6527 } 6528 6529 void CreateModel_dynamic_output_shape_nhwc_relu_float16(Model *model) { 6530 OperandType type0(Type::BOOL, {}); 6531 OperandType type4(Type::TENSOR_INT32, {4}); 6532 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 6533 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 6534 OperandType type46(Type::TENSOR_FLOAT16, {2}); 6535 OperandType type5(Type::INT32, {}); 6536 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 6537 // Phase 1, operands 6538 auto op1 = model->addOperand(&type44); 6539 auto op2 = model->addOperand(&type45); 6540 auto op3 = model->addOperand(&type46); 6541 auto shape = model->addOperand(&type4); 6542 auto param = model->addOperand(&type5); 6543 auto param1 = model->addOperand(&type5); 6544 auto param2 = model->addOperand(&type5); 6545 auto act = model->addOperand(&type5); 6546 auto layout = model->addOperand(&type0); 6547 auto op4 = model->addOperand(&type96); 6548 // Phase 2, operations 6549 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 6550 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 6551 static _Float16 op3_init[] = {-1.5f, -2.0f}; 6552 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 6553 static int32_t shape_init[] = {1, 5, 5, 2}; 6554 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6555 static int32_t param_init[] = {2}; 6556 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6557 static int32_t param1_init[] = {2}; 6558 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6559 static int32_t param2_init[] = {2}; 6560 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6561 static int32_t act_init[] = {1}; 6562 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6563 static bool8 layout_init[] = {false}; 6564 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6565 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6566 // Phase 3, inputs and outputs 6567 model->identifyInputsAndOutputs( 6568 {op1}, 6569 {op4}); 6570 assert(model->isValid()); 6571 } 6572 6573 inline bool is_ignored_dynamic_output_shape_nhwc_relu_float16(int i) { 6574 static std::set<int> ignore = {}; 6575 return ignore.find(i) != ignore.end(); 6576 } 6577 6578 void CreateModel_dynamic_output_shape_nhwc_relu_float16_weight_as_input(Model *model) { 6579 OperandType type0(Type::BOOL, {}); 6580 OperandType type4(Type::TENSOR_INT32, {4}); 6581 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 6582 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 6583 OperandType type49(Type::TENSOR_FLOAT16, {2}); 6584 OperandType type5(Type::INT32, {}); 6585 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 6586 // Phase 1, operands 6587 auto op1 = model->addOperand(&type44); 6588 auto op2 = model->addOperand(&type48); 6589 auto op3 = model->addOperand(&type49); 6590 auto shape = model->addOperand(&type4); 6591 auto param = model->addOperand(&type5); 6592 auto param1 = model->addOperand(&type5); 6593 auto param2 = model->addOperand(&type5); 6594 auto act = model->addOperand(&type5); 6595 auto layout = model->addOperand(&type0); 6596 auto op4 = model->addOperand(&type96); 6597 // Phase 2, operations 6598 static int32_t shape_init[] = {1, 5, 5, 2}; 6599 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6600 static int32_t param_init[] = {2}; 6601 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6602 static int32_t param1_init[] = {2}; 6603 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6604 static int32_t param2_init[] = {2}; 6605 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6606 static int32_t act_init[] = {1}; 6607 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6608 static bool8 layout_init[] = {false}; 6609 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6610 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6611 // Phase 3, inputs and outputs 6612 model->identifyInputsAndOutputs( 6613 {op1, op2, op3}, 6614 {op4}); 6615 assert(model->isValid()); 6616 } 6617 6618 inline bool is_ignored_dynamic_output_shape_nhwc_relu_float16_weight_as_input(int i) { 6619 static std::set<int> ignore = {}; 6620 return ignore.find(i) != ignore.end(); 6621 } 6622 6623 void CreateModel_dynamic_output_shape_nhwc_relu1(Model *model) { 6624 OperandType type0(Type::BOOL, {}); 6625 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6626 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6627 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6628 OperandType type4(Type::TENSOR_INT32, {4}); 6629 OperandType type5(Type::INT32, {}); 6630 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6631 // Phase 1, operands 6632 auto op1 = model->addOperand(&type1); 6633 auto op2 = model->addOperand(&type2); 6634 auto op3 = model->addOperand(&type3); 6635 auto shape = model->addOperand(&type4); 6636 auto param = model->addOperand(&type5); 6637 auto param1 = model->addOperand(&type5); 6638 auto param2 = model->addOperand(&type5); 6639 auto act = model->addOperand(&type5); 6640 auto layout = model->addOperand(&type0); 6641 auto op4 = model->addOperand(&type88); 6642 // Phase 2, operations 6643 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 6644 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 6645 static float op3_init[] = {-1.5f, -2.0f}; 6646 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 6647 static int32_t shape_init[] = {1, 5, 5, 2}; 6648 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6649 static int32_t param_init[] = {2}; 6650 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6651 static int32_t param1_init[] = {2}; 6652 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6653 static int32_t param2_init[] = {2}; 6654 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6655 static int32_t act_init[] = {2}; 6656 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6657 static bool8 layout_init[] = {false}; 6658 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6659 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6660 // Phase 3, inputs and outputs 6661 model->identifyInputsAndOutputs( 6662 {op1}, 6663 {op4}); 6664 assert(model->isValid()); 6665 } 6666 6667 inline bool is_ignored_dynamic_output_shape_nhwc_relu1(int i) { 6668 static std::set<int> ignore = {}; 6669 return ignore.find(i) != ignore.end(); 6670 } 6671 6672 void CreateModel_dynamic_output_shape_nhwc_relu1_weight_as_input(Model *model) { 6673 OperandType type0(Type::BOOL, {}); 6674 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6675 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6676 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6677 OperandType type4(Type::TENSOR_INT32, {4}); 6678 OperandType type5(Type::INT32, {}); 6679 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6680 // Phase 1, operands 6681 auto op1 = model->addOperand(&type1); 6682 auto op2 = model->addOperand(&type2); 6683 auto op3 = model->addOperand(&type3); 6684 auto shape = model->addOperand(&type4); 6685 auto param = model->addOperand(&type5); 6686 auto param1 = model->addOperand(&type5); 6687 auto param2 = model->addOperand(&type5); 6688 auto act = model->addOperand(&type5); 6689 auto layout = model->addOperand(&type0); 6690 auto op4 = model->addOperand(&type88); 6691 // Phase 2, operations 6692 static int32_t shape_init[] = {1, 5, 5, 2}; 6693 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6694 static int32_t param_init[] = {2}; 6695 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6696 static int32_t param1_init[] = {2}; 6697 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6698 static int32_t param2_init[] = {2}; 6699 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6700 static int32_t act_init[] = {2}; 6701 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6702 static bool8 layout_init[] = {false}; 6703 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6704 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6705 // Phase 3, inputs and outputs 6706 model->identifyInputsAndOutputs( 6707 {op1, op2, op3}, 6708 {op4}); 6709 assert(model->isValid()); 6710 } 6711 6712 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_weight_as_input(int i) { 6713 static std::set<int> ignore = {}; 6714 return ignore.find(i) != ignore.end(); 6715 } 6716 6717 void CreateModel_dynamic_output_shape_nhwc_relu1_relaxed(Model *model) { 6718 OperandType type0(Type::BOOL, {}); 6719 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6720 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6721 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6722 OperandType type4(Type::TENSOR_INT32, {4}); 6723 OperandType type5(Type::INT32, {}); 6724 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6725 // Phase 1, operands 6726 auto op1 = model->addOperand(&type1); 6727 auto op2 = model->addOperand(&type2); 6728 auto op3 = model->addOperand(&type3); 6729 auto shape = model->addOperand(&type4); 6730 auto param = model->addOperand(&type5); 6731 auto param1 = model->addOperand(&type5); 6732 auto param2 = model->addOperand(&type5); 6733 auto act = model->addOperand(&type5); 6734 auto layout = model->addOperand(&type0); 6735 auto op4 = model->addOperand(&type88); 6736 // Phase 2, operations 6737 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 6738 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 6739 static float op3_init[] = {-1.5f, -2.0f}; 6740 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 6741 static int32_t shape_init[] = {1, 5, 5, 2}; 6742 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6743 static int32_t param_init[] = {2}; 6744 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6745 static int32_t param1_init[] = {2}; 6746 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6747 static int32_t param2_init[] = {2}; 6748 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6749 static int32_t act_init[] = {2}; 6750 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6751 static bool8 layout_init[] = {false}; 6752 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6753 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6754 // Phase 3, inputs and outputs 6755 model->identifyInputsAndOutputs( 6756 {op1}, 6757 {op4}); 6758 // Phase 4: set relaxed execution 6759 model->relaxComputationFloat32toFloat16(true); 6760 assert(model->isValid()); 6761 } 6762 6763 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_relaxed(int i) { 6764 static std::set<int> ignore = {}; 6765 return ignore.find(i) != ignore.end(); 6766 } 6767 6768 void CreateModel_dynamic_output_shape_nhwc_relu1_relaxed_weight_as_input(Model *model) { 6769 OperandType type0(Type::BOOL, {}); 6770 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 6771 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 6772 OperandType type3(Type::TENSOR_FLOAT32, {2}); 6773 OperandType type4(Type::TENSOR_INT32, {4}); 6774 OperandType type5(Type::INT32, {}); 6775 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 6776 // Phase 1, operands 6777 auto op1 = model->addOperand(&type1); 6778 auto op2 = model->addOperand(&type2); 6779 auto op3 = model->addOperand(&type3); 6780 auto shape = model->addOperand(&type4); 6781 auto param = model->addOperand(&type5); 6782 auto param1 = model->addOperand(&type5); 6783 auto param2 = model->addOperand(&type5); 6784 auto act = model->addOperand(&type5); 6785 auto layout = model->addOperand(&type0); 6786 auto op4 = model->addOperand(&type88); 6787 // Phase 2, operations 6788 static int32_t shape_init[] = {1, 5, 5, 2}; 6789 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6790 static int32_t param_init[] = {2}; 6791 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6792 static int32_t param1_init[] = {2}; 6793 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6794 static int32_t param2_init[] = {2}; 6795 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6796 static int32_t act_init[] = {2}; 6797 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6798 static bool8 layout_init[] = {false}; 6799 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6800 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6801 // Phase 3, inputs and outputs 6802 model->identifyInputsAndOutputs( 6803 {op1, op2, op3}, 6804 {op4}); 6805 // Phase 4: set relaxed execution 6806 model->relaxComputationFloat32toFloat16(true); 6807 assert(model->isValid()); 6808 } 6809 6810 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_relaxed_weight_as_input(int i) { 6811 static std::set<int> ignore = {}; 6812 return ignore.find(i) != ignore.end(); 6813 } 6814 6815 void CreateModel_dynamic_output_shape_nhwc_relu1_quant8(Model *model) { 6816 OperandType type0(Type::BOOL, {}); 6817 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 6818 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 6819 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6820 OperandType type4(Type::TENSOR_INT32, {4}); 6821 OperandType type5(Type::INT32, {}); 6822 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 6823 // Phase 1, operands 6824 auto op1 = model->addOperand(&type27); 6825 auto op2 = model->addOperand(&type28); 6826 auto op3 = model->addOperand(&type29); 6827 auto shape = model->addOperand(&type4); 6828 auto param = model->addOperand(&type5); 6829 auto param1 = model->addOperand(&type5); 6830 auto param2 = model->addOperand(&type5); 6831 auto act = model->addOperand(&type5); 6832 auto layout = model->addOperand(&type0); 6833 auto op4 = model->addOperand(&type89); 6834 // Phase 2, operations 6835 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 6836 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 6837 static int32_t op3_init[] = {-6, -8}; 6838 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 6839 static int32_t shape_init[] = {1, 5, 5, 2}; 6840 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6841 static int32_t param_init[] = {2}; 6842 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6843 static int32_t param1_init[] = {2}; 6844 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6845 static int32_t param2_init[] = {2}; 6846 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6847 static int32_t act_init[] = {2}; 6848 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6849 static bool8 layout_init[] = {false}; 6850 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6851 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6852 // Phase 3, inputs and outputs 6853 model->identifyInputsAndOutputs( 6854 {op1}, 6855 {op4}); 6856 assert(model->isValid()); 6857 } 6858 6859 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8(int i) { 6860 static std::set<int> ignore = {}; 6861 return ignore.find(i) != ignore.end(); 6862 } 6863 6864 void CreateModel_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input(Model *model) { 6865 OperandType type0(Type::BOOL, {}); 6866 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 6867 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 6868 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6869 OperandType type4(Type::TENSOR_INT32, {4}); 6870 OperandType type5(Type::INT32, {}); 6871 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 6872 // Phase 1, operands 6873 auto op1 = model->addOperand(&type27); 6874 auto op2 = model->addOperand(&type28); 6875 auto op3 = model->addOperand(&type29); 6876 auto shape = model->addOperand(&type4); 6877 auto param = model->addOperand(&type5); 6878 auto param1 = model->addOperand(&type5); 6879 auto param2 = model->addOperand(&type5); 6880 auto act = model->addOperand(&type5); 6881 auto layout = model->addOperand(&type0); 6882 auto op4 = model->addOperand(&type89); 6883 // Phase 2, operations 6884 static int32_t shape_init[] = {1, 5, 5, 2}; 6885 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6886 static int32_t param_init[] = {2}; 6887 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6888 static int32_t param1_init[] = {2}; 6889 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6890 static int32_t param2_init[] = {2}; 6891 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6892 static int32_t act_init[] = {2}; 6893 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6894 static bool8 layout_init[] = {false}; 6895 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6896 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6897 // Phase 3, inputs and outputs 6898 model->identifyInputsAndOutputs( 6899 {op1, op2, op3}, 6900 {op4}); 6901 assert(model->isValid()); 6902 } 6903 6904 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input(int i) { 6905 static std::set<int> ignore = {}; 6906 return ignore.find(i) != ignore.end(); 6907 } 6908 6909 void CreateModel_dynamic_output_shape_nhwc_relu1_quant8_2(Model *model) { 6910 OperandType type0(Type::BOOL, {}); 6911 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6912 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 6913 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 6914 OperandType type4(Type::TENSOR_INT32, {4}); 6915 OperandType type5(Type::INT32, {}); 6916 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 6917 // Phase 1, operands 6918 auto op1 = model->addOperand(&type31); 6919 auto op2 = model->addOperand(&type32); 6920 auto op3 = model->addOperand(&type29); 6921 auto shape = model->addOperand(&type4); 6922 auto param = model->addOperand(&type5); 6923 auto param1 = model->addOperand(&type5); 6924 auto param2 = model->addOperand(&type5); 6925 auto act = model->addOperand(&type5); 6926 auto layout = model->addOperand(&type0); 6927 auto op4 = model->addOperand(&type90); 6928 // Phase 2, operations 6929 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 6930 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 6931 static int32_t op3_init[] = {-6, -8}; 6932 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 6933 static int32_t shape_init[] = {1, 5, 5, 2}; 6934 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6935 static int32_t param_init[] = {2}; 6936 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6937 static int32_t param1_init[] = {2}; 6938 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6939 static int32_t param2_init[] = {2}; 6940 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6941 static int32_t act_init[] = {2}; 6942 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6943 static bool8 layout_init[] = {false}; 6944 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6945 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6946 // Phase 3, inputs and outputs 6947 model->identifyInputsAndOutputs( 6948 {op1}, 6949 {op4}); 6950 assert(model->isValid()); 6951 } 6952 6953 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8_2(int i) { 6954 static std::set<int> ignore = {}; 6955 return ignore.find(i) != ignore.end(); 6956 } 6957 6958 void CreateModel_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input_2(Model *model) { 6959 OperandType type0(Type::BOOL, {}); 6960 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 6961 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 6962 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 6963 OperandType type4(Type::TENSOR_INT32, {4}); 6964 OperandType type5(Type::INT32, {}); 6965 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 6966 // Phase 1, operands 6967 auto op1 = model->addOperand(&type31); 6968 auto op2 = model->addOperand(&type32); 6969 auto op3 = model->addOperand(&type29); 6970 auto shape = model->addOperand(&type4); 6971 auto param = model->addOperand(&type5); 6972 auto param1 = model->addOperand(&type5); 6973 auto param2 = model->addOperand(&type5); 6974 auto act = model->addOperand(&type5); 6975 auto layout = model->addOperand(&type0); 6976 auto op4 = model->addOperand(&type90); 6977 // Phase 2, operations 6978 static int32_t shape_init[] = {1, 5, 5, 2}; 6979 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 6980 static int32_t param_init[] = {2}; 6981 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 6982 static int32_t param1_init[] = {2}; 6983 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 6984 static int32_t param2_init[] = {2}; 6985 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 6986 static int32_t act_init[] = {2}; 6987 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 6988 static bool8 layout_init[] = {false}; 6989 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 6990 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 6991 // Phase 3, inputs and outputs 6992 model->identifyInputsAndOutputs( 6993 {op1, op2, op3}, 6994 {op4}); 6995 assert(model->isValid()); 6996 } 6997 6998 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input_2(int i) { 6999 static std::set<int> ignore = {}; 7000 return ignore.find(i) != ignore.end(); 7001 } 7002 7003 void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8(Model *model) { 7004 OperandType type0(Type::BOOL, {}); 7005 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7006 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7007 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 7008 OperandType type4(Type::TENSOR_INT32, {4}); 7009 OperandType type5(Type::INT32, {}); 7010 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 7011 // Phase 1, operands 7012 auto op1 = model->addOperand(&type34); 7013 auto op2 = model->addOperand(&type35); 7014 auto op3 = model->addOperand(&type36); 7015 auto shape = model->addOperand(&type4); 7016 auto param = model->addOperand(&type5); 7017 auto param1 = model->addOperand(&type5); 7018 auto param2 = model->addOperand(&type5); 7019 auto act = model->addOperand(&type5); 7020 auto layout = model->addOperand(&type0); 7021 auto op4 = model->addOperand(&type91); 7022 // Phase 2, operations 7023 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 7024 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 7025 static int32_t op3_init[] = {-24, -16}; 7026 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 7027 static int32_t shape_init[] = {1, 5, 5, 2}; 7028 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7029 static int32_t param_init[] = {2}; 7030 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7031 static int32_t param1_init[] = {2}; 7032 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7033 static int32_t param2_init[] = {2}; 7034 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7035 static int32_t act_init[] = {2}; 7036 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7037 static bool8 layout_init[] = {false}; 7038 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7039 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7040 // Phase 3, inputs and outputs 7041 model->identifyInputsAndOutputs( 7042 {op1}, 7043 {op4}); 7044 assert(model->isValid()); 7045 } 7046 7047 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8(int i) { 7048 static std::set<int> ignore = {}; 7049 return ignore.find(i) != ignore.end(); 7050 } 7051 7052 void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input(Model *model) { 7053 OperandType type0(Type::BOOL, {}); 7054 OperandType type101(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7055 OperandType type102(Type::TENSOR_INT32, {2}, 0.0f, 0); 7056 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7057 OperandType type4(Type::TENSOR_INT32, {4}); 7058 OperandType type5(Type::INT32, {}); 7059 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 7060 // Phase 1, operands 7061 auto op1 = model->addOperand(&type34); 7062 auto op2 = model->addOperand(&type101); 7063 auto op3 = model->addOperand(&type102); 7064 auto shape = model->addOperand(&type4); 7065 auto param = model->addOperand(&type5); 7066 auto param1 = model->addOperand(&type5); 7067 auto param2 = model->addOperand(&type5); 7068 auto act = model->addOperand(&type5); 7069 auto layout = model->addOperand(&type0); 7070 auto op4 = model->addOperand(&type91); 7071 // Phase 2, operations 7072 static int32_t shape_init[] = {1, 5, 5, 2}; 7073 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7074 static int32_t param_init[] = {2}; 7075 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7076 static int32_t param1_init[] = {2}; 7077 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7078 static int32_t param2_init[] = {2}; 7079 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7080 static int32_t act_init[] = {2}; 7081 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7082 static bool8 layout_init[] = {false}; 7083 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7084 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7085 // Phase 3, inputs and outputs 7086 model->identifyInputsAndOutputs( 7087 {op1, op2, op3}, 7088 {op4}); 7089 assert(model->isValid()); 7090 } 7091 7092 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input(int i) { 7093 static std::set<int> ignore = {}; 7094 return ignore.find(i) != ignore.end(); 7095 } 7096 7097 void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8_2(Model *model) { 7098 OperandType type0(Type::BOOL, {}); 7099 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7100 OperandType type4(Type::TENSOR_INT32, {4}); 7101 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7102 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 7103 OperandType type5(Type::INT32, {}); 7104 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 7105 // Phase 1, operands 7106 auto op1 = model->addOperand(&type34); 7107 auto op2 = model->addOperand(&type40); 7108 auto op3 = model->addOperand(&type41); 7109 auto shape = model->addOperand(&type4); 7110 auto param = model->addOperand(&type5); 7111 auto param1 = model->addOperand(&type5); 7112 auto param2 = model->addOperand(&type5); 7113 auto act = model->addOperand(&type5); 7114 auto layout = model->addOperand(&type0); 7115 auto op4 = model->addOperand(&type90); 7116 // Phase 2, operations 7117 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 7118 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 7119 static int32_t op3_init[] = {-24, -16}; 7120 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 7121 static int32_t shape_init[] = {1, 5, 5, 2}; 7122 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7123 static int32_t param_init[] = {2}; 7124 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7125 static int32_t param1_init[] = {2}; 7126 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7127 static int32_t param2_init[] = {2}; 7128 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7129 static int32_t act_init[] = {2}; 7130 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7131 static bool8 layout_init[] = {false}; 7132 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7133 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7134 // Phase 3, inputs and outputs 7135 model->identifyInputsAndOutputs( 7136 {op1}, 7137 {op4}); 7138 assert(model->isValid()); 7139 } 7140 7141 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8_2(int i) { 7142 static std::set<int> ignore = {}; 7143 return ignore.find(i) != ignore.end(); 7144 } 7145 7146 void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input_2(Model *model) { 7147 OperandType type0(Type::BOOL, {}); 7148 OperandType type103(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7149 OperandType type104(Type::TENSOR_INT32, {2}, 0.0f, 0); 7150 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7151 OperandType type4(Type::TENSOR_INT32, {4}); 7152 OperandType type5(Type::INT32, {}); 7153 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 7154 // Phase 1, operands 7155 auto op1 = model->addOperand(&type34); 7156 auto op2 = model->addOperand(&type103); 7157 auto op3 = model->addOperand(&type104); 7158 auto shape = model->addOperand(&type4); 7159 auto param = model->addOperand(&type5); 7160 auto param1 = model->addOperand(&type5); 7161 auto param2 = model->addOperand(&type5); 7162 auto act = model->addOperand(&type5); 7163 auto layout = model->addOperand(&type0); 7164 auto op4 = model->addOperand(&type90); 7165 // Phase 2, operations 7166 static int32_t shape_init[] = {1, 5, 5, 2}; 7167 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7168 static int32_t param_init[] = {2}; 7169 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7170 static int32_t param1_init[] = {2}; 7171 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7172 static int32_t param2_init[] = {2}; 7173 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7174 static int32_t act_init[] = {2}; 7175 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7176 static bool8 layout_init[] = {false}; 7177 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7178 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7179 // Phase 3, inputs and outputs 7180 model->identifyInputsAndOutputs( 7181 {op1, op2, op3}, 7182 {op4}); 7183 assert(model->isValid()); 7184 } 7185 7186 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input_2(int i) { 7187 static std::set<int> ignore = {}; 7188 return ignore.find(i) != ignore.end(); 7189 } 7190 7191 void CreateModel_dynamic_output_shape_nhwc_relu1_float16(Model *model) { 7192 OperandType type0(Type::BOOL, {}); 7193 OperandType type4(Type::TENSOR_INT32, {4}); 7194 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 7195 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 7196 OperandType type46(Type::TENSOR_FLOAT16, {2}); 7197 OperandType type5(Type::INT32, {}); 7198 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 7199 // Phase 1, operands 7200 auto op1 = model->addOperand(&type44); 7201 auto op2 = model->addOperand(&type45); 7202 auto op3 = model->addOperand(&type46); 7203 auto shape = model->addOperand(&type4); 7204 auto param = model->addOperand(&type5); 7205 auto param1 = model->addOperand(&type5); 7206 auto param2 = model->addOperand(&type5); 7207 auto act = model->addOperand(&type5); 7208 auto layout = model->addOperand(&type0); 7209 auto op4 = model->addOperand(&type96); 7210 // Phase 2, operations 7211 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 7212 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 7213 static _Float16 op3_init[] = {-1.5f, -2.0f}; 7214 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 7215 static int32_t shape_init[] = {1, 5, 5, 2}; 7216 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7217 static int32_t param_init[] = {2}; 7218 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7219 static int32_t param1_init[] = {2}; 7220 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7221 static int32_t param2_init[] = {2}; 7222 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7223 static int32_t act_init[] = {2}; 7224 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7225 static bool8 layout_init[] = {false}; 7226 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7227 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7228 // Phase 3, inputs and outputs 7229 model->identifyInputsAndOutputs( 7230 {op1}, 7231 {op4}); 7232 assert(model->isValid()); 7233 } 7234 7235 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_float16(int i) { 7236 static std::set<int> ignore = {}; 7237 return ignore.find(i) != ignore.end(); 7238 } 7239 7240 void CreateModel_dynamic_output_shape_nhwc_relu1_float16_weight_as_input(Model *model) { 7241 OperandType type0(Type::BOOL, {}); 7242 OperandType type4(Type::TENSOR_INT32, {4}); 7243 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 7244 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 7245 OperandType type49(Type::TENSOR_FLOAT16, {2}); 7246 OperandType type5(Type::INT32, {}); 7247 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 7248 // Phase 1, operands 7249 auto op1 = model->addOperand(&type44); 7250 auto op2 = model->addOperand(&type48); 7251 auto op3 = model->addOperand(&type49); 7252 auto shape = model->addOperand(&type4); 7253 auto param = model->addOperand(&type5); 7254 auto param1 = model->addOperand(&type5); 7255 auto param2 = model->addOperand(&type5); 7256 auto act = model->addOperand(&type5); 7257 auto layout = model->addOperand(&type0); 7258 auto op4 = model->addOperand(&type96); 7259 // Phase 2, operations 7260 static int32_t shape_init[] = {1, 5, 5, 2}; 7261 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7262 static int32_t param_init[] = {2}; 7263 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7264 static int32_t param1_init[] = {2}; 7265 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7266 static int32_t param2_init[] = {2}; 7267 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7268 static int32_t act_init[] = {2}; 7269 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7270 static bool8 layout_init[] = {false}; 7271 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7272 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7273 // Phase 3, inputs and outputs 7274 model->identifyInputsAndOutputs( 7275 {op1, op2, op3}, 7276 {op4}); 7277 assert(model->isValid()); 7278 } 7279 7280 inline bool is_ignored_dynamic_output_shape_nhwc_relu1_float16_weight_as_input(int i) { 7281 static std::set<int> ignore = {}; 7282 return ignore.find(i) != ignore.end(); 7283 } 7284 7285 void CreateModel_dynamic_output_shape_nhwc_relu6(Model *model) { 7286 OperandType type0(Type::BOOL, {}); 7287 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 7288 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7289 OperandType type3(Type::TENSOR_FLOAT32, {2}); 7290 OperandType type4(Type::TENSOR_INT32, {4}); 7291 OperandType type5(Type::INT32, {}); 7292 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7293 // Phase 1, operands 7294 auto op1 = model->addOperand(&type1); 7295 auto op2 = model->addOperand(&type2); 7296 auto op3 = model->addOperand(&type3); 7297 auto shape = model->addOperand(&type4); 7298 auto param = model->addOperand(&type5); 7299 auto param1 = model->addOperand(&type5); 7300 auto param2 = model->addOperand(&type5); 7301 auto act = model->addOperand(&type5); 7302 auto layout = model->addOperand(&type0); 7303 auto op4 = model->addOperand(&type88); 7304 // Phase 2, operations 7305 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 7306 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 7307 static float op3_init[] = {-1.5f, -2.0f}; 7308 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 7309 static int32_t shape_init[] = {1, 5, 5, 2}; 7310 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7311 static int32_t param_init[] = {2}; 7312 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7313 static int32_t param1_init[] = {2}; 7314 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7315 static int32_t param2_init[] = {2}; 7316 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7317 static int32_t act_init[] = {3}; 7318 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7319 static bool8 layout_init[] = {false}; 7320 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7321 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7322 // Phase 3, inputs and outputs 7323 model->identifyInputsAndOutputs( 7324 {op1}, 7325 {op4}); 7326 assert(model->isValid()); 7327 } 7328 7329 inline bool is_ignored_dynamic_output_shape_nhwc_relu6(int i) { 7330 static std::set<int> ignore = {}; 7331 return ignore.find(i) != ignore.end(); 7332 } 7333 7334 void CreateModel_dynamic_output_shape_nhwc_relu6_weight_as_input(Model *model) { 7335 OperandType type0(Type::BOOL, {}); 7336 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 7337 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7338 OperandType type3(Type::TENSOR_FLOAT32, {2}); 7339 OperandType type4(Type::TENSOR_INT32, {4}); 7340 OperandType type5(Type::INT32, {}); 7341 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7342 // Phase 1, operands 7343 auto op1 = model->addOperand(&type1); 7344 auto op2 = model->addOperand(&type2); 7345 auto op3 = model->addOperand(&type3); 7346 auto shape = model->addOperand(&type4); 7347 auto param = model->addOperand(&type5); 7348 auto param1 = model->addOperand(&type5); 7349 auto param2 = model->addOperand(&type5); 7350 auto act = model->addOperand(&type5); 7351 auto layout = model->addOperand(&type0); 7352 auto op4 = model->addOperand(&type88); 7353 // Phase 2, operations 7354 static int32_t shape_init[] = {1, 5, 5, 2}; 7355 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7356 static int32_t param_init[] = {2}; 7357 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7358 static int32_t param1_init[] = {2}; 7359 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7360 static int32_t param2_init[] = {2}; 7361 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7362 static int32_t act_init[] = {3}; 7363 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7364 static bool8 layout_init[] = {false}; 7365 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7366 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7367 // Phase 3, inputs and outputs 7368 model->identifyInputsAndOutputs( 7369 {op1, op2, op3}, 7370 {op4}); 7371 assert(model->isValid()); 7372 } 7373 7374 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_weight_as_input(int i) { 7375 static std::set<int> ignore = {}; 7376 return ignore.find(i) != ignore.end(); 7377 } 7378 7379 void CreateModel_dynamic_output_shape_nhwc_relu6_relaxed(Model *model) { 7380 OperandType type0(Type::BOOL, {}); 7381 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 7382 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7383 OperandType type3(Type::TENSOR_FLOAT32, {2}); 7384 OperandType type4(Type::TENSOR_INT32, {4}); 7385 OperandType type5(Type::INT32, {}); 7386 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7387 // Phase 1, operands 7388 auto op1 = model->addOperand(&type1); 7389 auto op2 = model->addOperand(&type2); 7390 auto op3 = model->addOperand(&type3); 7391 auto shape = model->addOperand(&type4); 7392 auto param = model->addOperand(&type5); 7393 auto param1 = model->addOperand(&type5); 7394 auto param2 = model->addOperand(&type5); 7395 auto act = model->addOperand(&type5); 7396 auto layout = model->addOperand(&type0); 7397 auto op4 = model->addOperand(&type88); 7398 // Phase 2, operations 7399 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 7400 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 7401 static float op3_init[] = {-1.5f, -2.0f}; 7402 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 7403 static int32_t shape_init[] = {1, 5, 5, 2}; 7404 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7405 static int32_t param_init[] = {2}; 7406 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7407 static int32_t param1_init[] = {2}; 7408 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7409 static int32_t param2_init[] = {2}; 7410 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7411 static int32_t act_init[] = {3}; 7412 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7413 static bool8 layout_init[] = {false}; 7414 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7415 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7416 // Phase 3, inputs and outputs 7417 model->identifyInputsAndOutputs( 7418 {op1}, 7419 {op4}); 7420 // Phase 4: set relaxed execution 7421 model->relaxComputationFloat32toFloat16(true); 7422 assert(model->isValid()); 7423 } 7424 7425 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_relaxed(int i) { 7426 static std::set<int> ignore = {}; 7427 return ignore.find(i) != ignore.end(); 7428 } 7429 7430 void CreateModel_dynamic_output_shape_nhwc_relu6_relaxed_weight_as_input(Model *model) { 7431 OperandType type0(Type::BOOL, {}); 7432 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 7433 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7434 OperandType type3(Type::TENSOR_FLOAT32, {2}); 7435 OperandType type4(Type::TENSOR_INT32, {4}); 7436 OperandType type5(Type::INT32, {}); 7437 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7438 // Phase 1, operands 7439 auto op1 = model->addOperand(&type1); 7440 auto op2 = model->addOperand(&type2); 7441 auto op3 = model->addOperand(&type3); 7442 auto shape = model->addOperand(&type4); 7443 auto param = model->addOperand(&type5); 7444 auto param1 = model->addOperand(&type5); 7445 auto param2 = model->addOperand(&type5); 7446 auto act = model->addOperand(&type5); 7447 auto layout = model->addOperand(&type0); 7448 auto op4 = model->addOperand(&type88); 7449 // Phase 2, operations 7450 static int32_t shape_init[] = {1, 5, 5, 2}; 7451 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7452 static int32_t param_init[] = {2}; 7453 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7454 static int32_t param1_init[] = {2}; 7455 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7456 static int32_t param2_init[] = {2}; 7457 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7458 static int32_t act_init[] = {3}; 7459 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7460 static bool8 layout_init[] = {false}; 7461 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7462 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7463 // Phase 3, inputs and outputs 7464 model->identifyInputsAndOutputs( 7465 {op1, op2, op3}, 7466 {op4}); 7467 // Phase 4: set relaxed execution 7468 model->relaxComputationFloat32toFloat16(true); 7469 assert(model->isValid()); 7470 } 7471 7472 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_relaxed_weight_as_input(int i) { 7473 static std::set<int> ignore = {}; 7474 return ignore.find(i) != ignore.end(); 7475 } 7476 7477 void CreateModel_dynamic_output_shape_nhwc_relu6_quant8(Model *model) { 7478 OperandType type0(Type::BOOL, {}); 7479 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 7480 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 7481 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 7482 OperandType type4(Type::TENSOR_INT32, {4}); 7483 OperandType type5(Type::INT32, {}); 7484 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 7485 // Phase 1, operands 7486 auto op1 = model->addOperand(&type27); 7487 auto op2 = model->addOperand(&type28); 7488 auto op3 = model->addOperand(&type29); 7489 auto shape = model->addOperand(&type4); 7490 auto param = model->addOperand(&type5); 7491 auto param1 = model->addOperand(&type5); 7492 auto param2 = model->addOperand(&type5); 7493 auto act = model->addOperand(&type5); 7494 auto layout = model->addOperand(&type0); 7495 auto op4 = model->addOperand(&type89); 7496 // Phase 2, operations 7497 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 7498 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 7499 static int32_t op3_init[] = {-6, -8}; 7500 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 7501 static int32_t shape_init[] = {1, 5, 5, 2}; 7502 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7503 static int32_t param_init[] = {2}; 7504 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7505 static int32_t param1_init[] = {2}; 7506 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7507 static int32_t param2_init[] = {2}; 7508 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7509 static int32_t act_init[] = {3}; 7510 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7511 static bool8 layout_init[] = {false}; 7512 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7513 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7514 // Phase 3, inputs and outputs 7515 model->identifyInputsAndOutputs( 7516 {op1}, 7517 {op4}); 7518 assert(model->isValid()); 7519 } 7520 7521 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8(int i) { 7522 static std::set<int> ignore = {}; 7523 return ignore.find(i) != ignore.end(); 7524 } 7525 7526 void CreateModel_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input(Model *model) { 7527 OperandType type0(Type::BOOL, {}); 7528 OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); 7529 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 7530 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 7531 OperandType type4(Type::TENSOR_INT32, {4}); 7532 OperandType type5(Type::INT32, {}); 7533 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 7534 // Phase 1, operands 7535 auto op1 = model->addOperand(&type27); 7536 auto op2 = model->addOperand(&type28); 7537 auto op3 = model->addOperand(&type29); 7538 auto shape = model->addOperand(&type4); 7539 auto param = model->addOperand(&type5); 7540 auto param1 = model->addOperand(&type5); 7541 auto param2 = model->addOperand(&type5); 7542 auto act = model->addOperand(&type5); 7543 auto layout = model->addOperand(&type0); 7544 auto op4 = model->addOperand(&type89); 7545 // Phase 2, operations 7546 static int32_t shape_init[] = {1, 5, 5, 2}; 7547 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7548 static int32_t param_init[] = {2}; 7549 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7550 static int32_t param1_init[] = {2}; 7551 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7552 static int32_t param2_init[] = {2}; 7553 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7554 static int32_t act_init[] = {3}; 7555 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7556 static bool8 layout_init[] = {false}; 7557 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7558 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7559 // Phase 3, inputs and outputs 7560 model->identifyInputsAndOutputs( 7561 {op1, op2, op3}, 7562 {op4}); 7563 assert(model->isValid()); 7564 } 7565 7566 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input(int i) { 7567 static std::set<int> ignore = {}; 7568 return ignore.find(i) != ignore.end(); 7569 } 7570 7571 void CreateModel_dynamic_output_shape_nhwc_relu6_quant8_2(Model *model) { 7572 OperandType type0(Type::BOOL, {}); 7573 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 7574 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 7575 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 7576 OperandType type4(Type::TENSOR_INT32, {4}); 7577 OperandType type5(Type::INT32, {}); 7578 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 7579 // Phase 1, operands 7580 auto op1 = model->addOperand(&type31); 7581 auto op2 = model->addOperand(&type32); 7582 auto op3 = model->addOperand(&type29); 7583 auto shape = model->addOperand(&type4); 7584 auto param = model->addOperand(&type5); 7585 auto param1 = model->addOperand(&type5); 7586 auto param2 = model->addOperand(&type5); 7587 auto act = model->addOperand(&type5); 7588 auto layout = model->addOperand(&type0); 7589 auto op4 = model->addOperand(&type90); 7590 // Phase 2, operations 7591 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 7592 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 7593 static int32_t op3_init[] = {-6, -8}; 7594 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 7595 static int32_t shape_init[] = {1, 5, 5, 2}; 7596 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7597 static int32_t param_init[] = {2}; 7598 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7599 static int32_t param1_init[] = {2}; 7600 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7601 static int32_t param2_init[] = {2}; 7602 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7603 static int32_t act_init[] = {3}; 7604 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7605 static bool8 layout_init[] = {false}; 7606 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7607 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7608 // Phase 3, inputs and outputs 7609 model->identifyInputsAndOutputs( 7610 {op1}, 7611 {op4}); 7612 assert(model->isValid()); 7613 } 7614 7615 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8_2(int i) { 7616 static std::set<int> ignore = {}; 7617 return ignore.find(i) != ignore.end(); 7618 } 7619 7620 void CreateModel_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input_2(Model *model) { 7621 OperandType type0(Type::BOOL, {}); 7622 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 7623 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 7624 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 7625 OperandType type4(Type::TENSOR_INT32, {4}); 7626 OperandType type5(Type::INT32, {}); 7627 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 7628 // Phase 1, operands 7629 auto op1 = model->addOperand(&type31); 7630 auto op2 = model->addOperand(&type32); 7631 auto op3 = model->addOperand(&type29); 7632 auto shape = model->addOperand(&type4); 7633 auto param = model->addOperand(&type5); 7634 auto param1 = model->addOperand(&type5); 7635 auto param2 = model->addOperand(&type5); 7636 auto act = model->addOperand(&type5); 7637 auto layout = model->addOperand(&type0); 7638 auto op4 = model->addOperand(&type90); 7639 // Phase 2, operations 7640 static int32_t shape_init[] = {1, 5, 5, 2}; 7641 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7642 static int32_t param_init[] = {2}; 7643 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7644 static int32_t param1_init[] = {2}; 7645 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7646 static int32_t param2_init[] = {2}; 7647 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7648 static int32_t act_init[] = {3}; 7649 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7650 static bool8 layout_init[] = {false}; 7651 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7652 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7653 // Phase 3, inputs and outputs 7654 model->identifyInputsAndOutputs( 7655 {op1, op2, op3}, 7656 {op4}); 7657 assert(model->isValid()); 7658 } 7659 7660 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input_2(int i) { 7661 static std::set<int> ignore = {}; 7662 return ignore.find(i) != ignore.end(); 7663 } 7664 7665 void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8(Model *model) { 7666 OperandType type0(Type::BOOL, {}); 7667 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7668 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7669 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 7670 OperandType type4(Type::TENSOR_INT32, {4}); 7671 OperandType type5(Type::INT32, {}); 7672 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 7673 // Phase 1, operands 7674 auto op1 = model->addOperand(&type34); 7675 auto op2 = model->addOperand(&type35); 7676 auto op3 = model->addOperand(&type36); 7677 auto shape = model->addOperand(&type4); 7678 auto param = model->addOperand(&type5); 7679 auto param1 = model->addOperand(&type5); 7680 auto param2 = model->addOperand(&type5); 7681 auto act = model->addOperand(&type5); 7682 auto layout = model->addOperand(&type0); 7683 auto op4 = model->addOperand(&type91); 7684 // Phase 2, operations 7685 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 7686 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 7687 static int32_t op3_init[] = {-24, -16}; 7688 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 7689 static int32_t shape_init[] = {1, 5, 5, 2}; 7690 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7691 static int32_t param_init[] = {2}; 7692 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7693 static int32_t param1_init[] = {2}; 7694 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7695 static int32_t param2_init[] = {2}; 7696 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7697 static int32_t act_init[] = {3}; 7698 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7699 static bool8 layout_init[] = {false}; 7700 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7701 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7702 // Phase 3, inputs and outputs 7703 model->identifyInputsAndOutputs( 7704 {op1}, 7705 {op4}); 7706 assert(model->isValid()); 7707 } 7708 7709 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8(int i) { 7710 static std::set<int> ignore = {}; 7711 return ignore.find(i) != ignore.end(); 7712 } 7713 7714 void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input(Model *model) { 7715 OperandType type0(Type::BOOL, {}); 7716 OperandType type105(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7717 OperandType type106(Type::TENSOR_INT32, {2}, 0.0f, 0); 7718 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7719 OperandType type4(Type::TENSOR_INT32, {4}); 7720 OperandType type5(Type::INT32, {}); 7721 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 7722 // Phase 1, operands 7723 auto op1 = model->addOperand(&type34); 7724 auto op2 = model->addOperand(&type105); 7725 auto op3 = model->addOperand(&type106); 7726 auto shape = model->addOperand(&type4); 7727 auto param = model->addOperand(&type5); 7728 auto param1 = model->addOperand(&type5); 7729 auto param2 = model->addOperand(&type5); 7730 auto act = model->addOperand(&type5); 7731 auto layout = model->addOperand(&type0); 7732 auto op4 = model->addOperand(&type91); 7733 // Phase 2, operations 7734 static int32_t shape_init[] = {1, 5, 5, 2}; 7735 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7736 static int32_t param_init[] = {2}; 7737 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7738 static int32_t param1_init[] = {2}; 7739 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7740 static int32_t param2_init[] = {2}; 7741 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7742 static int32_t act_init[] = {3}; 7743 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7744 static bool8 layout_init[] = {false}; 7745 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7746 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7747 // Phase 3, inputs and outputs 7748 model->identifyInputsAndOutputs( 7749 {op1, op2, op3}, 7750 {op4}); 7751 assert(model->isValid()); 7752 } 7753 7754 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input(int i) { 7755 static std::set<int> ignore = {}; 7756 return ignore.find(i) != ignore.end(); 7757 } 7758 7759 void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8_2(Model *model) { 7760 OperandType type0(Type::BOOL, {}); 7761 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7762 OperandType type4(Type::TENSOR_INT32, {4}); 7763 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7764 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 7765 OperandType type5(Type::INT32, {}); 7766 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 7767 // Phase 1, operands 7768 auto op1 = model->addOperand(&type34); 7769 auto op2 = model->addOperand(&type40); 7770 auto op3 = model->addOperand(&type41); 7771 auto shape = model->addOperand(&type4); 7772 auto param = model->addOperand(&type5); 7773 auto param1 = model->addOperand(&type5); 7774 auto param2 = model->addOperand(&type5); 7775 auto act = model->addOperand(&type5); 7776 auto layout = model->addOperand(&type0); 7777 auto op4 = model->addOperand(&type90); 7778 // Phase 2, operations 7779 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 7780 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 7781 static int32_t op3_init[] = {-24, -16}; 7782 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 7783 static int32_t shape_init[] = {1, 5, 5, 2}; 7784 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7785 static int32_t param_init[] = {2}; 7786 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7787 static int32_t param1_init[] = {2}; 7788 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7789 static int32_t param2_init[] = {2}; 7790 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7791 static int32_t act_init[] = {3}; 7792 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7793 static bool8 layout_init[] = {false}; 7794 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7795 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7796 // Phase 3, inputs and outputs 7797 model->identifyInputsAndOutputs( 7798 {op1}, 7799 {op4}); 7800 assert(model->isValid()); 7801 } 7802 7803 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8_2(int i) { 7804 static std::set<int> ignore = {}; 7805 return ignore.find(i) != ignore.end(); 7806 } 7807 7808 void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input_2(Model *model) { 7809 OperandType type0(Type::BOOL, {}); 7810 OperandType type107(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 7811 OperandType type108(Type::TENSOR_INT32, {2}, 0.0f, 0); 7812 OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); 7813 OperandType type4(Type::TENSOR_INT32, {4}); 7814 OperandType type5(Type::INT32, {}); 7815 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 7816 // Phase 1, operands 7817 auto op1 = model->addOperand(&type34); 7818 auto op2 = model->addOperand(&type107); 7819 auto op3 = model->addOperand(&type108); 7820 auto shape = model->addOperand(&type4); 7821 auto param = model->addOperand(&type5); 7822 auto param1 = model->addOperand(&type5); 7823 auto param2 = model->addOperand(&type5); 7824 auto act = model->addOperand(&type5); 7825 auto layout = model->addOperand(&type0); 7826 auto op4 = model->addOperand(&type90); 7827 // Phase 2, operations 7828 static int32_t shape_init[] = {1, 5, 5, 2}; 7829 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7830 static int32_t param_init[] = {2}; 7831 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7832 static int32_t param1_init[] = {2}; 7833 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7834 static int32_t param2_init[] = {2}; 7835 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7836 static int32_t act_init[] = {3}; 7837 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7838 static bool8 layout_init[] = {false}; 7839 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7840 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7841 // Phase 3, inputs and outputs 7842 model->identifyInputsAndOutputs( 7843 {op1, op2, op3}, 7844 {op4}); 7845 assert(model->isValid()); 7846 } 7847 7848 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input_2(int i) { 7849 static std::set<int> ignore = {}; 7850 return ignore.find(i) != ignore.end(); 7851 } 7852 7853 void CreateModel_dynamic_output_shape_nhwc_relu6_float16(Model *model) { 7854 OperandType type0(Type::BOOL, {}); 7855 OperandType type4(Type::TENSOR_INT32, {4}); 7856 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 7857 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 7858 OperandType type46(Type::TENSOR_FLOAT16, {2}); 7859 OperandType type5(Type::INT32, {}); 7860 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 7861 // Phase 1, operands 7862 auto op1 = model->addOperand(&type44); 7863 auto op2 = model->addOperand(&type45); 7864 auto op3 = model->addOperand(&type46); 7865 auto shape = model->addOperand(&type4); 7866 auto param = model->addOperand(&type5); 7867 auto param1 = model->addOperand(&type5); 7868 auto param2 = model->addOperand(&type5); 7869 auto act = model->addOperand(&type5); 7870 auto layout = model->addOperand(&type0); 7871 auto op4 = model->addOperand(&type96); 7872 // Phase 2, operations 7873 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 7874 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 7875 static _Float16 op3_init[] = {-1.5f, -2.0f}; 7876 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 7877 static int32_t shape_init[] = {1, 5, 5, 2}; 7878 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7879 static int32_t param_init[] = {2}; 7880 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7881 static int32_t param1_init[] = {2}; 7882 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7883 static int32_t param2_init[] = {2}; 7884 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7885 static int32_t act_init[] = {3}; 7886 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7887 static bool8 layout_init[] = {false}; 7888 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7889 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7890 // Phase 3, inputs and outputs 7891 model->identifyInputsAndOutputs( 7892 {op1}, 7893 {op4}); 7894 assert(model->isValid()); 7895 } 7896 7897 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_float16(int i) { 7898 static std::set<int> ignore = {}; 7899 return ignore.find(i) != ignore.end(); 7900 } 7901 7902 void CreateModel_dynamic_output_shape_nhwc_relu6_float16_weight_as_input(Model *model) { 7903 OperandType type0(Type::BOOL, {}); 7904 OperandType type4(Type::TENSOR_INT32, {4}); 7905 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 7906 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 7907 OperandType type49(Type::TENSOR_FLOAT16, {2}); 7908 OperandType type5(Type::INT32, {}); 7909 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 7910 // Phase 1, operands 7911 auto op1 = model->addOperand(&type44); 7912 auto op2 = model->addOperand(&type48); 7913 auto op3 = model->addOperand(&type49); 7914 auto shape = model->addOperand(&type4); 7915 auto param = model->addOperand(&type5); 7916 auto param1 = model->addOperand(&type5); 7917 auto param2 = model->addOperand(&type5); 7918 auto act = model->addOperand(&type5); 7919 auto layout = model->addOperand(&type0); 7920 auto op4 = model->addOperand(&type96); 7921 // Phase 2, operations 7922 static int32_t shape_init[] = {1, 5, 5, 2}; 7923 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7924 static int32_t param_init[] = {2}; 7925 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7926 static int32_t param1_init[] = {2}; 7927 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7928 static int32_t param2_init[] = {2}; 7929 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7930 static int32_t act_init[] = {3}; 7931 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7932 static bool8 layout_init[] = {false}; 7933 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7934 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7935 // Phase 3, inputs and outputs 7936 model->identifyInputsAndOutputs( 7937 {op1, op2, op3}, 7938 {op4}); 7939 assert(model->isValid()); 7940 } 7941 7942 inline bool is_ignored_dynamic_output_shape_nhwc_relu6_float16_weight_as_input(int i) { 7943 static std::set<int> ignore = {}; 7944 return ignore.find(i) != ignore.end(); 7945 } 7946 7947 void CreateModel_dynamic_output_shape_nchw_none(Model *model) { 7948 OperandType type0(Type::BOOL, {}); 7949 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7950 OperandType type3(Type::TENSOR_FLOAT32, {2}); 7951 OperandType type4(Type::TENSOR_INT32, {4}); 7952 OperandType type5(Type::INT32, {}); 7953 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 7954 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 7955 // Phase 1, operands 7956 auto op1 = model->addOperand(&type62); 7957 auto op2 = model->addOperand(&type2); 7958 auto op3 = model->addOperand(&type3); 7959 auto shape = model->addOperand(&type4); 7960 auto param = model->addOperand(&type5); 7961 auto param1 = model->addOperand(&type5); 7962 auto param2 = model->addOperand(&type5); 7963 auto act = model->addOperand(&type5); 7964 auto layout = model->addOperand(&type0); 7965 auto op4 = model->addOperand(&type88); 7966 // Phase 2, operations 7967 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 7968 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 7969 static float op3_init[] = {-1.5f, -2.0f}; 7970 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 7971 static int32_t shape_init[] = {1, 2, 5, 5}; 7972 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 7973 static int32_t param_init[] = {2}; 7974 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 7975 static int32_t param1_init[] = {2}; 7976 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 7977 static int32_t param2_init[] = {2}; 7978 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 7979 static int32_t act_init[] = {0}; 7980 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 7981 static bool8 layout_init[] = {true}; 7982 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 7983 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 7984 // Phase 3, inputs and outputs 7985 model->identifyInputsAndOutputs( 7986 {op1}, 7987 {op4}); 7988 assert(model->isValid()); 7989 } 7990 7991 inline bool is_ignored_dynamic_output_shape_nchw_none(int i) { 7992 static std::set<int> ignore = {}; 7993 return ignore.find(i) != ignore.end(); 7994 } 7995 7996 void CreateModel_dynamic_output_shape_nchw_none_weight_as_input(Model *model) { 7997 OperandType type0(Type::BOOL, {}); 7998 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 7999 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8000 OperandType type4(Type::TENSOR_INT32, {4}); 8001 OperandType type5(Type::INT32, {}); 8002 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8003 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8004 // Phase 1, operands 8005 auto op1 = model->addOperand(&type62); 8006 auto op2 = model->addOperand(&type2); 8007 auto op3 = model->addOperand(&type3); 8008 auto shape = model->addOperand(&type4); 8009 auto param = model->addOperand(&type5); 8010 auto param1 = model->addOperand(&type5); 8011 auto param2 = model->addOperand(&type5); 8012 auto act = model->addOperand(&type5); 8013 auto layout = model->addOperand(&type0); 8014 auto op4 = model->addOperand(&type88); 8015 // Phase 2, operations 8016 static int32_t shape_init[] = {1, 2, 5, 5}; 8017 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8018 static int32_t param_init[] = {2}; 8019 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8020 static int32_t param1_init[] = {2}; 8021 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8022 static int32_t param2_init[] = {2}; 8023 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8024 static int32_t act_init[] = {0}; 8025 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8026 static bool8 layout_init[] = {true}; 8027 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8028 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8029 // Phase 3, inputs and outputs 8030 model->identifyInputsAndOutputs( 8031 {op1, op2, op3}, 8032 {op4}); 8033 assert(model->isValid()); 8034 } 8035 8036 inline bool is_ignored_dynamic_output_shape_nchw_none_weight_as_input(int i) { 8037 static std::set<int> ignore = {}; 8038 return ignore.find(i) != ignore.end(); 8039 } 8040 8041 void CreateModel_dynamic_output_shape_nchw_none_relaxed(Model *model) { 8042 OperandType type0(Type::BOOL, {}); 8043 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 8044 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8045 OperandType type4(Type::TENSOR_INT32, {4}); 8046 OperandType type5(Type::INT32, {}); 8047 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8048 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8049 // Phase 1, operands 8050 auto op1 = model->addOperand(&type62); 8051 auto op2 = model->addOperand(&type2); 8052 auto op3 = model->addOperand(&type3); 8053 auto shape = model->addOperand(&type4); 8054 auto param = model->addOperand(&type5); 8055 auto param1 = model->addOperand(&type5); 8056 auto param2 = model->addOperand(&type5); 8057 auto act = model->addOperand(&type5); 8058 auto layout = model->addOperand(&type0); 8059 auto op4 = model->addOperand(&type88); 8060 // Phase 2, operations 8061 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 8062 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 8063 static float op3_init[] = {-1.5f, -2.0f}; 8064 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 8065 static int32_t shape_init[] = {1, 2, 5, 5}; 8066 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8067 static int32_t param_init[] = {2}; 8068 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8069 static int32_t param1_init[] = {2}; 8070 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8071 static int32_t param2_init[] = {2}; 8072 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8073 static int32_t act_init[] = {0}; 8074 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8075 static bool8 layout_init[] = {true}; 8076 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8077 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8078 // Phase 3, inputs and outputs 8079 model->identifyInputsAndOutputs( 8080 {op1}, 8081 {op4}); 8082 // Phase 4: set relaxed execution 8083 model->relaxComputationFloat32toFloat16(true); 8084 assert(model->isValid()); 8085 } 8086 8087 inline bool is_ignored_dynamic_output_shape_nchw_none_relaxed(int i) { 8088 static std::set<int> ignore = {}; 8089 return ignore.find(i) != ignore.end(); 8090 } 8091 8092 void CreateModel_dynamic_output_shape_nchw_none_relaxed_weight_as_input(Model *model) { 8093 OperandType type0(Type::BOOL, {}); 8094 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 8095 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8096 OperandType type4(Type::TENSOR_INT32, {4}); 8097 OperandType type5(Type::INT32, {}); 8098 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8099 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8100 // Phase 1, operands 8101 auto op1 = model->addOperand(&type62); 8102 auto op2 = model->addOperand(&type2); 8103 auto op3 = model->addOperand(&type3); 8104 auto shape = model->addOperand(&type4); 8105 auto param = model->addOperand(&type5); 8106 auto param1 = model->addOperand(&type5); 8107 auto param2 = model->addOperand(&type5); 8108 auto act = model->addOperand(&type5); 8109 auto layout = model->addOperand(&type0); 8110 auto op4 = model->addOperand(&type88); 8111 // Phase 2, operations 8112 static int32_t shape_init[] = {1, 2, 5, 5}; 8113 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8114 static int32_t param_init[] = {2}; 8115 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8116 static int32_t param1_init[] = {2}; 8117 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8118 static int32_t param2_init[] = {2}; 8119 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8120 static int32_t act_init[] = {0}; 8121 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8122 static bool8 layout_init[] = {true}; 8123 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8124 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8125 // Phase 3, inputs and outputs 8126 model->identifyInputsAndOutputs( 8127 {op1, op2, op3}, 8128 {op4}); 8129 // Phase 4: set relaxed execution 8130 model->relaxComputationFloat32toFloat16(true); 8131 assert(model->isValid()); 8132 } 8133 8134 inline bool is_ignored_dynamic_output_shape_nchw_none_relaxed_weight_as_input(int i) { 8135 static std::set<int> ignore = {}; 8136 return ignore.find(i) != ignore.end(); 8137 } 8138 8139 void CreateModel_dynamic_output_shape_nchw_none_quant8(Model *model) { 8140 OperandType type0(Type::BOOL, {}); 8141 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 8142 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8143 OperandType type4(Type::TENSOR_INT32, {4}); 8144 OperandType type5(Type::INT32, {}); 8145 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 8146 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 8147 // Phase 1, operands 8148 auto op1 = model->addOperand(&type64); 8149 auto op2 = model->addOperand(&type28); 8150 auto op3 = model->addOperand(&type29); 8151 auto shape = model->addOperand(&type4); 8152 auto param = model->addOperand(&type5); 8153 auto param1 = model->addOperand(&type5); 8154 auto param2 = model->addOperand(&type5); 8155 auto act = model->addOperand(&type5); 8156 auto layout = model->addOperand(&type0); 8157 auto op4 = model->addOperand(&type89); 8158 // Phase 2, operations 8159 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 8160 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 8161 static int32_t op3_init[] = {-6, -8}; 8162 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 8163 static int32_t shape_init[] = {1, 2, 5, 5}; 8164 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8165 static int32_t param_init[] = {2}; 8166 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8167 static int32_t param1_init[] = {2}; 8168 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8169 static int32_t param2_init[] = {2}; 8170 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8171 static int32_t act_init[] = {0}; 8172 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8173 static bool8 layout_init[] = {true}; 8174 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8175 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8176 // Phase 3, inputs and outputs 8177 model->identifyInputsAndOutputs( 8178 {op1}, 8179 {op4}); 8180 assert(model->isValid()); 8181 } 8182 8183 inline bool is_ignored_dynamic_output_shape_nchw_none_quant8(int i) { 8184 static std::set<int> ignore = {}; 8185 return ignore.find(i) != ignore.end(); 8186 } 8187 8188 void CreateModel_dynamic_output_shape_nchw_none_quant8_weight_as_input(Model *model) { 8189 OperandType type0(Type::BOOL, {}); 8190 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 8191 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8192 OperandType type4(Type::TENSOR_INT32, {4}); 8193 OperandType type5(Type::INT32, {}); 8194 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 8195 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 8196 // Phase 1, operands 8197 auto op1 = model->addOperand(&type64); 8198 auto op2 = model->addOperand(&type28); 8199 auto op3 = model->addOperand(&type29); 8200 auto shape = model->addOperand(&type4); 8201 auto param = model->addOperand(&type5); 8202 auto param1 = model->addOperand(&type5); 8203 auto param2 = model->addOperand(&type5); 8204 auto act = model->addOperand(&type5); 8205 auto layout = model->addOperand(&type0); 8206 auto op4 = model->addOperand(&type89); 8207 // Phase 2, operations 8208 static int32_t shape_init[] = {1, 2, 5, 5}; 8209 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8210 static int32_t param_init[] = {2}; 8211 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8212 static int32_t param1_init[] = {2}; 8213 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8214 static int32_t param2_init[] = {2}; 8215 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8216 static int32_t act_init[] = {0}; 8217 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8218 static bool8 layout_init[] = {true}; 8219 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8220 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8221 // Phase 3, inputs and outputs 8222 model->identifyInputsAndOutputs( 8223 {op1, op2, op3}, 8224 {op4}); 8225 assert(model->isValid()); 8226 } 8227 8228 inline bool is_ignored_dynamic_output_shape_nchw_none_quant8_weight_as_input(int i) { 8229 static std::set<int> ignore = {}; 8230 return ignore.find(i) != ignore.end(); 8231 } 8232 8233 void CreateModel_dynamic_output_shape_nchw_none_quant8_2(Model *model) { 8234 OperandType type0(Type::BOOL, {}); 8235 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8236 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 8237 OperandType type4(Type::TENSOR_INT32, {4}); 8238 OperandType type5(Type::INT32, {}); 8239 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 8240 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 8241 // Phase 1, operands 8242 auto op1 = model->addOperand(&type66); 8243 auto op2 = model->addOperand(&type32); 8244 auto op3 = model->addOperand(&type29); 8245 auto shape = model->addOperand(&type4); 8246 auto param = model->addOperand(&type5); 8247 auto param1 = model->addOperand(&type5); 8248 auto param2 = model->addOperand(&type5); 8249 auto act = model->addOperand(&type5); 8250 auto layout = model->addOperand(&type0); 8251 auto op4 = model->addOperand(&type90); 8252 // Phase 2, operations 8253 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 8254 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 8255 static int32_t op3_init[] = {-6, -8}; 8256 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 8257 static int32_t shape_init[] = {1, 2, 5, 5}; 8258 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8259 static int32_t param_init[] = {2}; 8260 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8261 static int32_t param1_init[] = {2}; 8262 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8263 static int32_t param2_init[] = {2}; 8264 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8265 static int32_t act_init[] = {0}; 8266 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8267 static bool8 layout_init[] = {true}; 8268 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8269 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8270 // Phase 3, inputs and outputs 8271 model->identifyInputsAndOutputs( 8272 {op1}, 8273 {op4}); 8274 assert(model->isValid()); 8275 } 8276 8277 inline bool is_ignored_dynamic_output_shape_nchw_none_quant8_2(int i) { 8278 static std::set<int> ignore = {}; 8279 return ignore.find(i) != ignore.end(); 8280 } 8281 8282 void CreateModel_dynamic_output_shape_nchw_none_quant8_weight_as_input_2(Model *model) { 8283 OperandType type0(Type::BOOL, {}); 8284 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8285 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 8286 OperandType type4(Type::TENSOR_INT32, {4}); 8287 OperandType type5(Type::INT32, {}); 8288 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 8289 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 8290 // Phase 1, operands 8291 auto op1 = model->addOperand(&type66); 8292 auto op2 = model->addOperand(&type32); 8293 auto op3 = model->addOperand(&type29); 8294 auto shape = model->addOperand(&type4); 8295 auto param = model->addOperand(&type5); 8296 auto param1 = model->addOperand(&type5); 8297 auto param2 = model->addOperand(&type5); 8298 auto act = model->addOperand(&type5); 8299 auto layout = model->addOperand(&type0); 8300 auto op4 = model->addOperand(&type90); 8301 // Phase 2, operations 8302 static int32_t shape_init[] = {1, 2, 5, 5}; 8303 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8304 static int32_t param_init[] = {2}; 8305 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8306 static int32_t param1_init[] = {2}; 8307 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8308 static int32_t param2_init[] = {2}; 8309 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8310 static int32_t act_init[] = {0}; 8311 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8312 static bool8 layout_init[] = {true}; 8313 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8314 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8315 // Phase 3, inputs and outputs 8316 model->identifyInputsAndOutputs( 8317 {op1, op2, op3}, 8318 {op4}); 8319 assert(model->isValid()); 8320 } 8321 8322 inline bool is_ignored_dynamic_output_shape_nchw_none_quant8_weight_as_input_2(int i) { 8323 static std::set<int> ignore = {}; 8324 return ignore.find(i) != ignore.end(); 8325 } 8326 8327 void CreateModel_dynamic_output_shape_nchw_none_channelQuant8(Model *model) { 8328 OperandType type0(Type::BOOL, {}); 8329 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 8330 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 8331 OperandType type4(Type::TENSOR_INT32, {4}); 8332 OperandType type5(Type::INT32, {}); 8333 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 8334 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 8335 // Phase 1, operands 8336 auto op1 = model->addOperand(&type68); 8337 auto op2 = model->addOperand(&type35); 8338 auto op3 = model->addOperand(&type36); 8339 auto shape = model->addOperand(&type4); 8340 auto param = model->addOperand(&type5); 8341 auto param1 = model->addOperand(&type5); 8342 auto param2 = model->addOperand(&type5); 8343 auto act = model->addOperand(&type5); 8344 auto layout = model->addOperand(&type0); 8345 auto op4 = model->addOperand(&type91); 8346 // Phase 2, operations 8347 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 8348 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 8349 static int32_t op3_init[] = {-24, -16}; 8350 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 8351 static int32_t shape_init[] = {1, 2, 5, 5}; 8352 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8353 static int32_t param_init[] = {2}; 8354 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8355 static int32_t param1_init[] = {2}; 8356 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8357 static int32_t param2_init[] = {2}; 8358 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8359 static int32_t act_init[] = {0}; 8360 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8361 static bool8 layout_init[] = {true}; 8362 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8363 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8364 // Phase 3, inputs and outputs 8365 model->identifyInputsAndOutputs( 8366 {op1}, 8367 {op4}); 8368 assert(model->isValid()); 8369 } 8370 8371 inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8(int i) { 8372 static std::set<int> ignore = {}; 8373 return ignore.find(i) != ignore.end(); 8374 } 8375 8376 void CreateModel_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input(Model *model) { 8377 OperandType type0(Type::BOOL, {}); 8378 OperandType type109(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 8379 OperandType type110(Type::TENSOR_INT32, {2}, 0.0f, 0); 8380 OperandType type4(Type::TENSOR_INT32, {4}); 8381 OperandType type5(Type::INT32, {}); 8382 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 8383 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 8384 // Phase 1, operands 8385 auto op1 = model->addOperand(&type68); 8386 auto op2 = model->addOperand(&type109); 8387 auto op3 = model->addOperand(&type110); 8388 auto shape = model->addOperand(&type4); 8389 auto param = model->addOperand(&type5); 8390 auto param1 = model->addOperand(&type5); 8391 auto param2 = model->addOperand(&type5); 8392 auto act = model->addOperand(&type5); 8393 auto layout = model->addOperand(&type0); 8394 auto op4 = model->addOperand(&type91); 8395 // Phase 2, operations 8396 static int32_t shape_init[] = {1, 2, 5, 5}; 8397 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8398 static int32_t param_init[] = {2}; 8399 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8400 static int32_t param1_init[] = {2}; 8401 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8402 static int32_t param2_init[] = {2}; 8403 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8404 static int32_t act_init[] = {0}; 8405 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8406 static bool8 layout_init[] = {true}; 8407 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8408 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8409 // Phase 3, inputs and outputs 8410 model->identifyInputsAndOutputs( 8411 {op1, op2, op3}, 8412 {op4}); 8413 assert(model->isValid()); 8414 } 8415 8416 inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input(int i) { 8417 static std::set<int> ignore = {}; 8418 return ignore.find(i) != ignore.end(); 8419 } 8420 8421 void CreateModel_dynamic_output_shape_nchw_none_channelQuant8_2(Model *model) { 8422 OperandType type0(Type::BOOL, {}); 8423 OperandType type4(Type::TENSOR_INT32, {4}); 8424 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 8425 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 8426 OperandType type5(Type::INT32, {}); 8427 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 8428 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 8429 // Phase 1, operands 8430 auto op1 = model->addOperand(&type68); 8431 auto op2 = model->addOperand(&type40); 8432 auto op3 = model->addOperand(&type41); 8433 auto shape = model->addOperand(&type4); 8434 auto param = model->addOperand(&type5); 8435 auto param1 = model->addOperand(&type5); 8436 auto param2 = model->addOperand(&type5); 8437 auto act = model->addOperand(&type5); 8438 auto layout = model->addOperand(&type0); 8439 auto op4 = model->addOperand(&type90); 8440 // Phase 2, operations 8441 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 8442 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 8443 static int32_t op3_init[] = {-24, -16}; 8444 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 8445 static int32_t shape_init[] = {1, 2, 5, 5}; 8446 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8447 static int32_t param_init[] = {2}; 8448 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8449 static int32_t param1_init[] = {2}; 8450 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8451 static int32_t param2_init[] = {2}; 8452 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8453 static int32_t act_init[] = {0}; 8454 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8455 static bool8 layout_init[] = {true}; 8456 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8457 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8458 // Phase 3, inputs and outputs 8459 model->identifyInputsAndOutputs( 8460 {op1}, 8461 {op4}); 8462 assert(model->isValid()); 8463 } 8464 8465 inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8_2(int i) { 8466 static std::set<int> ignore = {}; 8467 return ignore.find(i) != ignore.end(); 8468 } 8469 8470 void CreateModel_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input_2(Model *model) { 8471 OperandType type0(Type::BOOL, {}); 8472 OperandType type111(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 8473 OperandType type112(Type::TENSOR_INT32, {2}, 0.0f, 0); 8474 OperandType type4(Type::TENSOR_INT32, {4}); 8475 OperandType type5(Type::INT32, {}); 8476 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 8477 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 8478 // Phase 1, operands 8479 auto op1 = model->addOperand(&type68); 8480 auto op2 = model->addOperand(&type111); 8481 auto op3 = model->addOperand(&type112); 8482 auto shape = model->addOperand(&type4); 8483 auto param = model->addOperand(&type5); 8484 auto param1 = model->addOperand(&type5); 8485 auto param2 = model->addOperand(&type5); 8486 auto act = model->addOperand(&type5); 8487 auto layout = model->addOperand(&type0); 8488 auto op4 = model->addOperand(&type90); 8489 // Phase 2, operations 8490 static int32_t shape_init[] = {1, 2, 5, 5}; 8491 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8492 static int32_t param_init[] = {2}; 8493 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8494 static int32_t param1_init[] = {2}; 8495 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8496 static int32_t param2_init[] = {2}; 8497 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8498 static int32_t act_init[] = {0}; 8499 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8500 static bool8 layout_init[] = {true}; 8501 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8502 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8503 // Phase 3, inputs and outputs 8504 model->identifyInputsAndOutputs( 8505 {op1, op2, op3}, 8506 {op4}); 8507 assert(model->isValid()); 8508 } 8509 8510 inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input_2(int i) { 8511 static std::set<int> ignore = {}; 8512 return ignore.find(i) != ignore.end(); 8513 } 8514 8515 void CreateModel_dynamic_output_shape_nchw_none_float16(Model *model) { 8516 OperandType type0(Type::BOOL, {}); 8517 OperandType type4(Type::TENSOR_INT32, {4}); 8518 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 8519 OperandType type46(Type::TENSOR_FLOAT16, {2}); 8520 OperandType type5(Type::INT32, {}); 8521 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 8522 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 8523 // Phase 1, operands 8524 auto op1 = model->addOperand(&type74); 8525 auto op2 = model->addOperand(&type45); 8526 auto op3 = model->addOperand(&type46); 8527 auto shape = model->addOperand(&type4); 8528 auto param = model->addOperand(&type5); 8529 auto param1 = model->addOperand(&type5); 8530 auto param2 = model->addOperand(&type5); 8531 auto act = model->addOperand(&type5); 8532 auto layout = model->addOperand(&type0); 8533 auto op4 = model->addOperand(&type96); 8534 // Phase 2, operations 8535 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 8536 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 8537 static _Float16 op3_init[] = {-1.5f, -2.0f}; 8538 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 8539 static int32_t shape_init[] = {1, 2, 5, 5}; 8540 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8541 static int32_t param_init[] = {2}; 8542 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8543 static int32_t param1_init[] = {2}; 8544 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8545 static int32_t param2_init[] = {2}; 8546 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8547 static int32_t act_init[] = {0}; 8548 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8549 static bool8 layout_init[] = {true}; 8550 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8551 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8552 // Phase 3, inputs and outputs 8553 model->identifyInputsAndOutputs( 8554 {op1}, 8555 {op4}); 8556 assert(model->isValid()); 8557 } 8558 8559 inline bool is_ignored_dynamic_output_shape_nchw_none_float16(int i) { 8560 static std::set<int> ignore = {}; 8561 return ignore.find(i) != ignore.end(); 8562 } 8563 8564 void CreateModel_dynamic_output_shape_nchw_none_float16_weight_as_input(Model *model) { 8565 OperandType type0(Type::BOOL, {}); 8566 OperandType type4(Type::TENSOR_INT32, {4}); 8567 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 8568 OperandType type49(Type::TENSOR_FLOAT16, {2}); 8569 OperandType type5(Type::INT32, {}); 8570 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 8571 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 8572 // Phase 1, operands 8573 auto op1 = model->addOperand(&type74); 8574 auto op2 = model->addOperand(&type48); 8575 auto op3 = model->addOperand(&type49); 8576 auto shape = model->addOperand(&type4); 8577 auto param = model->addOperand(&type5); 8578 auto param1 = model->addOperand(&type5); 8579 auto param2 = model->addOperand(&type5); 8580 auto act = model->addOperand(&type5); 8581 auto layout = model->addOperand(&type0); 8582 auto op4 = model->addOperand(&type96); 8583 // Phase 2, operations 8584 static int32_t shape_init[] = {1, 2, 5, 5}; 8585 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8586 static int32_t param_init[] = {2}; 8587 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8588 static int32_t param1_init[] = {2}; 8589 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8590 static int32_t param2_init[] = {2}; 8591 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8592 static int32_t act_init[] = {0}; 8593 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8594 static bool8 layout_init[] = {true}; 8595 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8596 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8597 // Phase 3, inputs and outputs 8598 model->identifyInputsAndOutputs( 8599 {op1, op2, op3}, 8600 {op4}); 8601 assert(model->isValid()); 8602 } 8603 8604 inline bool is_ignored_dynamic_output_shape_nchw_none_float16_weight_as_input(int i) { 8605 static std::set<int> ignore = {}; 8606 return ignore.find(i) != ignore.end(); 8607 } 8608 8609 void CreateModel_dynamic_output_shape_nchw_relu(Model *model) { 8610 OperandType type0(Type::BOOL, {}); 8611 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 8612 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8613 OperandType type4(Type::TENSOR_INT32, {4}); 8614 OperandType type5(Type::INT32, {}); 8615 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8616 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8617 // Phase 1, operands 8618 auto op1 = model->addOperand(&type62); 8619 auto op2 = model->addOperand(&type2); 8620 auto op3 = model->addOperand(&type3); 8621 auto shape = model->addOperand(&type4); 8622 auto param = model->addOperand(&type5); 8623 auto param1 = model->addOperand(&type5); 8624 auto param2 = model->addOperand(&type5); 8625 auto act = model->addOperand(&type5); 8626 auto layout = model->addOperand(&type0); 8627 auto op4 = model->addOperand(&type88); 8628 // Phase 2, operations 8629 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 8630 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 8631 static float op3_init[] = {-1.5f, -2.0f}; 8632 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 8633 static int32_t shape_init[] = {1, 2, 5, 5}; 8634 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8635 static int32_t param_init[] = {2}; 8636 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8637 static int32_t param1_init[] = {2}; 8638 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8639 static int32_t param2_init[] = {2}; 8640 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8641 static int32_t act_init[] = {1}; 8642 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8643 static bool8 layout_init[] = {true}; 8644 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8645 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8646 // Phase 3, inputs and outputs 8647 model->identifyInputsAndOutputs( 8648 {op1}, 8649 {op4}); 8650 assert(model->isValid()); 8651 } 8652 8653 inline bool is_ignored_dynamic_output_shape_nchw_relu(int i) { 8654 static std::set<int> ignore = {}; 8655 return ignore.find(i) != ignore.end(); 8656 } 8657 8658 void CreateModel_dynamic_output_shape_nchw_relu_weight_as_input(Model *model) { 8659 OperandType type0(Type::BOOL, {}); 8660 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 8661 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8662 OperandType type4(Type::TENSOR_INT32, {4}); 8663 OperandType type5(Type::INT32, {}); 8664 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8665 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8666 // Phase 1, operands 8667 auto op1 = model->addOperand(&type62); 8668 auto op2 = model->addOperand(&type2); 8669 auto op3 = model->addOperand(&type3); 8670 auto shape = model->addOperand(&type4); 8671 auto param = model->addOperand(&type5); 8672 auto param1 = model->addOperand(&type5); 8673 auto param2 = model->addOperand(&type5); 8674 auto act = model->addOperand(&type5); 8675 auto layout = model->addOperand(&type0); 8676 auto op4 = model->addOperand(&type88); 8677 // Phase 2, operations 8678 static int32_t shape_init[] = {1, 2, 5, 5}; 8679 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8680 static int32_t param_init[] = {2}; 8681 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8682 static int32_t param1_init[] = {2}; 8683 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8684 static int32_t param2_init[] = {2}; 8685 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8686 static int32_t act_init[] = {1}; 8687 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8688 static bool8 layout_init[] = {true}; 8689 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8690 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8691 // Phase 3, inputs and outputs 8692 model->identifyInputsAndOutputs( 8693 {op1, op2, op3}, 8694 {op4}); 8695 assert(model->isValid()); 8696 } 8697 8698 inline bool is_ignored_dynamic_output_shape_nchw_relu_weight_as_input(int i) { 8699 static std::set<int> ignore = {}; 8700 return ignore.find(i) != ignore.end(); 8701 } 8702 8703 void CreateModel_dynamic_output_shape_nchw_relu_relaxed(Model *model) { 8704 OperandType type0(Type::BOOL, {}); 8705 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 8706 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8707 OperandType type4(Type::TENSOR_INT32, {4}); 8708 OperandType type5(Type::INT32, {}); 8709 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8710 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8711 // Phase 1, operands 8712 auto op1 = model->addOperand(&type62); 8713 auto op2 = model->addOperand(&type2); 8714 auto op3 = model->addOperand(&type3); 8715 auto shape = model->addOperand(&type4); 8716 auto param = model->addOperand(&type5); 8717 auto param1 = model->addOperand(&type5); 8718 auto param2 = model->addOperand(&type5); 8719 auto act = model->addOperand(&type5); 8720 auto layout = model->addOperand(&type0); 8721 auto op4 = model->addOperand(&type88); 8722 // Phase 2, operations 8723 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 8724 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 8725 static float op3_init[] = {-1.5f, -2.0f}; 8726 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 8727 static int32_t shape_init[] = {1, 2, 5, 5}; 8728 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8729 static int32_t param_init[] = {2}; 8730 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8731 static int32_t param1_init[] = {2}; 8732 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8733 static int32_t param2_init[] = {2}; 8734 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8735 static int32_t act_init[] = {1}; 8736 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8737 static bool8 layout_init[] = {true}; 8738 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8739 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8740 // Phase 3, inputs and outputs 8741 model->identifyInputsAndOutputs( 8742 {op1}, 8743 {op4}); 8744 // Phase 4: set relaxed execution 8745 model->relaxComputationFloat32toFloat16(true); 8746 assert(model->isValid()); 8747 } 8748 8749 inline bool is_ignored_dynamic_output_shape_nchw_relu_relaxed(int i) { 8750 static std::set<int> ignore = {}; 8751 return ignore.find(i) != ignore.end(); 8752 } 8753 8754 void CreateModel_dynamic_output_shape_nchw_relu_relaxed_weight_as_input(Model *model) { 8755 OperandType type0(Type::BOOL, {}); 8756 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 8757 OperandType type3(Type::TENSOR_FLOAT32, {2}); 8758 OperandType type4(Type::TENSOR_INT32, {4}); 8759 OperandType type5(Type::INT32, {}); 8760 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 8761 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 8762 // Phase 1, operands 8763 auto op1 = model->addOperand(&type62); 8764 auto op2 = model->addOperand(&type2); 8765 auto op3 = model->addOperand(&type3); 8766 auto shape = model->addOperand(&type4); 8767 auto param = model->addOperand(&type5); 8768 auto param1 = model->addOperand(&type5); 8769 auto param2 = model->addOperand(&type5); 8770 auto act = model->addOperand(&type5); 8771 auto layout = model->addOperand(&type0); 8772 auto op4 = model->addOperand(&type88); 8773 // Phase 2, operations 8774 static int32_t shape_init[] = {1, 2, 5, 5}; 8775 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8776 static int32_t param_init[] = {2}; 8777 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8778 static int32_t param1_init[] = {2}; 8779 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8780 static int32_t param2_init[] = {2}; 8781 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8782 static int32_t act_init[] = {1}; 8783 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8784 static bool8 layout_init[] = {true}; 8785 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8786 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8787 // Phase 3, inputs and outputs 8788 model->identifyInputsAndOutputs( 8789 {op1, op2, op3}, 8790 {op4}); 8791 // Phase 4: set relaxed execution 8792 model->relaxComputationFloat32toFloat16(true); 8793 assert(model->isValid()); 8794 } 8795 8796 inline bool is_ignored_dynamic_output_shape_nchw_relu_relaxed_weight_as_input(int i) { 8797 static std::set<int> ignore = {}; 8798 return ignore.find(i) != ignore.end(); 8799 } 8800 8801 void CreateModel_dynamic_output_shape_nchw_relu_quant8(Model *model) { 8802 OperandType type0(Type::BOOL, {}); 8803 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 8804 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8805 OperandType type4(Type::TENSOR_INT32, {4}); 8806 OperandType type5(Type::INT32, {}); 8807 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 8808 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 8809 // Phase 1, operands 8810 auto op1 = model->addOperand(&type64); 8811 auto op2 = model->addOperand(&type28); 8812 auto op3 = model->addOperand(&type29); 8813 auto shape = model->addOperand(&type4); 8814 auto param = model->addOperand(&type5); 8815 auto param1 = model->addOperand(&type5); 8816 auto param2 = model->addOperand(&type5); 8817 auto act = model->addOperand(&type5); 8818 auto layout = model->addOperand(&type0); 8819 auto op4 = model->addOperand(&type89); 8820 // Phase 2, operations 8821 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 8822 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 8823 static int32_t op3_init[] = {-6, -8}; 8824 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 8825 static int32_t shape_init[] = {1, 2, 5, 5}; 8826 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8827 static int32_t param_init[] = {2}; 8828 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8829 static int32_t param1_init[] = {2}; 8830 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8831 static int32_t param2_init[] = {2}; 8832 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8833 static int32_t act_init[] = {1}; 8834 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8835 static bool8 layout_init[] = {true}; 8836 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8837 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8838 // Phase 3, inputs and outputs 8839 model->identifyInputsAndOutputs( 8840 {op1}, 8841 {op4}); 8842 assert(model->isValid()); 8843 } 8844 8845 inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8(int i) { 8846 static std::set<int> ignore = {}; 8847 return ignore.find(i) != ignore.end(); 8848 } 8849 8850 void CreateModel_dynamic_output_shape_nchw_relu_quant8_weight_as_input(Model *model) { 8851 OperandType type0(Type::BOOL, {}); 8852 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 8853 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8854 OperandType type4(Type::TENSOR_INT32, {4}); 8855 OperandType type5(Type::INT32, {}); 8856 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 8857 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 8858 // Phase 1, operands 8859 auto op1 = model->addOperand(&type64); 8860 auto op2 = model->addOperand(&type28); 8861 auto op3 = model->addOperand(&type29); 8862 auto shape = model->addOperand(&type4); 8863 auto param = model->addOperand(&type5); 8864 auto param1 = model->addOperand(&type5); 8865 auto param2 = model->addOperand(&type5); 8866 auto act = model->addOperand(&type5); 8867 auto layout = model->addOperand(&type0); 8868 auto op4 = model->addOperand(&type89); 8869 // Phase 2, operations 8870 static int32_t shape_init[] = {1, 2, 5, 5}; 8871 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8872 static int32_t param_init[] = {2}; 8873 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8874 static int32_t param1_init[] = {2}; 8875 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8876 static int32_t param2_init[] = {2}; 8877 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8878 static int32_t act_init[] = {1}; 8879 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8880 static bool8 layout_init[] = {true}; 8881 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8882 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8883 // Phase 3, inputs and outputs 8884 model->identifyInputsAndOutputs( 8885 {op1, op2, op3}, 8886 {op4}); 8887 assert(model->isValid()); 8888 } 8889 8890 inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8_weight_as_input(int i) { 8891 static std::set<int> ignore = {}; 8892 return ignore.find(i) != ignore.end(); 8893 } 8894 8895 void CreateModel_dynamic_output_shape_nchw_relu_quant8_2(Model *model) { 8896 OperandType type0(Type::BOOL, {}); 8897 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8898 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 8899 OperandType type4(Type::TENSOR_INT32, {4}); 8900 OperandType type5(Type::INT32, {}); 8901 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 8902 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 8903 // Phase 1, operands 8904 auto op1 = model->addOperand(&type66); 8905 auto op2 = model->addOperand(&type32); 8906 auto op3 = model->addOperand(&type29); 8907 auto shape = model->addOperand(&type4); 8908 auto param = model->addOperand(&type5); 8909 auto param1 = model->addOperand(&type5); 8910 auto param2 = model->addOperand(&type5); 8911 auto act = model->addOperand(&type5); 8912 auto layout = model->addOperand(&type0); 8913 auto op4 = model->addOperand(&type90); 8914 // Phase 2, operations 8915 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 8916 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 8917 static int32_t op3_init[] = {-6, -8}; 8918 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 8919 static int32_t shape_init[] = {1, 2, 5, 5}; 8920 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8921 static int32_t param_init[] = {2}; 8922 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8923 static int32_t param1_init[] = {2}; 8924 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8925 static int32_t param2_init[] = {2}; 8926 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8927 static int32_t act_init[] = {1}; 8928 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8929 static bool8 layout_init[] = {true}; 8930 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8931 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8932 // Phase 3, inputs and outputs 8933 model->identifyInputsAndOutputs( 8934 {op1}, 8935 {op4}); 8936 assert(model->isValid()); 8937 } 8938 8939 inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8_2(int i) { 8940 static std::set<int> ignore = {}; 8941 return ignore.find(i) != ignore.end(); 8942 } 8943 8944 void CreateModel_dynamic_output_shape_nchw_relu_quant8_weight_as_input_2(Model *model) { 8945 OperandType type0(Type::BOOL, {}); 8946 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 8947 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 8948 OperandType type4(Type::TENSOR_INT32, {4}); 8949 OperandType type5(Type::INT32, {}); 8950 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 8951 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 8952 // Phase 1, operands 8953 auto op1 = model->addOperand(&type66); 8954 auto op2 = model->addOperand(&type32); 8955 auto op3 = model->addOperand(&type29); 8956 auto shape = model->addOperand(&type4); 8957 auto param = model->addOperand(&type5); 8958 auto param1 = model->addOperand(&type5); 8959 auto param2 = model->addOperand(&type5); 8960 auto act = model->addOperand(&type5); 8961 auto layout = model->addOperand(&type0); 8962 auto op4 = model->addOperand(&type90); 8963 // Phase 2, operations 8964 static int32_t shape_init[] = {1, 2, 5, 5}; 8965 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 8966 static int32_t param_init[] = {2}; 8967 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 8968 static int32_t param1_init[] = {2}; 8969 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 8970 static int32_t param2_init[] = {2}; 8971 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 8972 static int32_t act_init[] = {1}; 8973 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 8974 static bool8 layout_init[] = {true}; 8975 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 8976 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 8977 // Phase 3, inputs and outputs 8978 model->identifyInputsAndOutputs( 8979 {op1, op2, op3}, 8980 {op4}); 8981 assert(model->isValid()); 8982 } 8983 8984 inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8_weight_as_input_2(int i) { 8985 static std::set<int> ignore = {}; 8986 return ignore.find(i) != ignore.end(); 8987 } 8988 8989 void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8(Model *model) { 8990 OperandType type0(Type::BOOL, {}); 8991 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 8992 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 8993 OperandType type4(Type::TENSOR_INT32, {4}); 8994 OperandType type5(Type::INT32, {}); 8995 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 8996 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 8997 // Phase 1, operands 8998 auto op1 = model->addOperand(&type68); 8999 auto op2 = model->addOperand(&type35); 9000 auto op3 = model->addOperand(&type36); 9001 auto shape = model->addOperand(&type4); 9002 auto param = model->addOperand(&type5); 9003 auto param1 = model->addOperand(&type5); 9004 auto param2 = model->addOperand(&type5); 9005 auto act = model->addOperand(&type5); 9006 auto layout = model->addOperand(&type0); 9007 auto op4 = model->addOperand(&type91); 9008 // Phase 2, operations 9009 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 9010 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 9011 static int32_t op3_init[] = {-24, -16}; 9012 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 9013 static int32_t shape_init[] = {1, 2, 5, 5}; 9014 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9015 static int32_t param_init[] = {2}; 9016 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9017 static int32_t param1_init[] = {2}; 9018 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9019 static int32_t param2_init[] = {2}; 9020 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9021 static int32_t act_init[] = {1}; 9022 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9023 static bool8 layout_init[] = {true}; 9024 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9025 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9026 // Phase 3, inputs and outputs 9027 model->identifyInputsAndOutputs( 9028 {op1}, 9029 {op4}); 9030 assert(model->isValid()); 9031 } 9032 9033 inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8(int i) { 9034 static std::set<int> ignore = {}; 9035 return ignore.find(i) != ignore.end(); 9036 } 9037 9038 void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input(Model *model) { 9039 OperandType type0(Type::BOOL, {}); 9040 OperandType type113(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9041 OperandType type114(Type::TENSOR_INT32, {2}, 0.0f, 0); 9042 OperandType type4(Type::TENSOR_INT32, {4}); 9043 OperandType type5(Type::INT32, {}); 9044 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9045 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 9046 // Phase 1, operands 9047 auto op1 = model->addOperand(&type68); 9048 auto op2 = model->addOperand(&type113); 9049 auto op3 = model->addOperand(&type114); 9050 auto shape = model->addOperand(&type4); 9051 auto param = model->addOperand(&type5); 9052 auto param1 = model->addOperand(&type5); 9053 auto param2 = model->addOperand(&type5); 9054 auto act = model->addOperand(&type5); 9055 auto layout = model->addOperand(&type0); 9056 auto op4 = model->addOperand(&type91); 9057 // Phase 2, operations 9058 static int32_t shape_init[] = {1, 2, 5, 5}; 9059 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9060 static int32_t param_init[] = {2}; 9061 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9062 static int32_t param1_init[] = {2}; 9063 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9064 static int32_t param2_init[] = {2}; 9065 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9066 static int32_t act_init[] = {1}; 9067 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9068 static bool8 layout_init[] = {true}; 9069 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9070 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9071 // Phase 3, inputs and outputs 9072 model->identifyInputsAndOutputs( 9073 {op1, op2, op3}, 9074 {op4}); 9075 assert(model->isValid()); 9076 } 9077 9078 inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input(int i) { 9079 static std::set<int> ignore = {}; 9080 return ignore.find(i) != ignore.end(); 9081 } 9082 9083 void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8_2(Model *model) { 9084 OperandType type0(Type::BOOL, {}); 9085 OperandType type4(Type::TENSOR_INT32, {4}); 9086 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9087 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 9088 OperandType type5(Type::INT32, {}); 9089 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9090 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 9091 // Phase 1, operands 9092 auto op1 = model->addOperand(&type68); 9093 auto op2 = model->addOperand(&type40); 9094 auto op3 = model->addOperand(&type41); 9095 auto shape = model->addOperand(&type4); 9096 auto param = model->addOperand(&type5); 9097 auto param1 = model->addOperand(&type5); 9098 auto param2 = model->addOperand(&type5); 9099 auto act = model->addOperand(&type5); 9100 auto layout = model->addOperand(&type0); 9101 auto op4 = model->addOperand(&type90); 9102 // Phase 2, operations 9103 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 9104 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 9105 static int32_t op3_init[] = {-24, -16}; 9106 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 9107 static int32_t shape_init[] = {1, 2, 5, 5}; 9108 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9109 static int32_t param_init[] = {2}; 9110 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9111 static int32_t param1_init[] = {2}; 9112 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9113 static int32_t param2_init[] = {2}; 9114 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9115 static int32_t act_init[] = {1}; 9116 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9117 static bool8 layout_init[] = {true}; 9118 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9119 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9120 // Phase 3, inputs and outputs 9121 model->identifyInputsAndOutputs( 9122 {op1}, 9123 {op4}); 9124 assert(model->isValid()); 9125 } 9126 9127 inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8_2(int i) { 9128 static std::set<int> ignore = {}; 9129 return ignore.find(i) != ignore.end(); 9130 } 9131 9132 void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input_2(Model *model) { 9133 OperandType type0(Type::BOOL, {}); 9134 OperandType type115(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9135 OperandType type116(Type::TENSOR_INT32, {2}, 0.0f, 0); 9136 OperandType type4(Type::TENSOR_INT32, {4}); 9137 OperandType type5(Type::INT32, {}); 9138 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9139 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 9140 // Phase 1, operands 9141 auto op1 = model->addOperand(&type68); 9142 auto op2 = model->addOperand(&type115); 9143 auto op3 = model->addOperand(&type116); 9144 auto shape = model->addOperand(&type4); 9145 auto param = model->addOperand(&type5); 9146 auto param1 = model->addOperand(&type5); 9147 auto param2 = model->addOperand(&type5); 9148 auto act = model->addOperand(&type5); 9149 auto layout = model->addOperand(&type0); 9150 auto op4 = model->addOperand(&type90); 9151 // Phase 2, operations 9152 static int32_t shape_init[] = {1, 2, 5, 5}; 9153 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9154 static int32_t param_init[] = {2}; 9155 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9156 static int32_t param1_init[] = {2}; 9157 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9158 static int32_t param2_init[] = {2}; 9159 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9160 static int32_t act_init[] = {1}; 9161 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9162 static bool8 layout_init[] = {true}; 9163 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9164 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9165 // Phase 3, inputs and outputs 9166 model->identifyInputsAndOutputs( 9167 {op1, op2, op3}, 9168 {op4}); 9169 assert(model->isValid()); 9170 } 9171 9172 inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input_2(int i) { 9173 static std::set<int> ignore = {}; 9174 return ignore.find(i) != ignore.end(); 9175 } 9176 9177 void CreateModel_dynamic_output_shape_nchw_relu_float16(Model *model) { 9178 OperandType type0(Type::BOOL, {}); 9179 OperandType type4(Type::TENSOR_INT32, {4}); 9180 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 9181 OperandType type46(Type::TENSOR_FLOAT16, {2}); 9182 OperandType type5(Type::INT32, {}); 9183 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 9184 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9185 // Phase 1, operands 9186 auto op1 = model->addOperand(&type74); 9187 auto op2 = model->addOperand(&type45); 9188 auto op3 = model->addOperand(&type46); 9189 auto shape = model->addOperand(&type4); 9190 auto param = model->addOperand(&type5); 9191 auto param1 = model->addOperand(&type5); 9192 auto param2 = model->addOperand(&type5); 9193 auto act = model->addOperand(&type5); 9194 auto layout = model->addOperand(&type0); 9195 auto op4 = model->addOperand(&type96); 9196 // Phase 2, operations 9197 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 9198 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 9199 static _Float16 op3_init[] = {-1.5f, -2.0f}; 9200 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 9201 static int32_t shape_init[] = {1, 2, 5, 5}; 9202 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9203 static int32_t param_init[] = {2}; 9204 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9205 static int32_t param1_init[] = {2}; 9206 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9207 static int32_t param2_init[] = {2}; 9208 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9209 static int32_t act_init[] = {1}; 9210 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9211 static bool8 layout_init[] = {true}; 9212 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9213 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9214 // Phase 3, inputs and outputs 9215 model->identifyInputsAndOutputs( 9216 {op1}, 9217 {op4}); 9218 assert(model->isValid()); 9219 } 9220 9221 inline bool is_ignored_dynamic_output_shape_nchw_relu_float16(int i) { 9222 static std::set<int> ignore = {}; 9223 return ignore.find(i) != ignore.end(); 9224 } 9225 9226 void CreateModel_dynamic_output_shape_nchw_relu_float16_weight_as_input(Model *model) { 9227 OperandType type0(Type::BOOL, {}); 9228 OperandType type4(Type::TENSOR_INT32, {4}); 9229 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 9230 OperandType type49(Type::TENSOR_FLOAT16, {2}); 9231 OperandType type5(Type::INT32, {}); 9232 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 9233 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9234 // Phase 1, operands 9235 auto op1 = model->addOperand(&type74); 9236 auto op2 = model->addOperand(&type48); 9237 auto op3 = model->addOperand(&type49); 9238 auto shape = model->addOperand(&type4); 9239 auto param = model->addOperand(&type5); 9240 auto param1 = model->addOperand(&type5); 9241 auto param2 = model->addOperand(&type5); 9242 auto act = model->addOperand(&type5); 9243 auto layout = model->addOperand(&type0); 9244 auto op4 = model->addOperand(&type96); 9245 // Phase 2, operations 9246 static int32_t shape_init[] = {1, 2, 5, 5}; 9247 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9248 static int32_t param_init[] = {2}; 9249 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9250 static int32_t param1_init[] = {2}; 9251 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9252 static int32_t param2_init[] = {2}; 9253 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9254 static int32_t act_init[] = {1}; 9255 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9256 static bool8 layout_init[] = {true}; 9257 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9258 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9259 // Phase 3, inputs and outputs 9260 model->identifyInputsAndOutputs( 9261 {op1, op2, op3}, 9262 {op4}); 9263 assert(model->isValid()); 9264 } 9265 9266 inline bool is_ignored_dynamic_output_shape_nchw_relu_float16_weight_as_input(int i) { 9267 static std::set<int> ignore = {}; 9268 return ignore.find(i) != ignore.end(); 9269 } 9270 9271 void CreateModel_dynamic_output_shape_nchw_relu1(Model *model) { 9272 OperandType type0(Type::BOOL, {}); 9273 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 9274 OperandType type3(Type::TENSOR_FLOAT32, {2}); 9275 OperandType type4(Type::TENSOR_INT32, {4}); 9276 OperandType type5(Type::INT32, {}); 9277 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 9278 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9279 // Phase 1, operands 9280 auto op1 = model->addOperand(&type62); 9281 auto op2 = model->addOperand(&type2); 9282 auto op3 = model->addOperand(&type3); 9283 auto shape = model->addOperand(&type4); 9284 auto param = model->addOperand(&type5); 9285 auto param1 = model->addOperand(&type5); 9286 auto param2 = model->addOperand(&type5); 9287 auto act = model->addOperand(&type5); 9288 auto layout = model->addOperand(&type0); 9289 auto op4 = model->addOperand(&type88); 9290 // Phase 2, operations 9291 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 9292 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 9293 static float op3_init[] = {-1.5f, -2.0f}; 9294 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 9295 static int32_t shape_init[] = {1, 2, 5, 5}; 9296 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9297 static int32_t param_init[] = {2}; 9298 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9299 static int32_t param1_init[] = {2}; 9300 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9301 static int32_t param2_init[] = {2}; 9302 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9303 static int32_t act_init[] = {2}; 9304 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9305 static bool8 layout_init[] = {true}; 9306 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9307 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9308 // Phase 3, inputs and outputs 9309 model->identifyInputsAndOutputs( 9310 {op1}, 9311 {op4}); 9312 assert(model->isValid()); 9313 } 9314 9315 inline bool is_ignored_dynamic_output_shape_nchw_relu1(int i) { 9316 static std::set<int> ignore = {}; 9317 return ignore.find(i) != ignore.end(); 9318 } 9319 9320 void CreateModel_dynamic_output_shape_nchw_relu1_weight_as_input(Model *model) { 9321 OperandType type0(Type::BOOL, {}); 9322 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 9323 OperandType type3(Type::TENSOR_FLOAT32, {2}); 9324 OperandType type4(Type::TENSOR_INT32, {4}); 9325 OperandType type5(Type::INT32, {}); 9326 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 9327 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9328 // Phase 1, operands 9329 auto op1 = model->addOperand(&type62); 9330 auto op2 = model->addOperand(&type2); 9331 auto op3 = model->addOperand(&type3); 9332 auto shape = model->addOperand(&type4); 9333 auto param = model->addOperand(&type5); 9334 auto param1 = model->addOperand(&type5); 9335 auto param2 = model->addOperand(&type5); 9336 auto act = model->addOperand(&type5); 9337 auto layout = model->addOperand(&type0); 9338 auto op4 = model->addOperand(&type88); 9339 // Phase 2, operations 9340 static int32_t shape_init[] = {1, 2, 5, 5}; 9341 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9342 static int32_t param_init[] = {2}; 9343 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9344 static int32_t param1_init[] = {2}; 9345 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9346 static int32_t param2_init[] = {2}; 9347 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9348 static int32_t act_init[] = {2}; 9349 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9350 static bool8 layout_init[] = {true}; 9351 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9352 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9353 // Phase 3, inputs and outputs 9354 model->identifyInputsAndOutputs( 9355 {op1, op2, op3}, 9356 {op4}); 9357 assert(model->isValid()); 9358 } 9359 9360 inline bool is_ignored_dynamic_output_shape_nchw_relu1_weight_as_input(int i) { 9361 static std::set<int> ignore = {}; 9362 return ignore.find(i) != ignore.end(); 9363 } 9364 9365 void CreateModel_dynamic_output_shape_nchw_relu1_relaxed(Model *model) { 9366 OperandType type0(Type::BOOL, {}); 9367 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 9368 OperandType type3(Type::TENSOR_FLOAT32, {2}); 9369 OperandType type4(Type::TENSOR_INT32, {4}); 9370 OperandType type5(Type::INT32, {}); 9371 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 9372 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9373 // Phase 1, operands 9374 auto op1 = model->addOperand(&type62); 9375 auto op2 = model->addOperand(&type2); 9376 auto op3 = model->addOperand(&type3); 9377 auto shape = model->addOperand(&type4); 9378 auto param = model->addOperand(&type5); 9379 auto param1 = model->addOperand(&type5); 9380 auto param2 = model->addOperand(&type5); 9381 auto act = model->addOperand(&type5); 9382 auto layout = model->addOperand(&type0); 9383 auto op4 = model->addOperand(&type88); 9384 // Phase 2, operations 9385 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 9386 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 9387 static float op3_init[] = {-1.5f, -2.0f}; 9388 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 9389 static int32_t shape_init[] = {1, 2, 5, 5}; 9390 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9391 static int32_t param_init[] = {2}; 9392 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9393 static int32_t param1_init[] = {2}; 9394 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9395 static int32_t param2_init[] = {2}; 9396 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9397 static int32_t act_init[] = {2}; 9398 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9399 static bool8 layout_init[] = {true}; 9400 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9401 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9402 // Phase 3, inputs and outputs 9403 model->identifyInputsAndOutputs( 9404 {op1}, 9405 {op4}); 9406 // Phase 4: set relaxed execution 9407 model->relaxComputationFloat32toFloat16(true); 9408 assert(model->isValid()); 9409 } 9410 9411 inline bool is_ignored_dynamic_output_shape_nchw_relu1_relaxed(int i) { 9412 static std::set<int> ignore = {}; 9413 return ignore.find(i) != ignore.end(); 9414 } 9415 9416 void CreateModel_dynamic_output_shape_nchw_relu1_relaxed_weight_as_input(Model *model) { 9417 OperandType type0(Type::BOOL, {}); 9418 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 9419 OperandType type3(Type::TENSOR_FLOAT32, {2}); 9420 OperandType type4(Type::TENSOR_INT32, {4}); 9421 OperandType type5(Type::INT32, {}); 9422 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 9423 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9424 // Phase 1, operands 9425 auto op1 = model->addOperand(&type62); 9426 auto op2 = model->addOperand(&type2); 9427 auto op3 = model->addOperand(&type3); 9428 auto shape = model->addOperand(&type4); 9429 auto param = model->addOperand(&type5); 9430 auto param1 = model->addOperand(&type5); 9431 auto param2 = model->addOperand(&type5); 9432 auto act = model->addOperand(&type5); 9433 auto layout = model->addOperand(&type0); 9434 auto op4 = model->addOperand(&type88); 9435 // Phase 2, operations 9436 static int32_t shape_init[] = {1, 2, 5, 5}; 9437 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9438 static int32_t param_init[] = {2}; 9439 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9440 static int32_t param1_init[] = {2}; 9441 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9442 static int32_t param2_init[] = {2}; 9443 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9444 static int32_t act_init[] = {2}; 9445 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9446 static bool8 layout_init[] = {true}; 9447 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9448 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9449 // Phase 3, inputs and outputs 9450 model->identifyInputsAndOutputs( 9451 {op1, op2, op3}, 9452 {op4}); 9453 // Phase 4: set relaxed execution 9454 model->relaxComputationFloat32toFloat16(true); 9455 assert(model->isValid()); 9456 } 9457 9458 inline bool is_ignored_dynamic_output_shape_nchw_relu1_relaxed_weight_as_input(int i) { 9459 static std::set<int> ignore = {}; 9460 return ignore.find(i) != ignore.end(); 9461 } 9462 9463 void CreateModel_dynamic_output_shape_nchw_relu1_quant8(Model *model) { 9464 OperandType type0(Type::BOOL, {}); 9465 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 9466 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 9467 OperandType type4(Type::TENSOR_INT32, {4}); 9468 OperandType type5(Type::INT32, {}); 9469 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 9470 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 9471 // Phase 1, operands 9472 auto op1 = model->addOperand(&type64); 9473 auto op2 = model->addOperand(&type28); 9474 auto op3 = model->addOperand(&type29); 9475 auto shape = model->addOperand(&type4); 9476 auto param = model->addOperand(&type5); 9477 auto param1 = model->addOperand(&type5); 9478 auto param2 = model->addOperand(&type5); 9479 auto act = model->addOperand(&type5); 9480 auto layout = model->addOperand(&type0); 9481 auto op4 = model->addOperand(&type89); 9482 // Phase 2, operations 9483 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 9484 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 9485 static int32_t op3_init[] = {-6, -8}; 9486 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 9487 static int32_t shape_init[] = {1, 2, 5, 5}; 9488 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9489 static int32_t param_init[] = {2}; 9490 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9491 static int32_t param1_init[] = {2}; 9492 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9493 static int32_t param2_init[] = {2}; 9494 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9495 static int32_t act_init[] = {2}; 9496 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9497 static bool8 layout_init[] = {true}; 9498 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9499 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9500 // Phase 3, inputs and outputs 9501 model->identifyInputsAndOutputs( 9502 {op1}, 9503 {op4}); 9504 assert(model->isValid()); 9505 } 9506 9507 inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8(int i) { 9508 static std::set<int> ignore = {}; 9509 return ignore.find(i) != ignore.end(); 9510 } 9511 9512 void CreateModel_dynamic_output_shape_nchw_relu1_quant8_weight_as_input(Model *model) { 9513 OperandType type0(Type::BOOL, {}); 9514 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 9515 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 9516 OperandType type4(Type::TENSOR_INT32, {4}); 9517 OperandType type5(Type::INT32, {}); 9518 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 9519 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 9520 // Phase 1, operands 9521 auto op1 = model->addOperand(&type64); 9522 auto op2 = model->addOperand(&type28); 9523 auto op3 = model->addOperand(&type29); 9524 auto shape = model->addOperand(&type4); 9525 auto param = model->addOperand(&type5); 9526 auto param1 = model->addOperand(&type5); 9527 auto param2 = model->addOperand(&type5); 9528 auto act = model->addOperand(&type5); 9529 auto layout = model->addOperand(&type0); 9530 auto op4 = model->addOperand(&type89); 9531 // Phase 2, operations 9532 static int32_t shape_init[] = {1, 2, 5, 5}; 9533 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9534 static int32_t param_init[] = {2}; 9535 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9536 static int32_t param1_init[] = {2}; 9537 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9538 static int32_t param2_init[] = {2}; 9539 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9540 static int32_t act_init[] = {2}; 9541 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9542 static bool8 layout_init[] = {true}; 9543 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9544 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9545 // Phase 3, inputs and outputs 9546 model->identifyInputsAndOutputs( 9547 {op1, op2, op3}, 9548 {op4}); 9549 assert(model->isValid()); 9550 } 9551 9552 inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8_weight_as_input(int i) { 9553 static std::set<int> ignore = {}; 9554 return ignore.find(i) != ignore.end(); 9555 } 9556 9557 void CreateModel_dynamic_output_shape_nchw_relu1_quant8_2(Model *model) { 9558 OperandType type0(Type::BOOL, {}); 9559 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 9560 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 9561 OperandType type4(Type::TENSOR_INT32, {4}); 9562 OperandType type5(Type::INT32, {}); 9563 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 9564 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 9565 // Phase 1, operands 9566 auto op1 = model->addOperand(&type66); 9567 auto op2 = model->addOperand(&type32); 9568 auto op3 = model->addOperand(&type29); 9569 auto shape = model->addOperand(&type4); 9570 auto param = model->addOperand(&type5); 9571 auto param1 = model->addOperand(&type5); 9572 auto param2 = model->addOperand(&type5); 9573 auto act = model->addOperand(&type5); 9574 auto layout = model->addOperand(&type0); 9575 auto op4 = model->addOperand(&type90); 9576 // Phase 2, operations 9577 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 9578 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 9579 static int32_t op3_init[] = {-6, -8}; 9580 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 9581 static int32_t shape_init[] = {1, 2, 5, 5}; 9582 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9583 static int32_t param_init[] = {2}; 9584 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9585 static int32_t param1_init[] = {2}; 9586 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9587 static int32_t param2_init[] = {2}; 9588 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9589 static int32_t act_init[] = {2}; 9590 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9591 static bool8 layout_init[] = {true}; 9592 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9593 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9594 // Phase 3, inputs and outputs 9595 model->identifyInputsAndOutputs( 9596 {op1}, 9597 {op4}); 9598 assert(model->isValid()); 9599 } 9600 9601 inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8_2(int i) { 9602 static std::set<int> ignore = {}; 9603 return ignore.find(i) != ignore.end(); 9604 } 9605 9606 void CreateModel_dynamic_output_shape_nchw_relu1_quant8_weight_as_input_2(Model *model) { 9607 OperandType type0(Type::BOOL, {}); 9608 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 9609 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 9610 OperandType type4(Type::TENSOR_INT32, {4}); 9611 OperandType type5(Type::INT32, {}); 9612 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 9613 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 9614 // Phase 1, operands 9615 auto op1 = model->addOperand(&type66); 9616 auto op2 = model->addOperand(&type32); 9617 auto op3 = model->addOperand(&type29); 9618 auto shape = model->addOperand(&type4); 9619 auto param = model->addOperand(&type5); 9620 auto param1 = model->addOperand(&type5); 9621 auto param2 = model->addOperand(&type5); 9622 auto act = model->addOperand(&type5); 9623 auto layout = model->addOperand(&type0); 9624 auto op4 = model->addOperand(&type90); 9625 // Phase 2, operations 9626 static int32_t shape_init[] = {1, 2, 5, 5}; 9627 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9628 static int32_t param_init[] = {2}; 9629 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9630 static int32_t param1_init[] = {2}; 9631 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9632 static int32_t param2_init[] = {2}; 9633 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9634 static int32_t act_init[] = {2}; 9635 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9636 static bool8 layout_init[] = {true}; 9637 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9638 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9639 // Phase 3, inputs and outputs 9640 model->identifyInputsAndOutputs( 9641 {op1, op2, op3}, 9642 {op4}); 9643 assert(model->isValid()); 9644 } 9645 9646 inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8_weight_as_input_2(int i) { 9647 static std::set<int> ignore = {}; 9648 return ignore.find(i) != ignore.end(); 9649 } 9650 9651 void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8(Model *model) { 9652 OperandType type0(Type::BOOL, {}); 9653 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9654 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 9655 OperandType type4(Type::TENSOR_INT32, {4}); 9656 OperandType type5(Type::INT32, {}); 9657 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9658 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 9659 // Phase 1, operands 9660 auto op1 = model->addOperand(&type68); 9661 auto op2 = model->addOperand(&type35); 9662 auto op3 = model->addOperand(&type36); 9663 auto shape = model->addOperand(&type4); 9664 auto param = model->addOperand(&type5); 9665 auto param1 = model->addOperand(&type5); 9666 auto param2 = model->addOperand(&type5); 9667 auto act = model->addOperand(&type5); 9668 auto layout = model->addOperand(&type0); 9669 auto op4 = model->addOperand(&type91); 9670 // Phase 2, operations 9671 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 9672 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 9673 static int32_t op3_init[] = {-24, -16}; 9674 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 9675 static int32_t shape_init[] = {1, 2, 5, 5}; 9676 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9677 static int32_t param_init[] = {2}; 9678 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9679 static int32_t param1_init[] = {2}; 9680 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9681 static int32_t param2_init[] = {2}; 9682 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9683 static int32_t act_init[] = {2}; 9684 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9685 static bool8 layout_init[] = {true}; 9686 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9687 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9688 // Phase 3, inputs and outputs 9689 model->identifyInputsAndOutputs( 9690 {op1}, 9691 {op4}); 9692 assert(model->isValid()); 9693 } 9694 9695 inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8(int i) { 9696 static std::set<int> ignore = {}; 9697 return ignore.find(i) != ignore.end(); 9698 } 9699 9700 void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input(Model *model) { 9701 OperandType type0(Type::BOOL, {}); 9702 OperandType type117(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9703 OperandType type118(Type::TENSOR_INT32, {2}, 0.0f, 0); 9704 OperandType type4(Type::TENSOR_INT32, {4}); 9705 OperandType type5(Type::INT32, {}); 9706 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9707 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 9708 // Phase 1, operands 9709 auto op1 = model->addOperand(&type68); 9710 auto op2 = model->addOperand(&type117); 9711 auto op3 = model->addOperand(&type118); 9712 auto shape = model->addOperand(&type4); 9713 auto param = model->addOperand(&type5); 9714 auto param1 = model->addOperand(&type5); 9715 auto param2 = model->addOperand(&type5); 9716 auto act = model->addOperand(&type5); 9717 auto layout = model->addOperand(&type0); 9718 auto op4 = model->addOperand(&type91); 9719 // Phase 2, operations 9720 static int32_t shape_init[] = {1, 2, 5, 5}; 9721 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9722 static int32_t param_init[] = {2}; 9723 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9724 static int32_t param1_init[] = {2}; 9725 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9726 static int32_t param2_init[] = {2}; 9727 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9728 static int32_t act_init[] = {2}; 9729 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9730 static bool8 layout_init[] = {true}; 9731 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9732 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9733 // Phase 3, inputs and outputs 9734 model->identifyInputsAndOutputs( 9735 {op1, op2, op3}, 9736 {op4}); 9737 assert(model->isValid()); 9738 } 9739 9740 inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input(int i) { 9741 static std::set<int> ignore = {}; 9742 return ignore.find(i) != ignore.end(); 9743 } 9744 9745 void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8_2(Model *model) { 9746 OperandType type0(Type::BOOL, {}); 9747 OperandType type4(Type::TENSOR_INT32, {4}); 9748 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9749 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 9750 OperandType type5(Type::INT32, {}); 9751 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9752 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 9753 // Phase 1, operands 9754 auto op1 = model->addOperand(&type68); 9755 auto op2 = model->addOperand(&type40); 9756 auto op3 = model->addOperand(&type41); 9757 auto shape = model->addOperand(&type4); 9758 auto param = model->addOperand(&type5); 9759 auto param1 = model->addOperand(&type5); 9760 auto param2 = model->addOperand(&type5); 9761 auto act = model->addOperand(&type5); 9762 auto layout = model->addOperand(&type0); 9763 auto op4 = model->addOperand(&type90); 9764 // Phase 2, operations 9765 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 9766 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 9767 static int32_t op3_init[] = {-24, -16}; 9768 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 9769 static int32_t shape_init[] = {1, 2, 5, 5}; 9770 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9771 static int32_t param_init[] = {2}; 9772 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9773 static int32_t param1_init[] = {2}; 9774 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9775 static int32_t param2_init[] = {2}; 9776 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9777 static int32_t act_init[] = {2}; 9778 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9779 static bool8 layout_init[] = {true}; 9780 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9781 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9782 // Phase 3, inputs and outputs 9783 model->identifyInputsAndOutputs( 9784 {op1}, 9785 {op4}); 9786 assert(model->isValid()); 9787 } 9788 9789 inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8_2(int i) { 9790 static std::set<int> ignore = {}; 9791 return ignore.find(i) != ignore.end(); 9792 } 9793 9794 void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input_2(Model *model) { 9795 OperandType type0(Type::BOOL, {}); 9796 OperandType type119(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 9797 OperandType type120(Type::TENSOR_INT32, {2}, 0.0f, 0); 9798 OperandType type4(Type::TENSOR_INT32, {4}); 9799 OperandType type5(Type::INT32, {}); 9800 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 9801 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 9802 // Phase 1, operands 9803 auto op1 = model->addOperand(&type68); 9804 auto op2 = model->addOperand(&type119); 9805 auto op3 = model->addOperand(&type120); 9806 auto shape = model->addOperand(&type4); 9807 auto param = model->addOperand(&type5); 9808 auto param1 = model->addOperand(&type5); 9809 auto param2 = model->addOperand(&type5); 9810 auto act = model->addOperand(&type5); 9811 auto layout = model->addOperand(&type0); 9812 auto op4 = model->addOperand(&type90); 9813 // Phase 2, operations 9814 static int32_t shape_init[] = {1, 2, 5, 5}; 9815 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9816 static int32_t param_init[] = {2}; 9817 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9818 static int32_t param1_init[] = {2}; 9819 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9820 static int32_t param2_init[] = {2}; 9821 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9822 static int32_t act_init[] = {2}; 9823 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9824 static bool8 layout_init[] = {true}; 9825 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9826 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9827 // Phase 3, inputs and outputs 9828 model->identifyInputsAndOutputs( 9829 {op1, op2, op3}, 9830 {op4}); 9831 assert(model->isValid()); 9832 } 9833 9834 inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input_2(int i) { 9835 static std::set<int> ignore = {}; 9836 return ignore.find(i) != ignore.end(); 9837 } 9838 9839 void CreateModel_dynamic_output_shape_nchw_relu1_float16(Model *model) { 9840 OperandType type0(Type::BOOL, {}); 9841 OperandType type4(Type::TENSOR_INT32, {4}); 9842 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 9843 OperandType type46(Type::TENSOR_FLOAT16, {2}); 9844 OperandType type5(Type::INT32, {}); 9845 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 9846 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9847 // Phase 1, operands 9848 auto op1 = model->addOperand(&type74); 9849 auto op2 = model->addOperand(&type45); 9850 auto op3 = model->addOperand(&type46); 9851 auto shape = model->addOperand(&type4); 9852 auto param = model->addOperand(&type5); 9853 auto param1 = model->addOperand(&type5); 9854 auto param2 = model->addOperand(&type5); 9855 auto act = model->addOperand(&type5); 9856 auto layout = model->addOperand(&type0); 9857 auto op4 = model->addOperand(&type96); 9858 // Phase 2, operations 9859 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 9860 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 9861 static _Float16 op3_init[] = {-1.5f, -2.0f}; 9862 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 9863 static int32_t shape_init[] = {1, 2, 5, 5}; 9864 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9865 static int32_t param_init[] = {2}; 9866 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9867 static int32_t param1_init[] = {2}; 9868 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9869 static int32_t param2_init[] = {2}; 9870 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9871 static int32_t act_init[] = {2}; 9872 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9873 static bool8 layout_init[] = {true}; 9874 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9875 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9876 // Phase 3, inputs and outputs 9877 model->identifyInputsAndOutputs( 9878 {op1}, 9879 {op4}); 9880 assert(model->isValid()); 9881 } 9882 9883 inline bool is_ignored_dynamic_output_shape_nchw_relu1_float16(int i) { 9884 static std::set<int> ignore = {}; 9885 return ignore.find(i) != ignore.end(); 9886 } 9887 9888 void CreateModel_dynamic_output_shape_nchw_relu1_float16_weight_as_input(Model *model) { 9889 OperandType type0(Type::BOOL, {}); 9890 OperandType type4(Type::TENSOR_INT32, {4}); 9891 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 9892 OperandType type49(Type::TENSOR_FLOAT16, {2}); 9893 OperandType type5(Type::INT32, {}); 9894 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 9895 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 9896 // Phase 1, operands 9897 auto op1 = model->addOperand(&type74); 9898 auto op2 = model->addOperand(&type48); 9899 auto op3 = model->addOperand(&type49); 9900 auto shape = model->addOperand(&type4); 9901 auto param = model->addOperand(&type5); 9902 auto param1 = model->addOperand(&type5); 9903 auto param2 = model->addOperand(&type5); 9904 auto act = model->addOperand(&type5); 9905 auto layout = model->addOperand(&type0); 9906 auto op4 = model->addOperand(&type96); 9907 // Phase 2, operations 9908 static int32_t shape_init[] = {1, 2, 5, 5}; 9909 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9910 static int32_t param_init[] = {2}; 9911 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9912 static int32_t param1_init[] = {2}; 9913 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9914 static int32_t param2_init[] = {2}; 9915 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9916 static int32_t act_init[] = {2}; 9917 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9918 static bool8 layout_init[] = {true}; 9919 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9920 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9921 // Phase 3, inputs and outputs 9922 model->identifyInputsAndOutputs( 9923 {op1, op2, op3}, 9924 {op4}); 9925 assert(model->isValid()); 9926 } 9927 9928 inline bool is_ignored_dynamic_output_shape_nchw_relu1_float16_weight_as_input(int i) { 9929 static std::set<int> ignore = {}; 9930 return ignore.find(i) != ignore.end(); 9931 } 9932 9933 void CreateModel_dynamic_output_shape_nchw_relu6(Model *model) { 9934 OperandType type0(Type::BOOL, {}); 9935 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 9936 OperandType type3(Type::TENSOR_FLOAT32, {2}); 9937 OperandType type4(Type::TENSOR_INT32, {4}); 9938 OperandType type5(Type::INT32, {}); 9939 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 9940 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9941 // Phase 1, operands 9942 auto op1 = model->addOperand(&type62); 9943 auto op2 = model->addOperand(&type2); 9944 auto op3 = model->addOperand(&type3); 9945 auto shape = model->addOperand(&type4); 9946 auto param = model->addOperand(&type5); 9947 auto param1 = model->addOperand(&type5); 9948 auto param2 = model->addOperand(&type5); 9949 auto act = model->addOperand(&type5); 9950 auto layout = model->addOperand(&type0); 9951 auto op4 = model->addOperand(&type88); 9952 // Phase 2, operations 9953 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 9954 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 9955 static float op3_init[] = {-1.5f, -2.0f}; 9956 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 9957 static int32_t shape_init[] = {1, 2, 5, 5}; 9958 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 9959 static int32_t param_init[] = {2}; 9960 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 9961 static int32_t param1_init[] = {2}; 9962 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 9963 static int32_t param2_init[] = {2}; 9964 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 9965 static int32_t act_init[] = {3}; 9966 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 9967 static bool8 layout_init[] = {true}; 9968 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 9969 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 9970 // Phase 3, inputs and outputs 9971 model->identifyInputsAndOutputs( 9972 {op1}, 9973 {op4}); 9974 assert(model->isValid()); 9975 } 9976 9977 inline bool is_ignored_dynamic_output_shape_nchw_relu6(int i) { 9978 static std::set<int> ignore = {}; 9979 return ignore.find(i) != ignore.end(); 9980 } 9981 9982 void CreateModel_dynamic_output_shape_nchw_relu6_weight_as_input(Model *model) { 9983 OperandType type0(Type::BOOL, {}); 9984 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 9985 OperandType type3(Type::TENSOR_FLOAT32, {2}); 9986 OperandType type4(Type::TENSOR_INT32, {4}); 9987 OperandType type5(Type::INT32, {}); 9988 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 9989 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 9990 // Phase 1, operands 9991 auto op1 = model->addOperand(&type62); 9992 auto op2 = model->addOperand(&type2); 9993 auto op3 = model->addOperand(&type3); 9994 auto shape = model->addOperand(&type4); 9995 auto param = model->addOperand(&type5); 9996 auto param1 = model->addOperand(&type5); 9997 auto param2 = model->addOperand(&type5); 9998 auto act = model->addOperand(&type5); 9999 auto layout = model->addOperand(&type0); 10000 auto op4 = model->addOperand(&type88); 10001 // Phase 2, operations 10002 static int32_t shape_init[] = {1, 2, 5, 5}; 10003 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10004 static int32_t param_init[] = {2}; 10005 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10006 static int32_t param1_init[] = {2}; 10007 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10008 static int32_t param2_init[] = {2}; 10009 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10010 static int32_t act_init[] = {3}; 10011 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10012 static bool8 layout_init[] = {true}; 10013 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10014 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10015 // Phase 3, inputs and outputs 10016 model->identifyInputsAndOutputs( 10017 {op1, op2, op3}, 10018 {op4}); 10019 assert(model->isValid()); 10020 } 10021 10022 inline bool is_ignored_dynamic_output_shape_nchw_relu6_weight_as_input(int i) { 10023 static std::set<int> ignore = {}; 10024 return ignore.find(i) != ignore.end(); 10025 } 10026 10027 void CreateModel_dynamic_output_shape_nchw_relu6_relaxed(Model *model) { 10028 OperandType type0(Type::BOOL, {}); 10029 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 10030 OperandType type3(Type::TENSOR_FLOAT32, {2}); 10031 OperandType type4(Type::TENSOR_INT32, {4}); 10032 OperandType type5(Type::INT32, {}); 10033 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 10034 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 10035 // Phase 1, operands 10036 auto op1 = model->addOperand(&type62); 10037 auto op2 = model->addOperand(&type2); 10038 auto op3 = model->addOperand(&type3); 10039 auto shape = model->addOperand(&type4); 10040 auto param = model->addOperand(&type5); 10041 auto param1 = model->addOperand(&type5); 10042 auto param2 = model->addOperand(&type5); 10043 auto act = model->addOperand(&type5); 10044 auto layout = model->addOperand(&type0); 10045 auto op4 = model->addOperand(&type88); 10046 // Phase 2, operations 10047 static float op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 10048 model->setOperandValue(op2, op2_init, sizeof(float) * 18); 10049 static float op3_init[] = {-1.5f, -2.0f}; 10050 model->setOperandValue(op3, op3_init, sizeof(float) * 2); 10051 static int32_t shape_init[] = {1, 2, 5, 5}; 10052 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10053 static int32_t param_init[] = {2}; 10054 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10055 static int32_t param1_init[] = {2}; 10056 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10057 static int32_t param2_init[] = {2}; 10058 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10059 static int32_t act_init[] = {3}; 10060 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10061 static bool8 layout_init[] = {true}; 10062 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10063 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10064 // Phase 3, inputs and outputs 10065 model->identifyInputsAndOutputs( 10066 {op1}, 10067 {op4}); 10068 // Phase 4: set relaxed execution 10069 model->relaxComputationFloat32toFloat16(true); 10070 assert(model->isValid()); 10071 } 10072 10073 inline bool is_ignored_dynamic_output_shape_nchw_relu6_relaxed(int i) { 10074 static std::set<int> ignore = {}; 10075 return ignore.find(i) != ignore.end(); 10076 } 10077 10078 void CreateModel_dynamic_output_shape_nchw_relu6_relaxed_weight_as_input(Model *model) { 10079 OperandType type0(Type::BOOL, {}); 10080 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 10081 OperandType type3(Type::TENSOR_FLOAT32, {2}); 10082 OperandType type4(Type::TENSOR_INT32, {4}); 10083 OperandType type5(Type::INT32, {}); 10084 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 10085 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 10086 // Phase 1, operands 10087 auto op1 = model->addOperand(&type62); 10088 auto op2 = model->addOperand(&type2); 10089 auto op3 = model->addOperand(&type3); 10090 auto shape = model->addOperand(&type4); 10091 auto param = model->addOperand(&type5); 10092 auto param1 = model->addOperand(&type5); 10093 auto param2 = model->addOperand(&type5); 10094 auto act = model->addOperand(&type5); 10095 auto layout = model->addOperand(&type0); 10096 auto op4 = model->addOperand(&type88); 10097 // Phase 2, operations 10098 static int32_t shape_init[] = {1, 2, 5, 5}; 10099 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10100 static int32_t param_init[] = {2}; 10101 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10102 static int32_t param1_init[] = {2}; 10103 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10104 static int32_t param2_init[] = {2}; 10105 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10106 static int32_t act_init[] = {3}; 10107 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10108 static bool8 layout_init[] = {true}; 10109 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10110 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10111 // Phase 3, inputs and outputs 10112 model->identifyInputsAndOutputs( 10113 {op1, op2, op3}, 10114 {op4}); 10115 // Phase 4: set relaxed execution 10116 model->relaxComputationFloat32toFloat16(true); 10117 assert(model->isValid()); 10118 } 10119 10120 inline bool is_ignored_dynamic_output_shape_nchw_relu6_relaxed_weight_as_input(int i) { 10121 static std::set<int> ignore = {}; 10122 return ignore.find(i) != ignore.end(); 10123 } 10124 10125 void CreateModel_dynamic_output_shape_nchw_relu6_quant8(Model *model) { 10126 OperandType type0(Type::BOOL, {}); 10127 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 10128 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 10129 OperandType type4(Type::TENSOR_INT32, {4}); 10130 OperandType type5(Type::INT32, {}); 10131 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 10132 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 10133 // Phase 1, operands 10134 auto op1 = model->addOperand(&type64); 10135 auto op2 = model->addOperand(&type28); 10136 auto op3 = model->addOperand(&type29); 10137 auto shape = model->addOperand(&type4); 10138 auto param = model->addOperand(&type5); 10139 auto param1 = model->addOperand(&type5); 10140 auto param2 = model->addOperand(&type5); 10141 auto act = model->addOperand(&type5); 10142 auto layout = model->addOperand(&type0); 10143 auto op4 = model->addOperand(&type89); 10144 // Phase 2, operations 10145 static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 10146 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 10147 static int32_t op3_init[] = {-6, -8}; 10148 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 10149 static int32_t shape_init[] = {1, 2, 5, 5}; 10150 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10151 static int32_t param_init[] = {2}; 10152 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10153 static int32_t param1_init[] = {2}; 10154 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10155 static int32_t param2_init[] = {2}; 10156 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10157 static int32_t act_init[] = {3}; 10158 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10159 static bool8 layout_init[] = {true}; 10160 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10161 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10162 // Phase 3, inputs and outputs 10163 model->identifyInputsAndOutputs( 10164 {op1}, 10165 {op4}); 10166 assert(model->isValid()); 10167 } 10168 10169 inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8(int i) { 10170 static std::set<int> ignore = {}; 10171 return ignore.find(i) != ignore.end(); 10172 } 10173 10174 void CreateModel_dynamic_output_shape_nchw_relu6_quant8_weight_as_input(Model *model) { 10175 OperandType type0(Type::BOOL, {}); 10176 OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); 10177 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 10178 OperandType type4(Type::TENSOR_INT32, {4}); 10179 OperandType type5(Type::INT32, {}); 10180 OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); 10181 OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); 10182 // Phase 1, operands 10183 auto op1 = model->addOperand(&type64); 10184 auto op2 = model->addOperand(&type28); 10185 auto op3 = model->addOperand(&type29); 10186 auto shape = model->addOperand(&type4); 10187 auto param = model->addOperand(&type5); 10188 auto param1 = model->addOperand(&type5); 10189 auto param2 = model->addOperand(&type5); 10190 auto act = model->addOperand(&type5); 10191 auto layout = model->addOperand(&type0); 10192 auto op4 = model->addOperand(&type89); 10193 // Phase 2, operations 10194 static int32_t shape_init[] = {1, 2, 5, 5}; 10195 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10196 static int32_t param_init[] = {2}; 10197 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10198 static int32_t param1_init[] = {2}; 10199 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10200 static int32_t param2_init[] = {2}; 10201 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10202 static int32_t act_init[] = {3}; 10203 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10204 static bool8 layout_init[] = {true}; 10205 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10206 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10207 // Phase 3, inputs and outputs 10208 model->identifyInputsAndOutputs( 10209 {op1, op2, op3}, 10210 {op4}); 10211 assert(model->isValid()); 10212 } 10213 10214 inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8_weight_as_input(int i) { 10215 static std::set<int> ignore = {}; 10216 return ignore.find(i) != ignore.end(); 10217 } 10218 10219 void CreateModel_dynamic_output_shape_nchw_relu6_quant8_2(Model *model) { 10220 OperandType type0(Type::BOOL, {}); 10221 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 10222 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 10223 OperandType type4(Type::TENSOR_INT32, {4}); 10224 OperandType type5(Type::INT32, {}); 10225 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 10226 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 10227 // Phase 1, operands 10228 auto op1 = model->addOperand(&type66); 10229 auto op2 = model->addOperand(&type32); 10230 auto op3 = model->addOperand(&type29); 10231 auto shape = model->addOperand(&type4); 10232 auto param = model->addOperand(&type5); 10233 auto param1 = model->addOperand(&type5); 10234 auto param2 = model->addOperand(&type5); 10235 auto act = model->addOperand(&type5); 10236 auto layout = model->addOperand(&type0); 10237 auto op4 = model->addOperand(&type90); 10238 // Phase 2, operations 10239 static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; 10240 model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); 10241 static int32_t op3_init[] = {-6, -8}; 10242 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 10243 static int32_t shape_init[] = {1, 2, 5, 5}; 10244 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10245 static int32_t param_init[] = {2}; 10246 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10247 static int32_t param1_init[] = {2}; 10248 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10249 static int32_t param2_init[] = {2}; 10250 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10251 static int32_t act_init[] = {3}; 10252 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10253 static bool8 layout_init[] = {true}; 10254 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10255 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10256 // Phase 3, inputs and outputs 10257 model->identifyInputsAndOutputs( 10258 {op1}, 10259 {op4}); 10260 assert(model->isValid()); 10261 } 10262 10263 inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8_2(int i) { 10264 static std::set<int> ignore = {}; 10265 return ignore.find(i) != ignore.end(); 10266 } 10267 10268 void CreateModel_dynamic_output_shape_nchw_relu6_quant8_weight_as_input_2(Model *model) { 10269 OperandType type0(Type::BOOL, {}); 10270 OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); 10271 OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); 10272 OperandType type4(Type::TENSOR_INT32, {4}); 10273 OperandType type5(Type::INT32, {}); 10274 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 10275 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 10276 // Phase 1, operands 10277 auto op1 = model->addOperand(&type66); 10278 auto op2 = model->addOperand(&type32); 10279 auto op3 = model->addOperand(&type29); 10280 auto shape = model->addOperand(&type4); 10281 auto param = model->addOperand(&type5); 10282 auto param1 = model->addOperand(&type5); 10283 auto param2 = model->addOperand(&type5); 10284 auto act = model->addOperand(&type5); 10285 auto layout = model->addOperand(&type0); 10286 auto op4 = model->addOperand(&type90); 10287 // Phase 2, operations 10288 static int32_t shape_init[] = {1, 2, 5, 5}; 10289 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10290 static int32_t param_init[] = {2}; 10291 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10292 static int32_t param1_init[] = {2}; 10293 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10294 static int32_t param2_init[] = {2}; 10295 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10296 static int32_t act_init[] = {3}; 10297 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10298 static bool8 layout_init[] = {true}; 10299 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10300 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10301 // Phase 3, inputs and outputs 10302 model->identifyInputsAndOutputs( 10303 {op1, op2, op3}, 10304 {op4}); 10305 assert(model->isValid()); 10306 } 10307 10308 inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8_weight_as_input_2(int i) { 10309 static std::set<int> ignore = {}; 10310 return ignore.find(i) != ignore.end(); 10311 } 10312 10313 void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8(Model *model) { 10314 OperandType type0(Type::BOOL, {}); 10315 OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 10316 OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); 10317 OperandType type4(Type::TENSOR_INT32, {4}); 10318 OperandType type5(Type::INT32, {}); 10319 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 10320 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 10321 // Phase 1, operands 10322 auto op1 = model->addOperand(&type68); 10323 auto op2 = model->addOperand(&type35); 10324 auto op3 = model->addOperand(&type36); 10325 auto shape = model->addOperand(&type4); 10326 auto param = model->addOperand(&type5); 10327 auto param1 = model->addOperand(&type5); 10328 auto param2 = model->addOperand(&type5); 10329 auto act = model->addOperand(&type5); 10330 auto layout = model->addOperand(&type0); 10331 auto op4 = model->addOperand(&type91); 10332 // Phase 2, operations 10333 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 10334 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 10335 static int32_t op3_init[] = {-24, -16}; 10336 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 10337 static int32_t shape_init[] = {1, 2, 5, 5}; 10338 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10339 static int32_t param_init[] = {2}; 10340 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10341 static int32_t param1_init[] = {2}; 10342 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10343 static int32_t param2_init[] = {2}; 10344 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10345 static int32_t act_init[] = {3}; 10346 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10347 static bool8 layout_init[] = {true}; 10348 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10349 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10350 // Phase 3, inputs and outputs 10351 model->identifyInputsAndOutputs( 10352 {op1}, 10353 {op4}); 10354 assert(model->isValid()); 10355 } 10356 10357 inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8(int i) { 10358 static std::set<int> ignore = {}; 10359 return ignore.find(i) != ignore.end(); 10360 } 10361 10362 void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input(Model *model) { 10363 OperandType type0(Type::BOOL, {}); 10364 OperandType type121(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 10365 OperandType type122(Type::TENSOR_INT32, {2}, 0.0f, 0); 10366 OperandType type4(Type::TENSOR_INT32, {4}); 10367 OperandType type5(Type::INT32, {}); 10368 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 10369 OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); 10370 // Phase 1, operands 10371 auto op1 = model->addOperand(&type68); 10372 auto op2 = model->addOperand(&type121); 10373 auto op3 = model->addOperand(&type122); 10374 auto shape = model->addOperand(&type4); 10375 auto param = model->addOperand(&type5); 10376 auto param1 = model->addOperand(&type5); 10377 auto param2 = model->addOperand(&type5); 10378 auto act = model->addOperand(&type5); 10379 auto layout = model->addOperand(&type0); 10380 auto op4 = model->addOperand(&type91); 10381 // Phase 2, operations 10382 static int32_t shape_init[] = {1, 2, 5, 5}; 10383 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10384 static int32_t param_init[] = {2}; 10385 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10386 static int32_t param1_init[] = {2}; 10387 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10388 static int32_t param2_init[] = {2}; 10389 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10390 static int32_t act_init[] = {3}; 10391 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10392 static bool8 layout_init[] = {true}; 10393 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10394 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10395 // Phase 3, inputs and outputs 10396 model->identifyInputsAndOutputs( 10397 {op1, op2, op3}, 10398 {op4}); 10399 assert(model->isValid()); 10400 } 10401 10402 inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input(int i) { 10403 static std::set<int> ignore = {}; 10404 return ignore.find(i) != ignore.end(); 10405 } 10406 10407 void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8_2(Model *model) { 10408 OperandType type0(Type::BOOL, {}); 10409 OperandType type4(Type::TENSOR_INT32, {4}); 10410 OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 10411 OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); 10412 OperandType type5(Type::INT32, {}); 10413 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 10414 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 10415 // Phase 1, operands 10416 auto op1 = model->addOperand(&type68); 10417 auto op2 = model->addOperand(&type40); 10418 auto op3 = model->addOperand(&type41); 10419 auto shape = model->addOperand(&type4); 10420 auto param = model->addOperand(&type5); 10421 auto param1 = model->addOperand(&type5); 10422 auto param2 = model->addOperand(&type5); 10423 auto act = model->addOperand(&type5); 10424 auto layout = model->addOperand(&type0); 10425 auto op4 = model->addOperand(&type90); 10426 // Phase 2, operations 10427 static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; 10428 model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); 10429 static int32_t op3_init[] = {-24, -16}; 10430 model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); 10431 static int32_t shape_init[] = {1, 2, 5, 5}; 10432 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10433 static int32_t param_init[] = {2}; 10434 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10435 static int32_t param1_init[] = {2}; 10436 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10437 static int32_t param2_init[] = {2}; 10438 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10439 static int32_t act_init[] = {3}; 10440 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10441 static bool8 layout_init[] = {true}; 10442 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10443 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10444 // Phase 3, inputs and outputs 10445 model->identifyInputsAndOutputs( 10446 {op1}, 10447 {op4}); 10448 assert(model->isValid()); 10449 } 10450 10451 inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8_2(int i) { 10452 static std::set<int> ignore = {}; 10453 return ignore.find(i) != ignore.end(); 10454 } 10455 10456 void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input_2(Model *model) { 10457 OperandType type0(Type::BOOL, {}); 10458 OperandType type123(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f, 0.5f},0)); 10459 OperandType type124(Type::TENSOR_INT32, {2}, 0.0f, 0); 10460 OperandType type4(Type::TENSOR_INT32, {4}); 10461 OperandType type5(Type::INT32, {}); 10462 OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); 10463 OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); 10464 // Phase 1, operands 10465 auto op1 = model->addOperand(&type68); 10466 auto op2 = model->addOperand(&type123); 10467 auto op3 = model->addOperand(&type124); 10468 auto shape = model->addOperand(&type4); 10469 auto param = model->addOperand(&type5); 10470 auto param1 = model->addOperand(&type5); 10471 auto param2 = model->addOperand(&type5); 10472 auto act = model->addOperand(&type5); 10473 auto layout = model->addOperand(&type0); 10474 auto op4 = model->addOperand(&type90); 10475 // Phase 2, operations 10476 static int32_t shape_init[] = {1, 2, 5, 5}; 10477 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10478 static int32_t param_init[] = {2}; 10479 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10480 static int32_t param1_init[] = {2}; 10481 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10482 static int32_t param2_init[] = {2}; 10483 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10484 static int32_t act_init[] = {3}; 10485 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10486 static bool8 layout_init[] = {true}; 10487 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10488 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10489 // Phase 3, inputs and outputs 10490 model->identifyInputsAndOutputs( 10491 {op1, op2, op3}, 10492 {op4}); 10493 assert(model->isValid()); 10494 } 10495 10496 inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input_2(int i) { 10497 static std::set<int> ignore = {}; 10498 return ignore.find(i) != ignore.end(); 10499 } 10500 10501 void CreateModel_dynamic_output_shape_nchw_relu6_float16(Model *model) { 10502 OperandType type0(Type::BOOL, {}); 10503 OperandType type4(Type::TENSOR_INT32, {4}); 10504 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 10505 OperandType type46(Type::TENSOR_FLOAT16, {2}); 10506 OperandType type5(Type::INT32, {}); 10507 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 10508 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 10509 // Phase 1, operands 10510 auto op1 = model->addOperand(&type74); 10511 auto op2 = model->addOperand(&type45); 10512 auto op3 = model->addOperand(&type46); 10513 auto shape = model->addOperand(&type4); 10514 auto param = model->addOperand(&type5); 10515 auto param1 = model->addOperand(&type5); 10516 auto param2 = model->addOperand(&type5); 10517 auto act = model->addOperand(&type5); 10518 auto layout = model->addOperand(&type0); 10519 auto op4 = model->addOperand(&type96); 10520 // Phase 2, operations 10521 static _Float16 op2_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 13.0f, 15.0f, 17.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, 18.0f}; 10522 model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); 10523 static _Float16 op3_init[] = {-1.5f, -2.0f}; 10524 model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); 10525 static int32_t shape_init[] = {1, 2, 5, 5}; 10526 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10527 static int32_t param_init[] = {2}; 10528 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10529 static int32_t param1_init[] = {2}; 10530 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10531 static int32_t param2_init[] = {2}; 10532 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10533 static int32_t act_init[] = {3}; 10534 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10535 static bool8 layout_init[] = {true}; 10536 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10537 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10538 // Phase 3, inputs and outputs 10539 model->identifyInputsAndOutputs( 10540 {op1}, 10541 {op4}); 10542 assert(model->isValid()); 10543 } 10544 10545 inline bool is_ignored_dynamic_output_shape_nchw_relu6_float16(int i) { 10546 static std::set<int> ignore = {}; 10547 return ignore.find(i) != ignore.end(); 10548 } 10549 10550 void CreateModel_dynamic_output_shape_nchw_relu6_float16_weight_as_input(Model *model) { 10551 OperandType type0(Type::BOOL, {}); 10552 OperandType type4(Type::TENSOR_INT32, {4}); 10553 OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 10554 OperandType type49(Type::TENSOR_FLOAT16, {2}); 10555 OperandType type5(Type::INT32, {}); 10556 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 10557 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 10558 // Phase 1, operands 10559 auto op1 = model->addOperand(&type74); 10560 auto op2 = model->addOperand(&type48); 10561 auto op3 = model->addOperand(&type49); 10562 auto shape = model->addOperand(&type4); 10563 auto param = model->addOperand(&type5); 10564 auto param1 = model->addOperand(&type5); 10565 auto param2 = model->addOperand(&type5); 10566 auto act = model->addOperand(&type5); 10567 auto layout = model->addOperand(&type0); 10568 auto op4 = model->addOperand(&type96); 10569 // Phase 2, operations 10570 static int32_t shape_init[] = {1, 2, 5, 5}; 10571 model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); 10572 static int32_t param_init[] = {2}; 10573 model->setOperandValue(param, param_init, sizeof(int32_t) * 1); 10574 static int32_t param1_init[] = {2}; 10575 model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); 10576 static int32_t param2_init[] = {2}; 10577 model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); 10578 static int32_t act_init[] = {3}; 10579 model->setOperandValue(act, act_init, sizeof(int32_t) * 1); 10580 static bool8 layout_init[] = {true}; 10581 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10582 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); 10583 // Phase 3, inputs and outputs 10584 model->identifyInputsAndOutputs( 10585 {op1, op2, op3}, 10586 {op4}); 10587 assert(model->isValid()); 10588 } 10589 10590 inline bool is_ignored_dynamic_output_shape_nchw_relu6_float16_weight_as_input(int i) { 10591 static std::set<int> ignore = {}; 10592 return ignore.find(i) != ignore.end(); 10593 } 10594 10595 void CreateModel_nhwc(Model *model) { 10596 OperandType type0(Type::BOOL, {}); 10597 OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 10598 OperandType type4(Type::TENSOR_INT32, {4}); 10599 OperandType type5(Type::INT32, {}); 10600 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 10601 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 10602 OperandType type9(Type::TENSOR_FLOAT32, {1}); 10603 // Phase 1, operands 10604 auto op11 = model->addOperand(&type7); 10605 auto op21 = model->addOperand(&type8); 10606 auto op31 = model->addOperand(&type9); 10607 auto shape1 = model->addOperand(&type4); 10608 auto param3 = model->addOperand(&type5); 10609 auto param4 = model->addOperand(&type5); 10610 auto param5 = model->addOperand(&type5); 10611 auto param6 = model->addOperand(&type5); 10612 auto layout = model->addOperand(&type0); 10613 auto op41 = model->addOperand(&type10); 10614 // Phase 2, operations 10615 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 10616 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 10617 static float op31_init[] = {-1000.0f}; 10618 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 10619 static int32_t shape1_init[] = {1, 3, 4, 1}; 10620 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10621 static int32_t param3_init[] = {1}; 10622 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10623 static int32_t param4_init[] = {3}; 10624 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10625 static int32_t param5_init[] = {3}; 10626 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10627 static int32_t param6_init[] = {1}; 10628 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10629 static bool8 layout_init[] = {false}; 10630 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10631 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10632 // Phase 3, inputs and outputs 10633 model->identifyInputsAndOutputs( 10634 {op11}, 10635 {op41}); 10636 assert(model->isValid()); 10637 } 10638 10639 inline bool is_ignored_nhwc(int i) { 10640 static std::set<int> ignore = {}; 10641 return ignore.find(i) != ignore.end(); 10642 } 10643 10644 void CreateModel_nhwc_weight_as_input(Model *model) { 10645 OperandType type0(Type::BOOL, {}); 10646 OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 10647 OperandType type4(Type::TENSOR_INT32, {4}); 10648 OperandType type5(Type::INT32, {}); 10649 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 10650 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 10651 OperandType type9(Type::TENSOR_FLOAT32, {1}); 10652 // Phase 1, operands 10653 auto op11 = model->addOperand(&type7); 10654 auto op21 = model->addOperand(&type8); 10655 auto op31 = model->addOperand(&type9); 10656 auto shape1 = model->addOperand(&type4); 10657 auto param3 = model->addOperand(&type5); 10658 auto param4 = model->addOperand(&type5); 10659 auto param5 = model->addOperand(&type5); 10660 auto param6 = model->addOperand(&type5); 10661 auto layout = model->addOperand(&type0); 10662 auto op41 = model->addOperand(&type10); 10663 // Phase 2, operations 10664 static int32_t shape1_init[] = {1, 3, 4, 1}; 10665 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10666 static int32_t param3_init[] = {1}; 10667 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10668 static int32_t param4_init[] = {3}; 10669 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10670 static int32_t param5_init[] = {3}; 10671 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10672 static int32_t param6_init[] = {1}; 10673 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10674 static bool8 layout_init[] = {false}; 10675 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10676 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10677 // Phase 3, inputs and outputs 10678 model->identifyInputsAndOutputs( 10679 {op11, op21, op31}, 10680 {op41}); 10681 assert(model->isValid()); 10682 } 10683 10684 inline bool is_ignored_nhwc_weight_as_input(int i) { 10685 static std::set<int> ignore = {}; 10686 return ignore.find(i) != ignore.end(); 10687 } 10688 10689 void CreateModel_nhwc_relaxed(Model *model) { 10690 OperandType type0(Type::BOOL, {}); 10691 OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 10692 OperandType type4(Type::TENSOR_INT32, {4}); 10693 OperandType type5(Type::INT32, {}); 10694 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 10695 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 10696 OperandType type9(Type::TENSOR_FLOAT32, {1}); 10697 // Phase 1, operands 10698 auto op11 = model->addOperand(&type7); 10699 auto op21 = model->addOperand(&type8); 10700 auto op31 = model->addOperand(&type9); 10701 auto shape1 = model->addOperand(&type4); 10702 auto param3 = model->addOperand(&type5); 10703 auto param4 = model->addOperand(&type5); 10704 auto param5 = model->addOperand(&type5); 10705 auto param6 = model->addOperand(&type5); 10706 auto layout = model->addOperand(&type0); 10707 auto op41 = model->addOperand(&type10); 10708 // Phase 2, operations 10709 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 10710 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 10711 static float op31_init[] = {-1000.0f}; 10712 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 10713 static int32_t shape1_init[] = {1, 3, 4, 1}; 10714 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10715 static int32_t param3_init[] = {1}; 10716 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10717 static int32_t param4_init[] = {3}; 10718 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10719 static int32_t param5_init[] = {3}; 10720 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10721 static int32_t param6_init[] = {1}; 10722 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10723 static bool8 layout_init[] = {false}; 10724 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10725 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10726 // Phase 3, inputs and outputs 10727 model->identifyInputsAndOutputs( 10728 {op11}, 10729 {op41}); 10730 // Phase 4: set relaxed execution 10731 model->relaxComputationFloat32toFloat16(true); 10732 assert(model->isValid()); 10733 } 10734 10735 inline bool is_ignored_nhwc_relaxed(int i) { 10736 static std::set<int> ignore = {}; 10737 return ignore.find(i) != ignore.end(); 10738 } 10739 10740 void CreateModel_nhwc_relaxed_weight_as_input(Model *model) { 10741 OperandType type0(Type::BOOL, {}); 10742 OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); 10743 OperandType type4(Type::TENSOR_INT32, {4}); 10744 OperandType type5(Type::INT32, {}); 10745 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 10746 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 10747 OperandType type9(Type::TENSOR_FLOAT32, {1}); 10748 // Phase 1, operands 10749 auto op11 = model->addOperand(&type7); 10750 auto op21 = model->addOperand(&type8); 10751 auto op31 = model->addOperand(&type9); 10752 auto shape1 = model->addOperand(&type4); 10753 auto param3 = model->addOperand(&type5); 10754 auto param4 = model->addOperand(&type5); 10755 auto param5 = model->addOperand(&type5); 10756 auto param6 = model->addOperand(&type5); 10757 auto layout = model->addOperand(&type0); 10758 auto op41 = model->addOperand(&type10); 10759 // Phase 2, operations 10760 static int32_t shape1_init[] = {1, 3, 4, 1}; 10761 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10762 static int32_t param3_init[] = {1}; 10763 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10764 static int32_t param4_init[] = {3}; 10765 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10766 static int32_t param5_init[] = {3}; 10767 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10768 static int32_t param6_init[] = {1}; 10769 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10770 static bool8 layout_init[] = {false}; 10771 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10772 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10773 // Phase 3, inputs and outputs 10774 model->identifyInputsAndOutputs( 10775 {op11, op21, op31}, 10776 {op41}); 10777 // Phase 4: set relaxed execution 10778 model->relaxComputationFloat32toFloat16(true); 10779 assert(model->isValid()); 10780 } 10781 10782 inline bool is_ignored_nhwc_relaxed_weight_as_input(int i) { 10783 static std::set<int> ignore = {}; 10784 return ignore.find(i) != ignore.end(); 10785 } 10786 10787 void CreateModel_nhwc_quant8(Model *model) { 10788 OperandType type0(Type::BOOL, {}); 10789 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 10790 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 10791 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 10792 OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); 10793 OperandType type4(Type::TENSOR_INT32, {4}); 10794 OperandType type5(Type::INT32, {}); 10795 // Phase 1, operands 10796 auto op11 = model->addOperand(&type125); 10797 auto op21 = model->addOperand(&type126); 10798 auto op31 = model->addOperand(&type127); 10799 auto shape1 = model->addOperand(&type4); 10800 auto param3 = model->addOperand(&type5); 10801 auto param4 = model->addOperand(&type5); 10802 auto param5 = model->addOperand(&type5); 10803 auto param6 = model->addOperand(&type5); 10804 auto layout = model->addOperand(&type0); 10805 auto op41 = model->addOperand(&type128); 10806 // Phase 2, operations 10807 static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; 10808 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 10809 static int32_t op31_init[] = {-2000}; 10810 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 10811 static int32_t shape1_init[] = {1, 3, 4, 1}; 10812 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10813 static int32_t param3_init[] = {1}; 10814 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10815 static int32_t param4_init[] = {3}; 10816 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10817 static int32_t param5_init[] = {3}; 10818 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10819 static int32_t param6_init[] = {1}; 10820 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10821 static bool8 layout_init[] = {false}; 10822 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10823 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10824 // Phase 3, inputs and outputs 10825 model->identifyInputsAndOutputs( 10826 {op11}, 10827 {op41}); 10828 assert(model->isValid()); 10829 } 10830 10831 inline bool is_ignored_nhwc_quant8(int i) { 10832 static std::set<int> ignore = {}; 10833 return ignore.find(i) != ignore.end(); 10834 } 10835 10836 void CreateModel_nhwc_quant8_weight_as_input(Model *model) { 10837 OperandType type0(Type::BOOL, {}); 10838 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 10839 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 10840 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 10841 OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); 10842 OperandType type4(Type::TENSOR_INT32, {4}); 10843 OperandType type5(Type::INT32, {}); 10844 // Phase 1, operands 10845 auto op11 = model->addOperand(&type125); 10846 auto op21 = model->addOperand(&type126); 10847 auto op31 = model->addOperand(&type127); 10848 auto shape1 = model->addOperand(&type4); 10849 auto param3 = model->addOperand(&type5); 10850 auto param4 = model->addOperand(&type5); 10851 auto param5 = model->addOperand(&type5); 10852 auto param6 = model->addOperand(&type5); 10853 auto layout = model->addOperand(&type0); 10854 auto op41 = model->addOperand(&type128); 10855 // Phase 2, operations 10856 static int32_t shape1_init[] = {1, 3, 4, 1}; 10857 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10858 static int32_t param3_init[] = {1}; 10859 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10860 static int32_t param4_init[] = {3}; 10861 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10862 static int32_t param5_init[] = {3}; 10863 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10864 static int32_t param6_init[] = {1}; 10865 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10866 static bool8 layout_init[] = {false}; 10867 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10868 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10869 // Phase 3, inputs and outputs 10870 model->identifyInputsAndOutputs( 10871 {op11, op21, op31}, 10872 {op41}); 10873 assert(model->isValid()); 10874 } 10875 10876 inline bool is_ignored_nhwc_quant8_weight_as_input(int i) { 10877 static std::set<int> ignore = {}; 10878 return ignore.find(i) != ignore.end(); 10879 } 10880 10881 void CreateModel_nhwc_channelQuant8(Model *model) { 10882 OperandType type0(Type::BOOL, {}); 10883 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 10884 OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); 10885 OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 10886 OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); 10887 OperandType type4(Type::TENSOR_INT32, {4}); 10888 OperandType type5(Type::INT32, {}); 10889 // Phase 1, operands 10890 auto op11 = model->addOperand(&type125); 10891 auto op21 = model->addOperand(&type129); 10892 auto op31 = model->addOperand(&type130); 10893 auto shape1 = model->addOperand(&type4); 10894 auto param3 = model->addOperand(&type5); 10895 auto param4 = model->addOperand(&type5); 10896 auto param5 = model->addOperand(&type5); 10897 auto param6 = model->addOperand(&type5); 10898 auto layout = model->addOperand(&type0); 10899 auto op41 = model->addOperand(&type128); 10900 // Phase 2, operations 10901 static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; 10902 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 10903 static int32_t op31_init[] = {-2000}; 10904 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 10905 static int32_t shape1_init[] = {1, 3, 4, 1}; 10906 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10907 static int32_t param3_init[] = {1}; 10908 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10909 static int32_t param4_init[] = {3}; 10910 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10911 static int32_t param5_init[] = {3}; 10912 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10913 static int32_t param6_init[] = {1}; 10914 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10915 static bool8 layout_init[] = {false}; 10916 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10917 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10918 // Phase 3, inputs and outputs 10919 model->identifyInputsAndOutputs( 10920 {op11}, 10921 {op41}); 10922 assert(model->isValid()); 10923 } 10924 10925 inline bool is_ignored_nhwc_channelQuant8(int i) { 10926 static std::set<int> ignore = {}; 10927 return ignore.find(i) != ignore.end(); 10928 } 10929 10930 void CreateModel_nhwc_channelQuant8_weight_as_input(Model *model) { 10931 OperandType type0(Type::BOOL, {}); 10932 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 10933 OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); 10934 OperandType type131(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 10935 OperandType type132(Type::TENSOR_INT32, {1}, 0.0f, 0); 10936 OperandType type4(Type::TENSOR_INT32, {4}); 10937 OperandType type5(Type::INT32, {}); 10938 // Phase 1, operands 10939 auto op11 = model->addOperand(&type125); 10940 auto op21 = model->addOperand(&type131); 10941 auto op31 = model->addOperand(&type132); 10942 auto shape1 = model->addOperand(&type4); 10943 auto param3 = model->addOperand(&type5); 10944 auto param4 = model->addOperand(&type5); 10945 auto param5 = model->addOperand(&type5); 10946 auto param6 = model->addOperand(&type5); 10947 auto layout = model->addOperand(&type0); 10948 auto op41 = model->addOperand(&type128); 10949 // Phase 2, operations 10950 static int32_t shape1_init[] = {1, 3, 4, 1}; 10951 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 10952 static int32_t param3_init[] = {1}; 10953 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 10954 static int32_t param4_init[] = {3}; 10955 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 10956 static int32_t param5_init[] = {3}; 10957 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 10958 static int32_t param6_init[] = {1}; 10959 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 10960 static bool8 layout_init[] = {false}; 10961 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 10962 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 10963 // Phase 3, inputs and outputs 10964 model->identifyInputsAndOutputs( 10965 {op11, op21, op31}, 10966 {op41}); 10967 assert(model->isValid()); 10968 } 10969 10970 inline bool is_ignored_nhwc_channelQuant8_weight_as_input(int i) { 10971 static std::set<int> ignore = {}; 10972 return ignore.find(i) != ignore.end(); 10973 } 10974 10975 void CreateModel_nhwc_float16(Model *model) { 10976 OperandType type0(Type::BOOL, {}); 10977 OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); 10978 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 10979 OperandType type135(Type::TENSOR_FLOAT16, {1}); 10980 OperandType type136(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); 10981 OperandType type4(Type::TENSOR_INT32, {4}); 10982 OperandType type5(Type::INT32, {}); 10983 // Phase 1, operands 10984 auto op11 = model->addOperand(&type133); 10985 auto op21 = model->addOperand(&type134); 10986 auto op31 = model->addOperand(&type135); 10987 auto shape1 = model->addOperand(&type4); 10988 auto param3 = model->addOperand(&type5); 10989 auto param4 = model->addOperand(&type5); 10990 auto param5 = model->addOperand(&type5); 10991 auto param6 = model->addOperand(&type5); 10992 auto layout = model->addOperand(&type0); 10993 auto op41 = model->addOperand(&type136); 10994 // Phase 2, operations 10995 static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 10996 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 10997 static _Float16 op31_init[] = {-1000.0f}; 10998 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 10999 static int32_t shape1_init[] = {1, 3, 4, 1}; 11000 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11001 static int32_t param3_init[] = {1}; 11002 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11003 static int32_t param4_init[] = {3}; 11004 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11005 static int32_t param5_init[] = {3}; 11006 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11007 static int32_t param6_init[] = {1}; 11008 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11009 static bool8 layout_init[] = {false}; 11010 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11011 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11012 // Phase 3, inputs and outputs 11013 model->identifyInputsAndOutputs( 11014 {op11}, 11015 {op41}); 11016 assert(model->isValid()); 11017 } 11018 11019 inline bool is_ignored_nhwc_float16(int i) { 11020 static std::set<int> ignore = {}; 11021 return ignore.find(i) != ignore.end(); 11022 } 11023 11024 void CreateModel_nhwc_float16_weight_as_input(Model *model) { 11025 OperandType type0(Type::BOOL, {}); 11026 OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); 11027 OperandType type136(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); 11028 OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 11029 OperandType type138(Type::TENSOR_FLOAT16, {1}); 11030 OperandType type4(Type::TENSOR_INT32, {4}); 11031 OperandType type5(Type::INT32, {}); 11032 // Phase 1, operands 11033 auto op11 = model->addOperand(&type133); 11034 auto op21 = model->addOperand(&type137); 11035 auto op31 = model->addOperand(&type138); 11036 auto shape1 = model->addOperand(&type4); 11037 auto param3 = model->addOperand(&type5); 11038 auto param4 = model->addOperand(&type5); 11039 auto param5 = model->addOperand(&type5); 11040 auto param6 = model->addOperand(&type5); 11041 auto layout = model->addOperand(&type0); 11042 auto op41 = model->addOperand(&type136); 11043 // Phase 2, operations 11044 static int32_t shape1_init[] = {1, 3, 4, 1}; 11045 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11046 static int32_t param3_init[] = {1}; 11047 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11048 static int32_t param4_init[] = {3}; 11049 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11050 static int32_t param5_init[] = {3}; 11051 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11052 static int32_t param6_init[] = {1}; 11053 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11054 static bool8 layout_init[] = {false}; 11055 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11056 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11057 // Phase 3, inputs and outputs 11058 model->identifyInputsAndOutputs( 11059 {op11, op21, op31}, 11060 {op41}); 11061 assert(model->isValid()); 11062 } 11063 11064 inline bool is_ignored_nhwc_float16_weight_as_input(int i) { 11065 static std::set<int> ignore = {}; 11066 return ignore.find(i) != ignore.end(); 11067 } 11068 11069 void CreateModel_nchw(Model *model) { 11070 OperandType type0(Type::BOOL, {}); 11071 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 11072 OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 11073 OperandType type4(Type::TENSOR_INT32, {4}); 11074 OperandType type5(Type::INT32, {}); 11075 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11076 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11077 // Phase 1, operands 11078 auto op11 = model->addOperand(&type139); 11079 auto op21 = model->addOperand(&type8); 11080 auto op31 = model->addOperand(&type9); 11081 auto shape1 = model->addOperand(&type4); 11082 auto param3 = model->addOperand(&type5); 11083 auto param4 = model->addOperand(&type5); 11084 auto param5 = model->addOperand(&type5); 11085 auto param6 = model->addOperand(&type5); 11086 auto layout = model->addOperand(&type0); 11087 auto op41 = model->addOperand(&type140); 11088 // Phase 2, operations 11089 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 11090 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 11091 static float op31_init[] = {-1000.0f}; 11092 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 11093 static int32_t shape1_init[] = {1, 1, 3, 4}; 11094 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11095 static int32_t param3_init[] = {1}; 11096 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11097 static int32_t param4_init[] = {3}; 11098 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11099 static int32_t param5_init[] = {3}; 11100 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11101 static int32_t param6_init[] = {1}; 11102 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11103 static bool8 layout_init[] = {true}; 11104 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11105 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11106 // Phase 3, inputs and outputs 11107 model->identifyInputsAndOutputs( 11108 {op11}, 11109 {op41}); 11110 assert(model->isValid()); 11111 } 11112 11113 inline bool is_ignored_nchw(int i) { 11114 static std::set<int> ignore = {}; 11115 return ignore.find(i) != ignore.end(); 11116 } 11117 11118 void CreateModel_nchw_weight_as_input(Model *model) { 11119 OperandType type0(Type::BOOL, {}); 11120 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 11121 OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 11122 OperandType type4(Type::TENSOR_INT32, {4}); 11123 OperandType type5(Type::INT32, {}); 11124 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11125 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11126 // Phase 1, operands 11127 auto op11 = model->addOperand(&type139); 11128 auto op21 = model->addOperand(&type8); 11129 auto op31 = model->addOperand(&type9); 11130 auto shape1 = model->addOperand(&type4); 11131 auto param3 = model->addOperand(&type5); 11132 auto param4 = model->addOperand(&type5); 11133 auto param5 = model->addOperand(&type5); 11134 auto param6 = model->addOperand(&type5); 11135 auto layout = model->addOperand(&type0); 11136 auto op41 = model->addOperand(&type140); 11137 // Phase 2, operations 11138 static int32_t shape1_init[] = {1, 1, 3, 4}; 11139 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11140 static int32_t param3_init[] = {1}; 11141 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11142 static int32_t param4_init[] = {3}; 11143 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11144 static int32_t param5_init[] = {3}; 11145 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11146 static int32_t param6_init[] = {1}; 11147 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11148 static bool8 layout_init[] = {true}; 11149 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11150 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11151 // Phase 3, inputs and outputs 11152 model->identifyInputsAndOutputs( 11153 {op11, op21, op31}, 11154 {op41}); 11155 assert(model->isValid()); 11156 } 11157 11158 inline bool is_ignored_nchw_weight_as_input(int i) { 11159 static std::set<int> ignore = {}; 11160 return ignore.find(i) != ignore.end(); 11161 } 11162 11163 void CreateModel_nchw_relaxed(Model *model) { 11164 OperandType type0(Type::BOOL, {}); 11165 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 11166 OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 11167 OperandType type4(Type::TENSOR_INT32, {4}); 11168 OperandType type5(Type::INT32, {}); 11169 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11170 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11171 // Phase 1, operands 11172 auto op11 = model->addOperand(&type139); 11173 auto op21 = model->addOperand(&type8); 11174 auto op31 = model->addOperand(&type9); 11175 auto shape1 = model->addOperand(&type4); 11176 auto param3 = model->addOperand(&type5); 11177 auto param4 = model->addOperand(&type5); 11178 auto param5 = model->addOperand(&type5); 11179 auto param6 = model->addOperand(&type5); 11180 auto layout = model->addOperand(&type0); 11181 auto op41 = model->addOperand(&type140); 11182 // Phase 2, operations 11183 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 11184 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 11185 static float op31_init[] = {-1000.0f}; 11186 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 11187 static int32_t shape1_init[] = {1, 1, 3, 4}; 11188 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11189 static int32_t param3_init[] = {1}; 11190 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11191 static int32_t param4_init[] = {3}; 11192 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11193 static int32_t param5_init[] = {3}; 11194 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11195 static int32_t param6_init[] = {1}; 11196 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11197 static bool8 layout_init[] = {true}; 11198 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11199 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11200 // Phase 3, inputs and outputs 11201 model->identifyInputsAndOutputs( 11202 {op11}, 11203 {op41}); 11204 // Phase 4: set relaxed execution 11205 model->relaxComputationFloat32toFloat16(true); 11206 assert(model->isValid()); 11207 } 11208 11209 inline bool is_ignored_nchw_relaxed(int i) { 11210 static std::set<int> ignore = {}; 11211 return ignore.find(i) != ignore.end(); 11212 } 11213 11214 void CreateModel_nchw_relaxed_weight_as_input(Model *model) { 11215 OperandType type0(Type::BOOL, {}); 11216 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 11217 OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); 11218 OperandType type4(Type::TENSOR_INT32, {4}); 11219 OperandType type5(Type::INT32, {}); 11220 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11221 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11222 // Phase 1, operands 11223 auto op11 = model->addOperand(&type139); 11224 auto op21 = model->addOperand(&type8); 11225 auto op31 = model->addOperand(&type9); 11226 auto shape1 = model->addOperand(&type4); 11227 auto param3 = model->addOperand(&type5); 11228 auto param4 = model->addOperand(&type5); 11229 auto param5 = model->addOperand(&type5); 11230 auto param6 = model->addOperand(&type5); 11231 auto layout = model->addOperand(&type0); 11232 auto op41 = model->addOperand(&type140); 11233 // Phase 2, operations 11234 static int32_t shape1_init[] = {1, 1, 3, 4}; 11235 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11236 static int32_t param3_init[] = {1}; 11237 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11238 static int32_t param4_init[] = {3}; 11239 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11240 static int32_t param5_init[] = {3}; 11241 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11242 static int32_t param6_init[] = {1}; 11243 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11244 static bool8 layout_init[] = {true}; 11245 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11246 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11247 // Phase 3, inputs and outputs 11248 model->identifyInputsAndOutputs( 11249 {op11, op21, op31}, 11250 {op41}); 11251 // Phase 4: set relaxed execution 11252 model->relaxComputationFloat32toFloat16(true); 11253 assert(model->isValid()); 11254 } 11255 11256 inline bool is_ignored_nchw_relaxed_weight_as_input(int i) { 11257 static std::set<int> ignore = {}; 11258 return ignore.find(i) != ignore.end(); 11259 } 11260 11261 void CreateModel_nchw_quant8(Model *model) { 11262 OperandType type0(Type::BOOL, {}); 11263 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 11264 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 11265 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 11266 OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); 11267 OperandType type4(Type::TENSOR_INT32, {4}); 11268 OperandType type5(Type::INT32, {}); 11269 // Phase 1, operands 11270 auto op11 = model->addOperand(&type141); 11271 auto op21 = model->addOperand(&type126); 11272 auto op31 = model->addOperand(&type127); 11273 auto shape1 = model->addOperand(&type4); 11274 auto param3 = model->addOperand(&type5); 11275 auto param4 = model->addOperand(&type5); 11276 auto param5 = model->addOperand(&type5); 11277 auto param6 = model->addOperand(&type5); 11278 auto layout = model->addOperand(&type0); 11279 auto op41 = model->addOperand(&type142); 11280 // Phase 2, operations 11281 static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; 11282 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 11283 static int32_t op31_init[] = {-2000}; 11284 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 11285 static int32_t shape1_init[] = {1, 1, 3, 4}; 11286 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11287 static int32_t param3_init[] = {1}; 11288 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11289 static int32_t param4_init[] = {3}; 11290 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11291 static int32_t param5_init[] = {3}; 11292 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11293 static int32_t param6_init[] = {1}; 11294 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11295 static bool8 layout_init[] = {true}; 11296 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11297 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11298 // Phase 3, inputs and outputs 11299 model->identifyInputsAndOutputs( 11300 {op11}, 11301 {op41}); 11302 assert(model->isValid()); 11303 } 11304 11305 inline bool is_ignored_nchw_quant8(int i) { 11306 static std::set<int> ignore = {}; 11307 return ignore.find(i) != ignore.end(); 11308 } 11309 11310 void CreateModel_nchw_quant8_weight_as_input(Model *model) { 11311 OperandType type0(Type::BOOL, {}); 11312 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 11313 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 11314 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 11315 OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); 11316 OperandType type4(Type::TENSOR_INT32, {4}); 11317 OperandType type5(Type::INT32, {}); 11318 // Phase 1, operands 11319 auto op11 = model->addOperand(&type141); 11320 auto op21 = model->addOperand(&type126); 11321 auto op31 = model->addOperand(&type127); 11322 auto shape1 = model->addOperand(&type4); 11323 auto param3 = model->addOperand(&type5); 11324 auto param4 = model->addOperand(&type5); 11325 auto param5 = model->addOperand(&type5); 11326 auto param6 = model->addOperand(&type5); 11327 auto layout = model->addOperand(&type0); 11328 auto op41 = model->addOperand(&type142); 11329 // Phase 2, operations 11330 static int32_t shape1_init[] = {1, 1, 3, 4}; 11331 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11332 static int32_t param3_init[] = {1}; 11333 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11334 static int32_t param4_init[] = {3}; 11335 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11336 static int32_t param5_init[] = {3}; 11337 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11338 static int32_t param6_init[] = {1}; 11339 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11340 static bool8 layout_init[] = {true}; 11341 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11342 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11343 // Phase 3, inputs and outputs 11344 model->identifyInputsAndOutputs( 11345 {op11, op21, op31}, 11346 {op41}); 11347 assert(model->isValid()); 11348 } 11349 11350 inline bool is_ignored_nchw_quant8_weight_as_input(int i) { 11351 static std::set<int> ignore = {}; 11352 return ignore.find(i) != ignore.end(); 11353 } 11354 11355 void CreateModel_nchw_channelQuant8(Model *model) { 11356 OperandType type0(Type::BOOL, {}); 11357 OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 11358 OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); 11359 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 11360 OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); 11361 OperandType type4(Type::TENSOR_INT32, {4}); 11362 OperandType type5(Type::INT32, {}); 11363 // Phase 1, operands 11364 auto op11 = model->addOperand(&type141); 11365 auto op21 = model->addOperand(&type129); 11366 auto op31 = model->addOperand(&type130); 11367 auto shape1 = model->addOperand(&type4); 11368 auto param3 = model->addOperand(&type5); 11369 auto param4 = model->addOperand(&type5); 11370 auto param5 = model->addOperand(&type5); 11371 auto param6 = model->addOperand(&type5); 11372 auto layout = model->addOperand(&type0); 11373 auto op41 = model->addOperand(&type142); 11374 // Phase 2, operations 11375 static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; 11376 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 11377 static int32_t op31_init[] = {-2000}; 11378 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 11379 static int32_t shape1_init[] = {1, 1, 3, 4}; 11380 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11381 static int32_t param3_init[] = {1}; 11382 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11383 static int32_t param4_init[] = {3}; 11384 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11385 static int32_t param5_init[] = {3}; 11386 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11387 static int32_t param6_init[] = {1}; 11388 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11389 static bool8 layout_init[] = {true}; 11390 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11391 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11392 // Phase 3, inputs and outputs 11393 model->identifyInputsAndOutputs( 11394 {op11}, 11395 {op41}); 11396 assert(model->isValid()); 11397 } 11398 11399 inline bool is_ignored_nchw_channelQuant8(int i) { 11400 static std::set<int> ignore = {}; 11401 return ignore.find(i) != ignore.end(); 11402 } 11403 11404 void CreateModel_nchw_channelQuant8_weight_as_input(Model *model) { 11405 OperandType type0(Type::BOOL, {}); 11406 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 11407 OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); 11408 OperandType type143(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 11409 OperandType type144(Type::TENSOR_INT32, {1}, 0.0f, 0); 11410 OperandType type4(Type::TENSOR_INT32, {4}); 11411 OperandType type5(Type::INT32, {}); 11412 // Phase 1, operands 11413 auto op11 = model->addOperand(&type141); 11414 auto op21 = model->addOperand(&type143); 11415 auto op31 = model->addOperand(&type144); 11416 auto shape1 = model->addOperand(&type4); 11417 auto param3 = model->addOperand(&type5); 11418 auto param4 = model->addOperand(&type5); 11419 auto param5 = model->addOperand(&type5); 11420 auto param6 = model->addOperand(&type5); 11421 auto layout = model->addOperand(&type0); 11422 auto op41 = model->addOperand(&type142); 11423 // Phase 2, operations 11424 static int32_t shape1_init[] = {1, 1, 3, 4}; 11425 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11426 static int32_t param3_init[] = {1}; 11427 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11428 static int32_t param4_init[] = {3}; 11429 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11430 static int32_t param5_init[] = {3}; 11431 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11432 static int32_t param6_init[] = {1}; 11433 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11434 static bool8 layout_init[] = {true}; 11435 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11436 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11437 // Phase 3, inputs and outputs 11438 model->identifyInputsAndOutputs( 11439 {op11, op21, op31}, 11440 {op41}); 11441 assert(model->isValid()); 11442 } 11443 11444 inline bool is_ignored_nchw_channelQuant8_weight_as_input(int i) { 11445 static std::set<int> ignore = {}; 11446 return ignore.find(i) != ignore.end(); 11447 } 11448 11449 void CreateModel_nchw_float16(Model *model) { 11450 OperandType type0(Type::BOOL, {}); 11451 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 11452 OperandType type135(Type::TENSOR_FLOAT16, {1}); 11453 OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); 11454 OperandType type146(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); 11455 OperandType type4(Type::TENSOR_INT32, {4}); 11456 OperandType type5(Type::INT32, {}); 11457 // Phase 1, operands 11458 auto op11 = model->addOperand(&type145); 11459 auto op21 = model->addOperand(&type134); 11460 auto op31 = model->addOperand(&type135); 11461 auto shape1 = model->addOperand(&type4); 11462 auto param3 = model->addOperand(&type5); 11463 auto param4 = model->addOperand(&type5); 11464 auto param5 = model->addOperand(&type5); 11465 auto param6 = model->addOperand(&type5); 11466 auto layout = model->addOperand(&type0); 11467 auto op41 = model->addOperand(&type146); 11468 // Phase 2, operations 11469 static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 11470 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 11471 static _Float16 op31_init[] = {-1000.0f}; 11472 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 11473 static int32_t shape1_init[] = {1, 1, 3, 4}; 11474 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11475 static int32_t param3_init[] = {1}; 11476 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11477 static int32_t param4_init[] = {3}; 11478 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11479 static int32_t param5_init[] = {3}; 11480 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11481 static int32_t param6_init[] = {1}; 11482 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11483 static bool8 layout_init[] = {true}; 11484 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11485 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11486 // Phase 3, inputs and outputs 11487 model->identifyInputsAndOutputs( 11488 {op11}, 11489 {op41}); 11490 assert(model->isValid()); 11491 } 11492 11493 inline bool is_ignored_nchw_float16(int i) { 11494 static std::set<int> ignore = {}; 11495 return ignore.find(i) != ignore.end(); 11496 } 11497 11498 void CreateModel_nchw_float16_weight_as_input(Model *model) { 11499 OperandType type0(Type::BOOL, {}); 11500 OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 11501 OperandType type138(Type::TENSOR_FLOAT16, {1}); 11502 OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); 11503 OperandType type146(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); 11504 OperandType type4(Type::TENSOR_INT32, {4}); 11505 OperandType type5(Type::INT32, {}); 11506 // Phase 1, operands 11507 auto op11 = model->addOperand(&type145); 11508 auto op21 = model->addOperand(&type137); 11509 auto op31 = model->addOperand(&type138); 11510 auto shape1 = model->addOperand(&type4); 11511 auto param3 = model->addOperand(&type5); 11512 auto param4 = model->addOperand(&type5); 11513 auto param5 = model->addOperand(&type5); 11514 auto param6 = model->addOperand(&type5); 11515 auto layout = model->addOperand(&type0); 11516 auto op41 = model->addOperand(&type146); 11517 // Phase 2, operations 11518 static int32_t shape1_init[] = {1, 1, 3, 4}; 11519 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11520 static int32_t param3_init[] = {1}; 11521 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11522 static int32_t param4_init[] = {3}; 11523 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11524 static int32_t param5_init[] = {3}; 11525 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11526 static int32_t param6_init[] = {1}; 11527 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11528 static bool8 layout_init[] = {true}; 11529 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11530 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11531 // Phase 3, inputs and outputs 11532 model->identifyInputsAndOutputs( 11533 {op11, op21, op31}, 11534 {op41}); 11535 assert(model->isValid()); 11536 } 11537 11538 inline bool is_ignored_nchw_float16_weight_as_input(int i) { 11539 static std::set<int> ignore = {}; 11540 return ignore.find(i) != ignore.end(); 11541 } 11542 11543 void CreateModel_dynamic_output_shape_nhwc(Model *model) { 11544 OperandType type0(Type::BOOL, {}); 11545 OperandType type4(Type::TENSOR_INT32, {4}); 11546 OperandType type5(Type::INT32, {}); 11547 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 11548 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11549 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 11550 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11551 // Phase 1, operands 11552 auto op11 = model->addOperand(&type7); 11553 auto op21 = model->addOperand(&type8); 11554 auto op31 = model->addOperand(&type9); 11555 auto shape1 = model->addOperand(&type4); 11556 auto param3 = model->addOperand(&type5); 11557 auto param4 = model->addOperand(&type5); 11558 auto param5 = model->addOperand(&type5); 11559 auto param6 = model->addOperand(&type5); 11560 auto layout = model->addOperand(&type0); 11561 auto op41 = model->addOperand(&type88); 11562 // Phase 2, operations 11563 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 11564 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 11565 static float op31_init[] = {-1000.0f}; 11566 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 11567 static int32_t shape1_init[] = {1, 3, 4, 1}; 11568 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11569 static int32_t param3_init[] = {1}; 11570 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11571 static int32_t param4_init[] = {3}; 11572 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11573 static int32_t param5_init[] = {3}; 11574 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11575 static int32_t param6_init[] = {1}; 11576 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11577 static bool8 layout_init[] = {false}; 11578 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11579 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11580 // Phase 3, inputs and outputs 11581 model->identifyInputsAndOutputs( 11582 {op11}, 11583 {op41}); 11584 assert(model->isValid()); 11585 } 11586 11587 inline bool is_ignored_dynamic_output_shape_nhwc(int i) { 11588 static std::set<int> ignore = {}; 11589 return ignore.find(i) != ignore.end(); 11590 } 11591 11592 void CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model *model) { 11593 OperandType type0(Type::BOOL, {}); 11594 OperandType type4(Type::TENSOR_INT32, {4}); 11595 OperandType type5(Type::INT32, {}); 11596 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 11597 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11598 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 11599 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11600 // Phase 1, operands 11601 auto op11 = model->addOperand(&type7); 11602 auto op21 = model->addOperand(&type8); 11603 auto op31 = model->addOperand(&type9); 11604 auto shape1 = model->addOperand(&type4); 11605 auto param3 = model->addOperand(&type5); 11606 auto param4 = model->addOperand(&type5); 11607 auto param5 = model->addOperand(&type5); 11608 auto param6 = model->addOperand(&type5); 11609 auto layout = model->addOperand(&type0); 11610 auto op41 = model->addOperand(&type88); 11611 // Phase 2, operations 11612 static int32_t shape1_init[] = {1, 3, 4, 1}; 11613 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11614 static int32_t param3_init[] = {1}; 11615 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11616 static int32_t param4_init[] = {3}; 11617 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11618 static int32_t param5_init[] = {3}; 11619 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11620 static int32_t param6_init[] = {1}; 11621 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11622 static bool8 layout_init[] = {false}; 11623 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11624 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11625 // Phase 3, inputs and outputs 11626 model->identifyInputsAndOutputs( 11627 {op11, op21, op31}, 11628 {op41}); 11629 assert(model->isValid()); 11630 } 11631 11632 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i) { 11633 static std::set<int> ignore = {}; 11634 return ignore.find(i) != ignore.end(); 11635 } 11636 11637 void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) { 11638 OperandType type0(Type::BOOL, {}); 11639 OperandType type4(Type::TENSOR_INT32, {4}); 11640 OperandType type5(Type::INT32, {}); 11641 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 11642 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11643 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 11644 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11645 // Phase 1, operands 11646 auto op11 = model->addOperand(&type7); 11647 auto op21 = model->addOperand(&type8); 11648 auto op31 = model->addOperand(&type9); 11649 auto shape1 = model->addOperand(&type4); 11650 auto param3 = model->addOperand(&type5); 11651 auto param4 = model->addOperand(&type5); 11652 auto param5 = model->addOperand(&type5); 11653 auto param6 = model->addOperand(&type5); 11654 auto layout = model->addOperand(&type0); 11655 auto op41 = model->addOperand(&type88); 11656 // Phase 2, operations 11657 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 11658 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 11659 static float op31_init[] = {-1000.0f}; 11660 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 11661 static int32_t shape1_init[] = {1, 3, 4, 1}; 11662 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11663 static int32_t param3_init[] = {1}; 11664 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11665 static int32_t param4_init[] = {3}; 11666 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11667 static int32_t param5_init[] = {3}; 11668 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11669 static int32_t param6_init[] = {1}; 11670 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11671 static bool8 layout_init[] = {false}; 11672 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11673 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11674 // Phase 3, inputs and outputs 11675 model->identifyInputsAndOutputs( 11676 {op11}, 11677 {op41}); 11678 // Phase 4: set relaxed execution 11679 model->relaxComputationFloat32toFloat16(true); 11680 assert(model->isValid()); 11681 } 11682 11683 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) { 11684 static std::set<int> ignore = {}; 11685 return ignore.find(i) != ignore.end(); 11686 } 11687 11688 void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input(Model *model) { 11689 OperandType type0(Type::BOOL, {}); 11690 OperandType type4(Type::TENSOR_INT32, {4}); 11691 OperandType type5(Type::INT32, {}); 11692 OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); 11693 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 11694 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 11695 OperandType type9(Type::TENSOR_FLOAT32, {1}); 11696 // Phase 1, operands 11697 auto op11 = model->addOperand(&type7); 11698 auto op21 = model->addOperand(&type8); 11699 auto op31 = model->addOperand(&type9); 11700 auto shape1 = model->addOperand(&type4); 11701 auto param3 = model->addOperand(&type5); 11702 auto param4 = model->addOperand(&type5); 11703 auto param5 = model->addOperand(&type5); 11704 auto param6 = model->addOperand(&type5); 11705 auto layout = model->addOperand(&type0); 11706 auto op41 = model->addOperand(&type88); 11707 // Phase 2, operations 11708 static int32_t shape1_init[] = {1, 3, 4, 1}; 11709 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11710 static int32_t param3_init[] = {1}; 11711 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11712 static int32_t param4_init[] = {3}; 11713 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11714 static int32_t param5_init[] = {3}; 11715 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11716 static int32_t param6_init[] = {1}; 11717 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11718 static bool8 layout_init[] = {false}; 11719 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11720 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11721 // Phase 3, inputs and outputs 11722 model->identifyInputsAndOutputs( 11723 {op11, op21, op31}, 11724 {op41}); 11725 // Phase 4: set relaxed execution 11726 model->relaxComputationFloat32toFloat16(true); 11727 assert(model->isValid()); 11728 } 11729 11730 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input(int i) { 11731 static std::set<int> ignore = {}; 11732 return ignore.find(i) != ignore.end(); 11733 } 11734 11735 void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) { 11736 OperandType type0(Type::BOOL, {}); 11737 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 11738 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 11739 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 11740 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 11741 OperandType type4(Type::TENSOR_INT32, {4}); 11742 OperandType type5(Type::INT32, {}); 11743 // Phase 1, operands 11744 auto op11 = model->addOperand(&type125); 11745 auto op21 = model->addOperand(&type126); 11746 auto op31 = model->addOperand(&type127); 11747 auto shape1 = model->addOperand(&type4); 11748 auto param3 = model->addOperand(&type5); 11749 auto param4 = model->addOperand(&type5); 11750 auto param5 = model->addOperand(&type5); 11751 auto param6 = model->addOperand(&type5); 11752 auto layout = model->addOperand(&type0); 11753 auto op41 = model->addOperand(&type147); 11754 // Phase 2, operations 11755 static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; 11756 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 11757 static int32_t op31_init[] = {-2000}; 11758 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 11759 static int32_t shape1_init[] = {1, 3, 4, 1}; 11760 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11761 static int32_t param3_init[] = {1}; 11762 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11763 static int32_t param4_init[] = {3}; 11764 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11765 static int32_t param5_init[] = {3}; 11766 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11767 static int32_t param6_init[] = {1}; 11768 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11769 static bool8 layout_init[] = {false}; 11770 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11771 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11772 // Phase 3, inputs and outputs 11773 model->identifyInputsAndOutputs( 11774 {op11}, 11775 {op41}); 11776 assert(model->isValid()); 11777 } 11778 11779 inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) { 11780 static std::set<int> ignore = {}; 11781 return ignore.find(i) != ignore.end(); 11782 } 11783 11784 void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input(Model *model) { 11785 OperandType type0(Type::BOOL, {}); 11786 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 11787 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 11788 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 11789 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 11790 OperandType type4(Type::TENSOR_INT32, {4}); 11791 OperandType type5(Type::INT32, {}); 11792 // Phase 1, operands 11793 auto op11 = model->addOperand(&type125); 11794 auto op21 = model->addOperand(&type126); 11795 auto op31 = model->addOperand(&type127); 11796 auto shape1 = model->addOperand(&type4); 11797 auto param3 = model->addOperand(&type5); 11798 auto param4 = model->addOperand(&type5); 11799 auto param5 = model->addOperand(&type5); 11800 auto param6 = model->addOperand(&type5); 11801 auto layout = model->addOperand(&type0); 11802 auto op41 = model->addOperand(&type147); 11803 // Phase 2, operations 11804 static int32_t shape1_init[] = {1, 3, 4, 1}; 11805 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11806 static int32_t param3_init[] = {1}; 11807 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11808 static int32_t param4_init[] = {3}; 11809 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11810 static int32_t param5_init[] = {3}; 11811 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11812 static int32_t param6_init[] = {1}; 11813 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11814 static bool8 layout_init[] = {false}; 11815 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11816 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11817 // Phase 3, inputs and outputs 11818 model->identifyInputsAndOutputs( 11819 {op11, op21, op31}, 11820 {op41}); 11821 assert(model->isValid()); 11822 } 11823 11824 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input(int i) { 11825 static std::set<int> ignore = {}; 11826 return ignore.find(i) != ignore.end(); 11827 } 11828 11829 void CreateModel_dynamic_output_shape_nhwc_channelQuant8(Model *model) { 11830 OperandType type0(Type::BOOL, {}); 11831 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 11832 OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 11833 OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); 11834 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 11835 OperandType type4(Type::TENSOR_INT32, {4}); 11836 OperandType type5(Type::INT32, {}); 11837 // Phase 1, operands 11838 auto op11 = model->addOperand(&type125); 11839 auto op21 = model->addOperand(&type129); 11840 auto op31 = model->addOperand(&type130); 11841 auto shape1 = model->addOperand(&type4); 11842 auto param3 = model->addOperand(&type5); 11843 auto param4 = model->addOperand(&type5); 11844 auto param5 = model->addOperand(&type5); 11845 auto param6 = model->addOperand(&type5); 11846 auto layout = model->addOperand(&type0); 11847 auto op41 = model->addOperand(&type147); 11848 // Phase 2, operations 11849 static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; 11850 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 11851 static int32_t op31_init[] = {-2000}; 11852 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 11853 static int32_t shape1_init[] = {1, 3, 4, 1}; 11854 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11855 static int32_t param3_init[] = {1}; 11856 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11857 static int32_t param4_init[] = {3}; 11858 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11859 static int32_t param5_init[] = {3}; 11860 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11861 static int32_t param6_init[] = {1}; 11862 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11863 static bool8 layout_init[] = {false}; 11864 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11865 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11866 // Phase 3, inputs and outputs 11867 model->identifyInputsAndOutputs( 11868 {op11}, 11869 {op41}); 11870 assert(model->isValid()); 11871 } 11872 11873 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8(int i) { 11874 static std::set<int> ignore = {}; 11875 return ignore.find(i) != ignore.end(); 11876 } 11877 11878 void CreateModel_dynamic_output_shape_nhwc_channelQuant8_weight_as_input(Model *model) { 11879 OperandType type0(Type::BOOL, {}); 11880 OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); 11881 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 11882 OperandType type148(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 11883 OperandType type149(Type::TENSOR_INT32, {1}, 0.0f, 0); 11884 OperandType type4(Type::TENSOR_INT32, {4}); 11885 OperandType type5(Type::INT32, {}); 11886 // Phase 1, operands 11887 auto op11 = model->addOperand(&type125); 11888 auto op21 = model->addOperand(&type148); 11889 auto op31 = model->addOperand(&type149); 11890 auto shape1 = model->addOperand(&type4); 11891 auto param3 = model->addOperand(&type5); 11892 auto param4 = model->addOperand(&type5); 11893 auto param5 = model->addOperand(&type5); 11894 auto param6 = model->addOperand(&type5); 11895 auto layout = model->addOperand(&type0); 11896 auto op41 = model->addOperand(&type147); 11897 // Phase 2, operations 11898 static int32_t shape1_init[] = {1, 3, 4, 1}; 11899 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11900 static int32_t param3_init[] = {1}; 11901 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11902 static int32_t param4_init[] = {3}; 11903 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11904 static int32_t param5_init[] = {3}; 11905 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11906 static int32_t param6_init[] = {1}; 11907 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11908 static bool8 layout_init[] = {false}; 11909 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11910 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11911 // Phase 3, inputs and outputs 11912 model->identifyInputsAndOutputs( 11913 {op11, op21, op31}, 11914 {op41}); 11915 assert(model->isValid()); 11916 } 11917 11918 inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8_weight_as_input(int i) { 11919 static std::set<int> ignore = {}; 11920 return ignore.find(i) != ignore.end(); 11921 } 11922 11923 void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) { 11924 OperandType type0(Type::BOOL, {}); 11925 OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); 11926 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 11927 OperandType type135(Type::TENSOR_FLOAT16, {1}); 11928 OperandType type4(Type::TENSOR_INT32, {4}); 11929 OperandType type5(Type::INT32, {}); 11930 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 11931 // Phase 1, operands 11932 auto op11 = model->addOperand(&type133); 11933 auto op21 = model->addOperand(&type134); 11934 auto op31 = model->addOperand(&type135); 11935 auto shape1 = model->addOperand(&type4); 11936 auto param3 = model->addOperand(&type5); 11937 auto param4 = model->addOperand(&type5); 11938 auto param5 = model->addOperand(&type5); 11939 auto param6 = model->addOperand(&type5); 11940 auto layout = model->addOperand(&type0); 11941 auto op41 = model->addOperand(&type96); 11942 // Phase 2, operations 11943 static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 11944 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 11945 static _Float16 op31_init[] = {-1000.0f}; 11946 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 11947 static int32_t shape1_init[] = {1, 3, 4, 1}; 11948 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11949 static int32_t param3_init[] = {1}; 11950 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11951 static int32_t param4_init[] = {3}; 11952 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11953 static int32_t param5_init[] = {3}; 11954 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 11955 static int32_t param6_init[] = {1}; 11956 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 11957 static bool8 layout_init[] = {false}; 11958 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 11959 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 11960 // Phase 3, inputs and outputs 11961 model->identifyInputsAndOutputs( 11962 {op11}, 11963 {op41}); 11964 assert(model->isValid()); 11965 } 11966 11967 inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) { 11968 static std::set<int> ignore = {}; 11969 return ignore.find(i) != ignore.end(); 11970 } 11971 11972 void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input(Model *model) { 11973 OperandType type0(Type::BOOL, {}); 11974 OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); 11975 OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 11976 OperandType type138(Type::TENSOR_FLOAT16, {1}); 11977 OperandType type4(Type::TENSOR_INT32, {4}); 11978 OperandType type5(Type::INT32, {}); 11979 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 11980 // Phase 1, operands 11981 auto op11 = model->addOperand(&type133); 11982 auto op21 = model->addOperand(&type137); 11983 auto op31 = model->addOperand(&type138); 11984 auto shape1 = model->addOperand(&type4); 11985 auto param3 = model->addOperand(&type5); 11986 auto param4 = model->addOperand(&type5); 11987 auto param5 = model->addOperand(&type5); 11988 auto param6 = model->addOperand(&type5); 11989 auto layout = model->addOperand(&type0); 11990 auto op41 = model->addOperand(&type96); 11991 // Phase 2, operations 11992 static int32_t shape1_init[] = {1, 3, 4, 1}; 11993 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 11994 static int32_t param3_init[] = {1}; 11995 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 11996 static int32_t param4_init[] = {3}; 11997 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 11998 static int32_t param5_init[] = {3}; 11999 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12000 static int32_t param6_init[] = {1}; 12001 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12002 static bool8 layout_init[] = {false}; 12003 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12004 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12005 // Phase 3, inputs and outputs 12006 model->identifyInputsAndOutputs( 12007 {op11, op21, op31}, 12008 {op41}); 12009 assert(model->isValid()); 12010 } 12011 12012 inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input(int i) { 12013 static std::set<int> ignore = {}; 12014 return ignore.find(i) != ignore.end(); 12015 } 12016 12017 void CreateModel_dynamic_output_shape_nchw(Model *model) { 12018 OperandType type0(Type::BOOL, {}); 12019 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 12020 OperandType type4(Type::TENSOR_INT32, {4}); 12021 OperandType type5(Type::INT32, {}); 12022 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 12023 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 12024 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12025 // Phase 1, operands 12026 auto op11 = model->addOperand(&type139); 12027 auto op21 = model->addOperand(&type8); 12028 auto op31 = model->addOperand(&type9); 12029 auto shape1 = model->addOperand(&type4); 12030 auto param3 = model->addOperand(&type5); 12031 auto param4 = model->addOperand(&type5); 12032 auto param5 = model->addOperand(&type5); 12033 auto param6 = model->addOperand(&type5); 12034 auto layout = model->addOperand(&type0); 12035 auto op41 = model->addOperand(&type88); 12036 // Phase 2, operations 12037 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 12038 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 12039 static float op31_init[] = {-1000.0f}; 12040 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 12041 static int32_t shape1_init[] = {1, 1, 3, 4}; 12042 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12043 static int32_t param3_init[] = {1}; 12044 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12045 static int32_t param4_init[] = {3}; 12046 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12047 static int32_t param5_init[] = {3}; 12048 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12049 static int32_t param6_init[] = {1}; 12050 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12051 static bool8 layout_init[] = {true}; 12052 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12053 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12054 // Phase 3, inputs and outputs 12055 model->identifyInputsAndOutputs( 12056 {op11}, 12057 {op41}); 12058 assert(model->isValid()); 12059 } 12060 12061 inline bool is_ignored_dynamic_output_shape_nchw(int i) { 12062 static std::set<int> ignore = {}; 12063 return ignore.find(i) != ignore.end(); 12064 } 12065 12066 void CreateModel_dynamic_output_shape_nchw_weight_as_input(Model *model) { 12067 OperandType type0(Type::BOOL, {}); 12068 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 12069 OperandType type4(Type::TENSOR_INT32, {4}); 12070 OperandType type5(Type::INT32, {}); 12071 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 12072 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 12073 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12074 // Phase 1, operands 12075 auto op11 = model->addOperand(&type139); 12076 auto op21 = model->addOperand(&type8); 12077 auto op31 = model->addOperand(&type9); 12078 auto shape1 = model->addOperand(&type4); 12079 auto param3 = model->addOperand(&type5); 12080 auto param4 = model->addOperand(&type5); 12081 auto param5 = model->addOperand(&type5); 12082 auto param6 = model->addOperand(&type5); 12083 auto layout = model->addOperand(&type0); 12084 auto op41 = model->addOperand(&type88); 12085 // Phase 2, operations 12086 static int32_t shape1_init[] = {1, 1, 3, 4}; 12087 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12088 static int32_t param3_init[] = {1}; 12089 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12090 static int32_t param4_init[] = {3}; 12091 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12092 static int32_t param5_init[] = {3}; 12093 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12094 static int32_t param6_init[] = {1}; 12095 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12096 static bool8 layout_init[] = {true}; 12097 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12098 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12099 // Phase 3, inputs and outputs 12100 model->identifyInputsAndOutputs( 12101 {op11, op21, op31}, 12102 {op41}); 12103 assert(model->isValid()); 12104 } 12105 12106 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input(int i) { 12107 static std::set<int> ignore = {}; 12108 return ignore.find(i) != ignore.end(); 12109 } 12110 12111 void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) { 12112 OperandType type0(Type::BOOL, {}); 12113 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 12114 OperandType type4(Type::TENSOR_INT32, {4}); 12115 OperandType type5(Type::INT32, {}); 12116 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 12117 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 12118 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12119 // Phase 1, operands 12120 auto op11 = model->addOperand(&type139); 12121 auto op21 = model->addOperand(&type8); 12122 auto op31 = model->addOperand(&type9); 12123 auto shape1 = model->addOperand(&type4); 12124 auto param3 = model->addOperand(&type5); 12125 auto param4 = model->addOperand(&type5); 12126 auto param5 = model->addOperand(&type5); 12127 auto param6 = model->addOperand(&type5); 12128 auto layout = model->addOperand(&type0); 12129 auto op41 = model->addOperand(&type88); 12130 // Phase 2, operations 12131 static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 12132 model->setOperandValue(op21, op21_init, sizeof(float) * 9); 12133 static float op31_init[] = {-1000.0f}; 12134 model->setOperandValue(op31, op31_init, sizeof(float) * 1); 12135 static int32_t shape1_init[] = {1, 1, 3, 4}; 12136 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12137 static int32_t param3_init[] = {1}; 12138 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12139 static int32_t param4_init[] = {3}; 12140 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12141 static int32_t param5_init[] = {3}; 12142 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12143 static int32_t param6_init[] = {1}; 12144 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12145 static bool8 layout_init[] = {true}; 12146 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12147 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12148 // Phase 3, inputs and outputs 12149 model->identifyInputsAndOutputs( 12150 {op11}, 12151 {op41}); 12152 // Phase 4: set relaxed execution 12153 model->relaxComputationFloat32toFloat16(true); 12154 assert(model->isValid()); 12155 } 12156 12157 inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) { 12158 static std::set<int> ignore = {}; 12159 return ignore.find(i) != ignore.end(); 12160 } 12161 12162 void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input(Model *model) { 12163 OperandType type0(Type::BOOL, {}); 12164 OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); 12165 OperandType type4(Type::TENSOR_INT32, {4}); 12166 OperandType type5(Type::INT32, {}); 12167 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 12168 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 12169 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12170 // Phase 1, operands 12171 auto op11 = model->addOperand(&type139); 12172 auto op21 = model->addOperand(&type8); 12173 auto op31 = model->addOperand(&type9); 12174 auto shape1 = model->addOperand(&type4); 12175 auto param3 = model->addOperand(&type5); 12176 auto param4 = model->addOperand(&type5); 12177 auto param5 = model->addOperand(&type5); 12178 auto param6 = model->addOperand(&type5); 12179 auto layout = model->addOperand(&type0); 12180 auto op41 = model->addOperand(&type88); 12181 // Phase 2, operations 12182 static int32_t shape1_init[] = {1, 1, 3, 4}; 12183 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12184 static int32_t param3_init[] = {1}; 12185 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12186 static int32_t param4_init[] = {3}; 12187 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12188 static int32_t param5_init[] = {3}; 12189 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12190 static int32_t param6_init[] = {1}; 12191 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12192 static bool8 layout_init[] = {true}; 12193 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12194 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12195 // Phase 3, inputs and outputs 12196 model->identifyInputsAndOutputs( 12197 {op11, op21, op31}, 12198 {op41}); 12199 // Phase 4: set relaxed execution 12200 model->relaxComputationFloat32toFloat16(true); 12201 assert(model->isValid()); 12202 } 12203 12204 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input(int i) { 12205 static std::set<int> ignore = {}; 12206 return ignore.find(i) != ignore.end(); 12207 } 12208 12209 void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) { 12210 OperandType type0(Type::BOOL, {}); 12211 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 12212 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 12213 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 12214 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 12215 OperandType type4(Type::TENSOR_INT32, {4}); 12216 OperandType type5(Type::INT32, {}); 12217 // Phase 1, operands 12218 auto op11 = model->addOperand(&type141); 12219 auto op21 = model->addOperand(&type126); 12220 auto op31 = model->addOperand(&type127); 12221 auto shape1 = model->addOperand(&type4); 12222 auto param3 = model->addOperand(&type5); 12223 auto param4 = model->addOperand(&type5); 12224 auto param5 = model->addOperand(&type5); 12225 auto param6 = model->addOperand(&type5); 12226 auto layout = model->addOperand(&type0); 12227 auto op41 = model->addOperand(&type147); 12228 // Phase 2, operations 12229 static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; 12230 model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); 12231 static int32_t op31_init[] = {-2000}; 12232 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 12233 static int32_t shape1_init[] = {1, 1, 3, 4}; 12234 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12235 static int32_t param3_init[] = {1}; 12236 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12237 static int32_t param4_init[] = {3}; 12238 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12239 static int32_t param5_init[] = {3}; 12240 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12241 static int32_t param6_init[] = {1}; 12242 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12243 static bool8 layout_init[] = {true}; 12244 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12245 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12246 // Phase 3, inputs and outputs 12247 model->identifyInputsAndOutputs( 12248 {op11}, 12249 {op41}); 12250 assert(model->isValid()); 12251 } 12252 12253 inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) { 12254 static std::set<int> ignore = {}; 12255 return ignore.find(i) != ignore.end(); 12256 } 12257 12258 void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input(Model *model) { 12259 OperandType type0(Type::BOOL, {}); 12260 OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); 12261 OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); 12262 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 12263 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 12264 OperandType type4(Type::TENSOR_INT32, {4}); 12265 OperandType type5(Type::INT32, {}); 12266 // Phase 1, operands 12267 auto op11 = model->addOperand(&type141); 12268 auto op21 = model->addOperand(&type126); 12269 auto op31 = model->addOperand(&type127); 12270 auto shape1 = model->addOperand(&type4); 12271 auto param3 = model->addOperand(&type5); 12272 auto param4 = model->addOperand(&type5); 12273 auto param5 = model->addOperand(&type5); 12274 auto param6 = model->addOperand(&type5); 12275 auto layout = model->addOperand(&type0); 12276 auto op41 = model->addOperand(&type147); 12277 // Phase 2, operations 12278 static int32_t shape1_init[] = {1, 1, 3, 4}; 12279 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12280 static int32_t param3_init[] = {1}; 12281 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12282 static int32_t param4_init[] = {3}; 12283 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12284 static int32_t param5_init[] = {3}; 12285 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12286 static int32_t param6_init[] = {1}; 12287 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12288 static bool8 layout_init[] = {true}; 12289 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12290 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12291 // Phase 3, inputs and outputs 12292 model->identifyInputsAndOutputs( 12293 {op11, op21, op31}, 12294 {op41}); 12295 assert(model->isValid()); 12296 } 12297 12298 inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input(int i) { 12299 static std::set<int> ignore = {}; 12300 return ignore.find(i) != ignore.end(); 12301 } 12302 12303 void CreateModel_dynamic_output_shape_nchw_channelQuant8(Model *model) { 12304 OperandType type0(Type::BOOL, {}); 12305 OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 12306 OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); 12307 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 12308 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 12309 OperandType type4(Type::TENSOR_INT32, {4}); 12310 OperandType type5(Type::INT32, {}); 12311 // Phase 1, operands 12312 auto op11 = model->addOperand(&type141); 12313 auto op21 = model->addOperand(&type129); 12314 auto op31 = model->addOperand(&type130); 12315 auto shape1 = model->addOperand(&type4); 12316 auto param3 = model->addOperand(&type5); 12317 auto param4 = model->addOperand(&type5); 12318 auto param5 = model->addOperand(&type5); 12319 auto param6 = model->addOperand(&type5); 12320 auto layout = model->addOperand(&type0); 12321 auto op41 = model->addOperand(&type147); 12322 // Phase 2, operations 12323 static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; 12324 model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); 12325 static int32_t op31_init[] = {-2000}; 12326 model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); 12327 static int32_t shape1_init[] = {1, 1, 3, 4}; 12328 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12329 static int32_t param3_init[] = {1}; 12330 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12331 static int32_t param4_init[] = {3}; 12332 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12333 static int32_t param5_init[] = {3}; 12334 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12335 static int32_t param6_init[] = {1}; 12336 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12337 static bool8 layout_init[] = {true}; 12338 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12339 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12340 // Phase 3, inputs and outputs 12341 model->identifyInputsAndOutputs( 12342 {op11}, 12343 {op41}); 12344 assert(model->isValid()); 12345 } 12346 12347 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8(int i) { 12348 static std::set<int> ignore = {}; 12349 return ignore.find(i) != ignore.end(); 12350 } 12351 12352 void CreateModel_dynamic_output_shape_nchw_channelQuant8_weight_as_input(Model *model) { 12353 OperandType type0(Type::BOOL, {}); 12354 OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); 12355 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 12356 OperandType type150(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, 0.0f, 0, SymmPerChannelQuantParams({0.25f},0)); 12357 OperandType type151(Type::TENSOR_INT32, {1}, 0.0f, 0); 12358 OperandType type4(Type::TENSOR_INT32, {4}); 12359 OperandType type5(Type::INT32, {}); 12360 // Phase 1, operands 12361 auto op11 = model->addOperand(&type141); 12362 auto op21 = model->addOperand(&type150); 12363 auto op31 = model->addOperand(&type151); 12364 auto shape1 = model->addOperand(&type4); 12365 auto param3 = model->addOperand(&type5); 12366 auto param4 = model->addOperand(&type5); 12367 auto param5 = model->addOperand(&type5); 12368 auto param6 = model->addOperand(&type5); 12369 auto layout = model->addOperand(&type0); 12370 auto op41 = model->addOperand(&type147); 12371 // Phase 2, operations 12372 static int32_t shape1_init[] = {1, 1, 3, 4}; 12373 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12374 static int32_t param3_init[] = {1}; 12375 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12376 static int32_t param4_init[] = {3}; 12377 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12378 static int32_t param5_init[] = {3}; 12379 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12380 static int32_t param6_init[] = {1}; 12381 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12382 static bool8 layout_init[] = {true}; 12383 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12384 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12385 // Phase 3, inputs and outputs 12386 model->identifyInputsAndOutputs( 12387 {op11, op21, op31}, 12388 {op41}); 12389 assert(model->isValid()); 12390 } 12391 12392 inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8_weight_as_input(int i) { 12393 static std::set<int> ignore = {}; 12394 return ignore.find(i) != ignore.end(); 12395 } 12396 12397 void CreateModel_dynamic_output_shape_nchw_float16(Model *model) { 12398 OperandType type0(Type::BOOL, {}); 12399 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 12400 OperandType type135(Type::TENSOR_FLOAT16, {1}); 12401 OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); 12402 OperandType type4(Type::TENSOR_INT32, {4}); 12403 OperandType type5(Type::INT32, {}); 12404 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 12405 // Phase 1, operands 12406 auto op11 = model->addOperand(&type145); 12407 auto op21 = model->addOperand(&type134); 12408 auto op31 = model->addOperand(&type135); 12409 auto shape1 = model->addOperand(&type4); 12410 auto param3 = model->addOperand(&type5); 12411 auto param4 = model->addOperand(&type5); 12412 auto param5 = model->addOperand(&type5); 12413 auto param6 = model->addOperand(&type5); 12414 auto layout = model->addOperand(&type0); 12415 auto op41 = model->addOperand(&type96); 12416 // Phase 2, operations 12417 static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; 12418 model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); 12419 static _Float16 op31_init[] = {-1000.0f}; 12420 model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); 12421 static int32_t shape1_init[] = {1, 1, 3, 4}; 12422 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12423 static int32_t param3_init[] = {1}; 12424 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12425 static int32_t param4_init[] = {3}; 12426 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12427 static int32_t param5_init[] = {3}; 12428 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12429 static int32_t param6_init[] = {1}; 12430 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12431 static bool8 layout_init[] = {true}; 12432 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12433 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12434 // Phase 3, inputs and outputs 12435 model->identifyInputsAndOutputs( 12436 {op11}, 12437 {op41}); 12438 assert(model->isValid()); 12439 } 12440 12441 inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) { 12442 static std::set<int> ignore = {}; 12443 return ignore.find(i) != ignore.end(); 12444 } 12445 12446 void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input(Model *model) { 12447 OperandType type0(Type::BOOL, {}); 12448 OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 12449 OperandType type138(Type::TENSOR_FLOAT16, {1}); 12450 OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); 12451 OperandType type4(Type::TENSOR_INT32, {4}); 12452 OperandType type5(Type::INT32, {}); 12453 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 12454 // Phase 1, operands 12455 auto op11 = model->addOperand(&type145); 12456 auto op21 = model->addOperand(&type137); 12457 auto op31 = model->addOperand(&type138); 12458 auto shape1 = model->addOperand(&type4); 12459 auto param3 = model->addOperand(&type5); 12460 auto param4 = model->addOperand(&type5); 12461 auto param5 = model->addOperand(&type5); 12462 auto param6 = model->addOperand(&type5); 12463 auto layout = model->addOperand(&type0); 12464 auto op41 = model->addOperand(&type96); 12465 // Phase 2, operations 12466 static int32_t shape1_init[] = {1, 1, 3, 4}; 12467 model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); 12468 static int32_t param3_init[] = {1}; 12469 model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); 12470 static int32_t param4_init[] = {3}; 12471 model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); 12472 static int32_t param5_init[] = {3}; 12473 model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); 12474 static int32_t param6_init[] = {1}; 12475 model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); 12476 static bool8 layout_init[] = {true}; 12477 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12478 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); 12479 // Phase 3, inputs and outputs 12480 model->identifyInputsAndOutputs( 12481 {op11, op21, op31}, 12482 {op41}); 12483 assert(model->isValid()); 12484 } 12485 12486 inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input(int i) { 12487 static std::set<int> ignore = {}; 12488 return ignore.find(i) != ignore.end(); 12489 } 12490 12491 void CreateModel_nhwc_2(Model *model) { 12492 OperandType type0(Type::BOOL, {}); 12493 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 12494 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12495 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 12496 OperandType type4(Type::TENSOR_INT32, {4}); 12497 OperandType type5(Type::INT32, {}); 12498 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12499 // Phase 1, operands 12500 auto op12 = model->addOperand(&type11); 12501 auto op22 = model->addOperand(&type12); 12502 auto op32 = model->addOperand(&type9); 12503 auto shape2 = model->addOperand(&type4); 12504 auto param7 = model->addOperand(&type5); 12505 auto param8 = model->addOperand(&type5); 12506 auto param9 = model->addOperand(&type5); 12507 auto param10 = model->addOperand(&type5); 12508 auto layout = model->addOperand(&type0); 12509 auto op42 = model->addOperand(&type13); 12510 // Phase 2, operations 12511 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 12512 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 12513 static float op32_init[] = {0.0f}; 12514 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 12515 static int32_t shape2_init[] = {1, 4, 4, 1}; 12516 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12517 static int32_t param7_init[] = {1}; 12518 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12519 static int32_t param8_init[] = {1}; 12520 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12521 static int32_t param9_init[] = {1}; 12522 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12523 static int32_t param10_init[] = {0}; 12524 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12525 static bool8 layout_init[] = {false}; 12526 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12527 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12528 // Phase 3, inputs and outputs 12529 model->identifyInputsAndOutputs( 12530 {op12}, 12531 {op42}); 12532 assert(model->isValid()); 12533 } 12534 12535 inline bool is_ignored_nhwc_2(int i) { 12536 static std::set<int> ignore = {}; 12537 return ignore.find(i) != ignore.end(); 12538 } 12539 12540 void CreateModel_nhwc_weight_as_input_2(Model *model) { 12541 OperandType type0(Type::BOOL, {}); 12542 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 12543 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12544 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 12545 OperandType type4(Type::TENSOR_INT32, {4}); 12546 OperandType type5(Type::INT32, {}); 12547 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12548 // Phase 1, operands 12549 auto op12 = model->addOperand(&type11); 12550 auto op22 = model->addOperand(&type12); 12551 auto op32 = model->addOperand(&type9); 12552 auto shape2 = model->addOperand(&type4); 12553 auto param7 = model->addOperand(&type5); 12554 auto param8 = model->addOperand(&type5); 12555 auto param9 = model->addOperand(&type5); 12556 auto param10 = model->addOperand(&type5); 12557 auto layout = model->addOperand(&type0); 12558 auto op42 = model->addOperand(&type13); 12559 // Phase 2, operations 12560 static int32_t shape2_init[] = {1, 4, 4, 1}; 12561 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12562 static int32_t param7_init[] = {1}; 12563 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12564 static int32_t param8_init[] = {1}; 12565 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12566 static int32_t param9_init[] = {1}; 12567 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12568 static int32_t param10_init[] = {0}; 12569 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12570 static bool8 layout_init[] = {false}; 12571 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12572 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12573 // Phase 3, inputs and outputs 12574 model->identifyInputsAndOutputs( 12575 {op12, op22, op32}, 12576 {op42}); 12577 assert(model->isValid()); 12578 } 12579 12580 inline bool is_ignored_nhwc_weight_as_input_2(int i) { 12581 static std::set<int> ignore = {}; 12582 return ignore.find(i) != ignore.end(); 12583 } 12584 12585 void CreateModel_nhwc_relaxed_2(Model *model) { 12586 OperandType type0(Type::BOOL, {}); 12587 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 12588 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12589 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 12590 OperandType type4(Type::TENSOR_INT32, {4}); 12591 OperandType type5(Type::INT32, {}); 12592 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12593 // Phase 1, operands 12594 auto op12 = model->addOperand(&type11); 12595 auto op22 = model->addOperand(&type12); 12596 auto op32 = model->addOperand(&type9); 12597 auto shape2 = model->addOperand(&type4); 12598 auto param7 = model->addOperand(&type5); 12599 auto param8 = model->addOperand(&type5); 12600 auto param9 = model->addOperand(&type5); 12601 auto param10 = model->addOperand(&type5); 12602 auto layout = model->addOperand(&type0); 12603 auto op42 = model->addOperand(&type13); 12604 // Phase 2, operations 12605 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 12606 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 12607 static float op32_init[] = {0.0f}; 12608 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 12609 static int32_t shape2_init[] = {1, 4, 4, 1}; 12610 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12611 static int32_t param7_init[] = {1}; 12612 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12613 static int32_t param8_init[] = {1}; 12614 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12615 static int32_t param9_init[] = {1}; 12616 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12617 static int32_t param10_init[] = {0}; 12618 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12619 static bool8 layout_init[] = {false}; 12620 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12621 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12622 // Phase 3, inputs and outputs 12623 model->identifyInputsAndOutputs( 12624 {op12}, 12625 {op42}); 12626 // Phase 4: set relaxed execution 12627 model->relaxComputationFloat32toFloat16(true); 12628 assert(model->isValid()); 12629 } 12630 12631 inline bool is_ignored_nhwc_relaxed_2(int i) { 12632 static std::set<int> ignore = {}; 12633 return ignore.find(i) != ignore.end(); 12634 } 12635 12636 void CreateModel_nhwc_relaxed_weight_as_input_2(Model *model) { 12637 OperandType type0(Type::BOOL, {}); 12638 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 12639 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12640 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 12641 OperandType type4(Type::TENSOR_INT32, {4}); 12642 OperandType type5(Type::INT32, {}); 12643 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12644 // Phase 1, operands 12645 auto op12 = model->addOperand(&type11); 12646 auto op22 = model->addOperand(&type12); 12647 auto op32 = model->addOperand(&type9); 12648 auto shape2 = model->addOperand(&type4); 12649 auto param7 = model->addOperand(&type5); 12650 auto param8 = model->addOperand(&type5); 12651 auto param9 = model->addOperand(&type5); 12652 auto param10 = model->addOperand(&type5); 12653 auto layout = model->addOperand(&type0); 12654 auto op42 = model->addOperand(&type13); 12655 // Phase 2, operations 12656 static int32_t shape2_init[] = {1, 4, 4, 1}; 12657 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12658 static int32_t param7_init[] = {1}; 12659 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12660 static int32_t param8_init[] = {1}; 12661 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12662 static int32_t param9_init[] = {1}; 12663 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12664 static int32_t param10_init[] = {0}; 12665 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12666 static bool8 layout_init[] = {false}; 12667 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12668 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12669 // Phase 3, inputs and outputs 12670 model->identifyInputsAndOutputs( 12671 {op12, op22, op32}, 12672 {op42}); 12673 // Phase 4: set relaxed execution 12674 model->relaxComputationFloat32toFloat16(true); 12675 assert(model->isValid()); 12676 } 12677 12678 inline bool is_ignored_nhwc_relaxed_weight_as_input_2(int i) { 12679 static std::set<int> ignore = {}; 12680 return ignore.find(i) != ignore.end(); 12681 } 12682 12683 void CreateModel_nhwc_quant8_2(Model *model) { 12684 OperandType type0(Type::BOOL, {}); 12685 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 12686 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 12687 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 12688 OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); 12689 OperandType type4(Type::TENSOR_INT32, {4}); 12690 OperandType type5(Type::INT32, {}); 12691 // Phase 1, operands 12692 auto op12 = model->addOperand(&type152); 12693 auto op22 = model->addOperand(&type153); 12694 auto op32 = model->addOperand(&type154); 12695 auto shape2 = model->addOperand(&type4); 12696 auto param7 = model->addOperand(&type5); 12697 auto param8 = model->addOperand(&type5); 12698 auto param9 = model->addOperand(&type5); 12699 auto param10 = model->addOperand(&type5); 12700 auto layout = model->addOperand(&type0); 12701 auto op42 = model->addOperand(&type155); 12702 // Phase 2, operations 12703 static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 12704 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); 12705 static int32_t op32_init[] = {0}; 12706 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); 12707 static int32_t shape2_init[] = {1, 4, 4, 1}; 12708 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12709 static int32_t param7_init[] = {1}; 12710 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12711 static int32_t param8_init[] = {1}; 12712 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12713 static int32_t param9_init[] = {1}; 12714 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12715 static int32_t param10_init[] = {0}; 12716 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12717 static bool8 layout_init[] = {false}; 12718 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12719 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12720 // Phase 3, inputs and outputs 12721 model->identifyInputsAndOutputs( 12722 {op12}, 12723 {op42}); 12724 assert(model->isValid()); 12725 } 12726 12727 inline bool is_ignored_nhwc_quant8_2(int i) { 12728 static std::set<int> ignore = {}; 12729 return ignore.find(i) != ignore.end(); 12730 } 12731 12732 void CreateModel_nhwc_quant8_weight_as_input_2(Model *model) { 12733 OperandType type0(Type::BOOL, {}); 12734 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 12735 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 12736 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 12737 OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); 12738 OperandType type4(Type::TENSOR_INT32, {4}); 12739 OperandType type5(Type::INT32, {}); 12740 // Phase 1, operands 12741 auto op12 = model->addOperand(&type152); 12742 auto op22 = model->addOperand(&type153); 12743 auto op32 = model->addOperand(&type154); 12744 auto shape2 = model->addOperand(&type4); 12745 auto param7 = model->addOperand(&type5); 12746 auto param8 = model->addOperand(&type5); 12747 auto param9 = model->addOperand(&type5); 12748 auto param10 = model->addOperand(&type5); 12749 auto layout = model->addOperand(&type0); 12750 auto op42 = model->addOperand(&type155); 12751 // Phase 2, operations 12752 static int32_t shape2_init[] = {1, 4, 4, 1}; 12753 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12754 static int32_t param7_init[] = {1}; 12755 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12756 static int32_t param8_init[] = {1}; 12757 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12758 static int32_t param9_init[] = {1}; 12759 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12760 static int32_t param10_init[] = {0}; 12761 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12762 static bool8 layout_init[] = {false}; 12763 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12764 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12765 // Phase 3, inputs and outputs 12766 model->identifyInputsAndOutputs( 12767 {op12, op22, op32}, 12768 {op42}); 12769 assert(model->isValid()); 12770 } 12771 12772 inline bool is_ignored_nhwc_quant8_weight_as_input_2(int i) { 12773 static std::set<int> ignore = {}; 12774 return ignore.find(i) != ignore.end(); 12775 } 12776 12777 void CreateModel_nhwc_float16_2(Model *model) { 12778 OperandType type0(Type::BOOL, {}); 12779 OperandType type135(Type::TENSOR_FLOAT16, {1}); 12780 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 12781 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 12782 OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); 12783 OperandType type4(Type::TENSOR_INT32, {4}); 12784 OperandType type5(Type::INT32, {}); 12785 // Phase 1, operands 12786 auto op12 = model->addOperand(&type156); 12787 auto op22 = model->addOperand(&type157); 12788 auto op32 = model->addOperand(&type135); 12789 auto shape2 = model->addOperand(&type4); 12790 auto param7 = model->addOperand(&type5); 12791 auto param8 = model->addOperand(&type5); 12792 auto param9 = model->addOperand(&type5); 12793 auto param10 = model->addOperand(&type5); 12794 auto layout = model->addOperand(&type0); 12795 auto op42 = model->addOperand(&type158); 12796 // Phase 2, operations 12797 static _Float16 op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 12798 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); 12799 static _Float16 op32_init[] = {0.0f}; 12800 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); 12801 static int32_t shape2_init[] = {1, 4, 4, 1}; 12802 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12803 static int32_t param7_init[] = {1}; 12804 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12805 static int32_t param8_init[] = {1}; 12806 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12807 static int32_t param9_init[] = {1}; 12808 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12809 static int32_t param10_init[] = {0}; 12810 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12811 static bool8 layout_init[] = {false}; 12812 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12813 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12814 // Phase 3, inputs and outputs 12815 model->identifyInputsAndOutputs( 12816 {op12}, 12817 {op42}); 12818 assert(model->isValid()); 12819 } 12820 12821 inline bool is_ignored_nhwc_float16_2(int i) { 12822 static std::set<int> ignore = {}; 12823 return ignore.find(i) != ignore.end(); 12824 } 12825 12826 void CreateModel_nhwc_float16_weight_as_input_2(Model *model) { 12827 OperandType type0(Type::BOOL, {}); 12828 OperandType type138(Type::TENSOR_FLOAT16, {1}); 12829 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 12830 OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); 12831 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 12832 OperandType type4(Type::TENSOR_INT32, {4}); 12833 OperandType type5(Type::INT32, {}); 12834 // Phase 1, operands 12835 auto op12 = model->addOperand(&type156); 12836 auto op22 = model->addOperand(&type159); 12837 auto op32 = model->addOperand(&type138); 12838 auto shape2 = model->addOperand(&type4); 12839 auto param7 = model->addOperand(&type5); 12840 auto param8 = model->addOperand(&type5); 12841 auto param9 = model->addOperand(&type5); 12842 auto param10 = model->addOperand(&type5); 12843 auto layout = model->addOperand(&type0); 12844 auto op42 = model->addOperand(&type158); 12845 // Phase 2, operations 12846 static int32_t shape2_init[] = {1, 4, 4, 1}; 12847 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12848 static int32_t param7_init[] = {1}; 12849 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12850 static int32_t param8_init[] = {1}; 12851 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12852 static int32_t param9_init[] = {1}; 12853 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12854 static int32_t param10_init[] = {0}; 12855 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12856 static bool8 layout_init[] = {false}; 12857 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12858 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12859 // Phase 3, inputs and outputs 12860 model->identifyInputsAndOutputs( 12861 {op12, op22, op32}, 12862 {op42}); 12863 assert(model->isValid()); 12864 } 12865 12866 inline bool is_ignored_nhwc_float16_weight_as_input_2(int i) { 12867 static std::set<int> ignore = {}; 12868 return ignore.find(i) != ignore.end(); 12869 } 12870 12871 void CreateModel_nchw_2(Model *model) { 12872 OperandType type0(Type::BOOL, {}); 12873 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12874 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 12875 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 12876 OperandType type4(Type::TENSOR_INT32, {4}); 12877 OperandType type5(Type::INT32, {}); 12878 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12879 // Phase 1, operands 12880 auto op12 = model->addOperand(&type160); 12881 auto op22 = model->addOperand(&type12); 12882 auto op32 = model->addOperand(&type9); 12883 auto shape2 = model->addOperand(&type4); 12884 auto param7 = model->addOperand(&type5); 12885 auto param8 = model->addOperand(&type5); 12886 auto param9 = model->addOperand(&type5); 12887 auto param10 = model->addOperand(&type5); 12888 auto layout = model->addOperand(&type0); 12889 auto op42 = model->addOperand(&type161); 12890 // Phase 2, operations 12891 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 12892 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 12893 static float op32_init[] = {0.0f}; 12894 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 12895 static int32_t shape2_init[] = {1, 1, 4, 4}; 12896 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12897 static int32_t param7_init[] = {1}; 12898 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12899 static int32_t param8_init[] = {1}; 12900 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12901 static int32_t param9_init[] = {1}; 12902 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12903 static int32_t param10_init[] = {0}; 12904 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12905 static bool8 layout_init[] = {true}; 12906 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12907 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12908 // Phase 3, inputs and outputs 12909 model->identifyInputsAndOutputs( 12910 {op12}, 12911 {op42}); 12912 assert(model->isValid()); 12913 } 12914 12915 inline bool is_ignored_nchw_2(int i) { 12916 static std::set<int> ignore = {}; 12917 return ignore.find(i) != ignore.end(); 12918 } 12919 12920 void CreateModel_nchw_weight_as_input_2(Model *model) { 12921 OperandType type0(Type::BOOL, {}); 12922 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12923 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 12924 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 12925 OperandType type4(Type::TENSOR_INT32, {4}); 12926 OperandType type5(Type::INT32, {}); 12927 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12928 // Phase 1, operands 12929 auto op12 = model->addOperand(&type160); 12930 auto op22 = model->addOperand(&type12); 12931 auto op32 = model->addOperand(&type9); 12932 auto shape2 = model->addOperand(&type4); 12933 auto param7 = model->addOperand(&type5); 12934 auto param8 = model->addOperand(&type5); 12935 auto param9 = model->addOperand(&type5); 12936 auto param10 = model->addOperand(&type5); 12937 auto layout = model->addOperand(&type0); 12938 auto op42 = model->addOperand(&type161); 12939 // Phase 2, operations 12940 static int32_t shape2_init[] = {1, 1, 4, 4}; 12941 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12942 static int32_t param7_init[] = {1}; 12943 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12944 static int32_t param8_init[] = {1}; 12945 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12946 static int32_t param9_init[] = {1}; 12947 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12948 static int32_t param10_init[] = {0}; 12949 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12950 static bool8 layout_init[] = {true}; 12951 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 12952 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 12953 // Phase 3, inputs and outputs 12954 model->identifyInputsAndOutputs( 12955 {op12, op22, op32}, 12956 {op42}); 12957 assert(model->isValid()); 12958 } 12959 12960 inline bool is_ignored_nchw_weight_as_input_2(int i) { 12961 static std::set<int> ignore = {}; 12962 return ignore.find(i) != ignore.end(); 12963 } 12964 12965 void CreateModel_nchw_relaxed_2(Model *model) { 12966 OperandType type0(Type::BOOL, {}); 12967 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 12968 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 12969 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 12970 OperandType type4(Type::TENSOR_INT32, {4}); 12971 OperandType type5(Type::INT32, {}); 12972 OperandType type9(Type::TENSOR_FLOAT32, {1}); 12973 // Phase 1, operands 12974 auto op12 = model->addOperand(&type160); 12975 auto op22 = model->addOperand(&type12); 12976 auto op32 = model->addOperand(&type9); 12977 auto shape2 = model->addOperand(&type4); 12978 auto param7 = model->addOperand(&type5); 12979 auto param8 = model->addOperand(&type5); 12980 auto param9 = model->addOperand(&type5); 12981 auto param10 = model->addOperand(&type5); 12982 auto layout = model->addOperand(&type0); 12983 auto op42 = model->addOperand(&type161); 12984 // Phase 2, operations 12985 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 12986 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 12987 static float op32_init[] = {0.0f}; 12988 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 12989 static int32_t shape2_init[] = {1, 1, 4, 4}; 12990 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 12991 static int32_t param7_init[] = {1}; 12992 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 12993 static int32_t param8_init[] = {1}; 12994 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 12995 static int32_t param9_init[] = {1}; 12996 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 12997 static int32_t param10_init[] = {0}; 12998 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 12999 static bool8 layout_init[] = {true}; 13000 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13001 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13002 // Phase 3, inputs and outputs 13003 model->identifyInputsAndOutputs( 13004 {op12}, 13005 {op42}); 13006 // Phase 4: set relaxed execution 13007 model->relaxComputationFloat32toFloat16(true); 13008 assert(model->isValid()); 13009 } 13010 13011 inline bool is_ignored_nchw_relaxed_2(int i) { 13012 static std::set<int> ignore = {}; 13013 return ignore.find(i) != ignore.end(); 13014 } 13015 13016 void CreateModel_nchw_relaxed_weight_as_input_2(Model *model) { 13017 OperandType type0(Type::BOOL, {}); 13018 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13019 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 13020 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 13021 OperandType type4(Type::TENSOR_INT32, {4}); 13022 OperandType type5(Type::INT32, {}); 13023 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13024 // Phase 1, operands 13025 auto op12 = model->addOperand(&type160); 13026 auto op22 = model->addOperand(&type12); 13027 auto op32 = model->addOperand(&type9); 13028 auto shape2 = model->addOperand(&type4); 13029 auto param7 = model->addOperand(&type5); 13030 auto param8 = model->addOperand(&type5); 13031 auto param9 = model->addOperand(&type5); 13032 auto param10 = model->addOperand(&type5); 13033 auto layout = model->addOperand(&type0); 13034 auto op42 = model->addOperand(&type161); 13035 // Phase 2, operations 13036 static int32_t shape2_init[] = {1, 1, 4, 4}; 13037 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13038 static int32_t param7_init[] = {1}; 13039 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13040 static int32_t param8_init[] = {1}; 13041 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13042 static int32_t param9_init[] = {1}; 13043 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13044 static int32_t param10_init[] = {0}; 13045 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13046 static bool8 layout_init[] = {true}; 13047 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13048 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13049 // Phase 3, inputs and outputs 13050 model->identifyInputsAndOutputs( 13051 {op12, op22, op32}, 13052 {op42}); 13053 // Phase 4: set relaxed execution 13054 model->relaxComputationFloat32toFloat16(true); 13055 assert(model->isValid()); 13056 } 13057 13058 inline bool is_ignored_nchw_relaxed_weight_as_input_2(int i) { 13059 static std::set<int> ignore = {}; 13060 return ignore.find(i) != ignore.end(); 13061 } 13062 13063 void CreateModel_nchw_quant8_2(Model *model) { 13064 OperandType type0(Type::BOOL, {}); 13065 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 13066 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 13067 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 13068 OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); 13069 OperandType type4(Type::TENSOR_INT32, {4}); 13070 OperandType type5(Type::INT32, {}); 13071 // Phase 1, operands 13072 auto op12 = model->addOperand(&type162); 13073 auto op22 = model->addOperand(&type153); 13074 auto op32 = model->addOperand(&type154); 13075 auto shape2 = model->addOperand(&type4); 13076 auto param7 = model->addOperand(&type5); 13077 auto param8 = model->addOperand(&type5); 13078 auto param9 = model->addOperand(&type5); 13079 auto param10 = model->addOperand(&type5); 13080 auto layout = model->addOperand(&type0); 13081 auto op42 = model->addOperand(&type163); 13082 // Phase 2, operations 13083 static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 13084 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); 13085 static int32_t op32_init[] = {0}; 13086 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); 13087 static int32_t shape2_init[] = {1, 1, 4, 4}; 13088 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13089 static int32_t param7_init[] = {1}; 13090 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13091 static int32_t param8_init[] = {1}; 13092 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13093 static int32_t param9_init[] = {1}; 13094 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13095 static int32_t param10_init[] = {0}; 13096 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13097 static bool8 layout_init[] = {true}; 13098 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13099 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13100 // Phase 3, inputs and outputs 13101 model->identifyInputsAndOutputs( 13102 {op12}, 13103 {op42}); 13104 assert(model->isValid()); 13105 } 13106 13107 inline bool is_ignored_nchw_quant8_2(int i) { 13108 static std::set<int> ignore = {}; 13109 return ignore.find(i) != ignore.end(); 13110 } 13111 13112 void CreateModel_nchw_quant8_weight_as_input_2(Model *model) { 13113 OperandType type0(Type::BOOL, {}); 13114 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 13115 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 13116 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 13117 OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); 13118 OperandType type4(Type::TENSOR_INT32, {4}); 13119 OperandType type5(Type::INT32, {}); 13120 // Phase 1, operands 13121 auto op12 = model->addOperand(&type162); 13122 auto op22 = model->addOperand(&type153); 13123 auto op32 = model->addOperand(&type154); 13124 auto shape2 = model->addOperand(&type4); 13125 auto param7 = model->addOperand(&type5); 13126 auto param8 = model->addOperand(&type5); 13127 auto param9 = model->addOperand(&type5); 13128 auto param10 = model->addOperand(&type5); 13129 auto layout = model->addOperand(&type0); 13130 auto op42 = model->addOperand(&type163); 13131 // Phase 2, operations 13132 static int32_t shape2_init[] = {1, 1, 4, 4}; 13133 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13134 static int32_t param7_init[] = {1}; 13135 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13136 static int32_t param8_init[] = {1}; 13137 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13138 static int32_t param9_init[] = {1}; 13139 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13140 static int32_t param10_init[] = {0}; 13141 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13142 static bool8 layout_init[] = {true}; 13143 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13144 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13145 // Phase 3, inputs and outputs 13146 model->identifyInputsAndOutputs( 13147 {op12, op22, op32}, 13148 {op42}); 13149 assert(model->isValid()); 13150 } 13151 13152 inline bool is_ignored_nchw_quant8_weight_as_input_2(int i) { 13153 static std::set<int> ignore = {}; 13154 return ignore.find(i) != ignore.end(); 13155 } 13156 13157 void CreateModel_nchw_float16_2(Model *model) { 13158 OperandType type0(Type::BOOL, {}); 13159 OperandType type135(Type::TENSOR_FLOAT16, {1}); 13160 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 13161 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 13162 OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); 13163 OperandType type4(Type::TENSOR_INT32, {4}); 13164 OperandType type5(Type::INT32, {}); 13165 // Phase 1, operands 13166 auto op12 = model->addOperand(&type164); 13167 auto op22 = model->addOperand(&type157); 13168 auto op32 = model->addOperand(&type135); 13169 auto shape2 = model->addOperand(&type4); 13170 auto param7 = model->addOperand(&type5); 13171 auto param8 = model->addOperand(&type5); 13172 auto param9 = model->addOperand(&type5); 13173 auto param10 = model->addOperand(&type5); 13174 auto layout = model->addOperand(&type0); 13175 auto op42 = model->addOperand(&type165); 13176 // Phase 2, operations 13177 static _Float16 op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13178 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); 13179 static _Float16 op32_init[] = {0.0f}; 13180 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); 13181 static int32_t shape2_init[] = {1, 1, 4, 4}; 13182 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13183 static int32_t param7_init[] = {1}; 13184 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13185 static int32_t param8_init[] = {1}; 13186 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13187 static int32_t param9_init[] = {1}; 13188 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13189 static int32_t param10_init[] = {0}; 13190 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13191 static bool8 layout_init[] = {true}; 13192 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13193 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13194 // Phase 3, inputs and outputs 13195 model->identifyInputsAndOutputs( 13196 {op12}, 13197 {op42}); 13198 assert(model->isValid()); 13199 } 13200 13201 inline bool is_ignored_nchw_float16_2(int i) { 13202 static std::set<int> ignore = {}; 13203 return ignore.find(i) != ignore.end(); 13204 } 13205 13206 void CreateModel_nchw_float16_weight_as_input_2(Model *model) { 13207 OperandType type0(Type::BOOL, {}); 13208 OperandType type138(Type::TENSOR_FLOAT16, {1}); 13209 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 13210 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 13211 OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); 13212 OperandType type4(Type::TENSOR_INT32, {4}); 13213 OperandType type5(Type::INT32, {}); 13214 // Phase 1, operands 13215 auto op12 = model->addOperand(&type164); 13216 auto op22 = model->addOperand(&type159); 13217 auto op32 = model->addOperand(&type138); 13218 auto shape2 = model->addOperand(&type4); 13219 auto param7 = model->addOperand(&type5); 13220 auto param8 = model->addOperand(&type5); 13221 auto param9 = model->addOperand(&type5); 13222 auto param10 = model->addOperand(&type5); 13223 auto layout = model->addOperand(&type0); 13224 auto op42 = model->addOperand(&type165); 13225 // Phase 2, operations 13226 static int32_t shape2_init[] = {1, 1, 4, 4}; 13227 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13228 static int32_t param7_init[] = {1}; 13229 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13230 static int32_t param8_init[] = {1}; 13231 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13232 static int32_t param9_init[] = {1}; 13233 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13234 static int32_t param10_init[] = {0}; 13235 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13236 static bool8 layout_init[] = {true}; 13237 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13238 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13239 // Phase 3, inputs and outputs 13240 model->identifyInputsAndOutputs( 13241 {op12, op22, op32}, 13242 {op42}); 13243 assert(model->isValid()); 13244 } 13245 13246 inline bool is_ignored_nchw_float16_weight_as_input_2(int i) { 13247 static std::set<int> ignore = {}; 13248 return ignore.find(i) != ignore.end(); 13249 } 13250 13251 void CreateModel_dynamic_output_shape_nhwc_2(Model *model) { 13252 OperandType type0(Type::BOOL, {}); 13253 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 13254 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13255 OperandType type4(Type::TENSOR_INT32, {4}); 13256 OperandType type5(Type::INT32, {}); 13257 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13258 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13259 // Phase 1, operands 13260 auto op12 = model->addOperand(&type11); 13261 auto op22 = model->addOperand(&type12); 13262 auto op32 = model->addOperand(&type9); 13263 auto shape2 = model->addOperand(&type4); 13264 auto param7 = model->addOperand(&type5); 13265 auto param8 = model->addOperand(&type5); 13266 auto param9 = model->addOperand(&type5); 13267 auto param10 = model->addOperand(&type5); 13268 auto layout = model->addOperand(&type0); 13269 auto op42 = model->addOperand(&type88); 13270 // Phase 2, operations 13271 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13272 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 13273 static float op32_init[] = {0.0f}; 13274 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 13275 static int32_t shape2_init[] = {1, 4, 4, 1}; 13276 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13277 static int32_t param7_init[] = {1}; 13278 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13279 static int32_t param8_init[] = {1}; 13280 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13281 static int32_t param9_init[] = {1}; 13282 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13283 static int32_t param10_init[] = {0}; 13284 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13285 static bool8 layout_init[] = {false}; 13286 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13287 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13288 // Phase 3, inputs and outputs 13289 model->identifyInputsAndOutputs( 13290 {op12}, 13291 {op42}); 13292 assert(model->isValid()); 13293 } 13294 13295 inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) { 13296 static std::set<int> ignore = {}; 13297 return ignore.find(i) != ignore.end(); 13298 } 13299 13300 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) { 13301 OperandType type0(Type::BOOL, {}); 13302 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 13303 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13304 OperandType type4(Type::TENSOR_INT32, {4}); 13305 OperandType type5(Type::INT32, {}); 13306 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13307 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13308 // Phase 1, operands 13309 auto op12 = model->addOperand(&type11); 13310 auto op22 = model->addOperand(&type12); 13311 auto op32 = model->addOperand(&type9); 13312 auto shape2 = model->addOperand(&type4); 13313 auto param7 = model->addOperand(&type5); 13314 auto param8 = model->addOperand(&type5); 13315 auto param9 = model->addOperand(&type5); 13316 auto param10 = model->addOperand(&type5); 13317 auto layout = model->addOperand(&type0); 13318 auto op42 = model->addOperand(&type88); 13319 // Phase 2, operations 13320 static int32_t shape2_init[] = {1, 4, 4, 1}; 13321 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13322 static int32_t param7_init[] = {1}; 13323 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13324 static int32_t param8_init[] = {1}; 13325 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13326 static int32_t param9_init[] = {1}; 13327 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13328 static int32_t param10_init[] = {0}; 13329 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13330 static bool8 layout_init[] = {false}; 13331 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13332 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13333 // Phase 3, inputs and outputs 13334 model->identifyInputsAndOutputs( 13335 {op12, op22, op32}, 13336 {op42}); 13337 assert(model->isValid()); 13338 } 13339 13340 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i) { 13341 static std::set<int> ignore = {}; 13342 return ignore.find(i) != ignore.end(); 13343 } 13344 13345 void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) { 13346 OperandType type0(Type::BOOL, {}); 13347 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 13348 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13349 OperandType type4(Type::TENSOR_INT32, {4}); 13350 OperandType type5(Type::INT32, {}); 13351 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13352 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13353 // Phase 1, operands 13354 auto op12 = model->addOperand(&type11); 13355 auto op22 = model->addOperand(&type12); 13356 auto op32 = model->addOperand(&type9); 13357 auto shape2 = model->addOperand(&type4); 13358 auto param7 = model->addOperand(&type5); 13359 auto param8 = model->addOperand(&type5); 13360 auto param9 = model->addOperand(&type5); 13361 auto param10 = model->addOperand(&type5); 13362 auto layout = model->addOperand(&type0); 13363 auto op42 = model->addOperand(&type88); 13364 // Phase 2, operations 13365 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13366 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 13367 static float op32_init[] = {0.0f}; 13368 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 13369 static int32_t shape2_init[] = {1, 4, 4, 1}; 13370 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13371 static int32_t param7_init[] = {1}; 13372 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13373 static int32_t param8_init[] = {1}; 13374 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13375 static int32_t param9_init[] = {1}; 13376 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13377 static int32_t param10_init[] = {0}; 13378 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13379 static bool8 layout_init[] = {false}; 13380 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13381 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13382 // Phase 3, inputs and outputs 13383 model->identifyInputsAndOutputs( 13384 {op12}, 13385 {op42}); 13386 // Phase 4: set relaxed execution 13387 model->relaxComputationFloat32toFloat16(true); 13388 assert(model->isValid()); 13389 } 13390 13391 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) { 13392 static std::set<int> ignore = {}; 13393 return ignore.find(i) != ignore.end(); 13394 } 13395 13396 void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_2(Model *model) { 13397 OperandType type0(Type::BOOL, {}); 13398 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 13399 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13400 OperandType type4(Type::TENSOR_INT32, {4}); 13401 OperandType type5(Type::INT32, {}); 13402 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13403 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13404 // Phase 1, operands 13405 auto op12 = model->addOperand(&type11); 13406 auto op22 = model->addOperand(&type12); 13407 auto op32 = model->addOperand(&type9); 13408 auto shape2 = model->addOperand(&type4); 13409 auto param7 = model->addOperand(&type5); 13410 auto param8 = model->addOperand(&type5); 13411 auto param9 = model->addOperand(&type5); 13412 auto param10 = model->addOperand(&type5); 13413 auto layout = model->addOperand(&type0); 13414 auto op42 = model->addOperand(&type88); 13415 // Phase 2, operations 13416 static int32_t shape2_init[] = {1, 4, 4, 1}; 13417 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13418 static int32_t param7_init[] = {1}; 13419 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13420 static int32_t param8_init[] = {1}; 13421 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13422 static int32_t param9_init[] = {1}; 13423 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13424 static int32_t param10_init[] = {0}; 13425 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13426 static bool8 layout_init[] = {false}; 13427 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13428 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13429 // Phase 3, inputs and outputs 13430 model->identifyInputsAndOutputs( 13431 {op12, op22, op32}, 13432 {op42}); 13433 // Phase 4: set relaxed execution 13434 model->relaxComputationFloat32toFloat16(true); 13435 assert(model->isValid()); 13436 } 13437 13438 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_2(int i) { 13439 static std::set<int> ignore = {}; 13440 return ignore.find(i) != ignore.end(); 13441 } 13442 13443 void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) { 13444 OperandType type0(Type::BOOL, {}); 13445 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 13446 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 13447 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 13448 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 13449 OperandType type4(Type::TENSOR_INT32, {4}); 13450 OperandType type5(Type::INT32, {}); 13451 // Phase 1, operands 13452 auto op12 = model->addOperand(&type152); 13453 auto op22 = model->addOperand(&type153); 13454 auto op32 = model->addOperand(&type154); 13455 auto shape2 = model->addOperand(&type4); 13456 auto param7 = model->addOperand(&type5); 13457 auto param8 = model->addOperand(&type5); 13458 auto param9 = model->addOperand(&type5); 13459 auto param10 = model->addOperand(&type5); 13460 auto layout = model->addOperand(&type0); 13461 auto op42 = model->addOperand(&type166); 13462 // Phase 2, operations 13463 static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 13464 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); 13465 static int32_t op32_init[] = {0}; 13466 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); 13467 static int32_t shape2_init[] = {1, 4, 4, 1}; 13468 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13469 static int32_t param7_init[] = {1}; 13470 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13471 static int32_t param8_init[] = {1}; 13472 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13473 static int32_t param9_init[] = {1}; 13474 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13475 static int32_t param10_init[] = {0}; 13476 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13477 static bool8 layout_init[] = {false}; 13478 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13479 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13480 // Phase 3, inputs and outputs 13481 model->identifyInputsAndOutputs( 13482 {op12}, 13483 {op42}); 13484 assert(model->isValid()); 13485 } 13486 13487 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) { 13488 static std::set<int> ignore = {}; 13489 return ignore.find(i) != ignore.end(); 13490 } 13491 13492 void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_2(Model *model) { 13493 OperandType type0(Type::BOOL, {}); 13494 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 13495 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 13496 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 13497 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 13498 OperandType type4(Type::TENSOR_INT32, {4}); 13499 OperandType type5(Type::INT32, {}); 13500 // Phase 1, operands 13501 auto op12 = model->addOperand(&type152); 13502 auto op22 = model->addOperand(&type153); 13503 auto op32 = model->addOperand(&type154); 13504 auto shape2 = model->addOperand(&type4); 13505 auto param7 = model->addOperand(&type5); 13506 auto param8 = model->addOperand(&type5); 13507 auto param9 = model->addOperand(&type5); 13508 auto param10 = model->addOperand(&type5); 13509 auto layout = model->addOperand(&type0); 13510 auto op42 = model->addOperand(&type166); 13511 // Phase 2, operations 13512 static int32_t shape2_init[] = {1, 4, 4, 1}; 13513 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13514 static int32_t param7_init[] = {1}; 13515 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13516 static int32_t param8_init[] = {1}; 13517 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13518 static int32_t param9_init[] = {1}; 13519 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13520 static int32_t param10_init[] = {0}; 13521 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13522 static bool8 layout_init[] = {false}; 13523 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13524 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13525 // Phase 3, inputs and outputs 13526 model->identifyInputsAndOutputs( 13527 {op12, op22, op32}, 13528 {op42}); 13529 assert(model->isValid()); 13530 } 13531 13532 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_2(int i) { 13533 static std::set<int> ignore = {}; 13534 return ignore.find(i) != ignore.end(); 13535 } 13536 13537 void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) { 13538 OperandType type0(Type::BOOL, {}); 13539 OperandType type135(Type::TENSOR_FLOAT16, {1}); 13540 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 13541 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 13542 OperandType type4(Type::TENSOR_INT32, {4}); 13543 OperandType type5(Type::INT32, {}); 13544 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 13545 // Phase 1, operands 13546 auto op12 = model->addOperand(&type156); 13547 auto op22 = model->addOperand(&type157); 13548 auto op32 = model->addOperand(&type135); 13549 auto shape2 = model->addOperand(&type4); 13550 auto param7 = model->addOperand(&type5); 13551 auto param8 = model->addOperand(&type5); 13552 auto param9 = model->addOperand(&type5); 13553 auto param10 = model->addOperand(&type5); 13554 auto layout = model->addOperand(&type0); 13555 auto op42 = model->addOperand(&type96); 13556 // Phase 2, operations 13557 static _Float16 op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13558 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); 13559 static _Float16 op32_init[] = {0.0f}; 13560 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); 13561 static int32_t shape2_init[] = {1, 4, 4, 1}; 13562 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13563 static int32_t param7_init[] = {1}; 13564 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13565 static int32_t param8_init[] = {1}; 13566 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13567 static int32_t param9_init[] = {1}; 13568 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13569 static int32_t param10_init[] = {0}; 13570 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13571 static bool8 layout_init[] = {false}; 13572 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13573 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13574 // Phase 3, inputs and outputs 13575 model->identifyInputsAndOutputs( 13576 {op12}, 13577 {op42}); 13578 assert(model->isValid()); 13579 } 13580 13581 inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) { 13582 static std::set<int> ignore = {}; 13583 return ignore.find(i) != ignore.end(); 13584 } 13585 13586 void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_2(Model *model) { 13587 OperandType type0(Type::BOOL, {}); 13588 OperandType type138(Type::TENSOR_FLOAT16, {1}); 13589 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 13590 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 13591 OperandType type4(Type::TENSOR_INT32, {4}); 13592 OperandType type5(Type::INT32, {}); 13593 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 13594 // Phase 1, operands 13595 auto op12 = model->addOperand(&type156); 13596 auto op22 = model->addOperand(&type159); 13597 auto op32 = model->addOperand(&type138); 13598 auto shape2 = model->addOperand(&type4); 13599 auto param7 = model->addOperand(&type5); 13600 auto param8 = model->addOperand(&type5); 13601 auto param9 = model->addOperand(&type5); 13602 auto param10 = model->addOperand(&type5); 13603 auto layout = model->addOperand(&type0); 13604 auto op42 = model->addOperand(&type96); 13605 // Phase 2, operations 13606 static int32_t shape2_init[] = {1, 4, 4, 1}; 13607 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13608 static int32_t param7_init[] = {1}; 13609 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13610 static int32_t param8_init[] = {1}; 13611 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13612 static int32_t param9_init[] = {1}; 13613 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13614 static int32_t param10_init[] = {0}; 13615 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13616 static bool8 layout_init[] = {false}; 13617 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13618 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13619 // Phase 3, inputs and outputs 13620 model->identifyInputsAndOutputs( 13621 {op12, op22, op32}, 13622 {op42}); 13623 assert(model->isValid()); 13624 } 13625 13626 inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_2(int i) { 13627 static std::set<int> ignore = {}; 13628 return ignore.find(i) != ignore.end(); 13629 } 13630 13631 void CreateModel_dynamic_output_shape_nchw_2(Model *model) { 13632 OperandType type0(Type::BOOL, {}); 13633 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13634 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 13635 OperandType type4(Type::TENSOR_INT32, {4}); 13636 OperandType type5(Type::INT32, {}); 13637 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13638 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13639 // Phase 1, operands 13640 auto op12 = model->addOperand(&type160); 13641 auto op22 = model->addOperand(&type12); 13642 auto op32 = model->addOperand(&type9); 13643 auto shape2 = model->addOperand(&type4); 13644 auto param7 = model->addOperand(&type5); 13645 auto param8 = model->addOperand(&type5); 13646 auto param9 = model->addOperand(&type5); 13647 auto param10 = model->addOperand(&type5); 13648 auto layout = model->addOperand(&type0); 13649 auto op42 = model->addOperand(&type88); 13650 // Phase 2, operations 13651 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13652 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 13653 static float op32_init[] = {0.0f}; 13654 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 13655 static int32_t shape2_init[] = {1, 1, 4, 4}; 13656 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13657 static int32_t param7_init[] = {1}; 13658 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13659 static int32_t param8_init[] = {1}; 13660 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13661 static int32_t param9_init[] = {1}; 13662 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13663 static int32_t param10_init[] = {0}; 13664 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13665 static bool8 layout_init[] = {true}; 13666 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13667 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13668 // Phase 3, inputs and outputs 13669 model->identifyInputsAndOutputs( 13670 {op12}, 13671 {op42}); 13672 assert(model->isValid()); 13673 } 13674 13675 inline bool is_ignored_dynamic_output_shape_nchw_2(int i) { 13676 static std::set<int> ignore = {}; 13677 return ignore.find(i) != ignore.end(); 13678 } 13679 13680 void CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model *model) { 13681 OperandType type0(Type::BOOL, {}); 13682 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13683 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 13684 OperandType type4(Type::TENSOR_INT32, {4}); 13685 OperandType type5(Type::INT32, {}); 13686 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13687 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13688 // Phase 1, operands 13689 auto op12 = model->addOperand(&type160); 13690 auto op22 = model->addOperand(&type12); 13691 auto op32 = model->addOperand(&type9); 13692 auto shape2 = model->addOperand(&type4); 13693 auto param7 = model->addOperand(&type5); 13694 auto param8 = model->addOperand(&type5); 13695 auto param9 = model->addOperand(&type5); 13696 auto param10 = model->addOperand(&type5); 13697 auto layout = model->addOperand(&type0); 13698 auto op42 = model->addOperand(&type88); 13699 // Phase 2, operations 13700 static int32_t shape2_init[] = {1, 1, 4, 4}; 13701 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13702 static int32_t param7_init[] = {1}; 13703 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13704 static int32_t param8_init[] = {1}; 13705 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13706 static int32_t param9_init[] = {1}; 13707 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13708 static int32_t param10_init[] = {0}; 13709 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13710 static bool8 layout_init[] = {true}; 13711 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13712 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13713 // Phase 3, inputs and outputs 13714 model->identifyInputsAndOutputs( 13715 {op12, op22, op32}, 13716 {op42}); 13717 assert(model->isValid()); 13718 } 13719 13720 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i) { 13721 static std::set<int> ignore = {}; 13722 return ignore.find(i) != ignore.end(); 13723 } 13724 13725 void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) { 13726 OperandType type0(Type::BOOL, {}); 13727 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13728 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 13729 OperandType type4(Type::TENSOR_INT32, {4}); 13730 OperandType type5(Type::INT32, {}); 13731 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13732 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13733 // Phase 1, operands 13734 auto op12 = model->addOperand(&type160); 13735 auto op22 = model->addOperand(&type12); 13736 auto op32 = model->addOperand(&type9); 13737 auto shape2 = model->addOperand(&type4); 13738 auto param7 = model->addOperand(&type5); 13739 auto param8 = model->addOperand(&type5); 13740 auto param9 = model->addOperand(&type5); 13741 auto param10 = model->addOperand(&type5); 13742 auto layout = model->addOperand(&type0); 13743 auto op42 = model->addOperand(&type88); 13744 // Phase 2, operations 13745 static float op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13746 model->setOperandValue(op22, op22_init, sizeof(float) * 18); 13747 static float op32_init[] = {0.0f}; 13748 model->setOperandValue(op32, op32_init, sizeof(float) * 1); 13749 static int32_t shape2_init[] = {1, 1, 4, 4}; 13750 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13751 static int32_t param7_init[] = {1}; 13752 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13753 static int32_t param8_init[] = {1}; 13754 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13755 static int32_t param9_init[] = {1}; 13756 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13757 static int32_t param10_init[] = {0}; 13758 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13759 static bool8 layout_init[] = {true}; 13760 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13761 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13762 // Phase 3, inputs and outputs 13763 model->identifyInputsAndOutputs( 13764 {op12}, 13765 {op42}); 13766 // Phase 4: set relaxed execution 13767 model->relaxComputationFloat32toFloat16(true); 13768 assert(model->isValid()); 13769 } 13770 13771 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) { 13772 static std::set<int> ignore = {}; 13773 return ignore.find(i) != ignore.end(); 13774 } 13775 13776 void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_2(Model *model) { 13777 OperandType type0(Type::BOOL, {}); 13778 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 13779 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 13780 OperandType type4(Type::TENSOR_INT32, {4}); 13781 OperandType type5(Type::INT32, {}); 13782 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 13783 OperandType type9(Type::TENSOR_FLOAT32, {1}); 13784 // Phase 1, operands 13785 auto op12 = model->addOperand(&type160); 13786 auto op22 = model->addOperand(&type12); 13787 auto op32 = model->addOperand(&type9); 13788 auto shape2 = model->addOperand(&type4); 13789 auto param7 = model->addOperand(&type5); 13790 auto param8 = model->addOperand(&type5); 13791 auto param9 = model->addOperand(&type5); 13792 auto param10 = model->addOperand(&type5); 13793 auto layout = model->addOperand(&type0); 13794 auto op42 = model->addOperand(&type88); 13795 // Phase 2, operations 13796 static int32_t shape2_init[] = {1, 1, 4, 4}; 13797 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13798 static int32_t param7_init[] = {1}; 13799 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13800 static int32_t param8_init[] = {1}; 13801 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13802 static int32_t param9_init[] = {1}; 13803 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13804 static int32_t param10_init[] = {0}; 13805 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13806 static bool8 layout_init[] = {true}; 13807 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13808 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13809 // Phase 3, inputs and outputs 13810 model->identifyInputsAndOutputs( 13811 {op12, op22, op32}, 13812 {op42}); 13813 // Phase 4: set relaxed execution 13814 model->relaxComputationFloat32toFloat16(true); 13815 assert(model->isValid()); 13816 } 13817 13818 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_2(int i) { 13819 static std::set<int> ignore = {}; 13820 return ignore.find(i) != ignore.end(); 13821 } 13822 13823 void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) { 13824 OperandType type0(Type::BOOL, {}); 13825 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 13826 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 13827 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 13828 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 13829 OperandType type4(Type::TENSOR_INT32, {4}); 13830 OperandType type5(Type::INT32, {}); 13831 // Phase 1, operands 13832 auto op12 = model->addOperand(&type162); 13833 auto op22 = model->addOperand(&type153); 13834 auto op32 = model->addOperand(&type154); 13835 auto shape2 = model->addOperand(&type4); 13836 auto param7 = model->addOperand(&type5); 13837 auto param8 = model->addOperand(&type5); 13838 auto param9 = model->addOperand(&type5); 13839 auto param10 = model->addOperand(&type5); 13840 auto layout = model->addOperand(&type0); 13841 auto op42 = model->addOperand(&type166); 13842 // Phase 2, operations 13843 static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 13844 model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); 13845 static int32_t op32_init[] = {0}; 13846 model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); 13847 static int32_t shape2_init[] = {1, 1, 4, 4}; 13848 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13849 static int32_t param7_init[] = {1}; 13850 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13851 static int32_t param8_init[] = {1}; 13852 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13853 static int32_t param9_init[] = {1}; 13854 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13855 static int32_t param10_init[] = {0}; 13856 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13857 static bool8 layout_init[] = {true}; 13858 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13859 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13860 // Phase 3, inputs and outputs 13861 model->identifyInputsAndOutputs( 13862 {op12}, 13863 {op42}); 13864 assert(model->isValid()); 13865 } 13866 13867 inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) { 13868 static std::set<int> ignore = {}; 13869 return ignore.find(i) != ignore.end(); 13870 } 13871 13872 void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_2(Model *model) { 13873 OperandType type0(Type::BOOL, {}); 13874 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 13875 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 13876 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 13877 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 13878 OperandType type4(Type::TENSOR_INT32, {4}); 13879 OperandType type5(Type::INT32, {}); 13880 // Phase 1, operands 13881 auto op12 = model->addOperand(&type162); 13882 auto op22 = model->addOperand(&type153); 13883 auto op32 = model->addOperand(&type154); 13884 auto shape2 = model->addOperand(&type4); 13885 auto param7 = model->addOperand(&type5); 13886 auto param8 = model->addOperand(&type5); 13887 auto param9 = model->addOperand(&type5); 13888 auto param10 = model->addOperand(&type5); 13889 auto layout = model->addOperand(&type0); 13890 auto op42 = model->addOperand(&type166); 13891 // Phase 2, operations 13892 static int32_t shape2_init[] = {1, 1, 4, 4}; 13893 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13894 static int32_t param7_init[] = {1}; 13895 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13896 static int32_t param8_init[] = {1}; 13897 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13898 static int32_t param9_init[] = {1}; 13899 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13900 static int32_t param10_init[] = {0}; 13901 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13902 static bool8 layout_init[] = {true}; 13903 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13904 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13905 // Phase 3, inputs and outputs 13906 model->identifyInputsAndOutputs( 13907 {op12, op22, op32}, 13908 {op42}); 13909 assert(model->isValid()); 13910 } 13911 13912 inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_2(int i) { 13913 static std::set<int> ignore = {}; 13914 return ignore.find(i) != ignore.end(); 13915 } 13916 13917 void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) { 13918 OperandType type0(Type::BOOL, {}); 13919 OperandType type135(Type::TENSOR_FLOAT16, {1}); 13920 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 13921 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 13922 OperandType type4(Type::TENSOR_INT32, {4}); 13923 OperandType type5(Type::INT32, {}); 13924 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 13925 // Phase 1, operands 13926 auto op12 = model->addOperand(&type164); 13927 auto op22 = model->addOperand(&type157); 13928 auto op32 = model->addOperand(&type135); 13929 auto shape2 = model->addOperand(&type4); 13930 auto param7 = model->addOperand(&type5); 13931 auto param8 = model->addOperand(&type5); 13932 auto param9 = model->addOperand(&type5); 13933 auto param10 = model->addOperand(&type5); 13934 auto layout = model->addOperand(&type0); 13935 auto op42 = model->addOperand(&type96); 13936 // Phase 2, operations 13937 static _Float16 op22_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 13938 model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); 13939 static _Float16 op32_init[] = {0.0f}; 13940 model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); 13941 static int32_t shape2_init[] = {1, 1, 4, 4}; 13942 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13943 static int32_t param7_init[] = {1}; 13944 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13945 static int32_t param8_init[] = {1}; 13946 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13947 static int32_t param9_init[] = {1}; 13948 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13949 static int32_t param10_init[] = {0}; 13950 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13951 static bool8 layout_init[] = {true}; 13952 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13953 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13954 // Phase 3, inputs and outputs 13955 model->identifyInputsAndOutputs( 13956 {op12}, 13957 {op42}); 13958 assert(model->isValid()); 13959 } 13960 13961 inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) { 13962 static std::set<int> ignore = {}; 13963 return ignore.find(i) != ignore.end(); 13964 } 13965 13966 void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_2(Model *model) { 13967 OperandType type0(Type::BOOL, {}); 13968 OperandType type138(Type::TENSOR_FLOAT16, {1}); 13969 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 13970 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 13971 OperandType type4(Type::TENSOR_INT32, {4}); 13972 OperandType type5(Type::INT32, {}); 13973 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 13974 // Phase 1, operands 13975 auto op12 = model->addOperand(&type164); 13976 auto op22 = model->addOperand(&type159); 13977 auto op32 = model->addOperand(&type138); 13978 auto shape2 = model->addOperand(&type4); 13979 auto param7 = model->addOperand(&type5); 13980 auto param8 = model->addOperand(&type5); 13981 auto param9 = model->addOperand(&type5); 13982 auto param10 = model->addOperand(&type5); 13983 auto layout = model->addOperand(&type0); 13984 auto op42 = model->addOperand(&type96); 13985 // Phase 2, operations 13986 static int32_t shape2_init[] = {1, 1, 4, 4}; 13987 model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); 13988 static int32_t param7_init[] = {1}; 13989 model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); 13990 static int32_t param8_init[] = {1}; 13991 model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); 13992 static int32_t param9_init[] = {1}; 13993 model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); 13994 static int32_t param10_init[] = {0}; 13995 model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); 13996 static bool8 layout_init[] = {true}; 13997 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 13998 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); 13999 // Phase 3, inputs and outputs 14000 model->identifyInputsAndOutputs( 14001 {op12, op22, op32}, 14002 {op42}); 14003 assert(model->isValid()); 14004 } 14005 14006 inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_2(int i) { 14007 static std::set<int> ignore = {}; 14008 return ignore.find(i) != ignore.end(); 14009 } 14010 14011 void CreateModel_nhwc_3(Model *model) { 14012 OperandType type0(Type::BOOL, {}); 14013 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14014 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14015 OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); 14016 OperandType type4(Type::TENSOR_INT32, {4}); 14017 OperandType type5(Type::INT32, {}); 14018 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14019 // Phase 1, operands 14020 auto op13 = model->addOperand(&type11); 14021 auto op23 = model->addOperand(&type12); 14022 auto op33 = model->addOperand(&type9); 14023 auto shape3 = model->addOperand(&type4); 14024 auto param11 = model->addOperand(&type5); 14025 auto param12 = model->addOperand(&type5); 14026 auto param13 = model->addOperand(&type5); 14027 auto param14 = model->addOperand(&type5); 14028 auto layout = model->addOperand(&type0); 14029 auto op43 = model->addOperand(&type14); 14030 // Phase 2, operations 14031 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14032 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 14033 static float op33_init[] = {0.0f}; 14034 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 14035 static int32_t shape3_init[] = {1, 6, 6, 1}; 14036 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14037 static int32_t param11_init[] = {2}; 14038 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14039 static int32_t param12_init[] = {1}; 14040 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14041 static int32_t param13_init[] = {1}; 14042 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14043 static int32_t param14_init[] = {0}; 14044 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14045 static bool8 layout_init[] = {false}; 14046 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14047 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14048 // Phase 3, inputs and outputs 14049 model->identifyInputsAndOutputs( 14050 {op13}, 14051 {op43}); 14052 assert(model->isValid()); 14053 } 14054 14055 inline bool is_ignored_nhwc_3(int i) { 14056 static std::set<int> ignore = {}; 14057 return ignore.find(i) != ignore.end(); 14058 } 14059 14060 void CreateModel_nhwc_weight_as_input_3(Model *model) { 14061 OperandType type0(Type::BOOL, {}); 14062 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14063 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14064 OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); 14065 OperandType type4(Type::TENSOR_INT32, {4}); 14066 OperandType type5(Type::INT32, {}); 14067 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14068 // Phase 1, operands 14069 auto op13 = model->addOperand(&type11); 14070 auto op23 = model->addOperand(&type12); 14071 auto op33 = model->addOperand(&type9); 14072 auto shape3 = model->addOperand(&type4); 14073 auto param11 = model->addOperand(&type5); 14074 auto param12 = model->addOperand(&type5); 14075 auto param13 = model->addOperand(&type5); 14076 auto param14 = model->addOperand(&type5); 14077 auto layout = model->addOperand(&type0); 14078 auto op43 = model->addOperand(&type14); 14079 // Phase 2, operations 14080 static int32_t shape3_init[] = {1, 6, 6, 1}; 14081 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14082 static int32_t param11_init[] = {2}; 14083 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14084 static int32_t param12_init[] = {1}; 14085 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14086 static int32_t param13_init[] = {1}; 14087 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14088 static int32_t param14_init[] = {0}; 14089 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14090 static bool8 layout_init[] = {false}; 14091 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14092 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14093 // Phase 3, inputs and outputs 14094 model->identifyInputsAndOutputs( 14095 {op13, op23, op33}, 14096 {op43}); 14097 assert(model->isValid()); 14098 } 14099 14100 inline bool is_ignored_nhwc_weight_as_input_3(int i) { 14101 static std::set<int> ignore = {}; 14102 return ignore.find(i) != ignore.end(); 14103 } 14104 14105 void CreateModel_nhwc_relaxed_3(Model *model) { 14106 OperandType type0(Type::BOOL, {}); 14107 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14108 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14109 OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); 14110 OperandType type4(Type::TENSOR_INT32, {4}); 14111 OperandType type5(Type::INT32, {}); 14112 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14113 // Phase 1, operands 14114 auto op13 = model->addOperand(&type11); 14115 auto op23 = model->addOperand(&type12); 14116 auto op33 = model->addOperand(&type9); 14117 auto shape3 = model->addOperand(&type4); 14118 auto param11 = model->addOperand(&type5); 14119 auto param12 = model->addOperand(&type5); 14120 auto param13 = model->addOperand(&type5); 14121 auto param14 = model->addOperand(&type5); 14122 auto layout = model->addOperand(&type0); 14123 auto op43 = model->addOperand(&type14); 14124 // Phase 2, operations 14125 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14126 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 14127 static float op33_init[] = {0.0f}; 14128 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 14129 static int32_t shape3_init[] = {1, 6, 6, 1}; 14130 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14131 static int32_t param11_init[] = {2}; 14132 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14133 static int32_t param12_init[] = {1}; 14134 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14135 static int32_t param13_init[] = {1}; 14136 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14137 static int32_t param14_init[] = {0}; 14138 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14139 static bool8 layout_init[] = {false}; 14140 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14141 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14142 // Phase 3, inputs and outputs 14143 model->identifyInputsAndOutputs( 14144 {op13}, 14145 {op43}); 14146 // Phase 4: set relaxed execution 14147 model->relaxComputationFloat32toFloat16(true); 14148 assert(model->isValid()); 14149 } 14150 14151 inline bool is_ignored_nhwc_relaxed_3(int i) { 14152 static std::set<int> ignore = {}; 14153 return ignore.find(i) != ignore.end(); 14154 } 14155 14156 void CreateModel_nhwc_relaxed_weight_as_input_3(Model *model) { 14157 OperandType type0(Type::BOOL, {}); 14158 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14159 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14160 OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); 14161 OperandType type4(Type::TENSOR_INT32, {4}); 14162 OperandType type5(Type::INT32, {}); 14163 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14164 // Phase 1, operands 14165 auto op13 = model->addOperand(&type11); 14166 auto op23 = model->addOperand(&type12); 14167 auto op33 = model->addOperand(&type9); 14168 auto shape3 = model->addOperand(&type4); 14169 auto param11 = model->addOperand(&type5); 14170 auto param12 = model->addOperand(&type5); 14171 auto param13 = model->addOperand(&type5); 14172 auto param14 = model->addOperand(&type5); 14173 auto layout = model->addOperand(&type0); 14174 auto op43 = model->addOperand(&type14); 14175 // Phase 2, operations 14176 static int32_t shape3_init[] = {1, 6, 6, 1}; 14177 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14178 static int32_t param11_init[] = {2}; 14179 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14180 static int32_t param12_init[] = {1}; 14181 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14182 static int32_t param13_init[] = {1}; 14183 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14184 static int32_t param14_init[] = {0}; 14185 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14186 static bool8 layout_init[] = {false}; 14187 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14188 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14189 // Phase 3, inputs and outputs 14190 model->identifyInputsAndOutputs( 14191 {op13, op23, op33}, 14192 {op43}); 14193 // Phase 4: set relaxed execution 14194 model->relaxComputationFloat32toFloat16(true); 14195 assert(model->isValid()); 14196 } 14197 14198 inline bool is_ignored_nhwc_relaxed_weight_as_input_3(int i) { 14199 static std::set<int> ignore = {}; 14200 return ignore.find(i) != ignore.end(); 14201 } 14202 14203 void CreateModel_nhwc_quant8_3(Model *model) { 14204 OperandType type0(Type::BOOL, {}); 14205 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 14206 OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); 14207 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 14208 OperandType type169(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 32.0f, 80); 14209 OperandType type4(Type::TENSOR_INT32, {4}); 14210 OperandType type5(Type::INT32, {}); 14211 // Phase 1, operands 14212 auto op13 = model->addOperand(&type167); 14213 auto op23 = model->addOperand(&type153); 14214 auto op33 = model->addOperand(&type168); 14215 auto shape3 = model->addOperand(&type4); 14216 auto param11 = model->addOperand(&type5); 14217 auto param12 = model->addOperand(&type5); 14218 auto param13 = model->addOperand(&type5); 14219 auto param14 = model->addOperand(&type5); 14220 auto layout = model->addOperand(&type0); 14221 auto op43 = model->addOperand(&type169); 14222 // Phase 2, operations 14223 static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 14224 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); 14225 static int32_t op33_init[] = {0}; 14226 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); 14227 static int32_t shape3_init[] = {1, 6, 6, 1}; 14228 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14229 static int32_t param11_init[] = {2}; 14230 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14231 static int32_t param12_init[] = {1}; 14232 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14233 static int32_t param13_init[] = {1}; 14234 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14235 static int32_t param14_init[] = {0}; 14236 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14237 static bool8 layout_init[] = {false}; 14238 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14239 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14240 // Phase 3, inputs and outputs 14241 model->identifyInputsAndOutputs( 14242 {op13}, 14243 {op43}); 14244 assert(model->isValid()); 14245 } 14246 14247 inline bool is_ignored_nhwc_quant8_3(int i) { 14248 static std::set<int> ignore = {}; 14249 return ignore.find(i) != ignore.end(); 14250 } 14251 14252 void CreateModel_nhwc_quant8_weight_as_input_3(Model *model) { 14253 OperandType type0(Type::BOOL, {}); 14254 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 14255 OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); 14256 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 14257 OperandType type169(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 32.0f, 80); 14258 OperandType type4(Type::TENSOR_INT32, {4}); 14259 OperandType type5(Type::INT32, {}); 14260 // Phase 1, operands 14261 auto op13 = model->addOperand(&type167); 14262 auto op23 = model->addOperand(&type153); 14263 auto op33 = model->addOperand(&type168); 14264 auto shape3 = model->addOperand(&type4); 14265 auto param11 = model->addOperand(&type5); 14266 auto param12 = model->addOperand(&type5); 14267 auto param13 = model->addOperand(&type5); 14268 auto param14 = model->addOperand(&type5); 14269 auto layout = model->addOperand(&type0); 14270 auto op43 = model->addOperand(&type169); 14271 // Phase 2, operations 14272 static int32_t shape3_init[] = {1, 6, 6, 1}; 14273 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14274 static int32_t param11_init[] = {2}; 14275 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14276 static int32_t param12_init[] = {1}; 14277 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14278 static int32_t param13_init[] = {1}; 14279 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14280 static int32_t param14_init[] = {0}; 14281 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14282 static bool8 layout_init[] = {false}; 14283 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14284 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14285 // Phase 3, inputs and outputs 14286 model->identifyInputsAndOutputs( 14287 {op13, op23, op33}, 14288 {op43}); 14289 assert(model->isValid()); 14290 } 14291 14292 inline bool is_ignored_nhwc_quant8_weight_as_input_3(int i) { 14293 static std::set<int> ignore = {}; 14294 return ignore.find(i) != ignore.end(); 14295 } 14296 14297 void CreateModel_nhwc_float16_3(Model *model) { 14298 OperandType type0(Type::BOOL, {}); 14299 OperandType type135(Type::TENSOR_FLOAT16, {1}); 14300 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 14301 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 14302 OperandType type170(Type::TENSOR_FLOAT16, {1, 6, 6, 1}); 14303 OperandType type4(Type::TENSOR_INT32, {4}); 14304 OperandType type5(Type::INT32, {}); 14305 // Phase 1, operands 14306 auto op13 = model->addOperand(&type156); 14307 auto op23 = model->addOperand(&type157); 14308 auto op33 = model->addOperand(&type135); 14309 auto shape3 = model->addOperand(&type4); 14310 auto param11 = model->addOperand(&type5); 14311 auto param12 = model->addOperand(&type5); 14312 auto param13 = model->addOperand(&type5); 14313 auto param14 = model->addOperand(&type5); 14314 auto layout = model->addOperand(&type0); 14315 auto op43 = model->addOperand(&type170); 14316 // Phase 2, operations 14317 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14318 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); 14319 static _Float16 op33_init[] = {0.0f}; 14320 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); 14321 static int32_t shape3_init[] = {1, 6, 6, 1}; 14322 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14323 static int32_t param11_init[] = {2}; 14324 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14325 static int32_t param12_init[] = {1}; 14326 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14327 static int32_t param13_init[] = {1}; 14328 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14329 static int32_t param14_init[] = {0}; 14330 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14331 static bool8 layout_init[] = {false}; 14332 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14333 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14334 // Phase 3, inputs and outputs 14335 model->identifyInputsAndOutputs( 14336 {op13}, 14337 {op43}); 14338 assert(model->isValid()); 14339 } 14340 14341 inline bool is_ignored_nhwc_float16_3(int i) { 14342 static std::set<int> ignore = {}; 14343 return ignore.find(i) != ignore.end(); 14344 } 14345 14346 void CreateModel_nhwc_float16_weight_as_input_3(Model *model) { 14347 OperandType type0(Type::BOOL, {}); 14348 OperandType type138(Type::TENSOR_FLOAT16, {1}); 14349 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 14350 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 14351 OperandType type170(Type::TENSOR_FLOAT16, {1, 6, 6, 1}); 14352 OperandType type4(Type::TENSOR_INT32, {4}); 14353 OperandType type5(Type::INT32, {}); 14354 // Phase 1, operands 14355 auto op13 = model->addOperand(&type156); 14356 auto op23 = model->addOperand(&type159); 14357 auto op33 = model->addOperand(&type138); 14358 auto shape3 = model->addOperand(&type4); 14359 auto param11 = model->addOperand(&type5); 14360 auto param12 = model->addOperand(&type5); 14361 auto param13 = model->addOperand(&type5); 14362 auto param14 = model->addOperand(&type5); 14363 auto layout = model->addOperand(&type0); 14364 auto op43 = model->addOperand(&type170); 14365 // Phase 2, operations 14366 static int32_t shape3_init[] = {1, 6, 6, 1}; 14367 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14368 static int32_t param11_init[] = {2}; 14369 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14370 static int32_t param12_init[] = {1}; 14371 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14372 static int32_t param13_init[] = {1}; 14373 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14374 static int32_t param14_init[] = {0}; 14375 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14376 static bool8 layout_init[] = {false}; 14377 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14378 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14379 // Phase 3, inputs and outputs 14380 model->identifyInputsAndOutputs( 14381 {op13, op23, op33}, 14382 {op43}); 14383 assert(model->isValid()); 14384 } 14385 14386 inline bool is_ignored_nhwc_float16_weight_as_input_3(int i) { 14387 static std::set<int> ignore = {}; 14388 return ignore.find(i) != ignore.end(); 14389 } 14390 14391 void CreateModel_nchw_3(Model *model) { 14392 OperandType type0(Type::BOOL, {}); 14393 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14394 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 14395 OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); 14396 OperandType type4(Type::TENSOR_INT32, {4}); 14397 OperandType type5(Type::INT32, {}); 14398 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14399 // Phase 1, operands 14400 auto op13 = model->addOperand(&type160); 14401 auto op23 = model->addOperand(&type12); 14402 auto op33 = model->addOperand(&type9); 14403 auto shape3 = model->addOperand(&type4); 14404 auto param11 = model->addOperand(&type5); 14405 auto param12 = model->addOperand(&type5); 14406 auto param13 = model->addOperand(&type5); 14407 auto param14 = model->addOperand(&type5); 14408 auto layout = model->addOperand(&type0); 14409 auto op43 = model->addOperand(&type171); 14410 // Phase 2, operations 14411 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14412 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 14413 static float op33_init[] = {0.0f}; 14414 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 14415 static int32_t shape3_init[] = {1, 1, 6, 6}; 14416 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14417 static int32_t param11_init[] = {2}; 14418 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14419 static int32_t param12_init[] = {1}; 14420 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14421 static int32_t param13_init[] = {1}; 14422 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14423 static int32_t param14_init[] = {0}; 14424 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14425 static bool8 layout_init[] = {true}; 14426 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14427 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14428 // Phase 3, inputs and outputs 14429 model->identifyInputsAndOutputs( 14430 {op13}, 14431 {op43}); 14432 assert(model->isValid()); 14433 } 14434 14435 inline bool is_ignored_nchw_3(int i) { 14436 static std::set<int> ignore = {}; 14437 return ignore.find(i) != ignore.end(); 14438 } 14439 14440 void CreateModel_nchw_weight_as_input_3(Model *model) { 14441 OperandType type0(Type::BOOL, {}); 14442 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14443 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 14444 OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); 14445 OperandType type4(Type::TENSOR_INT32, {4}); 14446 OperandType type5(Type::INT32, {}); 14447 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14448 // Phase 1, operands 14449 auto op13 = model->addOperand(&type160); 14450 auto op23 = model->addOperand(&type12); 14451 auto op33 = model->addOperand(&type9); 14452 auto shape3 = model->addOperand(&type4); 14453 auto param11 = model->addOperand(&type5); 14454 auto param12 = model->addOperand(&type5); 14455 auto param13 = model->addOperand(&type5); 14456 auto param14 = model->addOperand(&type5); 14457 auto layout = model->addOperand(&type0); 14458 auto op43 = model->addOperand(&type171); 14459 // Phase 2, operations 14460 static int32_t shape3_init[] = {1, 1, 6, 6}; 14461 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14462 static int32_t param11_init[] = {2}; 14463 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14464 static int32_t param12_init[] = {1}; 14465 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14466 static int32_t param13_init[] = {1}; 14467 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14468 static int32_t param14_init[] = {0}; 14469 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14470 static bool8 layout_init[] = {true}; 14471 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14472 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14473 // Phase 3, inputs and outputs 14474 model->identifyInputsAndOutputs( 14475 {op13, op23, op33}, 14476 {op43}); 14477 assert(model->isValid()); 14478 } 14479 14480 inline bool is_ignored_nchw_weight_as_input_3(int i) { 14481 static std::set<int> ignore = {}; 14482 return ignore.find(i) != ignore.end(); 14483 } 14484 14485 void CreateModel_nchw_relaxed_3(Model *model) { 14486 OperandType type0(Type::BOOL, {}); 14487 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14488 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 14489 OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); 14490 OperandType type4(Type::TENSOR_INT32, {4}); 14491 OperandType type5(Type::INT32, {}); 14492 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14493 // Phase 1, operands 14494 auto op13 = model->addOperand(&type160); 14495 auto op23 = model->addOperand(&type12); 14496 auto op33 = model->addOperand(&type9); 14497 auto shape3 = model->addOperand(&type4); 14498 auto param11 = model->addOperand(&type5); 14499 auto param12 = model->addOperand(&type5); 14500 auto param13 = model->addOperand(&type5); 14501 auto param14 = model->addOperand(&type5); 14502 auto layout = model->addOperand(&type0); 14503 auto op43 = model->addOperand(&type171); 14504 // Phase 2, operations 14505 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14506 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 14507 static float op33_init[] = {0.0f}; 14508 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 14509 static int32_t shape3_init[] = {1, 1, 6, 6}; 14510 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14511 static int32_t param11_init[] = {2}; 14512 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14513 static int32_t param12_init[] = {1}; 14514 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14515 static int32_t param13_init[] = {1}; 14516 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14517 static int32_t param14_init[] = {0}; 14518 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14519 static bool8 layout_init[] = {true}; 14520 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14521 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14522 // Phase 3, inputs and outputs 14523 model->identifyInputsAndOutputs( 14524 {op13}, 14525 {op43}); 14526 // Phase 4: set relaxed execution 14527 model->relaxComputationFloat32toFloat16(true); 14528 assert(model->isValid()); 14529 } 14530 14531 inline bool is_ignored_nchw_relaxed_3(int i) { 14532 static std::set<int> ignore = {}; 14533 return ignore.find(i) != ignore.end(); 14534 } 14535 14536 void CreateModel_nchw_relaxed_weight_as_input_3(Model *model) { 14537 OperandType type0(Type::BOOL, {}); 14538 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14539 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 14540 OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); 14541 OperandType type4(Type::TENSOR_INT32, {4}); 14542 OperandType type5(Type::INT32, {}); 14543 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14544 // Phase 1, operands 14545 auto op13 = model->addOperand(&type160); 14546 auto op23 = model->addOperand(&type12); 14547 auto op33 = model->addOperand(&type9); 14548 auto shape3 = model->addOperand(&type4); 14549 auto param11 = model->addOperand(&type5); 14550 auto param12 = model->addOperand(&type5); 14551 auto param13 = model->addOperand(&type5); 14552 auto param14 = model->addOperand(&type5); 14553 auto layout = model->addOperand(&type0); 14554 auto op43 = model->addOperand(&type171); 14555 // Phase 2, operations 14556 static int32_t shape3_init[] = {1, 1, 6, 6}; 14557 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14558 static int32_t param11_init[] = {2}; 14559 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14560 static int32_t param12_init[] = {1}; 14561 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14562 static int32_t param13_init[] = {1}; 14563 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14564 static int32_t param14_init[] = {0}; 14565 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14566 static bool8 layout_init[] = {true}; 14567 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14568 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14569 // Phase 3, inputs and outputs 14570 model->identifyInputsAndOutputs( 14571 {op13, op23, op33}, 14572 {op43}); 14573 // Phase 4: set relaxed execution 14574 model->relaxComputationFloat32toFloat16(true); 14575 assert(model->isValid()); 14576 } 14577 14578 inline bool is_ignored_nchw_relaxed_weight_as_input_3(int i) { 14579 static std::set<int> ignore = {}; 14580 return ignore.find(i) != ignore.end(); 14581 } 14582 14583 void CreateModel_nchw_quant8_3(Model *model) { 14584 OperandType type0(Type::BOOL, {}); 14585 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 14586 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 14587 OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); 14588 OperandType type173(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 32.0f, 80); 14589 OperandType type4(Type::TENSOR_INT32, {4}); 14590 OperandType type5(Type::INT32, {}); 14591 // Phase 1, operands 14592 auto op13 = model->addOperand(&type172); 14593 auto op23 = model->addOperand(&type153); 14594 auto op33 = model->addOperand(&type168); 14595 auto shape3 = model->addOperand(&type4); 14596 auto param11 = model->addOperand(&type5); 14597 auto param12 = model->addOperand(&type5); 14598 auto param13 = model->addOperand(&type5); 14599 auto param14 = model->addOperand(&type5); 14600 auto layout = model->addOperand(&type0); 14601 auto op43 = model->addOperand(&type173); 14602 // Phase 2, operations 14603 static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 14604 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); 14605 static int32_t op33_init[] = {0}; 14606 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); 14607 static int32_t shape3_init[] = {1, 1, 6, 6}; 14608 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14609 static int32_t param11_init[] = {2}; 14610 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14611 static int32_t param12_init[] = {1}; 14612 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14613 static int32_t param13_init[] = {1}; 14614 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14615 static int32_t param14_init[] = {0}; 14616 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14617 static bool8 layout_init[] = {true}; 14618 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14619 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14620 // Phase 3, inputs and outputs 14621 model->identifyInputsAndOutputs( 14622 {op13}, 14623 {op43}); 14624 assert(model->isValid()); 14625 } 14626 14627 inline bool is_ignored_nchw_quant8_3(int i) { 14628 static std::set<int> ignore = {}; 14629 return ignore.find(i) != ignore.end(); 14630 } 14631 14632 void CreateModel_nchw_quant8_weight_as_input_3(Model *model) { 14633 OperandType type0(Type::BOOL, {}); 14634 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 14635 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 14636 OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); 14637 OperandType type173(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 32.0f, 80); 14638 OperandType type4(Type::TENSOR_INT32, {4}); 14639 OperandType type5(Type::INT32, {}); 14640 // Phase 1, operands 14641 auto op13 = model->addOperand(&type172); 14642 auto op23 = model->addOperand(&type153); 14643 auto op33 = model->addOperand(&type168); 14644 auto shape3 = model->addOperand(&type4); 14645 auto param11 = model->addOperand(&type5); 14646 auto param12 = model->addOperand(&type5); 14647 auto param13 = model->addOperand(&type5); 14648 auto param14 = model->addOperand(&type5); 14649 auto layout = model->addOperand(&type0); 14650 auto op43 = model->addOperand(&type173); 14651 // Phase 2, operations 14652 static int32_t shape3_init[] = {1, 1, 6, 6}; 14653 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14654 static int32_t param11_init[] = {2}; 14655 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14656 static int32_t param12_init[] = {1}; 14657 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14658 static int32_t param13_init[] = {1}; 14659 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14660 static int32_t param14_init[] = {0}; 14661 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14662 static bool8 layout_init[] = {true}; 14663 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14664 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14665 // Phase 3, inputs and outputs 14666 model->identifyInputsAndOutputs( 14667 {op13, op23, op33}, 14668 {op43}); 14669 assert(model->isValid()); 14670 } 14671 14672 inline bool is_ignored_nchw_quant8_weight_as_input_3(int i) { 14673 static std::set<int> ignore = {}; 14674 return ignore.find(i) != ignore.end(); 14675 } 14676 14677 void CreateModel_nchw_float16_3(Model *model) { 14678 OperandType type0(Type::BOOL, {}); 14679 OperandType type135(Type::TENSOR_FLOAT16, {1}); 14680 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 14681 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 14682 OperandType type174(Type::TENSOR_FLOAT16, {1, 1, 6, 6}); 14683 OperandType type4(Type::TENSOR_INT32, {4}); 14684 OperandType type5(Type::INT32, {}); 14685 // Phase 1, operands 14686 auto op13 = model->addOperand(&type164); 14687 auto op23 = model->addOperand(&type157); 14688 auto op33 = model->addOperand(&type135); 14689 auto shape3 = model->addOperand(&type4); 14690 auto param11 = model->addOperand(&type5); 14691 auto param12 = model->addOperand(&type5); 14692 auto param13 = model->addOperand(&type5); 14693 auto param14 = model->addOperand(&type5); 14694 auto layout = model->addOperand(&type0); 14695 auto op43 = model->addOperand(&type174); 14696 // Phase 2, operations 14697 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14698 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); 14699 static _Float16 op33_init[] = {0.0f}; 14700 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); 14701 static int32_t shape3_init[] = {1, 1, 6, 6}; 14702 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14703 static int32_t param11_init[] = {2}; 14704 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14705 static int32_t param12_init[] = {1}; 14706 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14707 static int32_t param13_init[] = {1}; 14708 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14709 static int32_t param14_init[] = {0}; 14710 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14711 static bool8 layout_init[] = {true}; 14712 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14713 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14714 // Phase 3, inputs and outputs 14715 model->identifyInputsAndOutputs( 14716 {op13}, 14717 {op43}); 14718 assert(model->isValid()); 14719 } 14720 14721 inline bool is_ignored_nchw_float16_3(int i) { 14722 static std::set<int> ignore = {}; 14723 return ignore.find(i) != ignore.end(); 14724 } 14725 14726 void CreateModel_nchw_float16_weight_as_input_3(Model *model) { 14727 OperandType type0(Type::BOOL, {}); 14728 OperandType type138(Type::TENSOR_FLOAT16, {1}); 14729 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 14730 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 14731 OperandType type174(Type::TENSOR_FLOAT16, {1, 1, 6, 6}); 14732 OperandType type4(Type::TENSOR_INT32, {4}); 14733 OperandType type5(Type::INT32, {}); 14734 // Phase 1, operands 14735 auto op13 = model->addOperand(&type164); 14736 auto op23 = model->addOperand(&type159); 14737 auto op33 = model->addOperand(&type138); 14738 auto shape3 = model->addOperand(&type4); 14739 auto param11 = model->addOperand(&type5); 14740 auto param12 = model->addOperand(&type5); 14741 auto param13 = model->addOperand(&type5); 14742 auto param14 = model->addOperand(&type5); 14743 auto layout = model->addOperand(&type0); 14744 auto op43 = model->addOperand(&type174); 14745 // Phase 2, operations 14746 static int32_t shape3_init[] = {1, 1, 6, 6}; 14747 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14748 static int32_t param11_init[] = {2}; 14749 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14750 static int32_t param12_init[] = {1}; 14751 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14752 static int32_t param13_init[] = {1}; 14753 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14754 static int32_t param14_init[] = {0}; 14755 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14756 static bool8 layout_init[] = {true}; 14757 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14758 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14759 // Phase 3, inputs and outputs 14760 model->identifyInputsAndOutputs( 14761 {op13, op23, op33}, 14762 {op43}); 14763 assert(model->isValid()); 14764 } 14765 14766 inline bool is_ignored_nchw_float16_weight_as_input_3(int i) { 14767 static std::set<int> ignore = {}; 14768 return ignore.find(i) != ignore.end(); 14769 } 14770 14771 void CreateModel_dynamic_output_shape_nhwc_3(Model *model) { 14772 OperandType type0(Type::BOOL, {}); 14773 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14774 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14775 OperandType type4(Type::TENSOR_INT32, {4}); 14776 OperandType type5(Type::INT32, {}); 14777 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 14778 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14779 // Phase 1, operands 14780 auto op13 = model->addOperand(&type11); 14781 auto op23 = model->addOperand(&type12); 14782 auto op33 = model->addOperand(&type9); 14783 auto shape3 = model->addOperand(&type4); 14784 auto param11 = model->addOperand(&type5); 14785 auto param12 = model->addOperand(&type5); 14786 auto param13 = model->addOperand(&type5); 14787 auto param14 = model->addOperand(&type5); 14788 auto layout = model->addOperand(&type0); 14789 auto op43 = model->addOperand(&type88); 14790 // Phase 2, operations 14791 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14792 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 14793 static float op33_init[] = {0.0f}; 14794 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 14795 static int32_t shape3_init[] = {1, 6, 6, 1}; 14796 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14797 static int32_t param11_init[] = {2}; 14798 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14799 static int32_t param12_init[] = {1}; 14800 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14801 static int32_t param13_init[] = {1}; 14802 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14803 static int32_t param14_init[] = {0}; 14804 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14805 static bool8 layout_init[] = {false}; 14806 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14807 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14808 // Phase 3, inputs and outputs 14809 model->identifyInputsAndOutputs( 14810 {op13}, 14811 {op43}); 14812 assert(model->isValid()); 14813 } 14814 14815 inline bool is_ignored_dynamic_output_shape_nhwc_3(int i) { 14816 static std::set<int> ignore = {}; 14817 return ignore.find(i) != ignore.end(); 14818 } 14819 14820 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_3(Model *model) { 14821 OperandType type0(Type::BOOL, {}); 14822 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14823 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14824 OperandType type4(Type::TENSOR_INT32, {4}); 14825 OperandType type5(Type::INT32, {}); 14826 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 14827 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14828 // Phase 1, operands 14829 auto op13 = model->addOperand(&type11); 14830 auto op23 = model->addOperand(&type12); 14831 auto op33 = model->addOperand(&type9); 14832 auto shape3 = model->addOperand(&type4); 14833 auto param11 = model->addOperand(&type5); 14834 auto param12 = model->addOperand(&type5); 14835 auto param13 = model->addOperand(&type5); 14836 auto param14 = model->addOperand(&type5); 14837 auto layout = model->addOperand(&type0); 14838 auto op43 = model->addOperand(&type88); 14839 // Phase 2, operations 14840 static int32_t shape3_init[] = {1, 6, 6, 1}; 14841 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14842 static int32_t param11_init[] = {2}; 14843 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14844 static int32_t param12_init[] = {1}; 14845 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14846 static int32_t param13_init[] = {1}; 14847 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14848 static int32_t param14_init[] = {0}; 14849 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14850 static bool8 layout_init[] = {false}; 14851 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14852 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14853 // Phase 3, inputs and outputs 14854 model->identifyInputsAndOutputs( 14855 {op13, op23, op33}, 14856 {op43}); 14857 assert(model->isValid()); 14858 } 14859 14860 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_3(int i) { 14861 static std::set<int> ignore = {}; 14862 return ignore.find(i) != ignore.end(); 14863 } 14864 14865 void CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model *model) { 14866 OperandType type0(Type::BOOL, {}); 14867 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14868 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14869 OperandType type4(Type::TENSOR_INT32, {4}); 14870 OperandType type5(Type::INT32, {}); 14871 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 14872 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14873 // Phase 1, operands 14874 auto op13 = model->addOperand(&type11); 14875 auto op23 = model->addOperand(&type12); 14876 auto op33 = model->addOperand(&type9); 14877 auto shape3 = model->addOperand(&type4); 14878 auto param11 = model->addOperand(&type5); 14879 auto param12 = model->addOperand(&type5); 14880 auto param13 = model->addOperand(&type5); 14881 auto param14 = model->addOperand(&type5); 14882 auto layout = model->addOperand(&type0); 14883 auto op43 = model->addOperand(&type88); 14884 // Phase 2, operations 14885 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 14886 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 14887 static float op33_init[] = {0.0f}; 14888 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 14889 static int32_t shape3_init[] = {1, 6, 6, 1}; 14890 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14891 static int32_t param11_init[] = {2}; 14892 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14893 static int32_t param12_init[] = {1}; 14894 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14895 static int32_t param13_init[] = {1}; 14896 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14897 static int32_t param14_init[] = {0}; 14898 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14899 static bool8 layout_init[] = {false}; 14900 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14901 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14902 // Phase 3, inputs and outputs 14903 model->identifyInputsAndOutputs( 14904 {op13}, 14905 {op43}); 14906 // Phase 4: set relaxed execution 14907 model->relaxComputationFloat32toFloat16(true); 14908 assert(model->isValid()); 14909 } 14910 14911 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i) { 14912 static std::set<int> ignore = {}; 14913 return ignore.find(i) != ignore.end(); 14914 } 14915 14916 void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_3(Model *model) { 14917 OperandType type0(Type::BOOL, {}); 14918 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 14919 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 14920 OperandType type4(Type::TENSOR_INT32, {4}); 14921 OperandType type5(Type::INT32, {}); 14922 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 14923 OperandType type9(Type::TENSOR_FLOAT32, {1}); 14924 // Phase 1, operands 14925 auto op13 = model->addOperand(&type11); 14926 auto op23 = model->addOperand(&type12); 14927 auto op33 = model->addOperand(&type9); 14928 auto shape3 = model->addOperand(&type4); 14929 auto param11 = model->addOperand(&type5); 14930 auto param12 = model->addOperand(&type5); 14931 auto param13 = model->addOperand(&type5); 14932 auto param14 = model->addOperand(&type5); 14933 auto layout = model->addOperand(&type0); 14934 auto op43 = model->addOperand(&type88); 14935 // Phase 2, operations 14936 static int32_t shape3_init[] = {1, 6, 6, 1}; 14937 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14938 static int32_t param11_init[] = {2}; 14939 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14940 static int32_t param12_init[] = {1}; 14941 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14942 static int32_t param13_init[] = {1}; 14943 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14944 static int32_t param14_init[] = {0}; 14945 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14946 static bool8 layout_init[] = {false}; 14947 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14948 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 14949 // Phase 3, inputs and outputs 14950 model->identifyInputsAndOutputs( 14951 {op13, op23, op33}, 14952 {op43}); 14953 // Phase 4: set relaxed execution 14954 model->relaxComputationFloat32toFloat16(true); 14955 assert(model->isValid()); 14956 } 14957 14958 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_3(int i) { 14959 static std::set<int> ignore = {}; 14960 return ignore.find(i) != ignore.end(); 14961 } 14962 14963 void CreateModel_dynamic_output_shape_nhwc_quant8_3(Model *model) { 14964 OperandType type0(Type::BOOL, {}); 14965 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 14966 OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); 14967 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 14968 OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); 14969 OperandType type4(Type::TENSOR_INT32, {4}); 14970 OperandType type5(Type::INT32, {}); 14971 // Phase 1, operands 14972 auto op13 = model->addOperand(&type167); 14973 auto op23 = model->addOperand(&type153); 14974 auto op33 = model->addOperand(&type168); 14975 auto shape3 = model->addOperand(&type4); 14976 auto param11 = model->addOperand(&type5); 14977 auto param12 = model->addOperand(&type5); 14978 auto param13 = model->addOperand(&type5); 14979 auto param14 = model->addOperand(&type5); 14980 auto layout = model->addOperand(&type0); 14981 auto op43 = model->addOperand(&type175); 14982 // Phase 2, operations 14983 static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 14984 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); 14985 static int32_t op33_init[] = {0}; 14986 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); 14987 static int32_t shape3_init[] = {1, 6, 6, 1}; 14988 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 14989 static int32_t param11_init[] = {2}; 14990 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 14991 static int32_t param12_init[] = {1}; 14992 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 14993 static int32_t param13_init[] = {1}; 14994 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 14995 static int32_t param14_init[] = {0}; 14996 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 14997 static bool8 layout_init[] = {false}; 14998 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 14999 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15000 // Phase 3, inputs and outputs 15001 model->identifyInputsAndOutputs( 15002 {op13}, 15003 {op43}); 15004 assert(model->isValid()); 15005 } 15006 15007 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_3(int i) { 15008 static std::set<int> ignore = {}; 15009 return ignore.find(i) != ignore.end(); 15010 } 15011 15012 void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_3(Model *model) { 15013 OperandType type0(Type::BOOL, {}); 15014 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 15015 OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); 15016 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 15017 OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); 15018 OperandType type4(Type::TENSOR_INT32, {4}); 15019 OperandType type5(Type::INT32, {}); 15020 // Phase 1, operands 15021 auto op13 = model->addOperand(&type167); 15022 auto op23 = model->addOperand(&type153); 15023 auto op33 = model->addOperand(&type168); 15024 auto shape3 = model->addOperand(&type4); 15025 auto param11 = model->addOperand(&type5); 15026 auto param12 = model->addOperand(&type5); 15027 auto param13 = model->addOperand(&type5); 15028 auto param14 = model->addOperand(&type5); 15029 auto layout = model->addOperand(&type0); 15030 auto op43 = model->addOperand(&type175); 15031 // Phase 2, operations 15032 static int32_t shape3_init[] = {1, 6, 6, 1}; 15033 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15034 static int32_t param11_init[] = {2}; 15035 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15036 static int32_t param12_init[] = {1}; 15037 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15038 static int32_t param13_init[] = {1}; 15039 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15040 static int32_t param14_init[] = {0}; 15041 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15042 static bool8 layout_init[] = {false}; 15043 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15044 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15045 // Phase 3, inputs and outputs 15046 model->identifyInputsAndOutputs( 15047 {op13, op23, op33}, 15048 {op43}); 15049 assert(model->isValid()); 15050 } 15051 15052 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_3(int i) { 15053 static std::set<int> ignore = {}; 15054 return ignore.find(i) != ignore.end(); 15055 } 15056 15057 void CreateModel_dynamic_output_shape_nhwc_float16_3(Model *model) { 15058 OperandType type0(Type::BOOL, {}); 15059 OperandType type135(Type::TENSOR_FLOAT16, {1}); 15060 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 15061 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 15062 OperandType type4(Type::TENSOR_INT32, {4}); 15063 OperandType type5(Type::INT32, {}); 15064 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 15065 // Phase 1, operands 15066 auto op13 = model->addOperand(&type156); 15067 auto op23 = model->addOperand(&type157); 15068 auto op33 = model->addOperand(&type135); 15069 auto shape3 = model->addOperand(&type4); 15070 auto param11 = model->addOperand(&type5); 15071 auto param12 = model->addOperand(&type5); 15072 auto param13 = model->addOperand(&type5); 15073 auto param14 = model->addOperand(&type5); 15074 auto layout = model->addOperand(&type0); 15075 auto op43 = model->addOperand(&type96); 15076 // Phase 2, operations 15077 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15078 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); 15079 static _Float16 op33_init[] = {0.0f}; 15080 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); 15081 static int32_t shape3_init[] = {1, 6, 6, 1}; 15082 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15083 static int32_t param11_init[] = {2}; 15084 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15085 static int32_t param12_init[] = {1}; 15086 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15087 static int32_t param13_init[] = {1}; 15088 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15089 static int32_t param14_init[] = {0}; 15090 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15091 static bool8 layout_init[] = {false}; 15092 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15093 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15094 // Phase 3, inputs and outputs 15095 model->identifyInputsAndOutputs( 15096 {op13}, 15097 {op43}); 15098 assert(model->isValid()); 15099 } 15100 15101 inline bool is_ignored_dynamic_output_shape_nhwc_float16_3(int i) { 15102 static std::set<int> ignore = {}; 15103 return ignore.find(i) != ignore.end(); 15104 } 15105 15106 void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_3(Model *model) { 15107 OperandType type0(Type::BOOL, {}); 15108 OperandType type138(Type::TENSOR_FLOAT16, {1}); 15109 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 15110 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 15111 OperandType type4(Type::TENSOR_INT32, {4}); 15112 OperandType type5(Type::INT32, {}); 15113 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 15114 // Phase 1, operands 15115 auto op13 = model->addOperand(&type156); 15116 auto op23 = model->addOperand(&type159); 15117 auto op33 = model->addOperand(&type138); 15118 auto shape3 = model->addOperand(&type4); 15119 auto param11 = model->addOperand(&type5); 15120 auto param12 = model->addOperand(&type5); 15121 auto param13 = model->addOperand(&type5); 15122 auto param14 = model->addOperand(&type5); 15123 auto layout = model->addOperand(&type0); 15124 auto op43 = model->addOperand(&type96); 15125 // Phase 2, operations 15126 static int32_t shape3_init[] = {1, 6, 6, 1}; 15127 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15128 static int32_t param11_init[] = {2}; 15129 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15130 static int32_t param12_init[] = {1}; 15131 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15132 static int32_t param13_init[] = {1}; 15133 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15134 static int32_t param14_init[] = {0}; 15135 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15136 static bool8 layout_init[] = {false}; 15137 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15138 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15139 // Phase 3, inputs and outputs 15140 model->identifyInputsAndOutputs( 15141 {op13, op23, op33}, 15142 {op43}); 15143 assert(model->isValid()); 15144 } 15145 15146 inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_3(int i) { 15147 static std::set<int> ignore = {}; 15148 return ignore.find(i) != ignore.end(); 15149 } 15150 15151 void CreateModel_dynamic_output_shape_nchw_3(Model *model) { 15152 OperandType type0(Type::BOOL, {}); 15153 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15154 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 15155 OperandType type4(Type::TENSOR_INT32, {4}); 15156 OperandType type5(Type::INT32, {}); 15157 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 15158 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15159 // Phase 1, operands 15160 auto op13 = model->addOperand(&type160); 15161 auto op23 = model->addOperand(&type12); 15162 auto op33 = model->addOperand(&type9); 15163 auto shape3 = model->addOperand(&type4); 15164 auto param11 = model->addOperand(&type5); 15165 auto param12 = model->addOperand(&type5); 15166 auto param13 = model->addOperand(&type5); 15167 auto param14 = model->addOperand(&type5); 15168 auto layout = model->addOperand(&type0); 15169 auto op43 = model->addOperand(&type88); 15170 // Phase 2, operations 15171 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15172 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 15173 static float op33_init[] = {0.0f}; 15174 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 15175 static int32_t shape3_init[] = {1, 1, 6, 6}; 15176 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15177 static int32_t param11_init[] = {2}; 15178 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15179 static int32_t param12_init[] = {1}; 15180 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15181 static int32_t param13_init[] = {1}; 15182 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15183 static int32_t param14_init[] = {0}; 15184 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15185 static bool8 layout_init[] = {true}; 15186 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15187 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15188 // Phase 3, inputs and outputs 15189 model->identifyInputsAndOutputs( 15190 {op13}, 15191 {op43}); 15192 assert(model->isValid()); 15193 } 15194 15195 inline bool is_ignored_dynamic_output_shape_nchw_3(int i) { 15196 static std::set<int> ignore = {}; 15197 return ignore.find(i) != ignore.end(); 15198 } 15199 15200 void CreateModel_dynamic_output_shape_nchw_weight_as_input_3(Model *model) { 15201 OperandType type0(Type::BOOL, {}); 15202 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15203 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 15204 OperandType type4(Type::TENSOR_INT32, {4}); 15205 OperandType type5(Type::INT32, {}); 15206 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 15207 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15208 // Phase 1, operands 15209 auto op13 = model->addOperand(&type160); 15210 auto op23 = model->addOperand(&type12); 15211 auto op33 = model->addOperand(&type9); 15212 auto shape3 = model->addOperand(&type4); 15213 auto param11 = model->addOperand(&type5); 15214 auto param12 = model->addOperand(&type5); 15215 auto param13 = model->addOperand(&type5); 15216 auto param14 = model->addOperand(&type5); 15217 auto layout = model->addOperand(&type0); 15218 auto op43 = model->addOperand(&type88); 15219 // Phase 2, operations 15220 static int32_t shape3_init[] = {1, 1, 6, 6}; 15221 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15222 static int32_t param11_init[] = {2}; 15223 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15224 static int32_t param12_init[] = {1}; 15225 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15226 static int32_t param13_init[] = {1}; 15227 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15228 static int32_t param14_init[] = {0}; 15229 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15230 static bool8 layout_init[] = {true}; 15231 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15232 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15233 // Phase 3, inputs and outputs 15234 model->identifyInputsAndOutputs( 15235 {op13, op23, op33}, 15236 {op43}); 15237 assert(model->isValid()); 15238 } 15239 15240 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_3(int i) { 15241 static std::set<int> ignore = {}; 15242 return ignore.find(i) != ignore.end(); 15243 } 15244 15245 void CreateModel_dynamic_output_shape_nchw_relaxed_3(Model *model) { 15246 OperandType type0(Type::BOOL, {}); 15247 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15248 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 15249 OperandType type4(Type::TENSOR_INT32, {4}); 15250 OperandType type5(Type::INT32, {}); 15251 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 15252 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15253 // Phase 1, operands 15254 auto op13 = model->addOperand(&type160); 15255 auto op23 = model->addOperand(&type12); 15256 auto op33 = model->addOperand(&type9); 15257 auto shape3 = model->addOperand(&type4); 15258 auto param11 = model->addOperand(&type5); 15259 auto param12 = model->addOperand(&type5); 15260 auto param13 = model->addOperand(&type5); 15261 auto param14 = model->addOperand(&type5); 15262 auto layout = model->addOperand(&type0); 15263 auto op43 = model->addOperand(&type88); 15264 // Phase 2, operations 15265 static float op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15266 model->setOperandValue(op23, op23_init, sizeof(float) * 18); 15267 static float op33_init[] = {0.0f}; 15268 model->setOperandValue(op33, op33_init, sizeof(float) * 1); 15269 static int32_t shape3_init[] = {1, 1, 6, 6}; 15270 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15271 static int32_t param11_init[] = {2}; 15272 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15273 static int32_t param12_init[] = {1}; 15274 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15275 static int32_t param13_init[] = {1}; 15276 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15277 static int32_t param14_init[] = {0}; 15278 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15279 static bool8 layout_init[] = {true}; 15280 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15281 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15282 // Phase 3, inputs and outputs 15283 model->identifyInputsAndOutputs( 15284 {op13}, 15285 {op43}); 15286 // Phase 4: set relaxed execution 15287 model->relaxComputationFloat32toFloat16(true); 15288 assert(model->isValid()); 15289 } 15290 15291 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_3(int i) { 15292 static std::set<int> ignore = {}; 15293 return ignore.find(i) != ignore.end(); 15294 } 15295 15296 void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_3(Model *model) { 15297 OperandType type0(Type::BOOL, {}); 15298 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15299 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 15300 OperandType type4(Type::TENSOR_INT32, {4}); 15301 OperandType type5(Type::INT32, {}); 15302 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 15303 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15304 // Phase 1, operands 15305 auto op13 = model->addOperand(&type160); 15306 auto op23 = model->addOperand(&type12); 15307 auto op33 = model->addOperand(&type9); 15308 auto shape3 = model->addOperand(&type4); 15309 auto param11 = model->addOperand(&type5); 15310 auto param12 = model->addOperand(&type5); 15311 auto param13 = model->addOperand(&type5); 15312 auto param14 = model->addOperand(&type5); 15313 auto layout = model->addOperand(&type0); 15314 auto op43 = model->addOperand(&type88); 15315 // Phase 2, operations 15316 static int32_t shape3_init[] = {1, 1, 6, 6}; 15317 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15318 static int32_t param11_init[] = {2}; 15319 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15320 static int32_t param12_init[] = {1}; 15321 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15322 static int32_t param13_init[] = {1}; 15323 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15324 static int32_t param14_init[] = {0}; 15325 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15326 static bool8 layout_init[] = {true}; 15327 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15328 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15329 // Phase 3, inputs and outputs 15330 model->identifyInputsAndOutputs( 15331 {op13, op23, op33}, 15332 {op43}); 15333 // Phase 4: set relaxed execution 15334 model->relaxComputationFloat32toFloat16(true); 15335 assert(model->isValid()); 15336 } 15337 15338 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_3(int i) { 15339 static std::set<int> ignore = {}; 15340 return ignore.find(i) != ignore.end(); 15341 } 15342 15343 void CreateModel_dynamic_output_shape_nchw_quant8_3(Model *model) { 15344 OperandType type0(Type::BOOL, {}); 15345 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 15346 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 15347 OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); 15348 OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); 15349 OperandType type4(Type::TENSOR_INT32, {4}); 15350 OperandType type5(Type::INT32, {}); 15351 // Phase 1, operands 15352 auto op13 = model->addOperand(&type172); 15353 auto op23 = model->addOperand(&type153); 15354 auto op33 = model->addOperand(&type168); 15355 auto shape3 = model->addOperand(&type4); 15356 auto param11 = model->addOperand(&type5); 15357 auto param12 = model->addOperand(&type5); 15358 auto param13 = model->addOperand(&type5); 15359 auto param14 = model->addOperand(&type5); 15360 auto layout = model->addOperand(&type0); 15361 auto op43 = model->addOperand(&type175); 15362 // Phase 2, operations 15363 static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; 15364 model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); 15365 static int32_t op33_init[] = {0}; 15366 model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); 15367 static int32_t shape3_init[] = {1, 1, 6, 6}; 15368 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15369 static int32_t param11_init[] = {2}; 15370 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15371 static int32_t param12_init[] = {1}; 15372 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15373 static int32_t param13_init[] = {1}; 15374 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15375 static int32_t param14_init[] = {0}; 15376 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15377 static bool8 layout_init[] = {true}; 15378 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15379 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15380 // Phase 3, inputs and outputs 15381 model->identifyInputsAndOutputs( 15382 {op13}, 15383 {op43}); 15384 assert(model->isValid()); 15385 } 15386 15387 inline bool is_ignored_dynamic_output_shape_nchw_quant8_3(int i) { 15388 static std::set<int> ignore = {}; 15389 return ignore.find(i) != ignore.end(); 15390 } 15391 15392 void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_3(Model *model) { 15393 OperandType type0(Type::BOOL, {}); 15394 OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); 15395 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 15396 OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); 15397 OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); 15398 OperandType type4(Type::TENSOR_INT32, {4}); 15399 OperandType type5(Type::INT32, {}); 15400 // Phase 1, operands 15401 auto op13 = model->addOperand(&type172); 15402 auto op23 = model->addOperand(&type153); 15403 auto op33 = model->addOperand(&type168); 15404 auto shape3 = model->addOperand(&type4); 15405 auto param11 = model->addOperand(&type5); 15406 auto param12 = model->addOperand(&type5); 15407 auto param13 = model->addOperand(&type5); 15408 auto param14 = model->addOperand(&type5); 15409 auto layout = model->addOperand(&type0); 15410 auto op43 = model->addOperand(&type175); 15411 // Phase 2, operations 15412 static int32_t shape3_init[] = {1, 1, 6, 6}; 15413 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15414 static int32_t param11_init[] = {2}; 15415 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15416 static int32_t param12_init[] = {1}; 15417 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15418 static int32_t param13_init[] = {1}; 15419 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15420 static int32_t param14_init[] = {0}; 15421 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15422 static bool8 layout_init[] = {true}; 15423 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15424 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15425 // Phase 3, inputs and outputs 15426 model->identifyInputsAndOutputs( 15427 {op13, op23, op33}, 15428 {op43}); 15429 assert(model->isValid()); 15430 } 15431 15432 inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_3(int i) { 15433 static std::set<int> ignore = {}; 15434 return ignore.find(i) != ignore.end(); 15435 } 15436 15437 void CreateModel_dynamic_output_shape_nchw_float16_3(Model *model) { 15438 OperandType type0(Type::BOOL, {}); 15439 OperandType type135(Type::TENSOR_FLOAT16, {1}); 15440 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 15441 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 15442 OperandType type4(Type::TENSOR_INT32, {4}); 15443 OperandType type5(Type::INT32, {}); 15444 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 15445 // Phase 1, operands 15446 auto op13 = model->addOperand(&type164); 15447 auto op23 = model->addOperand(&type157); 15448 auto op33 = model->addOperand(&type135); 15449 auto shape3 = model->addOperand(&type4); 15450 auto param11 = model->addOperand(&type5); 15451 auto param12 = model->addOperand(&type5); 15452 auto param13 = model->addOperand(&type5); 15453 auto param14 = model->addOperand(&type5); 15454 auto layout = model->addOperand(&type0); 15455 auto op43 = model->addOperand(&type96); 15456 // Phase 2, operations 15457 static _Float16 op23_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15458 model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); 15459 static _Float16 op33_init[] = {0.0f}; 15460 model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); 15461 static int32_t shape3_init[] = {1, 1, 6, 6}; 15462 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15463 static int32_t param11_init[] = {2}; 15464 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15465 static int32_t param12_init[] = {1}; 15466 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15467 static int32_t param13_init[] = {1}; 15468 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15469 static int32_t param14_init[] = {0}; 15470 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15471 static bool8 layout_init[] = {true}; 15472 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15473 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15474 // Phase 3, inputs and outputs 15475 model->identifyInputsAndOutputs( 15476 {op13}, 15477 {op43}); 15478 assert(model->isValid()); 15479 } 15480 15481 inline bool is_ignored_dynamic_output_shape_nchw_float16_3(int i) { 15482 static std::set<int> ignore = {}; 15483 return ignore.find(i) != ignore.end(); 15484 } 15485 15486 void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_3(Model *model) { 15487 OperandType type0(Type::BOOL, {}); 15488 OperandType type138(Type::TENSOR_FLOAT16, {1}); 15489 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 15490 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 15491 OperandType type4(Type::TENSOR_INT32, {4}); 15492 OperandType type5(Type::INT32, {}); 15493 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 15494 // Phase 1, operands 15495 auto op13 = model->addOperand(&type164); 15496 auto op23 = model->addOperand(&type159); 15497 auto op33 = model->addOperand(&type138); 15498 auto shape3 = model->addOperand(&type4); 15499 auto param11 = model->addOperand(&type5); 15500 auto param12 = model->addOperand(&type5); 15501 auto param13 = model->addOperand(&type5); 15502 auto param14 = model->addOperand(&type5); 15503 auto layout = model->addOperand(&type0); 15504 auto op43 = model->addOperand(&type96); 15505 // Phase 2, operations 15506 static int32_t shape3_init[] = {1, 1, 6, 6}; 15507 model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); 15508 static int32_t param11_init[] = {2}; 15509 model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); 15510 static int32_t param12_init[] = {1}; 15511 model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); 15512 static int32_t param13_init[] = {1}; 15513 model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); 15514 static int32_t param14_init[] = {0}; 15515 model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); 15516 static bool8 layout_init[] = {true}; 15517 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15518 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); 15519 // Phase 3, inputs and outputs 15520 model->identifyInputsAndOutputs( 15521 {op13, op23, op33}, 15522 {op43}); 15523 assert(model->isValid()); 15524 } 15525 15526 inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_3(int i) { 15527 static std::set<int> ignore = {}; 15528 return ignore.find(i) != ignore.end(); 15529 } 15530 15531 void CreateModel_nhwc_4(Model *model) { 15532 OperandType type0(Type::BOOL, {}); 15533 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 15534 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15535 OperandType type5(Type::INT32, {}); 15536 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 15537 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15538 // Phase 1, operands 15539 auto op14 = model->addOperand(&type11); 15540 auto op24 = model->addOperand(&type12); 15541 auto op34 = model->addOperand(&type9); 15542 auto param15 = model->addOperand(&type5); 15543 auto param16 = model->addOperand(&type5); 15544 auto param17 = model->addOperand(&type5); 15545 auto param18 = model->addOperand(&type5); 15546 auto param19 = model->addOperand(&type5); 15547 auto param20 = model->addOperand(&type5); 15548 auto param21 = model->addOperand(&type5); 15549 auto layout = model->addOperand(&type0); 15550 auto op44 = model->addOperand(&type8); 15551 // Phase 2, operations 15552 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15553 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 15554 static float op34_init[] = {0.0f}; 15555 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 15556 static int32_t param15_init[] = {1}; 15557 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15558 static int32_t param16_init[] = {2}; 15559 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15560 static int32_t param17_init[] = {2}; 15561 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15562 static int32_t param18_init[] = {1}; 15563 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15564 static int32_t param19_init[] = {1}; 15565 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15566 static int32_t param20_init[] = {1}; 15567 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15568 static int32_t param21_init[] = {0}; 15569 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15570 static bool8 layout_init[] = {false}; 15571 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15572 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15573 // Phase 3, inputs and outputs 15574 model->identifyInputsAndOutputs( 15575 {op14}, 15576 {op44}); 15577 assert(model->isValid()); 15578 } 15579 15580 inline bool is_ignored_nhwc_4(int i) { 15581 static std::set<int> ignore = {}; 15582 return ignore.find(i) != ignore.end(); 15583 } 15584 15585 void CreateModel_nhwc_weight_as_input_4(Model *model) { 15586 OperandType type0(Type::BOOL, {}); 15587 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 15588 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15589 OperandType type5(Type::INT32, {}); 15590 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 15591 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15592 // Phase 1, operands 15593 auto op14 = model->addOperand(&type11); 15594 auto op24 = model->addOperand(&type12); 15595 auto op34 = model->addOperand(&type9); 15596 auto param15 = model->addOperand(&type5); 15597 auto param16 = model->addOperand(&type5); 15598 auto param17 = model->addOperand(&type5); 15599 auto param18 = model->addOperand(&type5); 15600 auto param19 = model->addOperand(&type5); 15601 auto param20 = model->addOperand(&type5); 15602 auto param21 = model->addOperand(&type5); 15603 auto layout = model->addOperand(&type0); 15604 auto op44 = model->addOperand(&type8); 15605 // Phase 2, operations 15606 static int32_t param15_init[] = {1}; 15607 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15608 static int32_t param16_init[] = {2}; 15609 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15610 static int32_t param17_init[] = {2}; 15611 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15612 static int32_t param18_init[] = {1}; 15613 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15614 static int32_t param19_init[] = {1}; 15615 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15616 static int32_t param20_init[] = {1}; 15617 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15618 static int32_t param21_init[] = {0}; 15619 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15620 static bool8 layout_init[] = {false}; 15621 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15622 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15623 // Phase 3, inputs and outputs 15624 model->identifyInputsAndOutputs( 15625 {op14, op24, op34}, 15626 {op44}); 15627 assert(model->isValid()); 15628 } 15629 15630 inline bool is_ignored_nhwc_weight_as_input_4(int i) { 15631 static std::set<int> ignore = {}; 15632 return ignore.find(i) != ignore.end(); 15633 } 15634 15635 void CreateModel_nhwc_relaxed_4(Model *model) { 15636 OperandType type0(Type::BOOL, {}); 15637 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 15638 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15639 OperandType type5(Type::INT32, {}); 15640 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 15641 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15642 // Phase 1, operands 15643 auto op14 = model->addOperand(&type11); 15644 auto op24 = model->addOperand(&type12); 15645 auto op34 = model->addOperand(&type9); 15646 auto param15 = model->addOperand(&type5); 15647 auto param16 = model->addOperand(&type5); 15648 auto param17 = model->addOperand(&type5); 15649 auto param18 = model->addOperand(&type5); 15650 auto param19 = model->addOperand(&type5); 15651 auto param20 = model->addOperand(&type5); 15652 auto param21 = model->addOperand(&type5); 15653 auto layout = model->addOperand(&type0); 15654 auto op44 = model->addOperand(&type8); 15655 // Phase 2, operations 15656 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15657 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 15658 static float op34_init[] = {0.0f}; 15659 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 15660 static int32_t param15_init[] = {1}; 15661 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15662 static int32_t param16_init[] = {2}; 15663 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15664 static int32_t param17_init[] = {2}; 15665 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15666 static int32_t param18_init[] = {1}; 15667 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15668 static int32_t param19_init[] = {1}; 15669 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15670 static int32_t param20_init[] = {1}; 15671 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15672 static int32_t param21_init[] = {0}; 15673 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15674 static bool8 layout_init[] = {false}; 15675 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15676 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15677 // Phase 3, inputs and outputs 15678 model->identifyInputsAndOutputs( 15679 {op14}, 15680 {op44}); 15681 // Phase 4: set relaxed execution 15682 model->relaxComputationFloat32toFloat16(true); 15683 assert(model->isValid()); 15684 } 15685 15686 inline bool is_ignored_nhwc_relaxed_4(int i) { 15687 static std::set<int> ignore = {}; 15688 return ignore.find(i) != ignore.end(); 15689 } 15690 15691 void CreateModel_nhwc_relaxed_weight_as_input_4(Model *model) { 15692 OperandType type0(Type::BOOL, {}); 15693 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 15694 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15695 OperandType type5(Type::INT32, {}); 15696 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 15697 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15698 // Phase 1, operands 15699 auto op14 = model->addOperand(&type11); 15700 auto op24 = model->addOperand(&type12); 15701 auto op34 = model->addOperand(&type9); 15702 auto param15 = model->addOperand(&type5); 15703 auto param16 = model->addOperand(&type5); 15704 auto param17 = model->addOperand(&type5); 15705 auto param18 = model->addOperand(&type5); 15706 auto param19 = model->addOperand(&type5); 15707 auto param20 = model->addOperand(&type5); 15708 auto param21 = model->addOperand(&type5); 15709 auto layout = model->addOperand(&type0); 15710 auto op44 = model->addOperand(&type8); 15711 // Phase 2, operations 15712 static int32_t param15_init[] = {1}; 15713 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15714 static int32_t param16_init[] = {2}; 15715 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15716 static int32_t param17_init[] = {2}; 15717 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15718 static int32_t param18_init[] = {1}; 15719 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15720 static int32_t param19_init[] = {1}; 15721 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15722 static int32_t param20_init[] = {1}; 15723 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15724 static int32_t param21_init[] = {0}; 15725 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15726 static bool8 layout_init[] = {false}; 15727 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15728 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15729 // Phase 3, inputs and outputs 15730 model->identifyInputsAndOutputs( 15731 {op14, op24, op34}, 15732 {op44}); 15733 // Phase 4: set relaxed execution 15734 model->relaxComputationFloat32toFloat16(true); 15735 assert(model->isValid()); 15736 } 15737 15738 inline bool is_ignored_nhwc_relaxed_weight_as_input_4(int i) { 15739 static std::set<int> ignore = {}; 15740 return ignore.find(i) != ignore.end(); 15741 } 15742 15743 void CreateModel_nhwc_quant8_4(Model *model) { 15744 OperandType type0(Type::BOOL, {}); 15745 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 15746 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 15747 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 15748 OperandType type177(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 20.0f, 50); 15749 OperandType type5(Type::INT32, {}); 15750 // Phase 1, operands 15751 auto op14 = model->addOperand(&type152); 15752 auto op24 = model->addOperand(&type176); 15753 auto op34 = model->addOperand(&type168); 15754 auto param15 = model->addOperand(&type5); 15755 auto param16 = model->addOperand(&type5); 15756 auto param17 = model->addOperand(&type5); 15757 auto param18 = model->addOperand(&type5); 15758 auto param19 = model->addOperand(&type5); 15759 auto param20 = model->addOperand(&type5); 15760 auto param21 = model->addOperand(&type5); 15761 auto layout = model->addOperand(&type0); 15762 auto op44 = model->addOperand(&type177); 15763 // Phase 2, operations 15764 static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; 15765 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); 15766 static int32_t op34_init[] = {0}; 15767 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); 15768 static int32_t param15_init[] = {1}; 15769 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15770 static int32_t param16_init[] = {2}; 15771 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15772 static int32_t param17_init[] = {2}; 15773 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15774 static int32_t param18_init[] = {1}; 15775 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15776 static int32_t param19_init[] = {1}; 15777 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15778 static int32_t param20_init[] = {1}; 15779 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15780 static int32_t param21_init[] = {0}; 15781 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15782 static bool8 layout_init[] = {false}; 15783 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15784 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15785 // Phase 3, inputs and outputs 15786 model->identifyInputsAndOutputs( 15787 {op14}, 15788 {op44}); 15789 assert(model->isValid()); 15790 } 15791 15792 inline bool is_ignored_nhwc_quant8_4(int i) { 15793 static std::set<int> ignore = {}; 15794 return ignore.find(i) != ignore.end(); 15795 } 15796 15797 void CreateModel_nhwc_quant8_weight_as_input_4(Model *model) { 15798 OperandType type0(Type::BOOL, {}); 15799 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 15800 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 15801 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 15802 OperandType type177(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 20.0f, 50); 15803 OperandType type5(Type::INT32, {}); 15804 // Phase 1, operands 15805 auto op14 = model->addOperand(&type152); 15806 auto op24 = model->addOperand(&type176); 15807 auto op34 = model->addOperand(&type168); 15808 auto param15 = model->addOperand(&type5); 15809 auto param16 = model->addOperand(&type5); 15810 auto param17 = model->addOperand(&type5); 15811 auto param18 = model->addOperand(&type5); 15812 auto param19 = model->addOperand(&type5); 15813 auto param20 = model->addOperand(&type5); 15814 auto param21 = model->addOperand(&type5); 15815 auto layout = model->addOperand(&type0); 15816 auto op44 = model->addOperand(&type177); 15817 // Phase 2, operations 15818 static int32_t param15_init[] = {1}; 15819 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15820 static int32_t param16_init[] = {2}; 15821 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15822 static int32_t param17_init[] = {2}; 15823 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15824 static int32_t param18_init[] = {1}; 15825 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15826 static int32_t param19_init[] = {1}; 15827 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15828 static int32_t param20_init[] = {1}; 15829 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15830 static int32_t param21_init[] = {0}; 15831 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15832 static bool8 layout_init[] = {false}; 15833 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15834 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15835 // Phase 3, inputs and outputs 15836 model->identifyInputsAndOutputs( 15837 {op14, op24, op34}, 15838 {op44}); 15839 assert(model->isValid()); 15840 } 15841 15842 inline bool is_ignored_nhwc_quant8_weight_as_input_4(int i) { 15843 static std::set<int> ignore = {}; 15844 return ignore.find(i) != ignore.end(); 15845 } 15846 15847 void CreateModel_nhwc_float16_4(Model *model) { 15848 OperandType type0(Type::BOOL, {}); 15849 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 15850 OperandType type135(Type::TENSOR_FLOAT16, {1}); 15851 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 15852 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 15853 OperandType type5(Type::INT32, {}); 15854 // Phase 1, operands 15855 auto op14 = model->addOperand(&type156); 15856 auto op24 = model->addOperand(&type157); 15857 auto op34 = model->addOperand(&type135); 15858 auto param15 = model->addOperand(&type5); 15859 auto param16 = model->addOperand(&type5); 15860 auto param17 = model->addOperand(&type5); 15861 auto param18 = model->addOperand(&type5); 15862 auto param19 = model->addOperand(&type5); 15863 auto param20 = model->addOperand(&type5); 15864 auto param21 = model->addOperand(&type5); 15865 auto layout = model->addOperand(&type0); 15866 auto op44 = model->addOperand(&type134); 15867 // Phase 2, operations 15868 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15869 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 15870 static _Float16 op34_init[] = {0.0f}; 15871 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 15872 static int32_t param15_init[] = {1}; 15873 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15874 static int32_t param16_init[] = {2}; 15875 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15876 static int32_t param17_init[] = {2}; 15877 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15878 static int32_t param18_init[] = {1}; 15879 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15880 static int32_t param19_init[] = {1}; 15881 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15882 static int32_t param20_init[] = {1}; 15883 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15884 static int32_t param21_init[] = {0}; 15885 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15886 static bool8 layout_init[] = {false}; 15887 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15888 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15889 // Phase 3, inputs and outputs 15890 model->identifyInputsAndOutputs( 15891 {op14}, 15892 {op44}); 15893 assert(model->isValid()); 15894 } 15895 15896 inline bool is_ignored_nhwc_float16_4(int i) { 15897 static std::set<int> ignore = {}; 15898 return ignore.find(i) != ignore.end(); 15899 } 15900 15901 void CreateModel_nhwc_float16_weight_as_input_4(Model *model) { 15902 OperandType type0(Type::BOOL, {}); 15903 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 15904 OperandType type138(Type::TENSOR_FLOAT16, {1}); 15905 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 15906 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 15907 OperandType type5(Type::INT32, {}); 15908 // Phase 1, operands 15909 auto op14 = model->addOperand(&type156); 15910 auto op24 = model->addOperand(&type159); 15911 auto op34 = model->addOperand(&type138); 15912 auto param15 = model->addOperand(&type5); 15913 auto param16 = model->addOperand(&type5); 15914 auto param17 = model->addOperand(&type5); 15915 auto param18 = model->addOperand(&type5); 15916 auto param19 = model->addOperand(&type5); 15917 auto param20 = model->addOperand(&type5); 15918 auto param21 = model->addOperand(&type5); 15919 auto layout = model->addOperand(&type0); 15920 auto op44 = model->addOperand(&type134); 15921 // Phase 2, operations 15922 static int32_t param15_init[] = {1}; 15923 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15924 static int32_t param16_init[] = {2}; 15925 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15926 static int32_t param17_init[] = {2}; 15927 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15928 static int32_t param18_init[] = {1}; 15929 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15930 static int32_t param19_init[] = {1}; 15931 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15932 static int32_t param20_init[] = {1}; 15933 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15934 static int32_t param21_init[] = {0}; 15935 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15936 static bool8 layout_init[] = {false}; 15937 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15938 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15939 // Phase 3, inputs and outputs 15940 model->identifyInputsAndOutputs( 15941 {op14, op24, op34}, 15942 {op44}); 15943 assert(model->isValid()); 15944 } 15945 15946 inline bool is_ignored_nhwc_float16_weight_as_input_4(int i) { 15947 static std::set<int> ignore = {}; 15948 return ignore.find(i) != ignore.end(); 15949 } 15950 15951 void CreateModel_nchw_4(Model *model) { 15952 OperandType type0(Type::BOOL, {}); 15953 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 15954 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 15955 OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 15956 OperandType type5(Type::INT32, {}); 15957 OperandType type9(Type::TENSOR_FLOAT32, {1}); 15958 // Phase 1, operands 15959 auto op14 = model->addOperand(&type160); 15960 auto op24 = model->addOperand(&type12); 15961 auto op34 = model->addOperand(&type9); 15962 auto param15 = model->addOperand(&type5); 15963 auto param16 = model->addOperand(&type5); 15964 auto param17 = model->addOperand(&type5); 15965 auto param18 = model->addOperand(&type5); 15966 auto param19 = model->addOperand(&type5); 15967 auto param20 = model->addOperand(&type5); 15968 auto param21 = model->addOperand(&type5); 15969 auto layout = model->addOperand(&type0); 15970 auto op44 = model->addOperand(&type178); 15971 // Phase 2, operations 15972 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 15973 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 15974 static float op34_init[] = {0.0f}; 15975 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 15976 static int32_t param15_init[] = {1}; 15977 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 15978 static int32_t param16_init[] = {2}; 15979 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 15980 static int32_t param17_init[] = {2}; 15981 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 15982 static int32_t param18_init[] = {1}; 15983 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 15984 static int32_t param19_init[] = {1}; 15985 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 15986 static int32_t param20_init[] = {1}; 15987 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 15988 static int32_t param21_init[] = {0}; 15989 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 15990 static bool8 layout_init[] = {true}; 15991 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 15992 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 15993 // Phase 3, inputs and outputs 15994 model->identifyInputsAndOutputs( 15995 {op14}, 15996 {op44}); 15997 assert(model->isValid()); 15998 } 15999 16000 inline bool is_ignored_nchw_4(int i) { 16001 static std::set<int> ignore = {}; 16002 return ignore.find(i) != ignore.end(); 16003 } 16004 16005 void CreateModel_nchw_weight_as_input_4(Model *model) { 16006 OperandType type0(Type::BOOL, {}); 16007 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16008 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16009 OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 16010 OperandType type5(Type::INT32, {}); 16011 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16012 // Phase 1, operands 16013 auto op14 = model->addOperand(&type160); 16014 auto op24 = model->addOperand(&type12); 16015 auto op34 = model->addOperand(&type9); 16016 auto param15 = model->addOperand(&type5); 16017 auto param16 = model->addOperand(&type5); 16018 auto param17 = model->addOperand(&type5); 16019 auto param18 = model->addOperand(&type5); 16020 auto param19 = model->addOperand(&type5); 16021 auto param20 = model->addOperand(&type5); 16022 auto param21 = model->addOperand(&type5); 16023 auto layout = model->addOperand(&type0); 16024 auto op44 = model->addOperand(&type178); 16025 // Phase 2, operations 16026 static int32_t param15_init[] = {1}; 16027 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16028 static int32_t param16_init[] = {2}; 16029 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16030 static int32_t param17_init[] = {2}; 16031 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16032 static int32_t param18_init[] = {1}; 16033 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16034 static int32_t param19_init[] = {1}; 16035 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16036 static int32_t param20_init[] = {1}; 16037 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16038 static int32_t param21_init[] = {0}; 16039 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16040 static bool8 layout_init[] = {true}; 16041 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16042 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16043 // Phase 3, inputs and outputs 16044 model->identifyInputsAndOutputs( 16045 {op14, op24, op34}, 16046 {op44}); 16047 assert(model->isValid()); 16048 } 16049 16050 inline bool is_ignored_nchw_weight_as_input_4(int i) { 16051 static std::set<int> ignore = {}; 16052 return ignore.find(i) != ignore.end(); 16053 } 16054 16055 void CreateModel_nchw_relaxed_4(Model *model) { 16056 OperandType type0(Type::BOOL, {}); 16057 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16058 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16059 OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 16060 OperandType type5(Type::INT32, {}); 16061 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16062 // Phase 1, operands 16063 auto op14 = model->addOperand(&type160); 16064 auto op24 = model->addOperand(&type12); 16065 auto op34 = model->addOperand(&type9); 16066 auto param15 = model->addOperand(&type5); 16067 auto param16 = model->addOperand(&type5); 16068 auto param17 = model->addOperand(&type5); 16069 auto param18 = model->addOperand(&type5); 16070 auto param19 = model->addOperand(&type5); 16071 auto param20 = model->addOperand(&type5); 16072 auto param21 = model->addOperand(&type5); 16073 auto layout = model->addOperand(&type0); 16074 auto op44 = model->addOperand(&type178); 16075 // Phase 2, operations 16076 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16077 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 16078 static float op34_init[] = {0.0f}; 16079 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 16080 static int32_t param15_init[] = {1}; 16081 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16082 static int32_t param16_init[] = {2}; 16083 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16084 static int32_t param17_init[] = {2}; 16085 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16086 static int32_t param18_init[] = {1}; 16087 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16088 static int32_t param19_init[] = {1}; 16089 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16090 static int32_t param20_init[] = {1}; 16091 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16092 static int32_t param21_init[] = {0}; 16093 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16094 static bool8 layout_init[] = {true}; 16095 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16096 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16097 // Phase 3, inputs and outputs 16098 model->identifyInputsAndOutputs( 16099 {op14}, 16100 {op44}); 16101 // Phase 4: set relaxed execution 16102 model->relaxComputationFloat32toFloat16(true); 16103 assert(model->isValid()); 16104 } 16105 16106 inline bool is_ignored_nchw_relaxed_4(int i) { 16107 static std::set<int> ignore = {}; 16108 return ignore.find(i) != ignore.end(); 16109 } 16110 16111 void CreateModel_nchw_relaxed_weight_as_input_4(Model *model) { 16112 OperandType type0(Type::BOOL, {}); 16113 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16114 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16115 OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); 16116 OperandType type5(Type::INT32, {}); 16117 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16118 // Phase 1, operands 16119 auto op14 = model->addOperand(&type160); 16120 auto op24 = model->addOperand(&type12); 16121 auto op34 = model->addOperand(&type9); 16122 auto param15 = model->addOperand(&type5); 16123 auto param16 = model->addOperand(&type5); 16124 auto param17 = model->addOperand(&type5); 16125 auto param18 = model->addOperand(&type5); 16126 auto param19 = model->addOperand(&type5); 16127 auto param20 = model->addOperand(&type5); 16128 auto param21 = model->addOperand(&type5); 16129 auto layout = model->addOperand(&type0); 16130 auto op44 = model->addOperand(&type178); 16131 // Phase 2, operations 16132 static int32_t param15_init[] = {1}; 16133 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16134 static int32_t param16_init[] = {2}; 16135 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16136 static int32_t param17_init[] = {2}; 16137 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16138 static int32_t param18_init[] = {1}; 16139 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16140 static int32_t param19_init[] = {1}; 16141 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16142 static int32_t param20_init[] = {1}; 16143 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16144 static int32_t param21_init[] = {0}; 16145 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16146 static bool8 layout_init[] = {true}; 16147 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16148 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16149 // Phase 3, inputs and outputs 16150 model->identifyInputsAndOutputs( 16151 {op14, op24, op34}, 16152 {op44}); 16153 // Phase 4: set relaxed execution 16154 model->relaxComputationFloat32toFloat16(true); 16155 assert(model->isValid()); 16156 } 16157 16158 inline bool is_ignored_nchw_relaxed_weight_as_input_4(int i) { 16159 static std::set<int> ignore = {}; 16160 return ignore.find(i) != ignore.end(); 16161 } 16162 16163 void CreateModel_nchw_quant8_4(Model *model) { 16164 OperandType type0(Type::BOOL, {}); 16165 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 16166 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 16167 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 16168 OperandType type179(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 20.0f, 50); 16169 OperandType type5(Type::INT32, {}); 16170 // Phase 1, operands 16171 auto op14 = model->addOperand(&type162); 16172 auto op24 = model->addOperand(&type176); 16173 auto op34 = model->addOperand(&type168); 16174 auto param15 = model->addOperand(&type5); 16175 auto param16 = model->addOperand(&type5); 16176 auto param17 = model->addOperand(&type5); 16177 auto param18 = model->addOperand(&type5); 16178 auto param19 = model->addOperand(&type5); 16179 auto param20 = model->addOperand(&type5); 16180 auto param21 = model->addOperand(&type5); 16181 auto layout = model->addOperand(&type0); 16182 auto op44 = model->addOperand(&type179); 16183 // Phase 2, operations 16184 static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; 16185 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); 16186 static int32_t op34_init[] = {0}; 16187 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); 16188 static int32_t param15_init[] = {1}; 16189 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16190 static int32_t param16_init[] = {2}; 16191 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16192 static int32_t param17_init[] = {2}; 16193 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16194 static int32_t param18_init[] = {1}; 16195 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16196 static int32_t param19_init[] = {1}; 16197 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16198 static int32_t param20_init[] = {1}; 16199 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16200 static int32_t param21_init[] = {0}; 16201 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16202 static bool8 layout_init[] = {true}; 16203 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16204 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16205 // Phase 3, inputs and outputs 16206 model->identifyInputsAndOutputs( 16207 {op14}, 16208 {op44}); 16209 assert(model->isValid()); 16210 } 16211 16212 inline bool is_ignored_nchw_quant8_4(int i) { 16213 static std::set<int> ignore = {}; 16214 return ignore.find(i) != ignore.end(); 16215 } 16216 16217 void CreateModel_nchw_quant8_weight_as_input_4(Model *model) { 16218 OperandType type0(Type::BOOL, {}); 16219 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 16220 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 16221 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 16222 OperandType type179(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 20.0f, 50); 16223 OperandType type5(Type::INT32, {}); 16224 // Phase 1, operands 16225 auto op14 = model->addOperand(&type162); 16226 auto op24 = model->addOperand(&type176); 16227 auto op34 = model->addOperand(&type168); 16228 auto param15 = model->addOperand(&type5); 16229 auto param16 = model->addOperand(&type5); 16230 auto param17 = model->addOperand(&type5); 16231 auto param18 = model->addOperand(&type5); 16232 auto param19 = model->addOperand(&type5); 16233 auto param20 = model->addOperand(&type5); 16234 auto param21 = model->addOperand(&type5); 16235 auto layout = model->addOperand(&type0); 16236 auto op44 = model->addOperand(&type179); 16237 // Phase 2, operations 16238 static int32_t param15_init[] = {1}; 16239 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16240 static int32_t param16_init[] = {2}; 16241 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16242 static int32_t param17_init[] = {2}; 16243 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16244 static int32_t param18_init[] = {1}; 16245 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16246 static int32_t param19_init[] = {1}; 16247 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16248 static int32_t param20_init[] = {1}; 16249 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16250 static int32_t param21_init[] = {0}; 16251 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16252 static bool8 layout_init[] = {true}; 16253 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16254 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16255 // Phase 3, inputs and outputs 16256 model->identifyInputsAndOutputs( 16257 {op14, op24, op34}, 16258 {op44}); 16259 assert(model->isValid()); 16260 } 16261 16262 inline bool is_ignored_nchw_quant8_weight_as_input_4(int i) { 16263 static std::set<int> ignore = {}; 16264 return ignore.find(i) != ignore.end(); 16265 } 16266 16267 void CreateModel_nchw_float16_4(Model *model) { 16268 OperandType type0(Type::BOOL, {}); 16269 OperandType type135(Type::TENSOR_FLOAT16, {1}); 16270 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 16271 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 16272 OperandType type180(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); 16273 OperandType type5(Type::INT32, {}); 16274 // Phase 1, operands 16275 auto op14 = model->addOperand(&type164); 16276 auto op24 = model->addOperand(&type157); 16277 auto op34 = model->addOperand(&type135); 16278 auto param15 = model->addOperand(&type5); 16279 auto param16 = model->addOperand(&type5); 16280 auto param17 = model->addOperand(&type5); 16281 auto param18 = model->addOperand(&type5); 16282 auto param19 = model->addOperand(&type5); 16283 auto param20 = model->addOperand(&type5); 16284 auto param21 = model->addOperand(&type5); 16285 auto layout = model->addOperand(&type0); 16286 auto op44 = model->addOperand(&type180); 16287 // Phase 2, operations 16288 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16289 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 16290 static _Float16 op34_init[] = {0.0f}; 16291 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 16292 static int32_t param15_init[] = {1}; 16293 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16294 static int32_t param16_init[] = {2}; 16295 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16296 static int32_t param17_init[] = {2}; 16297 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16298 static int32_t param18_init[] = {1}; 16299 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16300 static int32_t param19_init[] = {1}; 16301 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16302 static int32_t param20_init[] = {1}; 16303 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16304 static int32_t param21_init[] = {0}; 16305 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16306 static bool8 layout_init[] = {true}; 16307 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16308 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16309 // Phase 3, inputs and outputs 16310 model->identifyInputsAndOutputs( 16311 {op14}, 16312 {op44}); 16313 assert(model->isValid()); 16314 } 16315 16316 inline bool is_ignored_nchw_float16_4(int i) { 16317 static std::set<int> ignore = {}; 16318 return ignore.find(i) != ignore.end(); 16319 } 16320 16321 void CreateModel_nchw_float16_weight_as_input_4(Model *model) { 16322 OperandType type0(Type::BOOL, {}); 16323 OperandType type138(Type::TENSOR_FLOAT16, {1}); 16324 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 16325 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 16326 OperandType type180(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); 16327 OperandType type5(Type::INT32, {}); 16328 // Phase 1, operands 16329 auto op14 = model->addOperand(&type164); 16330 auto op24 = model->addOperand(&type159); 16331 auto op34 = model->addOperand(&type138); 16332 auto param15 = model->addOperand(&type5); 16333 auto param16 = model->addOperand(&type5); 16334 auto param17 = model->addOperand(&type5); 16335 auto param18 = model->addOperand(&type5); 16336 auto param19 = model->addOperand(&type5); 16337 auto param20 = model->addOperand(&type5); 16338 auto param21 = model->addOperand(&type5); 16339 auto layout = model->addOperand(&type0); 16340 auto op44 = model->addOperand(&type180); 16341 // Phase 2, operations 16342 static int32_t param15_init[] = {1}; 16343 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16344 static int32_t param16_init[] = {2}; 16345 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16346 static int32_t param17_init[] = {2}; 16347 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16348 static int32_t param18_init[] = {1}; 16349 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16350 static int32_t param19_init[] = {1}; 16351 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16352 static int32_t param20_init[] = {1}; 16353 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16354 static int32_t param21_init[] = {0}; 16355 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16356 static bool8 layout_init[] = {true}; 16357 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16358 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16359 // Phase 3, inputs and outputs 16360 model->identifyInputsAndOutputs( 16361 {op14, op24, op34}, 16362 {op44}); 16363 assert(model->isValid()); 16364 } 16365 16366 inline bool is_ignored_nchw_float16_weight_as_input_4(int i) { 16367 static std::set<int> ignore = {}; 16368 return ignore.find(i) != ignore.end(); 16369 } 16370 16371 void CreateModel_dynamic_output_shape_nhwc_4(Model *model) { 16372 OperandType type0(Type::BOOL, {}); 16373 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 16374 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16375 OperandType type5(Type::INT32, {}); 16376 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16377 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16378 // Phase 1, operands 16379 auto op14 = model->addOperand(&type11); 16380 auto op24 = model->addOperand(&type12); 16381 auto op34 = model->addOperand(&type9); 16382 auto param15 = model->addOperand(&type5); 16383 auto param16 = model->addOperand(&type5); 16384 auto param17 = model->addOperand(&type5); 16385 auto param18 = model->addOperand(&type5); 16386 auto param19 = model->addOperand(&type5); 16387 auto param20 = model->addOperand(&type5); 16388 auto param21 = model->addOperand(&type5); 16389 auto layout = model->addOperand(&type0); 16390 auto op44 = model->addOperand(&type88); 16391 // Phase 2, operations 16392 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16393 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 16394 static float op34_init[] = {0.0f}; 16395 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 16396 static int32_t param15_init[] = {1}; 16397 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16398 static int32_t param16_init[] = {2}; 16399 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16400 static int32_t param17_init[] = {2}; 16401 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16402 static int32_t param18_init[] = {1}; 16403 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16404 static int32_t param19_init[] = {1}; 16405 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16406 static int32_t param20_init[] = {1}; 16407 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16408 static int32_t param21_init[] = {0}; 16409 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16410 static bool8 layout_init[] = {false}; 16411 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16412 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16413 // Phase 3, inputs and outputs 16414 model->identifyInputsAndOutputs( 16415 {op14}, 16416 {op44}); 16417 assert(model->isValid()); 16418 } 16419 16420 inline bool is_ignored_dynamic_output_shape_nhwc_4(int i) { 16421 static std::set<int> ignore = {}; 16422 return ignore.find(i) != ignore.end(); 16423 } 16424 16425 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_4(Model *model) { 16426 OperandType type0(Type::BOOL, {}); 16427 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 16428 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16429 OperandType type5(Type::INT32, {}); 16430 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16431 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16432 // Phase 1, operands 16433 auto op14 = model->addOperand(&type11); 16434 auto op24 = model->addOperand(&type12); 16435 auto op34 = model->addOperand(&type9); 16436 auto param15 = model->addOperand(&type5); 16437 auto param16 = model->addOperand(&type5); 16438 auto param17 = model->addOperand(&type5); 16439 auto param18 = model->addOperand(&type5); 16440 auto param19 = model->addOperand(&type5); 16441 auto param20 = model->addOperand(&type5); 16442 auto param21 = model->addOperand(&type5); 16443 auto layout = model->addOperand(&type0); 16444 auto op44 = model->addOperand(&type88); 16445 // Phase 2, operations 16446 static int32_t param15_init[] = {1}; 16447 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16448 static int32_t param16_init[] = {2}; 16449 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16450 static int32_t param17_init[] = {2}; 16451 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16452 static int32_t param18_init[] = {1}; 16453 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16454 static int32_t param19_init[] = {1}; 16455 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16456 static int32_t param20_init[] = {1}; 16457 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16458 static int32_t param21_init[] = {0}; 16459 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16460 static bool8 layout_init[] = {false}; 16461 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16462 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16463 // Phase 3, inputs and outputs 16464 model->identifyInputsAndOutputs( 16465 {op14, op24, op34}, 16466 {op44}); 16467 assert(model->isValid()); 16468 } 16469 16470 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_4(int i) { 16471 static std::set<int> ignore = {}; 16472 return ignore.find(i) != ignore.end(); 16473 } 16474 16475 void CreateModel_dynamic_output_shape_nhwc_relaxed_4(Model *model) { 16476 OperandType type0(Type::BOOL, {}); 16477 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 16478 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16479 OperandType type5(Type::INT32, {}); 16480 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16481 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16482 // Phase 1, operands 16483 auto op14 = model->addOperand(&type11); 16484 auto op24 = model->addOperand(&type12); 16485 auto op34 = model->addOperand(&type9); 16486 auto param15 = model->addOperand(&type5); 16487 auto param16 = model->addOperand(&type5); 16488 auto param17 = model->addOperand(&type5); 16489 auto param18 = model->addOperand(&type5); 16490 auto param19 = model->addOperand(&type5); 16491 auto param20 = model->addOperand(&type5); 16492 auto param21 = model->addOperand(&type5); 16493 auto layout = model->addOperand(&type0); 16494 auto op44 = model->addOperand(&type88); 16495 // Phase 2, operations 16496 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16497 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 16498 static float op34_init[] = {0.0f}; 16499 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 16500 static int32_t param15_init[] = {1}; 16501 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16502 static int32_t param16_init[] = {2}; 16503 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16504 static int32_t param17_init[] = {2}; 16505 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16506 static int32_t param18_init[] = {1}; 16507 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16508 static int32_t param19_init[] = {1}; 16509 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16510 static int32_t param20_init[] = {1}; 16511 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16512 static int32_t param21_init[] = {0}; 16513 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16514 static bool8 layout_init[] = {false}; 16515 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16516 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16517 // Phase 3, inputs and outputs 16518 model->identifyInputsAndOutputs( 16519 {op14}, 16520 {op44}); 16521 // Phase 4: set relaxed execution 16522 model->relaxComputationFloat32toFloat16(true); 16523 assert(model->isValid()); 16524 } 16525 16526 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_4(int i) { 16527 static std::set<int> ignore = {}; 16528 return ignore.find(i) != ignore.end(); 16529 } 16530 16531 void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_4(Model *model) { 16532 OperandType type0(Type::BOOL, {}); 16533 OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); 16534 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16535 OperandType type5(Type::INT32, {}); 16536 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16537 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16538 // Phase 1, operands 16539 auto op14 = model->addOperand(&type11); 16540 auto op24 = model->addOperand(&type12); 16541 auto op34 = model->addOperand(&type9); 16542 auto param15 = model->addOperand(&type5); 16543 auto param16 = model->addOperand(&type5); 16544 auto param17 = model->addOperand(&type5); 16545 auto param18 = model->addOperand(&type5); 16546 auto param19 = model->addOperand(&type5); 16547 auto param20 = model->addOperand(&type5); 16548 auto param21 = model->addOperand(&type5); 16549 auto layout = model->addOperand(&type0); 16550 auto op44 = model->addOperand(&type88); 16551 // Phase 2, operations 16552 static int32_t param15_init[] = {1}; 16553 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16554 static int32_t param16_init[] = {2}; 16555 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16556 static int32_t param17_init[] = {2}; 16557 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16558 static int32_t param18_init[] = {1}; 16559 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16560 static int32_t param19_init[] = {1}; 16561 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16562 static int32_t param20_init[] = {1}; 16563 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16564 static int32_t param21_init[] = {0}; 16565 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16566 static bool8 layout_init[] = {false}; 16567 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16568 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16569 // Phase 3, inputs and outputs 16570 model->identifyInputsAndOutputs( 16571 {op14, op24, op34}, 16572 {op44}); 16573 // Phase 4: set relaxed execution 16574 model->relaxComputationFloat32toFloat16(true); 16575 assert(model->isValid()); 16576 } 16577 16578 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_4(int i) { 16579 static std::set<int> ignore = {}; 16580 return ignore.find(i) != ignore.end(); 16581 } 16582 16583 void CreateModel_dynamic_output_shape_nhwc_quant8_4(Model *model) { 16584 OperandType type0(Type::BOOL, {}); 16585 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 16586 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 16587 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 16588 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 16589 OperandType type5(Type::INT32, {}); 16590 // Phase 1, operands 16591 auto op14 = model->addOperand(&type152); 16592 auto op24 = model->addOperand(&type176); 16593 auto op34 = model->addOperand(&type168); 16594 auto param15 = model->addOperand(&type5); 16595 auto param16 = model->addOperand(&type5); 16596 auto param17 = model->addOperand(&type5); 16597 auto param18 = model->addOperand(&type5); 16598 auto param19 = model->addOperand(&type5); 16599 auto param20 = model->addOperand(&type5); 16600 auto param21 = model->addOperand(&type5); 16601 auto layout = model->addOperand(&type0); 16602 auto op44 = model->addOperand(&type147); 16603 // Phase 2, operations 16604 static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; 16605 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); 16606 static int32_t op34_init[] = {0}; 16607 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); 16608 static int32_t param15_init[] = {1}; 16609 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16610 static int32_t param16_init[] = {2}; 16611 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16612 static int32_t param17_init[] = {2}; 16613 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16614 static int32_t param18_init[] = {1}; 16615 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16616 static int32_t param19_init[] = {1}; 16617 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16618 static int32_t param20_init[] = {1}; 16619 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16620 static int32_t param21_init[] = {0}; 16621 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16622 static bool8 layout_init[] = {false}; 16623 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16624 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16625 // Phase 3, inputs and outputs 16626 model->identifyInputsAndOutputs( 16627 {op14}, 16628 {op44}); 16629 assert(model->isValid()); 16630 } 16631 16632 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_4(int i) { 16633 static std::set<int> ignore = {}; 16634 return ignore.find(i) != ignore.end(); 16635 } 16636 16637 void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_4(Model *model) { 16638 OperandType type0(Type::BOOL, {}); 16639 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 16640 OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); 16641 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 16642 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 16643 OperandType type5(Type::INT32, {}); 16644 // Phase 1, operands 16645 auto op14 = model->addOperand(&type152); 16646 auto op24 = model->addOperand(&type176); 16647 auto op34 = model->addOperand(&type168); 16648 auto param15 = model->addOperand(&type5); 16649 auto param16 = model->addOperand(&type5); 16650 auto param17 = model->addOperand(&type5); 16651 auto param18 = model->addOperand(&type5); 16652 auto param19 = model->addOperand(&type5); 16653 auto param20 = model->addOperand(&type5); 16654 auto param21 = model->addOperand(&type5); 16655 auto layout = model->addOperand(&type0); 16656 auto op44 = model->addOperand(&type147); 16657 // Phase 2, operations 16658 static int32_t param15_init[] = {1}; 16659 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16660 static int32_t param16_init[] = {2}; 16661 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16662 static int32_t param17_init[] = {2}; 16663 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16664 static int32_t param18_init[] = {1}; 16665 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16666 static int32_t param19_init[] = {1}; 16667 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16668 static int32_t param20_init[] = {1}; 16669 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16670 static int32_t param21_init[] = {0}; 16671 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16672 static bool8 layout_init[] = {false}; 16673 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16674 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16675 // Phase 3, inputs and outputs 16676 model->identifyInputsAndOutputs( 16677 {op14, op24, op34}, 16678 {op44}); 16679 assert(model->isValid()); 16680 } 16681 16682 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_4(int i) { 16683 static std::set<int> ignore = {}; 16684 return ignore.find(i) != ignore.end(); 16685 } 16686 16687 void CreateModel_dynamic_output_shape_nhwc_float16_4(Model *model) { 16688 OperandType type0(Type::BOOL, {}); 16689 OperandType type135(Type::TENSOR_FLOAT16, {1}); 16690 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 16691 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 16692 OperandType type5(Type::INT32, {}); 16693 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 16694 // Phase 1, operands 16695 auto op14 = model->addOperand(&type156); 16696 auto op24 = model->addOperand(&type157); 16697 auto op34 = model->addOperand(&type135); 16698 auto param15 = model->addOperand(&type5); 16699 auto param16 = model->addOperand(&type5); 16700 auto param17 = model->addOperand(&type5); 16701 auto param18 = model->addOperand(&type5); 16702 auto param19 = model->addOperand(&type5); 16703 auto param20 = model->addOperand(&type5); 16704 auto param21 = model->addOperand(&type5); 16705 auto layout = model->addOperand(&type0); 16706 auto op44 = model->addOperand(&type96); 16707 // Phase 2, operations 16708 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16709 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 16710 static _Float16 op34_init[] = {0.0f}; 16711 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 16712 static int32_t param15_init[] = {1}; 16713 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16714 static int32_t param16_init[] = {2}; 16715 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16716 static int32_t param17_init[] = {2}; 16717 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16718 static int32_t param18_init[] = {1}; 16719 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16720 static int32_t param19_init[] = {1}; 16721 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16722 static int32_t param20_init[] = {1}; 16723 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16724 static int32_t param21_init[] = {0}; 16725 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16726 static bool8 layout_init[] = {false}; 16727 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16728 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16729 // Phase 3, inputs and outputs 16730 model->identifyInputsAndOutputs( 16731 {op14}, 16732 {op44}); 16733 assert(model->isValid()); 16734 } 16735 16736 inline bool is_ignored_dynamic_output_shape_nhwc_float16_4(int i) { 16737 static std::set<int> ignore = {}; 16738 return ignore.find(i) != ignore.end(); 16739 } 16740 16741 void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_4(Model *model) { 16742 OperandType type0(Type::BOOL, {}); 16743 OperandType type138(Type::TENSOR_FLOAT16, {1}); 16744 OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); 16745 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 16746 OperandType type5(Type::INT32, {}); 16747 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 16748 // Phase 1, operands 16749 auto op14 = model->addOperand(&type156); 16750 auto op24 = model->addOperand(&type159); 16751 auto op34 = model->addOperand(&type138); 16752 auto param15 = model->addOperand(&type5); 16753 auto param16 = model->addOperand(&type5); 16754 auto param17 = model->addOperand(&type5); 16755 auto param18 = model->addOperand(&type5); 16756 auto param19 = model->addOperand(&type5); 16757 auto param20 = model->addOperand(&type5); 16758 auto param21 = model->addOperand(&type5); 16759 auto layout = model->addOperand(&type0); 16760 auto op44 = model->addOperand(&type96); 16761 // Phase 2, operations 16762 static int32_t param15_init[] = {1}; 16763 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16764 static int32_t param16_init[] = {2}; 16765 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16766 static int32_t param17_init[] = {2}; 16767 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16768 static int32_t param18_init[] = {1}; 16769 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16770 static int32_t param19_init[] = {1}; 16771 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16772 static int32_t param20_init[] = {1}; 16773 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16774 static int32_t param21_init[] = {0}; 16775 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16776 static bool8 layout_init[] = {false}; 16777 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16778 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16779 // Phase 3, inputs and outputs 16780 model->identifyInputsAndOutputs( 16781 {op14, op24, op34}, 16782 {op44}); 16783 assert(model->isValid()); 16784 } 16785 16786 inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_4(int i) { 16787 static std::set<int> ignore = {}; 16788 return ignore.find(i) != ignore.end(); 16789 } 16790 16791 void CreateModel_dynamic_output_shape_nchw_4(Model *model) { 16792 OperandType type0(Type::BOOL, {}); 16793 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16794 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16795 OperandType type5(Type::INT32, {}); 16796 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16797 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16798 // Phase 1, operands 16799 auto op14 = model->addOperand(&type160); 16800 auto op24 = model->addOperand(&type12); 16801 auto op34 = model->addOperand(&type9); 16802 auto param15 = model->addOperand(&type5); 16803 auto param16 = model->addOperand(&type5); 16804 auto param17 = model->addOperand(&type5); 16805 auto param18 = model->addOperand(&type5); 16806 auto param19 = model->addOperand(&type5); 16807 auto param20 = model->addOperand(&type5); 16808 auto param21 = model->addOperand(&type5); 16809 auto layout = model->addOperand(&type0); 16810 auto op44 = model->addOperand(&type88); 16811 // Phase 2, operations 16812 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16813 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 16814 static float op34_init[] = {0.0f}; 16815 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 16816 static int32_t param15_init[] = {1}; 16817 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16818 static int32_t param16_init[] = {2}; 16819 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16820 static int32_t param17_init[] = {2}; 16821 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16822 static int32_t param18_init[] = {1}; 16823 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16824 static int32_t param19_init[] = {1}; 16825 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16826 static int32_t param20_init[] = {1}; 16827 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16828 static int32_t param21_init[] = {0}; 16829 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16830 static bool8 layout_init[] = {true}; 16831 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16832 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16833 // Phase 3, inputs and outputs 16834 model->identifyInputsAndOutputs( 16835 {op14}, 16836 {op44}); 16837 assert(model->isValid()); 16838 } 16839 16840 inline bool is_ignored_dynamic_output_shape_nchw_4(int i) { 16841 static std::set<int> ignore = {}; 16842 return ignore.find(i) != ignore.end(); 16843 } 16844 16845 void CreateModel_dynamic_output_shape_nchw_weight_as_input_4(Model *model) { 16846 OperandType type0(Type::BOOL, {}); 16847 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16848 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16849 OperandType type5(Type::INT32, {}); 16850 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16851 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16852 // Phase 1, operands 16853 auto op14 = model->addOperand(&type160); 16854 auto op24 = model->addOperand(&type12); 16855 auto op34 = model->addOperand(&type9); 16856 auto param15 = model->addOperand(&type5); 16857 auto param16 = model->addOperand(&type5); 16858 auto param17 = model->addOperand(&type5); 16859 auto param18 = model->addOperand(&type5); 16860 auto param19 = model->addOperand(&type5); 16861 auto param20 = model->addOperand(&type5); 16862 auto param21 = model->addOperand(&type5); 16863 auto layout = model->addOperand(&type0); 16864 auto op44 = model->addOperand(&type88); 16865 // Phase 2, operations 16866 static int32_t param15_init[] = {1}; 16867 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16868 static int32_t param16_init[] = {2}; 16869 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16870 static int32_t param17_init[] = {2}; 16871 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16872 static int32_t param18_init[] = {1}; 16873 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16874 static int32_t param19_init[] = {1}; 16875 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16876 static int32_t param20_init[] = {1}; 16877 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16878 static int32_t param21_init[] = {0}; 16879 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16880 static bool8 layout_init[] = {true}; 16881 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16882 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16883 // Phase 3, inputs and outputs 16884 model->identifyInputsAndOutputs( 16885 {op14, op24, op34}, 16886 {op44}); 16887 assert(model->isValid()); 16888 } 16889 16890 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_4(int i) { 16891 static std::set<int> ignore = {}; 16892 return ignore.find(i) != ignore.end(); 16893 } 16894 16895 void CreateModel_dynamic_output_shape_nchw_relaxed_4(Model *model) { 16896 OperandType type0(Type::BOOL, {}); 16897 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16898 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16899 OperandType type5(Type::INT32, {}); 16900 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16901 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16902 // Phase 1, operands 16903 auto op14 = model->addOperand(&type160); 16904 auto op24 = model->addOperand(&type12); 16905 auto op34 = model->addOperand(&type9); 16906 auto param15 = model->addOperand(&type5); 16907 auto param16 = model->addOperand(&type5); 16908 auto param17 = model->addOperand(&type5); 16909 auto param18 = model->addOperand(&type5); 16910 auto param19 = model->addOperand(&type5); 16911 auto param20 = model->addOperand(&type5); 16912 auto param21 = model->addOperand(&type5); 16913 auto layout = model->addOperand(&type0); 16914 auto op44 = model->addOperand(&type88); 16915 // Phase 2, operations 16916 static float op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 16917 model->setOperandValue(op24, op24_init, sizeof(float) * 18); 16918 static float op34_init[] = {0.0f}; 16919 model->setOperandValue(op34, op34_init, sizeof(float) * 1); 16920 static int32_t param15_init[] = {1}; 16921 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16922 static int32_t param16_init[] = {2}; 16923 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16924 static int32_t param17_init[] = {2}; 16925 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16926 static int32_t param18_init[] = {1}; 16927 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16928 static int32_t param19_init[] = {1}; 16929 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16930 static int32_t param20_init[] = {1}; 16931 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16932 static int32_t param21_init[] = {0}; 16933 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16934 static bool8 layout_init[] = {true}; 16935 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16936 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16937 // Phase 3, inputs and outputs 16938 model->identifyInputsAndOutputs( 16939 {op14}, 16940 {op44}); 16941 // Phase 4: set relaxed execution 16942 model->relaxComputationFloat32toFloat16(true); 16943 assert(model->isValid()); 16944 } 16945 16946 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_4(int i) { 16947 static std::set<int> ignore = {}; 16948 return ignore.find(i) != ignore.end(); 16949 } 16950 16951 void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_4(Model *model) { 16952 OperandType type0(Type::BOOL, {}); 16953 OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); 16954 OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); 16955 OperandType type5(Type::INT32, {}); 16956 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 16957 OperandType type9(Type::TENSOR_FLOAT32, {1}); 16958 // Phase 1, operands 16959 auto op14 = model->addOperand(&type160); 16960 auto op24 = model->addOperand(&type12); 16961 auto op34 = model->addOperand(&type9); 16962 auto param15 = model->addOperand(&type5); 16963 auto param16 = model->addOperand(&type5); 16964 auto param17 = model->addOperand(&type5); 16965 auto param18 = model->addOperand(&type5); 16966 auto param19 = model->addOperand(&type5); 16967 auto param20 = model->addOperand(&type5); 16968 auto param21 = model->addOperand(&type5); 16969 auto layout = model->addOperand(&type0); 16970 auto op44 = model->addOperand(&type88); 16971 // Phase 2, operations 16972 static int32_t param15_init[] = {1}; 16973 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 16974 static int32_t param16_init[] = {2}; 16975 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 16976 static int32_t param17_init[] = {2}; 16977 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 16978 static int32_t param18_init[] = {1}; 16979 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 16980 static int32_t param19_init[] = {1}; 16981 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 16982 static int32_t param20_init[] = {1}; 16983 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 16984 static int32_t param21_init[] = {0}; 16985 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 16986 static bool8 layout_init[] = {true}; 16987 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 16988 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 16989 // Phase 3, inputs and outputs 16990 model->identifyInputsAndOutputs( 16991 {op14, op24, op34}, 16992 {op44}); 16993 // Phase 4: set relaxed execution 16994 model->relaxComputationFloat32toFloat16(true); 16995 assert(model->isValid()); 16996 } 16997 16998 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_4(int i) { 16999 static std::set<int> ignore = {}; 17000 return ignore.find(i) != ignore.end(); 17001 } 17002 17003 void CreateModel_dynamic_output_shape_nchw_quant8_4(Model *model) { 17004 OperandType type0(Type::BOOL, {}); 17005 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 17006 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 17007 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 17008 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 17009 OperandType type5(Type::INT32, {}); 17010 // Phase 1, operands 17011 auto op14 = model->addOperand(&type162); 17012 auto op24 = model->addOperand(&type176); 17013 auto op34 = model->addOperand(&type168); 17014 auto param15 = model->addOperand(&type5); 17015 auto param16 = model->addOperand(&type5); 17016 auto param17 = model->addOperand(&type5); 17017 auto param18 = model->addOperand(&type5); 17018 auto param19 = model->addOperand(&type5); 17019 auto param20 = model->addOperand(&type5); 17020 auto param21 = model->addOperand(&type5); 17021 auto layout = model->addOperand(&type0); 17022 auto op44 = model->addOperand(&type147); 17023 // Phase 2, operations 17024 static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; 17025 model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); 17026 static int32_t op34_init[] = {0}; 17027 model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); 17028 static int32_t param15_init[] = {1}; 17029 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 17030 static int32_t param16_init[] = {2}; 17031 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 17032 static int32_t param17_init[] = {2}; 17033 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 17034 static int32_t param18_init[] = {1}; 17035 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 17036 static int32_t param19_init[] = {1}; 17037 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 17038 static int32_t param20_init[] = {1}; 17039 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 17040 static int32_t param21_init[] = {0}; 17041 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 17042 static bool8 layout_init[] = {true}; 17043 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17044 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 17045 // Phase 3, inputs and outputs 17046 model->identifyInputsAndOutputs( 17047 {op14}, 17048 {op44}); 17049 assert(model->isValid()); 17050 } 17051 17052 inline bool is_ignored_dynamic_output_shape_nchw_quant8_4(int i) { 17053 static std::set<int> ignore = {}; 17054 return ignore.find(i) != ignore.end(); 17055 } 17056 17057 void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_4(Model *model) { 17058 OperandType type0(Type::BOOL, {}); 17059 OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); 17060 OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); 17061 OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); 17062 OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); 17063 OperandType type5(Type::INT32, {}); 17064 // Phase 1, operands 17065 auto op14 = model->addOperand(&type162); 17066 auto op24 = model->addOperand(&type176); 17067 auto op34 = model->addOperand(&type168); 17068 auto param15 = model->addOperand(&type5); 17069 auto param16 = model->addOperand(&type5); 17070 auto param17 = model->addOperand(&type5); 17071 auto param18 = model->addOperand(&type5); 17072 auto param19 = model->addOperand(&type5); 17073 auto param20 = model->addOperand(&type5); 17074 auto param21 = model->addOperand(&type5); 17075 auto layout = model->addOperand(&type0); 17076 auto op44 = model->addOperand(&type147); 17077 // Phase 2, operations 17078 static int32_t param15_init[] = {1}; 17079 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 17080 static int32_t param16_init[] = {2}; 17081 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 17082 static int32_t param17_init[] = {2}; 17083 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 17084 static int32_t param18_init[] = {1}; 17085 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 17086 static int32_t param19_init[] = {1}; 17087 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 17088 static int32_t param20_init[] = {1}; 17089 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 17090 static int32_t param21_init[] = {0}; 17091 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 17092 static bool8 layout_init[] = {true}; 17093 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17094 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 17095 // Phase 3, inputs and outputs 17096 model->identifyInputsAndOutputs( 17097 {op14, op24, op34}, 17098 {op44}); 17099 assert(model->isValid()); 17100 } 17101 17102 inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_4(int i) { 17103 static std::set<int> ignore = {}; 17104 return ignore.find(i) != ignore.end(); 17105 } 17106 17107 void CreateModel_dynamic_output_shape_nchw_float16_4(Model *model) { 17108 OperandType type0(Type::BOOL, {}); 17109 OperandType type135(Type::TENSOR_FLOAT16, {1}); 17110 OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 17111 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 17112 OperandType type5(Type::INT32, {}); 17113 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 17114 // Phase 1, operands 17115 auto op14 = model->addOperand(&type164); 17116 auto op24 = model->addOperand(&type157); 17117 auto op34 = model->addOperand(&type135); 17118 auto param15 = model->addOperand(&type5); 17119 auto param16 = model->addOperand(&type5); 17120 auto param17 = model->addOperand(&type5); 17121 auto param18 = model->addOperand(&type5); 17122 auto param19 = model->addOperand(&type5); 17123 auto param20 = model->addOperand(&type5); 17124 auto param21 = model->addOperand(&type5); 17125 auto layout = model->addOperand(&type0); 17126 auto op44 = model->addOperand(&type96); 17127 // Phase 2, operations 17128 static _Float16 op24_init[] = {1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 17.0f, 18.0f}; 17129 model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); 17130 static _Float16 op34_init[] = {0.0f}; 17131 model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); 17132 static int32_t param15_init[] = {1}; 17133 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 17134 static int32_t param16_init[] = {2}; 17135 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 17136 static int32_t param17_init[] = {2}; 17137 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 17138 static int32_t param18_init[] = {1}; 17139 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 17140 static int32_t param19_init[] = {1}; 17141 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 17142 static int32_t param20_init[] = {1}; 17143 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 17144 static int32_t param21_init[] = {0}; 17145 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 17146 static bool8 layout_init[] = {true}; 17147 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17148 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 17149 // Phase 3, inputs and outputs 17150 model->identifyInputsAndOutputs( 17151 {op14}, 17152 {op44}); 17153 assert(model->isValid()); 17154 } 17155 17156 inline bool is_ignored_dynamic_output_shape_nchw_float16_4(int i) { 17157 static std::set<int> ignore = {}; 17158 return ignore.find(i) != ignore.end(); 17159 } 17160 17161 void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_4(Model *model) { 17162 OperandType type0(Type::BOOL, {}); 17163 OperandType type138(Type::TENSOR_FLOAT16, {1}); 17164 OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); 17165 OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); 17166 OperandType type5(Type::INT32, {}); 17167 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 17168 // Phase 1, operands 17169 auto op14 = model->addOperand(&type164); 17170 auto op24 = model->addOperand(&type159); 17171 auto op34 = model->addOperand(&type138); 17172 auto param15 = model->addOperand(&type5); 17173 auto param16 = model->addOperand(&type5); 17174 auto param17 = model->addOperand(&type5); 17175 auto param18 = model->addOperand(&type5); 17176 auto param19 = model->addOperand(&type5); 17177 auto param20 = model->addOperand(&type5); 17178 auto param21 = model->addOperand(&type5); 17179 auto layout = model->addOperand(&type0); 17180 auto op44 = model->addOperand(&type96); 17181 // Phase 2, operations 17182 static int32_t param15_init[] = {1}; 17183 model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); 17184 static int32_t param16_init[] = {2}; 17185 model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); 17186 static int32_t param17_init[] = {2}; 17187 model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); 17188 static int32_t param18_init[] = {1}; 17189 model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); 17190 static int32_t param19_init[] = {1}; 17191 model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); 17192 static int32_t param20_init[] = {1}; 17193 model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); 17194 static int32_t param21_init[] = {0}; 17195 model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); 17196 static bool8 layout_init[] = {true}; 17197 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17198 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); 17199 // Phase 3, inputs and outputs 17200 model->identifyInputsAndOutputs( 17201 {op14, op24, op34}, 17202 {op44}); 17203 assert(model->isValid()); 17204 } 17205 17206 inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_4(int i) { 17207 static std::set<int> ignore = {}; 17208 return ignore.find(i) != ignore.end(); 17209 } 17210 17211 void CreateModel_zero_sized_nhwc(Model *model) { 17212 OperandType type0(Type::BOOL, {}); 17213 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 17214 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 17215 OperandType type17(Type::TENSOR_FLOAT32, {0}); 17216 OperandType type18(Type::TENSOR_INT32, {0}); 17217 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 17218 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 17219 OperandType type20(Type::TENSOR_INT32, {1}); 17220 OperandType type21(Type::FLOAT32, {}); 17221 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 17222 OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 17223 OperandType type24(Type::TENSOR_FLOAT32, {0, 5, 5, 2}); 17224 OperandType type3(Type::TENSOR_FLOAT32, {2}); 17225 OperandType type4(Type::TENSOR_INT32, {4}); 17226 OperandType type5(Type::INT32, {}); 17227 // Phase 1, operands 17228 auto scores = model->addOperand(&type15); 17229 auto roi = model->addOperand(&type16); 17230 auto param22 = model->addOperand(&type20); 17231 auto param23 = model->addOperand(&type21); 17232 auto param24 = model->addOperand(&type5); 17233 auto param25 = model->addOperand(&type5); 17234 auto param26 = model->addOperand(&type21); 17235 auto param27 = model->addOperand(&type21); 17236 auto param28 = model->addOperand(&type21); 17237 auto scoresOut = model->addOperand(&type17); 17238 auto roiOut = model->addOperand(&type19); 17239 auto classesOut = model->addOperand(&type18); 17240 auto batchSplitOut = model->addOperand(&type18); 17241 auto in = model->addOperand(&type22); 17242 auto param29 = model->addOperand(&type5); 17243 auto param30 = model->addOperand(&type5); 17244 auto param31 = model->addOperand(&type21); 17245 auto param32 = model->addOperand(&type21); 17246 auto param33 = model->addOperand(&type5); 17247 auto param34 = model->addOperand(&type5); 17248 auto layout = model->addOperand(&type0); 17249 auto featureMap = model->addOperand(&type23); 17250 auto weights = model->addOperand(&type2); 17251 auto bias = model->addOperand(&type3); 17252 auto shape4 = model->addOperand(&type4); 17253 auto param35 = model->addOperand(&type5); 17254 auto param36 = model->addOperand(&type5); 17255 auto param37 = model->addOperand(&type5); 17256 auto param38 = model->addOperand(&type5); 17257 auto out = model->addOperand(&type24); 17258 // Phase 2, operations 17259 static float scores_init[] = {0.9f, 0.1f}; 17260 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 17261 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 17262 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 17263 static int32_t param22_init[] = {0}; 17264 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17265 static float param23_init[] = {0.3f}; 17266 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 17267 static int32_t param24_init[] = {-1}; 17268 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17269 static int32_t param25_init[] = {0}; 17270 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17271 static float param26_init[] = {0.4f}; 17272 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 17273 static float param27_init[] = {1.0f}; 17274 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 17275 static float param28_init[] = {0.3f}; 17276 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 17277 static int32_t param29_init[] = {2}; 17278 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17279 static int32_t param30_init[] = {2}; 17280 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17281 static float param31_init[] = {2.0f}; 17282 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 17283 static float param32_init[] = {2.0f}; 17284 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 17285 static int32_t param33_init[] = {4}; 17286 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17287 static int32_t param34_init[] = {4}; 17288 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17289 static bool8 layout_init[] = {false}; 17290 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17291 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 17292 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 17293 static float bias_init[] = {-1.5f, -2.0f}; 17294 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 17295 static int32_t shape4_init[] = {0, 5, 5, 2}; 17296 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17297 static int32_t param35_init[] = {2}; 17298 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17299 static int32_t param36_init[] = {2}; 17300 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17301 static int32_t param37_init[] = {2}; 17302 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17303 static int32_t param38_init[] = {0}; 17304 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17305 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17306 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17307 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17308 // Phase 3, inputs and outputs 17309 model->identifyInputsAndOutputs( 17310 {in}, 17311 {scoresOut, classesOut, out}); 17312 assert(model->isValid()); 17313 } 17314 17315 inline bool is_ignored_zero_sized_nhwc(int i) { 17316 static std::set<int> ignore = {}; 17317 return ignore.find(i) != ignore.end(); 17318 } 17319 17320 void CreateModel_zero_sized_nhwc_relaxed(Model *model) { 17321 OperandType type0(Type::BOOL, {}); 17322 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 17323 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 17324 OperandType type17(Type::TENSOR_FLOAT32, {0}); 17325 OperandType type18(Type::TENSOR_INT32, {0}); 17326 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 17327 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 17328 OperandType type20(Type::TENSOR_INT32, {1}); 17329 OperandType type21(Type::FLOAT32, {}); 17330 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 17331 OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 17332 OperandType type24(Type::TENSOR_FLOAT32, {0, 5, 5, 2}); 17333 OperandType type3(Type::TENSOR_FLOAT32, {2}); 17334 OperandType type4(Type::TENSOR_INT32, {4}); 17335 OperandType type5(Type::INT32, {}); 17336 // Phase 1, operands 17337 auto scores = model->addOperand(&type15); 17338 auto roi = model->addOperand(&type16); 17339 auto param22 = model->addOperand(&type20); 17340 auto param23 = model->addOperand(&type21); 17341 auto param24 = model->addOperand(&type5); 17342 auto param25 = model->addOperand(&type5); 17343 auto param26 = model->addOperand(&type21); 17344 auto param27 = model->addOperand(&type21); 17345 auto param28 = model->addOperand(&type21); 17346 auto scoresOut = model->addOperand(&type17); 17347 auto roiOut = model->addOperand(&type19); 17348 auto classesOut = model->addOperand(&type18); 17349 auto batchSplitOut = model->addOperand(&type18); 17350 auto in = model->addOperand(&type22); 17351 auto param29 = model->addOperand(&type5); 17352 auto param30 = model->addOperand(&type5); 17353 auto param31 = model->addOperand(&type21); 17354 auto param32 = model->addOperand(&type21); 17355 auto param33 = model->addOperand(&type5); 17356 auto param34 = model->addOperand(&type5); 17357 auto layout = model->addOperand(&type0); 17358 auto featureMap = model->addOperand(&type23); 17359 auto weights = model->addOperand(&type2); 17360 auto bias = model->addOperand(&type3); 17361 auto shape4 = model->addOperand(&type4); 17362 auto param35 = model->addOperand(&type5); 17363 auto param36 = model->addOperand(&type5); 17364 auto param37 = model->addOperand(&type5); 17365 auto param38 = model->addOperand(&type5); 17366 auto out = model->addOperand(&type24); 17367 // Phase 2, operations 17368 static float scores_init[] = {0.9f, 0.1f}; 17369 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 17370 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 17371 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 17372 static int32_t param22_init[] = {0}; 17373 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17374 static float param23_init[] = {0.3f}; 17375 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 17376 static int32_t param24_init[] = {-1}; 17377 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17378 static int32_t param25_init[] = {0}; 17379 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17380 static float param26_init[] = {0.4f}; 17381 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 17382 static float param27_init[] = {1.0f}; 17383 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 17384 static float param28_init[] = {0.3f}; 17385 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 17386 static int32_t param29_init[] = {2}; 17387 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17388 static int32_t param30_init[] = {2}; 17389 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17390 static float param31_init[] = {2.0f}; 17391 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 17392 static float param32_init[] = {2.0f}; 17393 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 17394 static int32_t param33_init[] = {4}; 17395 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17396 static int32_t param34_init[] = {4}; 17397 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17398 static bool8 layout_init[] = {false}; 17399 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17400 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 17401 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 17402 static float bias_init[] = {-1.5f, -2.0f}; 17403 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 17404 static int32_t shape4_init[] = {0, 5, 5, 2}; 17405 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17406 static int32_t param35_init[] = {2}; 17407 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17408 static int32_t param36_init[] = {2}; 17409 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17410 static int32_t param37_init[] = {2}; 17411 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17412 static int32_t param38_init[] = {0}; 17413 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17414 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17415 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17416 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17417 // Phase 3, inputs and outputs 17418 model->identifyInputsAndOutputs( 17419 {in}, 17420 {scoresOut, classesOut, out}); 17421 // Phase 4: set relaxed execution 17422 model->relaxComputationFloat32toFloat16(true); 17423 assert(model->isValid()); 17424 } 17425 17426 inline bool is_ignored_zero_sized_nhwc_relaxed(int i) { 17427 static std::set<int> ignore = {}; 17428 return ignore.find(i) != ignore.end(); 17429 } 17430 17431 void CreateModel_zero_sized_nhwc_quant8(Model *model) { 17432 OperandType type0(Type::BOOL, {}); 17433 OperandType type18(Type::TENSOR_INT32, {0}); 17434 OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); 17435 OperandType type182(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); 17436 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 17437 OperandType type184(Type::TENSOR_QUANT8_ASYMM, {0, 5, 5, 2}, 0.1f, 128); 17438 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 17439 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 17440 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 17441 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 17442 OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); 17443 OperandType type20(Type::TENSOR_INT32, {1}); 17444 OperandType type21(Type::FLOAT32, {}); 17445 OperandType type4(Type::TENSOR_INT32, {4}); 17446 OperandType type5(Type::INT32, {}); 17447 // Phase 1, operands 17448 auto scores = model->addOperand(&type187); 17449 auto roi = model->addOperand(&type185); 17450 auto param22 = model->addOperand(&type20); 17451 auto param23 = model->addOperand(&type21); 17452 auto param24 = model->addOperand(&type5); 17453 auto param25 = model->addOperand(&type5); 17454 auto param26 = model->addOperand(&type21); 17455 auto param27 = model->addOperand(&type21); 17456 auto param28 = model->addOperand(&type21); 17457 auto scoresOut = model->addOperand(&type188); 17458 auto roiOut = model->addOperand(&type186); 17459 auto classesOut = model->addOperand(&type18); 17460 auto batchSplitOut = model->addOperand(&type18); 17461 auto in = model->addOperand(&type183); 17462 auto param29 = model->addOperand(&type5); 17463 auto param30 = model->addOperand(&type5); 17464 auto param31 = model->addOperand(&type21); 17465 auto param32 = model->addOperand(&type21); 17466 auto param33 = model->addOperand(&type5); 17467 auto param34 = model->addOperand(&type5); 17468 auto layout = model->addOperand(&type0); 17469 auto featureMap = model->addOperand(&type182); 17470 auto weights = model->addOperand(&type189); 17471 auto bias = model->addOperand(&type181); 17472 auto shape4 = model->addOperand(&type4); 17473 auto param35 = model->addOperand(&type5); 17474 auto param36 = model->addOperand(&type5); 17475 auto param37 = model->addOperand(&type5); 17476 auto param38 = model->addOperand(&type5); 17477 auto out = model->addOperand(&type184); 17478 // Phase 2, operations 17479 static uint8_t scores_init[] = {137, 129}; 17480 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 17481 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 17482 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 17483 static int32_t param22_init[] = {0}; 17484 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17485 static float param23_init[] = {0.3f}; 17486 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 17487 static int32_t param24_init[] = {-1}; 17488 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17489 static int32_t param25_init[] = {0}; 17490 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17491 static float param26_init[] = {0.4f}; 17492 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 17493 static float param27_init[] = {1.0f}; 17494 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 17495 static float param28_init[] = {0.3f}; 17496 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 17497 static int32_t param29_init[] = {2}; 17498 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17499 static int32_t param30_init[] = {2}; 17500 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17501 static float param31_init[] = {2.0f}; 17502 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 17503 static float param32_init[] = {2.0f}; 17504 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 17505 static int32_t param33_init[] = {4}; 17506 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17507 static int32_t param34_init[] = {4}; 17508 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17509 static bool8 layout_init[] = {false}; 17510 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17511 static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; 17512 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); 17513 static int32_t bias_init[] = {-150, -200}; 17514 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 17515 static int32_t shape4_init[] = {0, 5, 5, 2}; 17516 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17517 static int32_t param35_init[] = {2}; 17518 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17519 static int32_t param36_init[] = {2}; 17520 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17521 static int32_t param37_init[] = {2}; 17522 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17523 static int32_t param38_init[] = {0}; 17524 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17525 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17526 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17527 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17528 // Phase 3, inputs and outputs 17529 model->identifyInputsAndOutputs( 17530 {in}, 17531 {scoresOut, classesOut, out}); 17532 assert(model->isValid()); 17533 } 17534 17535 inline bool is_ignored_zero_sized_nhwc_quant8(int i) { 17536 static std::set<int> ignore = {}; 17537 return ignore.find(i) != ignore.end(); 17538 } 17539 17540 void CreateModel_zero_sized_nhwc_float16(Model *model) { 17541 OperandType type0(Type::BOOL, {}); 17542 OperandType type18(Type::TENSOR_INT32, {0}); 17543 OperandType type190(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); 17544 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 17545 OperandType type192(Type::TENSOR_FLOAT16, {0, 5, 5, 2}); 17546 OperandType type193(Type::FLOAT16, {}); 17547 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 17548 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 17549 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 17550 OperandType type197(Type::TENSOR_FLOAT16, {0}); 17551 OperandType type20(Type::TENSOR_INT32, {1}); 17552 OperandType type4(Type::TENSOR_INT32, {4}); 17553 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 17554 OperandType type46(Type::TENSOR_FLOAT16, {2}); 17555 OperandType type5(Type::INT32, {}); 17556 // Phase 1, operands 17557 auto scores = model->addOperand(&type196); 17558 auto roi = model->addOperand(&type194); 17559 auto param22 = model->addOperand(&type20); 17560 auto param23 = model->addOperand(&type193); 17561 auto param24 = model->addOperand(&type5); 17562 auto param25 = model->addOperand(&type5); 17563 auto param26 = model->addOperand(&type193); 17564 auto param27 = model->addOperand(&type193); 17565 auto param28 = model->addOperand(&type193); 17566 auto scoresOut = model->addOperand(&type197); 17567 auto roiOut = model->addOperand(&type195); 17568 auto classesOut = model->addOperand(&type18); 17569 auto batchSplitOut = model->addOperand(&type18); 17570 auto in = model->addOperand(&type191); 17571 auto param29 = model->addOperand(&type5); 17572 auto param30 = model->addOperand(&type5); 17573 auto param31 = model->addOperand(&type193); 17574 auto param32 = model->addOperand(&type193); 17575 auto param33 = model->addOperand(&type5); 17576 auto param34 = model->addOperand(&type5); 17577 auto layout = model->addOperand(&type0); 17578 auto featureMap = model->addOperand(&type190); 17579 auto weights = model->addOperand(&type45); 17580 auto bias = model->addOperand(&type46); 17581 auto shape4 = model->addOperand(&type4); 17582 auto param35 = model->addOperand(&type5); 17583 auto param36 = model->addOperand(&type5); 17584 auto param37 = model->addOperand(&type5); 17585 auto param38 = model->addOperand(&type5); 17586 auto out = model->addOperand(&type192); 17587 // Phase 2, operations 17588 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 17589 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 17590 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 17591 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 17592 static int32_t param22_init[] = {0}; 17593 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17594 static _Float16 param23_init[] = {0.30000001192092896f}; 17595 model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); 17596 static int32_t param24_init[] = {-1}; 17597 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17598 static int32_t param25_init[] = {0}; 17599 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17600 static _Float16 param26_init[] = {0.4000000059604645f}; 17601 model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); 17602 static _Float16 param27_init[] = {1.0f}; 17603 model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); 17604 static _Float16 param28_init[] = {0.30000001192092896f}; 17605 model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); 17606 static int32_t param29_init[] = {2}; 17607 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17608 static int32_t param30_init[] = {2}; 17609 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17610 static _Float16 param31_init[] = {2.0f}; 17611 model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); 17612 static _Float16 param32_init[] = {2.0f}; 17613 model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); 17614 static int32_t param33_init[] = {4}; 17615 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17616 static int32_t param34_init[] = {4}; 17617 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17618 static bool8 layout_init[] = {false}; 17619 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17620 static _Float16 weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 17621 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); 17622 static _Float16 bias_init[] = {-1.5f, -2.0f}; 17623 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 17624 static int32_t shape4_init[] = {0, 5, 5, 2}; 17625 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17626 static int32_t param35_init[] = {2}; 17627 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17628 static int32_t param36_init[] = {2}; 17629 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17630 static int32_t param37_init[] = {2}; 17631 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17632 static int32_t param38_init[] = {0}; 17633 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17634 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17635 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17636 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17637 // Phase 3, inputs and outputs 17638 model->identifyInputsAndOutputs( 17639 {in}, 17640 {scoresOut, classesOut, out}); 17641 assert(model->isValid()); 17642 } 17643 17644 inline bool is_ignored_zero_sized_nhwc_float16(int i) { 17645 static std::set<int> ignore = {}; 17646 return ignore.find(i) != ignore.end(); 17647 } 17648 17649 void CreateModel_zero_sized_nchw(Model *model) { 17650 OperandType type0(Type::BOOL, {}); 17651 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 17652 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 17653 OperandType type17(Type::TENSOR_FLOAT32, {0}); 17654 OperandType type18(Type::TENSOR_INT32, {0}); 17655 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 17656 OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 17657 OperandType type199(Type::TENSOR_FLOAT32, {0, 2, 5, 5}); 17658 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 17659 OperandType type20(Type::TENSOR_INT32, {1}); 17660 OperandType type21(Type::FLOAT32, {}); 17661 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 17662 OperandType type3(Type::TENSOR_FLOAT32, {2}); 17663 OperandType type4(Type::TENSOR_INT32, {4}); 17664 OperandType type5(Type::INT32, {}); 17665 // Phase 1, operands 17666 auto scores = model->addOperand(&type15); 17667 auto roi = model->addOperand(&type16); 17668 auto param22 = model->addOperand(&type20); 17669 auto param23 = model->addOperand(&type21); 17670 auto param24 = model->addOperand(&type5); 17671 auto param25 = model->addOperand(&type5); 17672 auto param26 = model->addOperand(&type21); 17673 auto param27 = model->addOperand(&type21); 17674 auto param28 = model->addOperand(&type21); 17675 auto scoresOut = model->addOperand(&type17); 17676 auto roiOut = model->addOperand(&type19); 17677 auto classesOut = model->addOperand(&type18); 17678 auto batchSplitOut = model->addOperand(&type18); 17679 auto in = model->addOperand(&type22); 17680 auto param29 = model->addOperand(&type5); 17681 auto param30 = model->addOperand(&type5); 17682 auto param31 = model->addOperand(&type21); 17683 auto param32 = model->addOperand(&type21); 17684 auto param33 = model->addOperand(&type5); 17685 auto param34 = model->addOperand(&type5); 17686 auto layout = model->addOperand(&type0); 17687 auto featureMap = model->addOperand(&type198); 17688 auto weights = model->addOperand(&type2); 17689 auto bias = model->addOperand(&type3); 17690 auto shape4 = model->addOperand(&type4); 17691 auto param35 = model->addOperand(&type5); 17692 auto param36 = model->addOperand(&type5); 17693 auto param37 = model->addOperand(&type5); 17694 auto param38 = model->addOperand(&type5); 17695 auto out = model->addOperand(&type199); 17696 // Phase 2, operations 17697 static float scores_init[] = {0.9f, 0.1f}; 17698 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 17699 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 17700 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 17701 static int32_t param22_init[] = {0}; 17702 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17703 static float param23_init[] = {0.3f}; 17704 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 17705 static int32_t param24_init[] = {-1}; 17706 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17707 static int32_t param25_init[] = {0}; 17708 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17709 static float param26_init[] = {0.4f}; 17710 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 17711 static float param27_init[] = {1.0f}; 17712 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 17713 static float param28_init[] = {0.3f}; 17714 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 17715 static int32_t param29_init[] = {2}; 17716 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17717 static int32_t param30_init[] = {2}; 17718 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17719 static float param31_init[] = {2.0f}; 17720 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 17721 static float param32_init[] = {2.0f}; 17722 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 17723 static int32_t param33_init[] = {4}; 17724 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17725 static int32_t param34_init[] = {4}; 17726 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17727 static bool8 layout_init[] = {true}; 17728 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17729 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 17730 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 17731 static float bias_init[] = {-1.5f, -2.0f}; 17732 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 17733 static int32_t shape4_init[] = {0, 2, 5, 5}; 17734 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17735 static int32_t param35_init[] = {2}; 17736 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17737 static int32_t param36_init[] = {2}; 17738 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17739 static int32_t param37_init[] = {2}; 17740 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17741 static int32_t param38_init[] = {0}; 17742 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17743 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17744 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17745 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17746 // Phase 3, inputs and outputs 17747 model->identifyInputsAndOutputs( 17748 {in}, 17749 {scoresOut, classesOut, out}); 17750 assert(model->isValid()); 17751 } 17752 17753 inline bool is_ignored_zero_sized_nchw(int i) { 17754 static std::set<int> ignore = {}; 17755 return ignore.find(i) != ignore.end(); 17756 } 17757 17758 void CreateModel_zero_sized_nchw_relaxed(Model *model) { 17759 OperandType type0(Type::BOOL, {}); 17760 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 17761 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 17762 OperandType type17(Type::TENSOR_FLOAT32, {0}); 17763 OperandType type18(Type::TENSOR_INT32, {0}); 17764 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 17765 OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 17766 OperandType type199(Type::TENSOR_FLOAT32, {0, 2, 5, 5}); 17767 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 17768 OperandType type20(Type::TENSOR_INT32, {1}); 17769 OperandType type21(Type::FLOAT32, {}); 17770 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 17771 OperandType type3(Type::TENSOR_FLOAT32, {2}); 17772 OperandType type4(Type::TENSOR_INT32, {4}); 17773 OperandType type5(Type::INT32, {}); 17774 // Phase 1, operands 17775 auto scores = model->addOperand(&type15); 17776 auto roi = model->addOperand(&type16); 17777 auto param22 = model->addOperand(&type20); 17778 auto param23 = model->addOperand(&type21); 17779 auto param24 = model->addOperand(&type5); 17780 auto param25 = model->addOperand(&type5); 17781 auto param26 = model->addOperand(&type21); 17782 auto param27 = model->addOperand(&type21); 17783 auto param28 = model->addOperand(&type21); 17784 auto scoresOut = model->addOperand(&type17); 17785 auto roiOut = model->addOperand(&type19); 17786 auto classesOut = model->addOperand(&type18); 17787 auto batchSplitOut = model->addOperand(&type18); 17788 auto in = model->addOperand(&type22); 17789 auto param29 = model->addOperand(&type5); 17790 auto param30 = model->addOperand(&type5); 17791 auto param31 = model->addOperand(&type21); 17792 auto param32 = model->addOperand(&type21); 17793 auto param33 = model->addOperand(&type5); 17794 auto param34 = model->addOperand(&type5); 17795 auto layout = model->addOperand(&type0); 17796 auto featureMap = model->addOperand(&type198); 17797 auto weights = model->addOperand(&type2); 17798 auto bias = model->addOperand(&type3); 17799 auto shape4 = model->addOperand(&type4); 17800 auto param35 = model->addOperand(&type5); 17801 auto param36 = model->addOperand(&type5); 17802 auto param37 = model->addOperand(&type5); 17803 auto param38 = model->addOperand(&type5); 17804 auto out = model->addOperand(&type199); 17805 // Phase 2, operations 17806 static float scores_init[] = {0.9f, 0.1f}; 17807 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 17808 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 17809 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 17810 static int32_t param22_init[] = {0}; 17811 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17812 static float param23_init[] = {0.3f}; 17813 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 17814 static int32_t param24_init[] = {-1}; 17815 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17816 static int32_t param25_init[] = {0}; 17817 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17818 static float param26_init[] = {0.4f}; 17819 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 17820 static float param27_init[] = {1.0f}; 17821 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 17822 static float param28_init[] = {0.3f}; 17823 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 17824 static int32_t param29_init[] = {2}; 17825 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17826 static int32_t param30_init[] = {2}; 17827 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17828 static float param31_init[] = {2.0f}; 17829 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 17830 static float param32_init[] = {2.0f}; 17831 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 17832 static int32_t param33_init[] = {4}; 17833 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17834 static int32_t param34_init[] = {4}; 17835 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17836 static bool8 layout_init[] = {true}; 17837 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17838 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 17839 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 17840 static float bias_init[] = {-1.5f, -2.0f}; 17841 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 17842 static int32_t shape4_init[] = {0, 2, 5, 5}; 17843 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17844 static int32_t param35_init[] = {2}; 17845 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17846 static int32_t param36_init[] = {2}; 17847 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17848 static int32_t param37_init[] = {2}; 17849 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17850 static int32_t param38_init[] = {0}; 17851 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17852 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17853 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17854 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17855 // Phase 3, inputs and outputs 17856 model->identifyInputsAndOutputs( 17857 {in}, 17858 {scoresOut, classesOut, out}); 17859 // Phase 4: set relaxed execution 17860 model->relaxComputationFloat32toFloat16(true); 17861 assert(model->isValid()); 17862 } 17863 17864 inline bool is_ignored_zero_sized_nchw_relaxed(int i) { 17865 static std::set<int> ignore = {}; 17866 return ignore.find(i) != ignore.end(); 17867 } 17868 17869 void CreateModel_zero_sized_nchw_quant8(Model *model) { 17870 OperandType type0(Type::BOOL, {}); 17871 OperandType type18(Type::TENSOR_INT32, {0}); 17872 OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); 17873 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 17874 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 17875 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 17876 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 17877 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 17878 OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); 17879 OperandType type20(Type::TENSOR_INT32, {1}); 17880 OperandType type200(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); 17881 OperandType type201(Type::TENSOR_QUANT8_ASYMM, {0, 2, 5, 5}, 0.1f, 128); 17882 OperandType type21(Type::FLOAT32, {}); 17883 OperandType type4(Type::TENSOR_INT32, {4}); 17884 OperandType type5(Type::INT32, {}); 17885 // Phase 1, operands 17886 auto scores = model->addOperand(&type187); 17887 auto roi = model->addOperand(&type185); 17888 auto param22 = model->addOperand(&type20); 17889 auto param23 = model->addOperand(&type21); 17890 auto param24 = model->addOperand(&type5); 17891 auto param25 = model->addOperand(&type5); 17892 auto param26 = model->addOperand(&type21); 17893 auto param27 = model->addOperand(&type21); 17894 auto param28 = model->addOperand(&type21); 17895 auto scoresOut = model->addOperand(&type188); 17896 auto roiOut = model->addOperand(&type186); 17897 auto classesOut = model->addOperand(&type18); 17898 auto batchSplitOut = model->addOperand(&type18); 17899 auto in = model->addOperand(&type183); 17900 auto param29 = model->addOperand(&type5); 17901 auto param30 = model->addOperand(&type5); 17902 auto param31 = model->addOperand(&type21); 17903 auto param32 = model->addOperand(&type21); 17904 auto param33 = model->addOperand(&type5); 17905 auto param34 = model->addOperand(&type5); 17906 auto layout = model->addOperand(&type0); 17907 auto featureMap = model->addOperand(&type200); 17908 auto weights = model->addOperand(&type189); 17909 auto bias = model->addOperand(&type181); 17910 auto shape4 = model->addOperand(&type4); 17911 auto param35 = model->addOperand(&type5); 17912 auto param36 = model->addOperand(&type5); 17913 auto param37 = model->addOperand(&type5); 17914 auto param38 = model->addOperand(&type5); 17915 auto out = model->addOperand(&type201); 17916 // Phase 2, operations 17917 static uint8_t scores_init[] = {137, 129}; 17918 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 17919 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 17920 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 17921 static int32_t param22_init[] = {0}; 17922 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 17923 static float param23_init[] = {0.3f}; 17924 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 17925 static int32_t param24_init[] = {-1}; 17926 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 17927 static int32_t param25_init[] = {0}; 17928 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 17929 static float param26_init[] = {0.4f}; 17930 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 17931 static float param27_init[] = {1.0f}; 17932 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 17933 static float param28_init[] = {0.3f}; 17934 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 17935 static int32_t param29_init[] = {2}; 17936 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 17937 static int32_t param30_init[] = {2}; 17938 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 17939 static float param31_init[] = {2.0f}; 17940 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 17941 static float param32_init[] = {2.0f}; 17942 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 17943 static int32_t param33_init[] = {4}; 17944 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 17945 static int32_t param34_init[] = {4}; 17946 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 17947 static bool8 layout_init[] = {true}; 17948 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 17949 static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; 17950 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); 17951 static int32_t bias_init[] = {-150, -200}; 17952 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 17953 static int32_t shape4_init[] = {0, 2, 5, 5}; 17954 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 17955 static int32_t param35_init[] = {2}; 17956 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 17957 static int32_t param36_init[] = {2}; 17958 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 17959 static int32_t param37_init[] = {2}; 17960 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 17961 static int32_t param38_init[] = {0}; 17962 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 17963 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 17964 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 17965 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 17966 // Phase 3, inputs and outputs 17967 model->identifyInputsAndOutputs( 17968 {in}, 17969 {scoresOut, classesOut, out}); 17970 assert(model->isValid()); 17971 } 17972 17973 inline bool is_ignored_zero_sized_nchw_quant8(int i) { 17974 static std::set<int> ignore = {}; 17975 return ignore.find(i) != ignore.end(); 17976 } 17977 17978 void CreateModel_zero_sized_nchw_float16(Model *model) { 17979 OperandType type0(Type::BOOL, {}); 17980 OperandType type18(Type::TENSOR_INT32, {0}); 17981 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 17982 OperandType type193(Type::FLOAT16, {}); 17983 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 17984 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 17985 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 17986 OperandType type197(Type::TENSOR_FLOAT16, {0}); 17987 OperandType type20(Type::TENSOR_INT32, {1}); 17988 OperandType type202(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); 17989 OperandType type203(Type::TENSOR_FLOAT16, {0, 2, 5, 5}); 17990 OperandType type4(Type::TENSOR_INT32, {4}); 17991 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 17992 OperandType type46(Type::TENSOR_FLOAT16, {2}); 17993 OperandType type5(Type::INT32, {}); 17994 // Phase 1, operands 17995 auto scores = model->addOperand(&type196); 17996 auto roi = model->addOperand(&type194); 17997 auto param22 = model->addOperand(&type20); 17998 auto param23 = model->addOperand(&type193); 17999 auto param24 = model->addOperand(&type5); 18000 auto param25 = model->addOperand(&type5); 18001 auto param26 = model->addOperand(&type193); 18002 auto param27 = model->addOperand(&type193); 18003 auto param28 = model->addOperand(&type193); 18004 auto scoresOut = model->addOperand(&type197); 18005 auto roiOut = model->addOperand(&type195); 18006 auto classesOut = model->addOperand(&type18); 18007 auto batchSplitOut = model->addOperand(&type18); 18008 auto in = model->addOperand(&type191); 18009 auto param29 = model->addOperand(&type5); 18010 auto param30 = model->addOperand(&type5); 18011 auto param31 = model->addOperand(&type193); 18012 auto param32 = model->addOperand(&type193); 18013 auto param33 = model->addOperand(&type5); 18014 auto param34 = model->addOperand(&type5); 18015 auto layout = model->addOperand(&type0); 18016 auto featureMap = model->addOperand(&type202); 18017 auto weights = model->addOperand(&type45); 18018 auto bias = model->addOperand(&type46); 18019 auto shape4 = model->addOperand(&type4); 18020 auto param35 = model->addOperand(&type5); 18021 auto param36 = model->addOperand(&type5); 18022 auto param37 = model->addOperand(&type5); 18023 auto param38 = model->addOperand(&type5); 18024 auto out = model->addOperand(&type203); 18025 // Phase 2, operations 18026 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 18027 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 18028 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18029 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 18030 static int32_t param22_init[] = {0}; 18031 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18032 static _Float16 param23_init[] = {0.30000001192092896f}; 18033 model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); 18034 static int32_t param24_init[] = {-1}; 18035 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18036 static int32_t param25_init[] = {0}; 18037 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18038 static _Float16 param26_init[] = {0.4000000059604645f}; 18039 model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); 18040 static _Float16 param27_init[] = {1.0f}; 18041 model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); 18042 static _Float16 param28_init[] = {0.30000001192092896f}; 18043 model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); 18044 static int32_t param29_init[] = {2}; 18045 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18046 static int32_t param30_init[] = {2}; 18047 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18048 static _Float16 param31_init[] = {2.0f}; 18049 model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); 18050 static _Float16 param32_init[] = {2.0f}; 18051 model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); 18052 static int32_t param33_init[] = {4}; 18053 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18054 static int32_t param34_init[] = {4}; 18055 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18056 static bool8 layout_init[] = {true}; 18057 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18058 static _Float16 weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18059 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); 18060 static _Float16 bias_init[] = {-1.5f, -2.0f}; 18061 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 18062 static int32_t shape4_init[] = {0, 2, 5, 5}; 18063 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18064 static int32_t param35_init[] = {2}; 18065 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18066 static int32_t param36_init[] = {2}; 18067 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18068 static int32_t param37_init[] = {2}; 18069 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18070 static int32_t param38_init[] = {0}; 18071 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18072 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18073 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18074 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18075 // Phase 3, inputs and outputs 18076 model->identifyInputsAndOutputs( 18077 {in}, 18078 {scoresOut, classesOut, out}); 18079 assert(model->isValid()); 18080 } 18081 18082 inline bool is_ignored_zero_sized_nchw_float16(int i) { 18083 static std::set<int> ignore = {}; 18084 return ignore.find(i) != ignore.end(); 18085 } 18086 18087 void CreateModel_zero_sized_dynamic_output_shape_nhwc(Model *model) { 18088 OperandType type0(Type::BOOL, {}); 18089 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 18090 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 18091 OperandType type17(Type::TENSOR_FLOAT32, {0}); 18092 OperandType type18(Type::TENSOR_INT32, {0}); 18093 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 18094 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 18095 OperandType type20(Type::TENSOR_INT32, {1}); 18096 OperandType type21(Type::FLOAT32, {}); 18097 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 18098 OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 18099 OperandType type3(Type::TENSOR_FLOAT32, {2}); 18100 OperandType type4(Type::TENSOR_INT32, {4}); 18101 OperandType type5(Type::INT32, {}); 18102 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 18103 // Phase 1, operands 18104 auto scores = model->addOperand(&type15); 18105 auto roi = model->addOperand(&type16); 18106 auto param22 = model->addOperand(&type20); 18107 auto param23 = model->addOperand(&type21); 18108 auto param24 = model->addOperand(&type5); 18109 auto param25 = model->addOperand(&type5); 18110 auto param26 = model->addOperand(&type21); 18111 auto param27 = model->addOperand(&type21); 18112 auto param28 = model->addOperand(&type21); 18113 auto scoresOut = model->addOperand(&type17); 18114 auto roiOut = model->addOperand(&type19); 18115 auto classesOut = model->addOperand(&type18); 18116 auto batchSplitOut = model->addOperand(&type18); 18117 auto in = model->addOperand(&type22); 18118 auto param29 = model->addOperand(&type5); 18119 auto param30 = model->addOperand(&type5); 18120 auto param31 = model->addOperand(&type21); 18121 auto param32 = model->addOperand(&type21); 18122 auto param33 = model->addOperand(&type5); 18123 auto param34 = model->addOperand(&type5); 18124 auto layout = model->addOperand(&type0); 18125 auto featureMap = model->addOperand(&type23); 18126 auto weights = model->addOperand(&type2); 18127 auto bias = model->addOperand(&type3); 18128 auto shape4 = model->addOperand(&type4); 18129 auto param35 = model->addOperand(&type5); 18130 auto param36 = model->addOperand(&type5); 18131 auto param37 = model->addOperand(&type5); 18132 auto param38 = model->addOperand(&type5); 18133 auto out = model->addOperand(&type88); 18134 // Phase 2, operations 18135 static float scores_init[] = {0.9f, 0.1f}; 18136 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 18137 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18138 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 18139 static int32_t param22_init[] = {0}; 18140 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18141 static float param23_init[] = {0.3f}; 18142 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 18143 static int32_t param24_init[] = {-1}; 18144 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18145 static int32_t param25_init[] = {0}; 18146 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18147 static float param26_init[] = {0.4f}; 18148 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 18149 static float param27_init[] = {1.0f}; 18150 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 18151 static float param28_init[] = {0.3f}; 18152 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 18153 static int32_t param29_init[] = {2}; 18154 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18155 static int32_t param30_init[] = {2}; 18156 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18157 static float param31_init[] = {2.0f}; 18158 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 18159 static float param32_init[] = {2.0f}; 18160 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 18161 static int32_t param33_init[] = {4}; 18162 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18163 static int32_t param34_init[] = {4}; 18164 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18165 static bool8 layout_init[] = {false}; 18166 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18167 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18168 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 18169 static float bias_init[] = {-1.5f, -2.0f}; 18170 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 18171 static int32_t shape4_init[] = {0, 5, 5, 2}; 18172 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18173 static int32_t param35_init[] = {2}; 18174 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18175 static int32_t param36_init[] = {2}; 18176 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18177 static int32_t param37_init[] = {2}; 18178 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18179 static int32_t param38_init[] = {0}; 18180 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18181 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18182 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18183 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18184 // Phase 3, inputs and outputs 18185 model->identifyInputsAndOutputs( 18186 {in}, 18187 {scoresOut, classesOut, out}); 18188 assert(model->isValid()); 18189 } 18190 18191 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc(int i) { 18192 static std::set<int> ignore = {}; 18193 return ignore.find(i) != ignore.end(); 18194 } 18195 18196 void CreateModel_zero_sized_dynamic_output_shape_nhwc_relaxed(Model *model) { 18197 OperandType type0(Type::BOOL, {}); 18198 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 18199 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 18200 OperandType type17(Type::TENSOR_FLOAT32, {0}); 18201 OperandType type18(Type::TENSOR_INT32, {0}); 18202 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 18203 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 18204 OperandType type20(Type::TENSOR_INT32, {1}); 18205 OperandType type21(Type::FLOAT32, {}); 18206 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 18207 OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); 18208 OperandType type3(Type::TENSOR_FLOAT32, {2}); 18209 OperandType type4(Type::TENSOR_INT32, {4}); 18210 OperandType type5(Type::INT32, {}); 18211 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 18212 // Phase 1, operands 18213 auto scores = model->addOperand(&type15); 18214 auto roi = model->addOperand(&type16); 18215 auto param22 = model->addOperand(&type20); 18216 auto param23 = model->addOperand(&type21); 18217 auto param24 = model->addOperand(&type5); 18218 auto param25 = model->addOperand(&type5); 18219 auto param26 = model->addOperand(&type21); 18220 auto param27 = model->addOperand(&type21); 18221 auto param28 = model->addOperand(&type21); 18222 auto scoresOut = model->addOperand(&type17); 18223 auto roiOut = model->addOperand(&type19); 18224 auto classesOut = model->addOperand(&type18); 18225 auto batchSplitOut = model->addOperand(&type18); 18226 auto in = model->addOperand(&type22); 18227 auto param29 = model->addOperand(&type5); 18228 auto param30 = model->addOperand(&type5); 18229 auto param31 = model->addOperand(&type21); 18230 auto param32 = model->addOperand(&type21); 18231 auto param33 = model->addOperand(&type5); 18232 auto param34 = model->addOperand(&type5); 18233 auto layout = model->addOperand(&type0); 18234 auto featureMap = model->addOperand(&type23); 18235 auto weights = model->addOperand(&type2); 18236 auto bias = model->addOperand(&type3); 18237 auto shape4 = model->addOperand(&type4); 18238 auto param35 = model->addOperand(&type5); 18239 auto param36 = model->addOperand(&type5); 18240 auto param37 = model->addOperand(&type5); 18241 auto param38 = model->addOperand(&type5); 18242 auto out = model->addOperand(&type88); 18243 // Phase 2, operations 18244 static float scores_init[] = {0.9f, 0.1f}; 18245 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 18246 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18247 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 18248 static int32_t param22_init[] = {0}; 18249 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18250 static float param23_init[] = {0.3f}; 18251 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 18252 static int32_t param24_init[] = {-1}; 18253 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18254 static int32_t param25_init[] = {0}; 18255 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18256 static float param26_init[] = {0.4f}; 18257 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 18258 static float param27_init[] = {1.0f}; 18259 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 18260 static float param28_init[] = {0.3f}; 18261 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 18262 static int32_t param29_init[] = {2}; 18263 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18264 static int32_t param30_init[] = {2}; 18265 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18266 static float param31_init[] = {2.0f}; 18267 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 18268 static float param32_init[] = {2.0f}; 18269 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 18270 static int32_t param33_init[] = {4}; 18271 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18272 static int32_t param34_init[] = {4}; 18273 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18274 static bool8 layout_init[] = {false}; 18275 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18276 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18277 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 18278 static float bias_init[] = {-1.5f, -2.0f}; 18279 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 18280 static int32_t shape4_init[] = {0, 5, 5, 2}; 18281 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18282 static int32_t param35_init[] = {2}; 18283 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18284 static int32_t param36_init[] = {2}; 18285 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18286 static int32_t param37_init[] = {2}; 18287 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18288 static int32_t param38_init[] = {0}; 18289 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18290 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18291 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18292 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18293 // Phase 3, inputs and outputs 18294 model->identifyInputsAndOutputs( 18295 {in}, 18296 {scoresOut, classesOut, out}); 18297 // Phase 4: set relaxed execution 18298 model->relaxComputationFloat32toFloat16(true); 18299 assert(model->isValid()); 18300 } 18301 18302 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed(int i) { 18303 static std::set<int> ignore = {}; 18304 return ignore.find(i) != ignore.end(); 18305 } 18306 18307 void CreateModel_zero_sized_dynamic_output_shape_nhwc_quant8(Model *model) { 18308 OperandType type0(Type::BOOL, {}); 18309 OperandType type18(Type::TENSOR_INT32, {0}); 18310 OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); 18311 OperandType type182(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); 18312 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 18313 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 18314 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 18315 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 18316 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 18317 OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); 18318 OperandType type20(Type::TENSOR_INT32, {1}); 18319 OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 18320 OperandType type21(Type::FLOAT32, {}); 18321 OperandType type4(Type::TENSOR_INT32, {4}); 18322 OperandType type5(Type::INT32, {}); 18323 // Phase 1, operands 18324 auto scores = model->addOperand(&type187); 18325 auto roi = model->addOperand(&type185); 18326 auto param22 = model->addOperand(&type20); 18327 auto param23 = model->addOperand(&type21); 18328 auto param24 = model->addOperand(&type5); 18329 auto param25 = model->addOperand(&type5); 18330 auto param26 = model->addOperand(&type21); 18331 auto param27 = model->addOperand(&type21); 18332 auto param28 = model->addOperand(&type21); 18333 auto scoresOut = model->addOperand(&type188); 18334 auto roiOut = model->addOperand(&type186); 18335 auto classesOut = model->addOperand(&type18); 18336 auto batchSplitOut = model->addOperand(&type18); 18337 auto in = model->addOperand(&type183); 18338 auto param29 = model->addOperand(&type5); 18339 auto param30 = model->addOperand(&type5); 18340 auto param31 = model->addOperand(&type21); 18341 auto param32 = model->addOperand(&type21); 18342 auto param33 = model->addOperand(&type5); 18343 auto param34 = model->addOperand(&type5); 18344 auto layout = model->addOperand(&type0); 18345 auto featureMap = model->addOperand(&type182); 18346 auto weights = model->addOperand(&type189); 18347 auto bias = model->addOperand(&type181); 18348 auto shape4 = model->addOperand(&type4); 18349 auto param35 = model->addOperand(&type5); 18350 auto param36 = model->addOperand(&type5); 18351 auto param37 = model->addOperand(&type5); 18352 auto param38 = model->addOperand(&type5); 18353 auto out = model->addOperand(&type204); 18354 // Phase 2, operations 18355 static uint8_t scores_init[] = {137, 129}; 18356 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 18357 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 18358 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 18359 static int32_t param22_init[] = {0}; 18360 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18361 static float param23_init[] = {0.3f}; 18362 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 18363 static int32_t param24_init[] = {-1}; 18364 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18365 static int32_t param25_init[] = {0}; 18366 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18367 static float param26_init[] = {0.4f}; 18368 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 18369 static float param27_init[] = {1.0f}; 18370 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 18371 static float param28_init[] = {0.3f}; 18372 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 18373 static int32_t param29_init[] = {2}; 18374 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18375 static int32_t param30_init[] = {2}; 18376 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18377 static float param31_init[] = {2.0f}; 18378 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 18379 static float param32_init[] = {2.0f}; 18380 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 18381 static int32_t param33_init[] = {4}; 18382 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18383 static int32_t param34_init[] = {4}; 18384 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18385 static bool8 layout_init[] = {false}; 18386 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18387 static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; 18388 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); 18389 static int32_t bias_init[] = {-150, -200}; 18390 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 18391 static int32_t shape4_init[] = {0, 5, 5, 2}; 18392 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18393 static int32_t param35_init[] = {2}; 18394 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18395 static int32_t param36_init[] = {2}; 18396 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18397 static int32_t param37_init[] = {2}; 18398 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18399 static int32_t param38_init[] = {0}; 18400 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18401 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18402 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18403 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18404 // Phase 3, inputs and outputs 18405 model->identifyInputsAndOutputs( 18406 {in}, 18407 {scoresOut, classesOut, out}); 18408 assert(model->isValid()); 18409 } 18410 18411 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8(int i) { 18412 static std::set<int> ignore = {}; 18413 return ignore.find(i) != ignore.end(); 18414 } 18415 18416 void CreateModel_zero_sized_dynamic_output_shape_nhwc_float16(Model *model) { 18417 OperandType type0(Type::BOOL, {}); 18418 OperandType type18(Type::TENSOR_INT32, {0}); 18419 OperandType type190(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); 18420 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 18421 OperandType type193(Type::FLOAT16, {}); 18422 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 18423 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 18424 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 18425 OperandType type20(Type::TENSOR_INT32, {1}); 18426 OperandType type205(Type::TENSOR_FLOAT16, {0}); 18427 OperandType type4(Type::TENSOR_INT32, {4}); 18428 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 18429 OperandType type46(Type::TENSOR_FLOAT16, {2}); 18430 OperandType type5(Type::INT32, {}); 18431 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 18432 // Phase 1, operands 18433 auto scores = model->addOperand(&type196); 18434 auto roi = model->addOperand(&type194); 18435 auto param22 = model->addOperand(&type20); 18436 auto param23 = model->addOperand(&type193); 18437 auto param24 = model->addOperand(&type5); 18438 auto param25 = model->addOperand(&type5); 18439 auto param26 = model->addOperand(&type193); 18440 auto param27 = model->addOperand(&type193); 18441 auto param28 = model->addOperand(&type193); 18442 auto scoresOut = model->addOperand(&type205); 18443 auto roiOut = model->addOperand(&type195); 18444 auto classesOut = model->addOperand(&type18); 18445 auto batchSplitOut = model->addOperand(&type18); 18446 auto in = model->addOperand(&type191); 18447 auto param29 = model->addOperand(&type5); 18448 auto param30 = model->addOperand(&type5); 18449 auto param31 = model->addOperand(&type193); 18450 auto param32 = model->addOperand(&type193); 18451 auto param33 = model->addOperand(&type5); 18452 auto param34 = model->addOperand(&type5); 18453 auto layout = model->addOperand(&type0); 18454 auto featureMap = model->addOperand(&type190); 18455 auto weights = model->addOperand(&type45); 18456 auto bias = model->addOperand(&type46); 18457 auto shape4 = model->addOperand(&type4); 18458 auto param35 = model->addOperand(&type5); 18459 auto param36 = model->addOperand(&type5); 18460 auto param37 = model->addOperand(&type5); 18461 auto param38 = model->addOperand(&type5); 18462 auto out = model->addOperand(&type96); 18463 // Phase 2, operations 18464 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 18465 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 18466 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18467 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 18468 static int32_t param22_init[] = {0}; 18469 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18470 static _Float16 param23_init[] = {0.30000001192092896f}; 18471 model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); 18472 static int32_t param24_init[] = {-1}; 18473 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18474 static int32_t param25_init[] = {0}; 18475 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18476 static _Float16 param26_init[] = {0.4000000059604645f}; 18477 model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); 18478 static _Float16 param27_init[] = {1.0f}; 18479 model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); 18480 static _Float16 param28_init[] = {0.30000001192092896f}; 18481 model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); 18482 static int32_t param29_init[] = {2}; 18483 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18484 static int32_t param30_init[] = {2}; 18485 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18486 static _Float16 param31_init[] = {2.0f}; 18487 model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); 18488 static _Float16 param32_init[] = {2.0f}; 18489 model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); 18490 static int32_t param33_init[] = {4}; 18491 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18492 static int32_t param34_init[] = {4}; 18493 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18494 static bool8 layout_init[] = {false}; 18495 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18496 static _Float16 weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18497 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); 18498 static _Float16 bias_init[] = {-1.5f, -2.0f}; 18499 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 18500 static int32_t shape4_init[] = {0, 5, 5, 2}; 18501 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18502 static int32_t param35_init[] = {2}; 18503 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18504 static int32_t param36_init[] = {2}; 18505 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18506 static int32_t param37_init[] = {2}; 18507 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18508 static int32_t param38_init[] = {0}; 18509 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18510 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18511 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18512 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18513 // Phase 3, inputs and outputs 18514 model->identifyInputsAndOutputs( 18515 {in}, 18516 {scoresOut, classesOut, out}); 18517 assert(model->isValid()); 18518 } 18519 18520 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16(int i) { 18521 static std::set<int> ignore = {}; 18522 return ignore.find(i) != ignore.end(); 18523 } 18524 18525 void CreateModel_zero_sized_dynamic_output_shape_nchw(Model *model) { 18526 OperandType type0(Type::BOOL, {}); 18527 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 18528 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 18529 OperandType type17(Type::TENSOR_FLOAT32, {0}); 18530 OperandType type18(Type::TENSOR_INT32, {0}); 18531 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 18532 OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 18533 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 18534 OperandType type20(Type::TENSOR_INT32, {1}); 18535 OperandType type21(Type::FLOAT32, {}); 18536 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 18537 OperandType type3(Type::TENSOR_FLOAT32, {2}); 18538 OperandType type4(Type::TENSOR_INT32, {4}); 18539 OperandType type5(Type::INT32, {}); 18540 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 18541 // Phase 1, operands 18542 auto scores = model->addOperand(&type15); 18543 auto roi = model->addOperand(&type16); 18544 auto param22 = model->addOperand(&type20); 18545 auto param23 = model->addOperand(&type21); 18546 auto param24 = model->addOperand(&type5); 18547 auto param25 = model->addOperand(&type5); 18548 auto param26 = model->addOperand(&type21); 18549 auto param27 = model->addOperand(&type21); 18550 auto param28 = model->addOperand(&type21); 18551 auto scoresOut = model->addOperand(&type17); 18552 auto roiOut = model->addOperand(&type19); 18553 auto classesOut = model->addOperand(&type18); 18554 auto batchSplitOut = model->addOperand(&type18); 18555 auto in = model->addOperand(&type22); 18556 auto param29 = model->addOperand(&type5); 18557 auto param30 = model->addOperand(&type5); 18558 auto param31 = model->addOperand(&type21); 18559 auto param32 = model->addOperand(&type21); 18560 auto param33 = model->addOperand(&type5); 18561 auto param34 = model->addOperand(&type5); 18562 auto layout = model->addOperand(&type0); 18563 auto featureMap = model->addOperand(&type198); 18564 auto weights = model->addOperand(&type2); 18565 auto bias = model->addOperand(&type3); 18566 auto shape4 = model->addOperand(&type4); 18567 auto param35 = model->addOperand(&type5); 18568 auto param36 = model->addOperand(&type5); 18569 auto param37 = model->addOperand(&type5); 18570 auto param38 = model->addOperand(&type5); 18571 auto out = model->addOperand(&type88); 18572 // Phase 2, operations 18573 static float scores_init[] = {0.9f, 0.1f}; 18574 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 18575 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18576 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 18577 static int32_t param22_init[] = {0}; 18578 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18579 static float param23_init[] = {0.3f}; 18580 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 18581 static int32_t param24_init[] = {-1}; 18582 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18583 static int32_t param25_init[] = {0}; 18584 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18585 static float param26_init[] = {0.4f}; 18586 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 18587 static float param27_init[] = {1.0f}; 18588 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 18589 static float param28_init[] = {0.3f}; 18590 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 18591 static int32_t param29_init[] = {2}; 18592 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18593 static int32_t param30_init[] = {2}; 18594 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18595 static float param31_init[] = {2.0f}; 18596 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 18597 static float param32_init[] = {2.0f}; 18598 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 18599 static int32_t param33_init[] = {4}; 18600 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18601 static int32_t param34_init[] = {4}; 18602 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18603 static bool8 layout_init[] = {true}; 18604 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18605 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18606 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 18607 static float bias_init[] = {-1.5f, -2.0f}; 18608 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 18609 static int32_t shape4_init[] = {0, 2, 5, 5}; 18610 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18611 static int32_t param35_init[] = {2}; 18612 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18613 static int32_t param36_init[] = {2}; 18614 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18615 static int32_t param37_init[] = {2}; 18616 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18617 static int32_t param38_init[] = {0}; 18618 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18619 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18620 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18621 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18622 // Phase 3, inputs and outputs 18623 model->identifyInputsAndOutputs( 18624 {in}, 18625 {scoresOut, classesOut, out}); 18626 assert(model->isValid()); 18627 } 18628 18629 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw(int i) { 18630 static std::set<int> ignore = {}; 18631 return ignore.find(i) != ignore.end(); 18632 } 18633 18634 void CreateModel_zero_sized_dynamic_output_shape_nchw_relaxed(Model *model) { 18635 OperandType type0(Type::BOOL, {}); 18636 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 18637 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 18638 OperandType type17(Type::TENSOR_FLOAT32, {0}); 18639 OperandType type18(Type::TENSOR_INT32, {0}); 18640 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 18641 OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); 18642 OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); 18643 OperandType type20(Type::TENSOR_INT32, {1}); 18644 OperandType type21(Type::FLOAT32, {}); 18645 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 18646 OperandType type3(Type::TENSOR_FLOAT32, {2}); 18647 OperandType type4(Type::TENSOR_INT32, {4}); 18648 OperandType type5(Type::INT32, {}); 18649 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 18650 // Phase 1, operands 18651 auto scores = model->addOperand(&type15); 18652 auto roi = model->addOperand(&type16); 18653 auto param22 = model->addOperand(&type20); 18654 auto param23 = model->addOperand(&type21); 18655 auto param24 = model->addOperand(&type5); 18656 auto param25 = model->addOperand(&type5); 18657 auto param26 = model->addOperand(&type21); 18658 auto param27 = model->addOperand(&type21); 18659 auto param28 = model->addOperand(&type21); 18660 auto scoresOut = model->addOperand(&type17); 18661 auto roiOut = model->addOperand(&type19); 18662 auto classesOut = model->addOperand(&type18); 18663 auto batchSplitOut = model->addOperand(&type18); 18664 auto in = model->addOperand(&type22); 18665 auto param29 = model->addOperand(&type5); 18666 auto param30 = model->addOperand(&type5); 18667 auto param31 = model->addOperand(&type21); 18668 auto param32 = model->addOperand(&type21); 18669 auto param33 = model->addOperand(&type5); 18670 auto param34 = model->addOperand(&type5); 18671 auto layout = model->addOperand(&type0); 18672 auto featureMap = model->addOperand(&type198); 18673 auto weights = model->addOperand(&type2); 18674 auto bias = model->addOperand(&type3); 18675 auto shape4 = model->addOperand(&type4); 18676 auto param35 = model->addOperand(&type5); 18677 auto param36 = model->addOperand(&type5); 18678 auto param37 = model->addOperand(&type5); 18679 auto param38 = model->addOperand(&type5); 18680 auto out = model->addOperand(&type88); 18681 // Phase 2, operations 18682 static float scores_init[] = {0.9f, 0.1f}; 18683 model->setOperandValue(scores, scores_init, sizeof(float) * 2); 18684 static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18685 model->setOperandValue(roi, roi_init, sizeof(float) * 8); 18686 static int32_t param22_init[] = {0}; 18687 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18688 static float param23_init[] = {0.3f}; 18689 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 18690 static int32_t param24_init[] = {-1}; 18691 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18692 static int32_t param25_init[] = {0}; 18693 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18694 static float param26_init[] = {0.4f}; 18695 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 18696 static float param27_init[] = {1.0f}; 18697 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 18698 static float param28_init[] = {0.3f}; 18699 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 18700 static int32_t param29_init[] = {2}; 18701 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18702 static int32_t param30_init[] = {2}; 18703 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18704 static float param31_init[] = {2.0f}; 18705 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 18706 static float param32_init[] = {2.0f}; 18707 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 18708 static int32_t param33_init[] = {4}; 18709 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18710 static int32_t param34_init[] = {4}; 18711 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18712 static bool8 layout_init[] = {true}; 18713 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18714 static float weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18715 model->setOperandValue(weights, weights_init, sizeof(float) * 18); 18716 static float bias_init[] = {-1.5f, -2.0f}; 18717 model->setOperandValue(bias, bias_init, sizeof(float) * 2); 18718 static int32_t shape4_init[] = {0, 2, 5, 5}; 18719 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18720 static int32_t param35_init[] = {2}; 18721 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18722 static int32_t param36_init[] = {2}; 18723 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18724 static int32_t param37_init[] = {2}; 18725 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18726 static int32_t param38_init[] = {0}; 18727 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18728 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18729 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18730 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18731 // Phase 3, inputs and outputs 18732 model->identifyInputsAndOutputs( 18733 {in}, 18734 {scoresOut, classesOut, out}); 18735 // Phase 4: set relaxed execution 18736 model->relaxComputationFloat32toFloat16(true); 18737 assert(model->isValid()); 18738 } 18739 18740 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed(int i) { 18741 static std::set<int> ignore = {}; 18742 return ignore.find(i) != ignore.end(); 18743 } 18744 18745 void CreateModel_zero_sized_dynamic_output_shape_nchw_quant8(Model *model) { 18746 OperandType type0(Type::BOOL, {}); 18747 OperandType type18(Type::TENSOR_INT32, {0}); 18748 OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); 18749 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 18750 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 18751 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 18752 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 18753 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 18754 OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); 18755 OperandType type20(Type::TENSOR_INT32, {1}); 18756 OperandType type200(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); 18757 OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 18758 OperandType type21(Type::FLOAT32, {}); 18759 OperandType type4(Type::TENSOR_INT32, {4}); 18760 OperandType type5(Type::INT32, {}); 18761 // Phase 1, operands 18762 auto scores = model->addOperand(&type187); 18763 auto roi = model->addOperand(&type185); 18764 auto param22 = model->addOperand(&type20); 18765 auto param23 = model->addOperand(&type21); 18766 auto param24 = model->addOperand(&type5); 18767 auto param25 = model->addOperand(&type5); 18768 auto param26 = model->addOperand(&type21); 18769 auto param27 = model->addOperand(&type21); 18770 auto param28 = model->addOperand(&type21); 18771 auto scoresOut = model->addOperand(&type188); 18772 auto roiOut = model->addOperand(&type186); 18773 auto classesOut = model->addOperand(&type18); 18774 auto batchSplitOut = model->addOperand(&type18); 18775 auto in = model->addOperand(&type183); 18776 auto param29 = model->addOperand(&type5); 18777 auto param30 = model->addOperand(&type5); 18778 auto param31 = model->addOperand(&type21); 18779 auto param32 = model->addOperand(&type21); 18780 auto param33 = model->addOperand(&type5); 18781 auto param34 = model->addOperand(&type5); 18782 auto layout = model->addOperand(&type0); 18783 auto featureMap = model->addOperand(&type200); 18784 auto weights = model->addOperand(&type189); 18785 auto bias = model->addOperand(&type181); 18786 auto shape4 = model->addOperand(&type4); 18787 auto param35 = model->addOperand(&type5); 18788 auto param36 = model->addOperand(&type5); 18789 auto param37 = model->addOperand(&type5); 18790 auto param38 = model->addOperand(&type5); 18791 auto out = model->addOperand(&type204); 18792 // Phase 2, operations 18793 static uint8_t scores_init[] = {137, 129}; 18794 model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); 18795 static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 18796 model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); 18797 static int32_t param22_init[] = {0}; 18798 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18799 static float param23_init[] = {0.3f}; 18800 model->setOperandValue(param23, param23_init, sizeof(float) * 1); 18801 static int32_t param24_init[] = {-1}; 18802 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18803 static int32_t param25_init[] = {0}; 18804 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18805 static float param26_init[] = {0.4f}; 18806 model->setOperandValue(param26, param26_init, sizeof(float) * 1); 18807 static float param27_init[] = {1.0f}; 18808 model->setOperandValue(param27, param27_init, sizeof(float) * 1); 18809 static float param28_init[] = {0.3f}; 18810 model->setOperandValue(param28, param28_init, sizeof(float) * 1); 18811 static int32_t param29_init[] = {2}; 18812 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18813 static int32_t param30_init[] = {2}; 18814 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18815 static float param31_init[] = {2.0f}; 18816 model->setOperandValue(param31, param31_init, sizeof(float) * 1); 18817 static float param32_init[] = {2.0f}; 18818 model->setOperandValue(param32, param32_init, sizeof(float) * 1); 18819 static int32_t param33_init[] = {4}; 18820 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18821 static int32_t param34_init[] = {4}; 18822 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18823 static bool8 layout_init[] = {true}; 18824 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18825 static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; 18826 model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); 18827 static int32_t bias_init[] = {-150, -200}; 18828 model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); 18829 static int32_t shape4_init[] = {0, 2, 5, 5}; 18830 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18831 static int32_t param35_init[] = {2}; 18832 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18833 static int32_t param36_init[] = {2}; 18834 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18835 static int32_t param37_init[] = {2}; 18836 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18837 static int32_t param38_init[] = {0}; 18838 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18839 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18840 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18841 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18842 // Phase 3, inputs and outputs 18843 model->identifyInputsAndOutputs( 18844 {in}, 18845 {scoresOut, classesOut, out}); 18846 assert(model->isValid()); 18847 } 18848 18849 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8(int i) { 18850 static std::set<int> ignore = {}; 18851 return ignore.find(i) != ignore.end(); 18852 } 18853 18854 void CreateModel_zero_sized_dynamic_output_shape_nchw_float16(Model *model) { 18855 OperandType type0(Type::BOOL, {}); 18856 OperandType type18(Type::TENSOR_INT32, {0}); 18857 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 18858 OperandType type193(Type::FLOAT16, {}); 18859 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 18860 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 18861 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 18862 OperandType type20(Type::TENSOR_INT32, {1}); 18863 OperandType type202(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); 18864 OperandType type205(Type::TENSOR_FLOAT16, {0}); 18865 OperandType type4(Type::TENSOR_INT32, {4}); 18866 OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); 18867 OperandType type46(Type::TENSOR_FLOAT16, {2}); 18868 OperandType type5(Type::INT32, {}); 18869 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 18870 // Phase 1, operands 18871 auto scores = model->addOperand(&type196); 18872 auto roi = model->addOperand(&type194); 18873 auto param22 = model->addOperand(&type20); 18874 auto param23 = model->addOperand(&type193); 18875 auto param24 = model->addOperand(&type5); 18876 auto param25 = model->addOperand(&type5); 18877 auto param26 = model->addOperand(&type193); 18878 auto param27 = model->addOperand(&type193); 18879 auto param28 = model->addOperand(&type193); 18880 auto scoresOut = model->addOperand(&type205); 18881 auto roiOut = model->addOperand(&type195); 18882 auto classesOut = model->addOperand(&type18); 18883 auto batchSplitOut = model->addOperand(&type18); 18884 auto in = model->addOperand(&type191); 18885 auto param29 = model->addOperand(&type5); 18886 auto param30 = model->addOperand(&type5); 18887 auto param31 = model->addOperand(&type193); 18888 auto param32 = model->addOperand(&type193); 18889 auto param33 = model->addOperand(&type5); 18890 auto param34 = model->addOperand(&type5); 18891 auto layout = model->addOperand(&type0); 18892 auto featureMap = model->addOperand(&type202); 18893 auto weights = model->addOperand(&type45); 18894 auto bias = model->addOperand(&type46); 18895 auto shape4 = model->addOperand(&type4); 18896 auto param35 = model->addOperand(&type5); 18897 auto param36 = model->addOperand(&type5); 18898 auto param37 = model->addOperand(&type5); 18899 auto param38 = model->addOperand(&type5); 18900 auto out = model->addOperand(&type96); 18901 // Phase 2, operations 18902 static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; 18903 model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); 18904 static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 18905 model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); 18906 static int32_t param22_init[] = {0}; 18907 model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); 18908 static _Float16 param23_init[] = {0.30000001192092896f}; 18909 model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); 18910 static int32_t param24_init[] = {-1}; 18911 model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); 18912 static int32_t param25_init[] = {0}; 18913 model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); 18914 static _Float16 param26_init[] = {0.4000000059604645f}; 18915 model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); 18916 static _Float16 param27_init[] = {1.0f}; 18917 model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); 18918 static _Float16 param28_init[] = {0.30000001192092896f}; 18919 model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); 18920 static int32_t param29_init[] = {2}; 18921 model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); 18922 static int32_t param30_init[] = {2}; 18923 model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); 18924 static _Float16 param31_init[] = {2.0f}; 18925 model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); 18926 static _Float16 param32_init[] = {2.0f}; 18927 model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); 18928 static int32_t param33_init[] = {4}; 18929 model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); 18930 static int32_t param34_init[] = {4}; 18931 model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); 18932 static bool8 layout_init[] = {true}; 18933 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 18934 static _Float16 weights_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f, 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 10.0f, 8.0f, 6.0f}; 18935 model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); 18936 static _Float16 bias_init[] = {-1.5f, -2.0f}; 18937 model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); 18938 static int32_t shape4_init[] = {0, 2, 5, 5}; 18939 model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); 18940 static int32_t param35_init[] = {2}; 18941 model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); 18942 static int32_t param36_init[] = {2}; 18943 model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); 18944 static int32_t param37_init[] = {2}; 18945 model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); 18946 static int32_t param38_init[] = {0}; 18947 model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); 18948 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); 18949 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); 18950 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); 18951 // Phase 3, inputs and outputs 18952 model->identifyInputsAndOutputs( 18953 {in}, 18954 {scoresOut, classesOut, out}); 18955 assert(model->isValid()); 18956 } 18957 18958 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16(int i) { 18959 static std::set<int> ignore = {}; 18960 return ignore.find(i) != ignore.end(); 18961 } 18962 18963 void CreateModel_zero_sized_nhwc_2(Model *model) { 18964 OperandType type0(Type::BOOL, {}); 18965 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 18966 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 18967 OperandType type17(Type::TENSOR_FLOAT32, {0}); 18968 OperandType type18(Type::TENSOR_INT32, {0}); 18969 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 18970 OperandType type20(Type::TENSOR_INT32, {1}); 18971 OperandType type21(Type::FLOAT32, {}); 18972 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 18973 OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); 18974 OperandType type26(Type::TENSOR_FLOAT32, {0, 3, 3, 1}); 18975 OperandType type5(Type::INT32, {}); 18976 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 18977 OperandType type9(Type::TENSOR_FLOAT32, {1}); 18978 // Phase 1, operands 18979 auto scores1 = model->addOperand(&type15); 18980 auto roi1 = model->addOperand(&type16); 18981 auto param39 = model->addOperand(&type20); 18982 auto param40 = model->addOperand(&type21); 18983 auto param41 = model->addOperand(&type5); 18984 auto param42 = model->addOperand(&type5); 18985 auto param43 = model->addOperand(&type21); 18986 auto param44 = model->addOperand(&type21); 18987 auto param45 = model->addOperand(&type21); 18988 auto scoresOut1 = model->addOperand(&type17); 18989 auto roiOut1 = model->addOperand(&type19); 18990 auto classesOut1 = model->addOperand(&type18); 18991 auto batchSplitOut1 = model->addOperand(&type18); 18992 auto in1 = model->addOperand(&type22); 18993 auto param46 = model->addOperand(&type5); 18994 auto param47 = model->addOperand(&type5); 18995 auto param48 = model->addOperand(&type21); 18996 auto param49 = model->addOperand(&type21); 18997 auto param50 = model->addOperand(&type5); 18998 auto param51 = model->addOperand(&type5); 18999 auto layout = model->addOperand(&type0); 19000 auto featureMap1 = model->addOperand(&type25); 19001 auto weights1 = model->addOperand(&type8); 19002 auto bias1 = model->addOperand(&type9); 19003 auto param52 = model->addOperand(&type5); 19004 auto param53 = model->addOperand(&type5); 19005 auto param54 = model->addOperand(&type5); 19006 auto param55 = model->addOperand(&type5); 19007 auto param56 = model->addOperand(&type5); 19008 auto param57 = model->addOperand(&type5); 19009 auto param58 = model->addOperand(&type5); 19010 auto out1 = model->addOperand(&type26); 19011 // Phase 2, operations 19012 static float scores1_init[] = {0.9f, 0.1f}; 19013 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 19014 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19015 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 19016 static int32_t param39_init[] = {0}; 19017 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19018 static float param40_init[] = {0.3f}; 19019 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19020 static int32_t param41_init[] = {-1}; 19021 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19022 static int32_t param42_init[] = {0}; 19023 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19024 static float param43_init[] = {0.4f}; 19025 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19026 static float param44_init[] = {1.0f}; 19027 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19028 static float param45_init[] = {0.3f}; 19029 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19030 static int32_t param46_init[] = {4}; 19031 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19032 static int32_t param47_init[] = {4}; 19033 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19034 static float param48_init[] = {2.0f}; 19035 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19036 static float param49_init[] = {2.0f}; 19037 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19038 static int32_t param50_init[] = {4}; 19039 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19040 static int32_t param51_init[] = {4}; 19041 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19042 static bool8 layout_init[] = {false}; 19043 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19044 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19045 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 19046 static float bias1_init[] = {-1.5f}; 19047 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 19048 static int32_t param52_init[] = {1}; 19049 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19050 static int32_t param53_init[] = {2}; 19051 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19052 static int32_t param54_init[] = {2}; 19053 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19054 static int32_t param55_init[] = {1}; 19055 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19056 static int32_t param56_init[] = {1}; 19057 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19058 static int32_t param57_init[] = {1}; 19059 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19060 static int32_t param58_init[] = {0}; 19061 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19062 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19063 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19064 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19065 // Phase 3, inputs and outputs 19066 model->identifyInputsAndOutputs( 19067 {in1}, 19068 {scoresOut1, classesOut1, out1}); 19069 assert(model->isValid()); 19070 } 19071 19072 inline bool is_ignored_zero_sized_nhwc_2(int i) { 19073 static std::set<int> ignore = {}; 19074 return ignore.find(i) != ignore.end(); 19075 } 19076 19077 void CreateModel_zero_sized_nhwc_relaxed_2(Model *model) { 19078 OperandType type0(Type::BOOL, {}); 19079 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 19080 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 19081 OperandType type17(Type::TENSOR_FLOAT32, {0}); 19082 OperandType type18(Type::TENSOR_INT32, {0}); 19083 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 19084 OperandType type20(Type::TENSOR_INT32, {1}); 19085 OperandType type21(Type::FLOAT32, {}); 19086 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 19087 OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); 19088 OperandType type26(Type::TENSOR_FLOAT32, {0, 3, 3, 1}); 19089 OperandType type5(Type::INT32, {}); 19090 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 19091 OperandType type9(Type::TENSOR_FLOAT32, {1}); 19092 // Phase 1, operands 19093 auto scores1 = model->addOperand(&type15); 19094 auto roi1 = model->addOperand(&type16); 19095 auto param39 = model->addOperand(&type20); 19096 auto param40 = model->addOperand(&type21); 19097 auto param41 = model->addOperand(&type5); 19098 auto param42 = model->addOperand(&type5); 19099 auto param43 = model->addOperand(&type21); 19100 auto param44 = model->addOperand(&type21); 19101 auto param45 = model->addOperand(&type21); 19102 auto scoresOut1 = model->addOperand(&type17); 19103 auto roiOut1 = model->addOperand(&type19); 19104 auto classesOut1 = model->addOperand(&type18); 19105 auto batchSplitOut1 = model->addOperand(&type18); 19106 auto in1 = model->addOperand(&type22); 19107 auto param46 = model->addOperand(&type5); 19108 auto param47 = model->addOperand(&type5); 19109 auto param48 = model->addOperand(&type21); 19110 auto param49 = model->addOperand(&type21); 19111 auto param50 = model->addOperand(&type5); 19112 auto param51 = model->addOperand(&type5); 19113 auto layout = model->addOperand(&type0); 19114 auto featureMap1 = model->addOperand(&type25); 19115 auto weights1 = model->addOperand(&type8); 19116 auto bias1 = model->addOperand(&type9); 19117 auto param52 = model->addOperand(&type5); 19118 auto param53 = model->addOperand(&type5); 19119 auto param54 = model->addOperand(&type5); 19120 auto param55 = model->addOperand(&type5); 19121 auto param56 = model->addOperand(&type5); 19122 auto param57 = model->addOperand(&type5); 19123 auto param58 = model->addOperand(&type5); 19124 auto out1 = model->addOperand(&type26); 19125 // Phase 2, operations 19126 static float scores1_init[] = {0.9f, 0.1f}; 19127 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 19128 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19129 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 19130 static int32_t param39_init[] = {0}; 19131 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19132 static float param40_init[] = {0.3f}; 19133 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19134 static int32_t param41_init[] = {-1}; 19135 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19136 static int32_t param42_init[] = {0}; 19137 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19138 static float param43_init[] = {0.4f}; 19139 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19140 static float param44_init[] = {1.0f}; 19141 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19142 static float param45_init[] = {0.3f}; 19143 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19144 static int32_t param46_init[] = {4}; 19145 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19146 static int32_t param47_init[] = {4}; 19147 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19148 static float param48_init[] = {2.0f}; 19149 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19150 static float param49_init[] = {2.0f}; 19151 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19152 static int32_t param50_init[] = {4}; 19153 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19154 static int32_t param51_init[] = {4}; 19155 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19156 static bool8 layout_init[] = {false}; 19157 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19158 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19159 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 19160 static float bias1_init[] = {-1.5f}; 19161 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 19162 static int32_t param52_init[] = {1}; 19163 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19164 static int32_t param53_init[] = {2}; 19165 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19166 static int32_t param54_init[] = {2}; 19167 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19168 static int32_t param55_init[] = {1}; 19169 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19170 static int32_t param56_init[] = {1}; 19171 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19172 static int32_t param57_init[] = {1}; 19173 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19174 static int32_t param58_init[] = {0}; 19175 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19176 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19177 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19178 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19179 // Phase 3, inputs and outputs 19180 model->identifyInputsAndOutputs( 19181 {in1}, 19182 {scoresOut1, classesOut1, out1}); 19183 // Phase 4: set relaxed execution 19184 model->relaxComputationFloat32toFloat16(true); 19185 assert(model->isValid()); 19186 } 19187 19188 inline bool is_ignored_zero_sized_nhwc_relaxed_2(int i) { 19189 static std::set<int> ignore = {}; 19190 return ignore.find(i) != ignore.end(); 19191 } 19192 19193 void CreateModel_zero_sized_nhwc_quant8_2(Model *model) { 19194 OperandType type0(Type::BOOL, {}); 19195 OperandType type18(Type::TENSOR_INT32, {0}); 19196 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 19197 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 19198 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 19199 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 19200 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 19201 OperandType type20(Type::TENSOR_INT32, {1}); 19202 OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); 19203 OperandType type207(Type::TENSOR_QUANT8_ASYMM, {0, 4, 4, 1}, 0.1f, 128); 19204 OperandType type208(Type::TENSOR_QUANT8_ASYMM, {0, 3, 3, 1}, 0.1f, 128); 19205 OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); 19206 OperandType type21(Type::FLOAT32, {}); 19207 OperandType type5(Type::INT32, {}); 19208 // Phase 1, operands 19209 auto scores1 = model->addOperand(&type187); 19210 auto roi1 = model->addOperand(&type185); 19211 auto param39 = model->addOperand(&type20); 19212 auto param40 = model->addOperand(&type21); 19213 auto param41 = model->addOperand(&type5); 19214 auto param42 = model->addOperand(&type5); 19215 auto param43 = model->addOperand(&type21); 19216 auto param44 = model->addOperand(&type21); 19217 auto param45 = model->addOperand(&type21); 19218 auto scoresOut1 = model->addOperand(&type188); 19219 auto roiOut1 = model->addOperand(&type186); 19220 auto classesOut1 = model->addOperand(&type18); 19221 auto batchSplitOut1 = model->addOperand(&type18); 19222 auto in1 = model->addOperand(&type183); 19223 auto param46 = model->addOperand(&type5); 19224 auto param47 = model->addOperand(&type5); 19225 auto param48 = model->addOperand(&type21); 19226 auto param49 = model->addOperand(&type21); 19227 auto param50 = model->addOperand(&type5); 19228 auto param51 = model->addOperand(&type5); 19229 auto layout = model->addOperand(&type0); 19230 auto featureMap1 = model->addOperand(&type207); 19231 auto weights1 = model->addOperand(&type209); 19232 auto bias1 = model->addOperand(&type206); 19233 auto param52 = model->addOperand(&type5); 19234 auto param53 = model->addOperand(&type5); 19235 auto param54 = model->addOperand(&type5); 19236 auto param55 = model->addOperand(&type5); 19237 auto param56 = model->addOperand(&type5); 19238 auto param57 = model->addOperand(&type5); 19239 auto param58 = model->addOperand(&type5); 19240 auto out1 = model->addOperand(&type208); 19241 // Phase 2, operations 19242 static uint8_t scores1_init[] = {137, 129}; 19243 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 19244 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 19245 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 19246 static int32_t param39_init[] = {0}; 19247 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19248 static float param40_init[] = {0.3f}; 19249 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19250 static int32_t param41_init[] = {-1}; 19251 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19252 static int32_t param42_init[] = {0}; 19253 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19254 static float param43_init[] = {0.4f}; 19255 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19256 static float param44_init[] = {1.0f}; 19257 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19258 static float param45_init[] = {0.3f}; 19259 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19260 static int32_t param46_init[] = {4}; 19261 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19262 static int32_t param47_init[] = {4}; 19263 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19264 static float param48_init[] = {2.0f}; 19265 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19266 static float param49_init[] = {2.0f}; 19267 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19268 static int32_t param50_init[] = {4}; 19269 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19270 static int32_t param51_init[] = {4}; 19271 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19272 static bool8 layout_init[] = {false}; 19273 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19274 static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; 19275 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); 19276 static int32_t bias1_init[] = {-150}; 19277 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); 19278 static int32_t param52_init[] = {1}; 19279 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19280 static int32_t param53_init[] = {2}; 19281 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19282 static int32_t param54_init[] = {2}; 19283 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19284 static int32_t param55_init[] = {1}; 19285 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19286 static int32_t param56_init[] = {1}; 19287 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19288 static int32_t param57_init[] = {1}; 19289 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19290 static int32_t param58_init[] = {0}; 19291 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19292 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19293 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19294 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19295 // Phase 3, inputs and outputs 19296 model->identifyInputsAndOutputs( 19297 {in1}, 19298 {scoresOut1, classesOut1, out1}); 19299 assert(model->isValid()); 19300 } 19301 19302 inline bool is_ignored_zero_sized_nhwc_quant8_2(int i) { 19303 static std::set<int> ignore = {}; 19304 return ignore.find(i) != ignore.end(); 19305 } 19306 19307 void CreateModel_zero_sized_nhwc_float16_2(Model *model) { 19308 OperandType type0(Type::BOOL, {}); 19309 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 19310 OperandType type135(Type::TENSOR_FLOAT16, {1}); 19311 OperandType type18(Type::TENSOR_INT32, {0}); 19312 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 19313 OperandType type193(Type::FLOAT16, {}); 19314 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 19315 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 19316 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 19317 OperandType type197(Type::TENSOR_FLOAT16, {0}); 19318 OperandType type20(Type::TENSOR_INT32, {1}); 19319 OperandType type210(Type::TENSOR_FLOAT16, {0, 4, 4, 1}); 19320 OperandType type211(Type::TENSOR_FLOAT16, {0, 3, 3, 1}); 19321 OperandType type5(Type::INT32, {}); 19322 // Phase 1, operands 19323 auto scores1 = model->addOperand(&type196); 19324 auto roi1 = model->addOperand(&type194); 19325 auto param39 = model->addOperand(&type20); 19326 auto param40 = model->addOperand(&type193); 19327 auto param41 = model->addOperand(&type5); 19328 auto param42 = model->addOperand(&type5); 19329 auto param43 = model->addOperand(&type193); 19330 auto param44 = model->addOperand(&type193); 19331 auto param45 = model->addOperand(&type193); 19332 auto scoresOut1 = model->addOperand(&type197); 19333 auto roiOut1 = model->addOperand(&type195); 19334 auto classesOut1 = model->addOperand(&type18); 19335 auto batchSplitOut1 = model->addOperand(&type18); 19336 auto in1 = model->addOperand(&type191); 19337 auto param46 = model->addOperand(&type5); 19338 auto param47 = model->addOperand(&type5); 19339 auto param48 = model->addOperand(&type193); 19340 auto param49 = model->addOperand(&type193); 19341 auto param50 = model->addOperand(&type5); 19342 auto param51 = model->addOperand(&type5); 19343 auto layout = model->addOperand(&type0); 19344 auto featureMap1 = model->addOperand(&type210); 19345 auto weights1 = model->addOperand(&type134); 19346 auto bias1 = model->addOperand(&type135); 19347 auto param52 = model->addOperand(&type5); 19348 auto param53 = model->addOperand(&type5); 19349 auto param54 = model->addOperand(&type5); 19350 auto param55 = model->addOperand(&type5); 19351 auto param56 = model->addOperand(&type5); 19352 auto param57 = model->addOperand(&type5); 19353 auto param58 = model->addOperand(&type5); 19354 auto out1 = model->addOperand(&type211); 19355 // Phase 2, operations 19356 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 19357 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 19358 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19359 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 19360 static int32_t param39_init[] = {0}; 19361 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19362 static _Float16 param40_init[] = {0.30000001192092896f}; 19363 model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); 19364 static int32_t param41_init[] = {-1}; 19365 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19366 static int32_t param42_init[] = {0}; 19367 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19368 static _Float16 param43_init[] = {0.4000000059604645f}; 19369 model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); 19370 static _Float16 param44_init[] = {1.0f}; 19371 model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); 19372 static _Float16 param45_init[] = {0.30000001192092896f}; 19373 model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); 19374 static int32_t param46_init[] = {4}; 19375 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19376 static int32_t param47_init[] = {4}; 19377 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19378 static _Float16 param48_init[] = {2.0f}; 19379 model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); 19380 static _Float16 param49_init[] = {2.0f}; 19381 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 19382 static int32_t param50_init[] = {4}; 19383 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19384 static int32_t param51_init[] = {4}; 19385 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19386 static bool8 layout_init[] = {false}; 19387 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19388 static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19389 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); 19390 static _Float16 bias1_init[] = {-1.5f}; 19391 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); 19392 static int32_t param52_init[] = {1}; 19393 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19394 static int32_t param53_init[] = {2}; 19395 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19396 static int32_t param54_init[] = {2}; 19397 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19398 static int32_t param55_init[] = {1}; 19399 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19400 static int32_t param56_init[] = {1}; 19401 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19402 static int32_t param57_init[] = {1}; 19403 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19404 static int32_t param58_init[] = {0}; 19405 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19406 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19407 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19408 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19409 // Phase 3, inputs and outputs 19410 model->identifyInputsAndOutputs( 19411 {in1}, 19412 {scoresOut1, classesOut1, out1}); 19413 assert(model->isValid()); 19414 } 19415 19416 inline bool is_ignored_zero_sized_nhwc_float16_2(int i) { 19417 static std::set<int> ignore = {}; 19418 return ignore.find(i) != ignore.end(); 19419 } 19420 19421 void CreateModel_zero_sized_nchw_2(Model *model) { 19422 OperandType type0(Type::BOOL, {}); 19423 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 19424 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 19425 OperandType type17(Type::TENSOR_FLOAT32, {0}); 19426 OperandType type18(Type::TENSOR_INT32, {0}); 19427 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 19428 OperandType type20(Type::TENSOR_INT32, {1}); 19429 OperandType type21(Type::FLOAT32, {}); 19430 OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); 19431 OperandType type213(Type::TENSOR_FLOAT32, {0, 1, 3, 3}); 19432 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 19433 OperandType type5(Type::INT32, {}); 19434 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 19435 OperandType type9(Type::TENSOR_FLOAT32, {1}); 19436 // Phase 1, operands 19437 auto scores1 = model->addOperand(&type15); 19438 auto roi1 = model->addOperand(&type16); 19439 auto param39 = model->addOperand(&type20); 19440 auto param40 = model->addOperand(&type21); 19441 auto param41 = model->addOperand(&type5); 19442 auto param42 = model->addOperand(&type5); 19443 auto param43 = model->addOperand(&type21); 19444 auto param44 = model->addOperand(&type21); 19445 auto param45 = model->addOperand(&type21); 19446 auto scoresOut1 = model->addOperand(&type17); 19447 auto roiOut1 = model->addOperand(&type19); 19448 auto classesOut1 = model->addOperand(&type18); 19449 auto batchSplitOut1 = model->addOperand(&type18); 19450 auto in1 = model->addOperand(&type22); 19451 auto param46 = model->addOperand(&type5); 19452 auto param47 = model->addOperand(&type5); 19453 auto param48 = model->addOperand(&type21); 19454 auto param49 = model->addOperand(&type21); 19455 auto param50 = model->addOperand(&type5); 19456 auto param51 = model->addOperand(&type5); 19457 auto layout = model->addOperand(&type0); 19458 auto featureMap1 = model->addOperand(&type212); 19459 auto weights1 = model->addOperand(&type8); 19460 auto bias1 = model->addOperand(&type9); 19461 auto param52 = model->addOperand(&type5); 19462 auto param53 = model->addOperand(&type5); 19463 auto param54 = model->addOperand(&type5); 19464 auto param55 = model->addOperand(&type5); 19465 auto param56 = model->addOperand(&type5); 19466 auto param57 = model->addOperand(&type5); 19467 auto param58 = model->addOperand(&type5); 19468 auto out1 = model->addOperand(&type213); 19469 // Phase 2, operations 19470 static float scores1_init[] = {0.9f, 0.1f}; 19471 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 19472 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19473 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 19474 static int32_t param39_init[] = {0}; 19475 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19476 static float param40_init[] = {0.3f}; 19477 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19478 static int32_t param41_init[] = {-1}; 19479 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19480 static int32_t param42_init[] = {0}; 19481 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19482 static float param43_init[] = {0.4f}; 19483 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19484 static float param44_init[] = {1.0f}; 19485 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19486 static float param45_init[] = {0.3f}; 19487 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19488 static int32_t param46_init[] = {4}; 19489 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19490 static int32_t param47_init[] = {4}; 19491 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19492 static float param48_init[] = {2.0f}; 19493 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19494 static float param49_init[] = {2.0f}; 19495 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19496 static int32_t param50_init[] = {4}; 19497 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19498 static int32_t param51_init[] = {4}; 19499 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19500 static bool8 layout_init[] = {true}; 19501 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19502 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19503 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 19504 static float bias1_init[] = {-1.5f}; 19505 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 19506 static int32_t param52_init[] = {1}; 19507 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19508 static int32_t param53_init[] = {2}; 19509 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19510 static int32_t param54_init[] = {2}; 19511 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19512 static int32_t param55_init[] = {1}; 19513 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19514 static int32_t param56_init[] = {1}; 19515 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19516 static int32_t param57_init[] = {1}; 19517 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19518 static int32_t param58_init[] = {0}; 19519 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19520 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19521 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19522 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19523 // Phase 3, inputs and outputs 19524 model->identifyInputsAndOutputs( 19525 {in1}, 19526 {scoresOut1, classesOut1, out1}); 19527 assert(model->isValid()); 19528 } 19529 19530 inline bool is_ignored_zero_sized_nchw_2(int i) { 19531 static std::set<int> ignore = {}; 19532 return ignore.find(i) != ignore.end(); 19533 } 19534 19535 void CreateModel_zero_sized_nchw_relaxed_2(Model *model) { 19536 OperandType type0(Type::BOOL, {}); 19537 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 19538 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 19539 OperandType type17(Type::TENSOR_FLOAT32, {0}); 19540 OperandType type18(Type::TENSOR_INT32, {0}); 19541 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 19542 OperandType type20(Type::TENSOR_INT32, {1}); 19543 OperandType type21(Type::FLOAT32, {}); 19544 OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); 19545 OperandType type213(Type::TENSOR_FLOAT32, {0, 1, 3, 3}); 19546 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 19547 OperandType type5(Type::INT32, {}); 19548 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 19549 OperandType type9(Type::TENSOR_FLOAT32, {1}); 19550 // Phase 1, operands 19551 auto scores1 = model->addOperand(&type15); 19552 auto roi1 = model->addOperand(&type16); 19553 auto param39 = model->addOperand(&type20); 19554 auto param40 = model->addOperand(&type21); 19555 auto param41 = model->addOperand(&type5); 19556 auto param42 = model->addOperand(&type5); 19557 auto param43 = model->addOperand(&type21); 19558 auto param44 = model->addOperand(&type21); 19559 auto param45 = model->addOperand(&type21); 19560 auto scoresOut1 = model->addOperand(&type17); 19561 auto roiOut1 = model->addOperand(&type19); 19562 auto classesOut1 = model->addOperand(&type18); 19563 auto batchSplitOut1 = model->addOperand(&type18); 19564 auto in1 = model->addOperand(&type22); 19565 auto param46 = model->addOperand(&type5); 19566 auto param47 = model->addOperand(&type5); 19567 auto param48 = model->addOperand(&type21); 19568 auto param49 = model->addOperand(&type21); 19569 auto param50 = model->addOperand(&type5); 19570 auto param51 = model->addOperand(&type5); 19571 auto layout = model->addOperand(&type0); 19572 auto featureMap1 = model->addOperand(&type212); 19573 auto weights1 = model->addOperand(&type8); 19574 auto bias1 = model->addOperand(&type9); 19575 auto param52 = model->addOperand(&type5); 19576 auto param53 = model->addOperand(&type5); 19577 auto param54 = model->addOperand(&type5); 19578 auto param55 = model->addOperand(&type5); 19579 auto param56 = model->addOperand(&type5); 19580 auto param57 = model->addOperand(&type5); 19581 auto param58 = model->addOperand(&type5); 19582 auto out1 = model->addOperand(&type213); 19583 // Phase 2, operations 19584 static float scores1_init[] = {0.9f, 0.1f}; 19585 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 19586 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19587 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 19588 static int32_t param39_init[] = {0}; 19589 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19590 static float param40_init[] = {0.3f}; 19591 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19592 static int32_t param41_init[] = {-1}; 19593 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19594 static int32_t param42_init[] = {0}; 19595 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19596 static float param43_init[] = {0.4f}; 19597 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19598 static float param44_init[] = {1.0f}; 19599 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19600 static float param45_init[] = {0.3f}; 19601 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19602 static int32_t param46_init[] = {4}; 19603 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19604 static int32_t param47_init[] = {4}; 19605 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19606 static float param48_init[] = {2.0f}; 19607 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19608 static float param49_init[] = {2.0f}; 19609 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19610 static int32_t param50_init[] = {4}; 19611 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19612 static int32_t param51_init[] = {4}; 19613 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19614 static bool8 layout_init[] = {true}; 19615 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19616 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19617 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 19618 static float bias1_init[] = {-1.5f}; 19619 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 19620 static int32_t param52_init[] = {1}; 19621 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19622 static int32_t param53_init[] = {2}; 19623 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19624 static int32_t param54_init[] = {2}; 19625 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19626 static int32_t param55_init[] = {1}; 19627 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19628 static int32_t param56_init[] = {1}; 19629 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19630 static int32_t param57_init[] = {1}; 19631 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19632 static int32_t param58_init[] = {0}; 19633 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19634 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19635 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19636 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19637 // Phase 3, inputs and outputs 19638 model->identifyInputsAndOutputs( 19639 {in1}, 19640 {scoresOut1, classesOut1, out1}); 19641 // Phase 4: set relaxed execution 19642 model->relaxComputationFloat32toFloat16(true); 19643 assert(model->isValid()); 19644 } 19645 19646 inline bool is_ignored_zero_sized_nchw_relaxed_2(int i) { 19647 static std::set<int> ignore = {}; 19648 return ignore.find(i) != ignore.end(); 19649 } 19650 19651 void CreateModel_zero_sized_nchw_quant8_2(Model *model) { 19652 OperandType type0(Type::BOOL, {}); 19653 OperandType type18(Type::TENSOR_INT32, {0}); 19654 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 19655 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 19656 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 19657 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 19658 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 19659 OperandType type20(Type::TENSOR_INT32, {1}); 19660 OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); 19661 OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); 19662 OperandType type21(Type::FLOAT32, {}); 19663 OperandType type214(Type::TENSOR_QUANT8_ASYMM, {0, 1, 4, 4}, 0.1f, 128); 19664 OperandType type215(Type::TENSOR_QUANT8_ASYMM, {0, 1, 3, 3}, 0.1f, 128); 19665 OperandType type5(Type::INT32, {}); 19666 // Phase 1, operands 19667 auto scores1 = model->addOperand(&type187); 19668 auto roi1 = model->addOperand(&type185); 19669 auto param39 = model->addOperand(&type20); 19670 auto param40 = model->addOperand(&type21); 19671 auto param41 = model->addOperand(&type5); 19672 auto param42 = model->addOperand(&type5); 19673 auto param43 = model->addOperand(&type21); 19674 auto param44 = model->addOperand(&type21); 19675 auto param45 = model->addOperand(&type21); 19676 auto scoresOut1 = model->addOperand(&type188); 19677 auto roiOut1 = model->addOperand(&type186); 19678 auto classesOut1 = model->addOperand(&type18); 19679 auto batchSplitOut1 = model->addOperand(&type18); 19680 auto in1 = model->addOperand(&type183); 19681 auto param46 = model->addOperand(&type5); 19682 auto param47 = model->addOperand(&type5); 19683 auto param48 = model->addOperand(&type21); 19684 auto param49 = model->addOperand(&type21); 19685 auto param50 = model->addOperand(&type5); 19686 auto param51 = model->addOperand(&type5); 19687 auto layout = model->addOperand(&type0); 19688 auto featureMap1 = model->addOperand(&type214); 19689 auto weights1 = model->addOperand(&type209); 19690 auto bias1 = model->addOperand(&type206); 19691 auto param52 = model->addOperand(&type5); 19692 auto param53 = model->addOperand(&type5); 19693 auto param54 = model->addOperand(&type5); 19694 auto param55 = model->addOperand(&type5); 19695 auto param56 = model->addOperand(&type5); 19696 auto param57 = model->addOperand(&type5); 19697 auto param58 = model->addOperand(&type5); 19698 auto out1 = model->addOperand(&type215); 19699 // Phase 2, operations 19700 static uint8_t scores1_init[] = {137, 129}; 19701 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 19702 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 19703 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 19704 static int32_t param39_init[] = {0}; 19705 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19706 static float param40_init[] = {0.3f}; 19707 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19708 static int32_t param41_init[] = {-1}; 19709 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19710 static int32_t param42_init[] = {0}; 19711 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19712 static float param43_init[] = {0.4f}; 19713 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19714 static float param44_init[] = {1.0f}; 19715 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19716 static float param45_init[] = {0.3f}; 19717 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19718 static int32_t param46_init[] = {4}; 19719 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19720 static int32_t param47_init[] = {4}; 19721 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19722 static float param48_init[] = {2.0f}; 19723 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19724 static float param49_init[] = {2.0f}; 19725 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19726 static int32_t param50_init[] = {4}; 19727 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19728 static int32_t param51_init[] = {4}; 19729 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19730 static bool8 layout_init[] = {true}; 19731 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19732 static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; 19733 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); 19734 static int32_t bias1_init[] = {-150}; 19735 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); 19736 static int32_t param52_init[] = {1}; 19737 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19738 static int32_t param53_init[] = {2}; 19739 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19740 static int32_t param54_init[] = {2}; 19741 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19742 static int32_t param55_init[] = {1}; 19743 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19744 static int32_t param56_init[] = {1}; 19745 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19746 static int32_t param57_init[] = {1}; 19747 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19748 static int32_t param58_init[] = {0}; 19749 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19750 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19751 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19752 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19753 // Phase 3, inputs and outputs 19754 model->identifyInputsAndOutputs( 19755 {in1}, 19756 {scoresOut1, classesOut1, out1}); 19757 assert(model->isValid()); 19758 } 19759 19760 inline bool is_ignored_zero_sized_nchw_quant8_2(int i) { 19761 static std::set<int> ignore = {}; 19762 return ignore.find(i) != ignore.end(); 19763 } 19764 19765 void CreateModel_zero_sized_nchw_float16_2(Model *model) { 19766 OperandType type0(Type::BOOL, {}); 19767 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 19768 OperandType type135(Type::TENSOR_FLOAT16, {1}); 19769 OperandType type18(Type::TENSOR_INT32, {0}); 19770 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 19771 OperandType type193(Type::FLOAT16, {}); 19772 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 19773 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 19774 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 19775 OperandType type197(Type::TENSOR_FLOAT16, {0}); 19776 OperandType type20(Type::TENSOR_INT32, {1}); 19777 OperandType type216(Type::TENSOR_FLOAT16, {0, 1, 4, 4}); 19778 OperandType type217(Type::TENSOR_FLOAT16, {0, 1, 3, 3}); 19779 OperandType type5(Type::INT32, {}); 19780 // Phase 1, operands 19781 auto scores1 = model->addOperand(&type196); 19782 auto roi1 = model->addOperand(&type194); 19783 auto param39 = model->addOperand(&type20); 19784 auto param40 = model->addOperand(&type193); 19785 auto param41 = model->addOperand(&type5); 19786 auto param42 = model->addOperand(&type5); 19787 auto param43 = model->addOperand(&type193); 19788 auto param44 = model->addOperand(&type193); 19789 auto param45 = model->addOperand(&type193); 19790 auto scoresOut1 = model->addOperand(&type197); 19791 auto roiOut1 = model->addOperand(&type195); 19792 auto classesOut1 = model->addOperand(&type18); 19793 auto batchSplitOut1 = model->addOperand(&type18); 19794 auto in1 = model->addOperand(&type191); 19795 auto param46 = model->addOperand(&type5); 19796 auto param47 = model->addOperand(&type5); 19797 auto param48 = model->addOperand(&type193); 19798 auto param49 = model->addOperand(&type193); 19799 auto param50 = model->addOperand(&type5); 19800 auto param51 = model->addOperand(&type5); 19801 auto layout = model->addOperand(&type0); 19802 auto featureMap1 = model->addOperand(&type216); 19803 auto weights1 = model->addOperand(&type134); 19804 auto bias1 = model->addOperand(&type135); 19805 auto param52 = model->addOperand(&type5); 19806 auto param53 = model->addOperand(&type5); 19807 auto param54 = model->addOperand(&type5); 19808 auto param55 = model->addOperand(&type5); 19809 auto param56 = model->addOperand(&type5); 19810 auto param57 = model->addOperand(&type5); 19811 auto param58 = model->addOperand(&type5); 19812 auto out1 = model->addOperand(&type217); 19813 // Phase 2, operations 19814 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 19815 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 19816 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19817 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 19818 static int32_t param39_init[] = {0}; 19819 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19820 static _Float16 param40_init[] = {0.30000001192092896f}; 19821 model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); 19822 static int32_t param41_init[] = {-1}; 19823 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19824 static int32_t param42_init[] = {0}; 19825 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19826 static _Float16 param43_init[] = {0.4000000059604645f}; 19827 model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); 19828 static _Float16 param44_init[] = {1.0f}; 19829 model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); 19830 static _Float16 param45_init[] = {0.30000001192092896f}; 19831 model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); 19832 static int32_t param46_init[] = {4}; 19833 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19834 static int32_t param47_init[] = {4}; 19835 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19836 static _Float16 param48_init[] = {2.0f}; 19837 model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); 19838 static _Float16 param49_init[] = {2.0f}; 19839 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 19840 static int32_t param50_init[] = {4}; 19841 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19842 static int32_t param51_init[] = {4}; 19843 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19844 static bool8 layout_init[] = {true}; 19845 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19846 static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19847 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); 19848 static _Float16 bias1_init[] = {-1.5f}; 19849 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); 19850 static int32_t param52_init[] = {1}; 19851 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19852 static int32_t param53_init[] = {2}; 19853 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19854 static int32_t param54_init[] = {2}; 19855 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19856 static int32_t param55_init[] = {1}; 19857 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19858 static int32_t param56_init[] = {1}; 19859 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19860 static int32_t param57_init[] = {1}; 19861 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19862 static int32_t param58_init[] = {0}; 19863 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19864 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19865 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19866 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19867 // Phase 3, inputs and outputs 19868 model->identifyInputsAndOutputs( 19869 {in1}, 19870 {scoresOut1, classesOut1, out1}); 19871 assert(model->isValid()); 19872 } 19873 19874 inline bool is_ignored_zero_sized_nchw_float16_2(int i) { 19875 static std::set<int> ignore = {}; 19876 return ignore.find(i) != ignore.end(); 19877 } 19878 19879 void CreateModel_zero_sized_dynamic_output_shape_nhwc_2(Model *model) { 19880 OperandType type0(Type::BOOL, {}); 19881 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 19882 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 19883 OperandType type17(Type::TENSOR_FLOAT32, {0}); 19884 OperandType type18(Type::TENSOR_INT32, {0}); 19885 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 19886 OperandType type20(Type::TENSOR_INT32, {1}); 19887 OperandType type21(Type::FLOAT32, {}); 19888 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 19889 OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); 19890 OperandType type5(Type::INT32, {}); 19891 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 19892 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 19893 OperandType type9(Type::TENSOR_FLOAT32, {1}); 19894 // Phase 1, operands 19895 auto scores1 = model->addOperand(&type15); 19896 auto roi1 = model->addOperand(&type16); 19897 auto param39 = model->addOperand(&type20); 19898 auto param40 = model->addOperand(&type21); 19899 auto param41 = model->addOperand(&type5); 19900 auto param42 = model->addOperand(&type5); 19901 auto param43 = model->addOperand(&type21); 19902 auto param44 = model->addOperand(&type21); 19903 auto param45 = model->addOperand(&type21); 19904 auto scoresOut1 = model->addOperand(&type17); 19905 auto roiOut1 = model->addOperand(&type19); 19906 auto classesOut1 = model->addOperand(&type18); 19907 auto batchSplitOut1 = model->addOperand(&type18); 19908 auto in1 = model->addOperand(&type22); 19909 auto param46 = model->addOperand(&type5); 19910 auto param47 = model->addOperand(&type5); 19911 auto param48 = model->addOperand(&type21); 19912 auto param49 = model->addOperand(&type21); 19913 auto param50 = model->addOperand(&type5); 19914 auto param51 = model->addOperand(&type5); 19915 auto layout = model->addOperand(&type0); 19916 auto featureMap1 = model->addOperand(&type25); 19917 auto weights1 = model->addOperand(&type8); 19918 auto bias1 = model->addOperand(&type9); 19919 auto param52 = model->addOperand(&type5); 19920 auto param53 = model->addOperand(&type5); 19921 auto param54 = model->addOperand(&type5); 19922 auto param55 = model->addOperand(&type5); 19923 auto param56 = model->addOperand(&type5); 19924 auto param57 = model->addOperand(&type5); 19925 auto param58 = model->addOperand(&type5); 19926 auto out1 = model->addOperand(&type88); 19927 // Phase 2, operations 19928 static float scores1_init[] = {0.9f, 0.1f}; 19929 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 19930 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 19931 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 19932 static int32_t param39_init[] = {0}; 19933 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 19934 static float param40_init[] = {0.3f}; 19935 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 19936 static int32_t param41_init[] = {-1}; 19937 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 19938 static int32_t param42_init[] = {0}; 19939 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 19940 static float param43_init[] = {0.4f}; 19941 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 19942 static float param44_init[] = {1.0f}; 19943 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 19944 static float param45_init[] = {0.3f}; 19945 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 19946 static int32_t param46_init[] = {4}; 19947 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 19948 static int32_t param47_init[] = {4}; 19949 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 19950 static float param48_init[] = {2.0f}; 19951 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 19952 static float param49_init[] = {2.0f}; 19953 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 19954 static int32_t param50_init[] = {4}; 19955 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 19956 static int32_t param51_init[] = {4}; 19957 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 19958 static bool8 layout_init[] = {false}; 19959 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 19960 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 19961 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 19962 static float bias1_init[] = {-1.5f}; 19963 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 19964 static int32_t param52_init[] = {1}; 19965 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 19966 static int32_t param53_init[] = {2}; 19967 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 19968 static int32_t param54_init[] = {2}; 19969 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 19970 static int32_t param55_init[] = {1}; 19971 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 19972 static int32_t param56_init[] = {1}; 19973 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 19974 static int32_t param57_init[] = {1}; 19975 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 19976 static int32_t param58_init[] = {0}; 19977 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 19978 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 19979 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 19980 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 19981 // Phase 3, inputs and outputs 19982 model->identifyInputsAndOutputs( 19983 {in1}, 19984 {scoresOut1, classesOut1, out1}); 19985 assert(model->isValid()); 19986 } 19987 19988 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_2(int i) { 19989 static std::set<int> ignore = {}; 19990 return ignore.find(i) != ignore.end(); 19991 } 19992 19993 void CreateModel_zero_sized_dynamic_output_shape_nhwc_relaxed_2(Model *model) { 19994 OperandType type0(Type::BOOL, {}); 19995 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 19996 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 19997 OperandType type17(Type::TENSOR_FLOAT32, {0}); 19998 OperandType type18(Type::TENSOR_INT32, {0}); 19999 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 20000 OperandType type20(Type::TENSOR_INT32, {1}); 20001 OperandType type21(Type::FLOAT32, {}); 20002 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20003 OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); 20004 OperandType type5(Type::INT32, {}); 20005 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 20006 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 20007 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20008 // Phase 1, operands 20009 auto scores1 = model->addOperand(&type15); 20010 auto roi1 = model->addOperand(&type16); 20011 auto param39 = model->addOperand(&type20); 20012 auto param40 = model->addOperand(&type21); 20013 auto param41 = model->addOperand(&type5); 20014 auto param42 = model->addOperand(&type5); 20015 auto param43 = model->addOperand(&type21); 20016 auto param44 = model->addOperand(&type21); 20017 auto param45 = model->addOperand(&type21); 20018 auto scoresOut1 = model->addOperand(&type17); 20019 auto roiOut1 = model->addOperand(&type19); 20020 auto classesOut1 = model->addOperand(&type18); 20021 auto batchSplitOut1 = model->addOperand(&type18); 20022 auto in1 = model->addOperand(&type22); 20023 auto param46 = model->addOperand(&type5); 20024 auto param47 = model->addOperand(&type5); 20025 auto param48 = model->addOperand(&type21); 20026 auto param49 = model->addOperand(&type21); 20027 auto param50 = model->addOperand(&type5); 20028 auto param51 = model->addOperand(&type5); 20029 auto layout = model->addOperand(&type0); 20030 auto featureMap1 = model->addOperand(&type25); 20031 auto weights1 = model->addOperand(&type8); 20032 auto bias1 = model->addOperand(&type9); 20033 auto param52 = model->addOperand(&type5); 20034 auto param53 = model->addOperand(&type5); 20035 auto param54 = model->addOperand(&type5); 20036 auto param55 = model->addOperand(&type5); 20037 auto param56 = model->addOperand(&type5); 20038 auto param57 = model->addOperand(&type5); 20039 auto param58 = model->addOperand(&type5); 20040 auto out1 = model->addOperand(&type88); 20041 // Phase 2, operations 20042 static float scores1_init[] = {0.9f, 0.1f}; 20043 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 20044 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 20045 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 20046 static int32_t param39_init[] = {0}; 20047 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20048 static float param40_init[] = {0.3f}; 20049 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 20050 static int32_t param41_init[] = {-1}; 20051 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20052 static int32_t param42_init[] = {0}; 20053 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20054 static float param43_init[] = {0.4f}; 20055 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 20056 static float param44_init[] = {1.0f}; 20057 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 20058 static float param45_init[] = {0.3f}; 20059 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 20060 static int32_t param46_init[] = {4}; 20061 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20062 static int32_t param47_init[] = {4}; 20063 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20064 static float param48_init[] = {2.0f}; 20065 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 20066 static float param49_init[] = {2.0f}; 20067 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 20068 static int32_t param50_init[] = {4}; 20069 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20070 static int32_t param51_init[] = {4}; 20071 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20072 static bool8 layout_init[] = {false}; 20073 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20074 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 20075 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 20076 static float bias1_init[] = {-1.5f}; 20077 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 20078 static int32_t param52_init[] = {1}; 20079 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20080 static int32_t param53_init[] = {2}; 20081 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20082 static int32_t param54_init[] = {2}; 20083 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20084 static int32_t param55_init[] = {1}; 20085 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20086 static int32_t param56_init[] = {1}; 20087 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20088 static int32_t param57_init[] = {1}; 20089 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20090 static int32_t param58_init[] = {0}; 20091 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20092 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20093 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20094 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20095 // Phase 3, inputs and outputs 20096 model->identifyInputsAndOutputs( 20097 {in1}, 20098 {scoresOut1, classesOut1, out1}); 20099 // Phase 4: set relaxed execution 20100 model->relaxComputationFloat32toFloat16(true); 20101 assert(model->isValid()); 20102 } 20103 20104 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed_2(int i) { 20105 static std::set<int> ignore = {}; 20106 return ignore.find(i) != ignore.end(); 20107 } 20108 20109 void CreateModel_zero_sized_dynamic_output_shape_nhwc_quant8_2(Model *model) { 20110 OperandType type0(Type::BOOL, {}); 20111 OperandType type18(Type::TENSOR_INT32, {0}); 20112 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 20113 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 20114 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 20115 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 20116 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 20117 OperandType type20(Type::TENSOR_INT32, {1}); 20118 OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 20119 OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); 20120 OperandType type207(Type::TENSOR_QUANT8_ASYMM, {0, 4, 4, 1}, 0.1f, 128); 20121 OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); 20122 OperandType type21(Type::FLOAT32, {}); 20123 OperandType type5(Type::INT32, {}); 20124 // Phase 1, operands 20125 auto scores1 = model->addOperand(&type187); 20126 auto roi1 = model->addOperand(&type185); 20127 auto param39 = model->addOperand(&type20); 20128 auto param40 = model->addOperand(&type21); 20129 auto param41 = model->addOperand(&type5); 20130 auto param42 = model->addOperand(&type5); 20131 auto param43 = model->addOperand(&type21); 20132 auto param44 = model->addOperand(&type21); 20133 auto param45 = model->addOperand(&type21); 20134 auto scoresOut1 = model->addOperand(&type188); 20135 auto roiOut1 = model->addOperand(&type186); 20136 auto classesOut1 = model->addOperand(&type18); 20137 auto batchSplitOut1 = model->addOperand(&type18); 20138 auto in1 = model->addOperand(&type183); 20139 auto param46 = model->addOperand(&type5); 20140 auto param47 = model->addOperand(&type5); 20141 auto param48 = model->addOperand(&type21); 20142 auto param49 = model->addOperand(&type21); 20143 auto param50 = model->addOperand(&type5); 20144 auto param51 = model->addOperand(&type5); 20145 auto layout = model->addOperand(&type0); 20146 auto featureMap1 = model->addOperand(&type207); 20147 auto weights1 = model->addOperand(&type209); 20148 auto bias1 = model->addOperand(&type206); 20149 auto param52 = model->addOperand(&type5); 20150 auto param53 = model->addOperand(&type5); 20151 auto param54 = model->addOperand(&type5); 20152 auto param55 = model->addOperand(&type5); 20153 auto param56 = model->addOperand(&type5); 20154 auto param57 = model->addOperand(&type5); 20155 auto param58 = model->addOperand(&type5); 20156 auto out1 = model->addOperand(&type204); 20157 // Phase 2, operations 20158 static uint8_t scores1_init[] = {137, 129}; 20159 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 20160 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 20161 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 20162 static int32_t param39_init[] = {0}; 20163 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20164 static float param40_init[] = {0.3f}; 20165 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 20166 static int32_t param41_init[] = {-1}; 20167 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20168 static int32_t param42_init[] = {0}; 20169 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20170 static float param43_init[] = {0.4f}; 20171 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 20172 static float param44_init[] = {1.0f}; 20173 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 20174 static float param45_init[] = {0.3f}; 20175 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 20176 static int32_t param46_init[] = {4}; 20177 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20178 static int32_t param47_init[] = {4}; 20179 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20180 static float param48_init[] = {2.0f}; 20181 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 20182 static float param49_init[] = {2.0f}; 20183 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 20184 static int32_t param50_init[] = {4}; 20185 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20186 static int32_t param51_init[] = {4}; 20187 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20188 static bool8 layout_init[] = {false}; 20189 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20190 static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; 20191 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); 20192 static int32_t bias1_init[] = {-150}; 20193 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); 20194 static int32_t param52_init[] = {1}; 20195 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20196 static int32_t param53_init[] = {2}; 20197 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20198 static int32_t param54_init[] = {2}; 20199 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20200 static int32_t param55_init[] = {1}; 20201 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20202 static int32_t param56_init[] = {1}; 20203 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20204 static int32_t param57_init[] = {1}; 20205 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20206 static int32_t param58_init[] = {0}; 20207 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20208 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20209 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20210 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20211 // Phase 3, inputs and outputs 20212 model->identifyInputsAndOutputs( 20213 {in1}, 20214 {scoresOut1, classesOut1, out1}); 20215 assert(model->isValid()); 20216 } 20217 20218 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8_2(int i) { 20219 static std::set<int> ignore = {}; 20220 return ignore.find(i) != ignore.end(); 20221 } 20222 20223 void CreateModel_zero_sized_dynamic_output_shape_nhwc_float16_2(Model *model) { 20224 OperandType type0(Type::BOOL, {}); 20225 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 20226 OperandType type135(Type::TENSOR_FLOAT16, {1}); 20227 OperandType type18(Type::TENSOR_INT32, {0}); 20228 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 20229 OperandType type193(Type::FLOAT16, {}); 20230 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 20231 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 20232 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 20233 OperandType type20(Type::TENSOR_INT32, {1}); 20234 OperandType type205(Type::TENSOR_FLOAT16, {0}); 20235 OperandType type210(Type::TENSOR_FLOAT16, {0, 4, 4, 1}); 20236 OperandType type5(Type::INT32, {}); 20237 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 20238 // Phase 1, operands 20239 auto scores1 = model->addOperand(&type196); 20240 auto roi1 = model->addOperand(&type194); 20241 auto param39 = model->addOperand(&type20); 20242 auto param40 = model->addOperand(&type193); 20243 auto param41 = model->addOperand(&type5); 20244 auto param42 = model->addOperand(&type5); 20245 auto param43 = model->addOperand(&type193); 20246 auto param44 = model->addOperand(&type193); 20247 auto param45 = model->addOperand(&type193); 20248 auto scoresOut1 = model->addOperand(&type205); 20249 auto roiOut1 = model->addOperand(&type195); 20250 auto classesOut1 = model->addOperand(&type18); 20251 auto batchSplitOut1 = model->addOperand(&type18); 20252 auto in1 = model->addOperand(&type191); 20253 auto param46 = model->addOperand(&type5); 20254 auto param47 = model->addOperand(&type5); 20255 auto param48 = model->addOperand(&type193); 20256 auto param49 = model->addOperand(&type193); 20257 auto param50 = model->addOperand(&type5); 20258 auto param51 = model->addOperand(&type5); 20259 auto layout = model->addOperand(&type0); 20260 auto featureMap1 = model->addOperand(&type210); 20261 auto weights1 = model->addOperand(&type134); 20262 auto bias1 = model->addOperand(&type135); 20263 auto param52 = model->addOperand(&type5); 20264 auto param53 = model->addOperand(&type5); 20265 auto param54 = model->addOperand(&type5); 20266 auto param55 = model->addOperand(&type5); 20267 auto param56 = model->addOperand(&type5); 20268 auto param57 = model->addOperand(&type5); 20269 auto param58 = model->addOperand(&type5); 20270 auto out1 = model->addOperand(&type96); 20271 // Phase 2, operations 20272 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 20273 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 20274 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 20275 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 20276 static int32_t param39_init[] = {0}; 20277 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20278 static _Float16 param40_init[] = {0.30000001192092896f}; 20279 model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); 20280 static int32_t param41_init[] = {-1}; 20281 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20282 static int32_t param42_init[] = {0}; 20283 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20284 static _Float16 param43_init[] = {0.4000000059604645f}; 20285 model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); 20286 static _Float16 param44_init[] = {1.0f}; 20287 model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); 20288 static _Float16 param45_init[] = {0.30000001192092896f}; 20289 model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); 20290 static int32_t param46_init[] = {4}; 20291 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20292 static int32_t param47_init[] = {4}; 20293 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20294 static _Float16 param48_init[] = {2.0f}; 20295 model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); 20296 static _Float16 param49_init[] = {2.0f}; 20297 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 20298 static int32_t param50_init[] = {4}; 20299 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20300 static int32_t param51_init[] = {4}; 20301 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20302 static bool8 layout_init[] = {false}; 20303 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20304 static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 20305 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); 20306 static _Float16 bias1_init[] = {-1.5f}; 20307 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); 20308 static int32_t param52_init[] = {1}; 20309 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20310 static int32_t param53_init[] = {2}; 20311 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20312 static int32_t param54_init[] = {2}; 20313 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20314 static int32_t param55_init[] = {1}; 20315 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20316 static int32_t param56_init[] = {1}; 20317 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20318 static int32_t param57_init[] = {1}; 20319 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20320 static int32_t param58_init[] = {0}; 20321 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20322 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20323 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20324 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20325 // Phase 3, inputs and outputs 20326 model->identifyInputsAndOutputs( 20327 {in1}, 20328 {scoresOut1, classesOut1, out1}); 20329 assert(model->isValid()); 20330 } 20331 20332 inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16_2(int i) { 20333 static std::set<int> ignore = {}; 20334 return ignore.find(i) != ignore.end(); 20335 } 20336 20337 void CreateModel_zero_sized_dynamic_output_shape_nchw_2(Model *model) { 20338 OperandType type0(Type::BOOL, {}); 20339 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 20340 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 20341 OperandType type17(Type::TENSOR_FLOAT32, {0}); 20342 OperandType type18(Type::TENSOR_INT32, {0}); 20343 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 20344 OperandType type20(Type::TENSOR_INT32, {1}); 20345 OperandType type21(Type::FLOAT32, {}); 20346 OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); 20347 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20348 OperandType type5(Type::INT32, {}); 20349 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 20350 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 20351 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20352 // Phase 1, operands 20353 auto scores1 = model->addOperand(&type15); 20354 auto roi1 = model->addOperand(&type16); 20355 auto param39 = model->addOperand(&type20); 20356 auto param40 = model->addOperand(&type21); 20357 auto param41 = model->addOperand(&type5); 20358 auto param42 = model->addOperand(&type5); 20359 auto param43 = model->addOperand(&type21); 20360 auto param44 = model->addOperand(&type21); 20361 auto param45 = model->addOperand(&type21); 20362 auto scoresOut1 = model->addOperand(&type17); 20363 auto roiOut1 = model->addOperand(&type19); 20364 auto classesOut1 = model->addOperand(&type18); 20365 auto batchSplitOut1 = model->addOperand(&type18); 20366 auto in1 = model->addOperand(&type22); 20367 auto param46 = model->addOperand(&type5); 20368 auto param47 = model->addOperand(&type5); 20369 auto param48 = model->addOperand(&type21); 20370 auto param49 = model->addOperand(&type21); 20371 auto param50 = model->addOperand(&type5); 20372 auto param51 = model->addOperand(&type5); 20373 auto layout = model->addOperand(&type0); 20374 auto featureMap1 = model->addOperand(&type212); 20375 auto weights1 = model->addOperand(&type8); 20376 auto bias1 = model->addOperand(&type9); 20377 auto param52 = model->addOperand(&type5); 20378 auto param53 = model->addOperand(&type5); 20379 auto param54 = model->addOperand(&type5); 20380 auto param55 = model->addOperand(&type5); 20381 auto param56 = model->addOperand(&type5); 20382 auto param57 = model->addOperand(&type5); 20383 auto param58 = model->addOperand(&type5); 20384 auto out1 = model->addOperand(&type88); 20385 // Phase 2, operations 20386 static float scores1_init[] = {0.9f, 0.1f}; 20387 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 20388 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 20389 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 20390 static int32_t param39_init[] = {0}; 20391 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20392 static float param40_init[] = {0.3f}; 20393 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 20394 static int32_t param41_init[] = {-1}; 20395 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20396 static int32_t param42_init[] = {0}; 20397 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20398 static float param43_init[] = {0.4f}; 20399 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 20400 static float param44_init[] = {1.0f}; 20401 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 20402 static float param45_init[] = {0.3f}; 20403 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 20404 static int32_t param46_init[] = {4}; 20405 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20406 static int32_t param47_init[] = {4}; 20407 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20408 static float param48_init[] = {2.0f}; 20409 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 20410 static float param49_init[] = {2.0f}; 20411 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 20412 static int32_t param50_init[] = {4}; 20413 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20414 static int32_t param51_init[] = {4}; 20415 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20416 static bool8 layout_init[] = {true}; 20417 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20418 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 20419 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 20420 static float bias1_init[] = {-1.5f}; 20421 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 20422 static int32_t param52_init[] = {1}; 20423 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20424 static int32_t param53_init[] = {2}; 20425 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20426 static int32_t param54_init[] = {2}; 20427 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20428 static int32_t param55_init[] = {1}; 20429 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20430 static int32_t param56_init[] = {1}; 20431 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20432 static int32_t param57_init[] = {1}; 20433 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20434 static int32_t param58_init[] = {0}; 20435 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20436 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20437 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20438 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20439 // Phase 3, inputs and outputs 20440 model->identifyInputsAndOutputs( 20441 {in1}, 20442 {scoresOut1, classesOut1, out1}); 20443 assert(model->isValid()); 20444 } 20445 20446 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_2(int i) { 20447 static std::set<int> ignore = {}; 20448 return ignore.find(i) != ignore.end(); 20449 } 20450 20451 void CreateModel_zero_sized_dynamic_output_shape_nchw_relaxed_2(Model *model) { 20452 OperandType type0(Type::BOOL, {}); 20453 OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); 20454 OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); 20455 OperandType type17(Type::TENSOR_FLOAT32, {0}); 20456 OperandType type18(Type::TENSOR_INT32, {0}); 20457 OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); 20458 OperandType type20(Type::TENSOR_INT32, {1}); 20459 OperandType type21(Type::FLOAT32, {}); 20460 OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); 20461 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20462 OperandType type5(Type::INT32, {}); 20463 OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); 20464 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 20465 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20466 // Phase 1, operands 20467 auto scores1 = model->addOperand(&type15); 20468 auto roi1 = model->addOperand(&type16); 20469 auto param39 = model->addOperand(&type20); 20470 auto param40 = model->addOperand(&type21); 20471 auto param41 = model->addOperand(&type5); 20472 auto param42 = model->addOperand(&type5); 20473 auto param43 = model->addOperand(&type21); 20474 auto param44 = model->addOperand(&type21); 20475 auto param45 = model->addOperand(&type21); 20476 auto scoresOut1 = model->addOperand(&type17); 20477 auto roiOut1 = model->addOperand(&type19); 20478 auto classesOut1 = model->addOperand(&type18); 20479 auto batchSplitOut1 = model->addOperand(&type18); 20480 auto in1 = model->addOperand(&type22); 20481 auto param46 = model->addOperand(&type5); 20482 auto param47 = model->addOperand(&type5); 20483 auto param48 = model->addOperand(&type21); 20484 auto param49 = model->addOperand(&type21); 20485 auto param50 = model->addOperand(&type5); 20486 auto param51 = model->addOperand(&type5); 20487 auto layout = model->addOperand(&type0); 20488 auto featureMap1 = model->addOperand(&type212); 20489 auto weights1 = model->addOperand(&type8); 20490 auto bias1 = model->addOperand(&type9); 20491 auto param52 = model->addOperand(&type5); 20492 auto param53 = model->addOperand(&type5); 20493 auto param54 = model->addOperand(&type5); 20494 auto param55 = model->addOperand(&type5); 20495 auto param56 = model->addOperand(&type5); 20496 auto param57 = model->addOperand(&type5); 20497 auto param58 = model->addOperand(&type5); 20498 auto out1 = model->addOperand(&type88); 20499 // Phase 2, operations 20500 static float scores1_init[] = {0.9f, 0.1f}; 20501 model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); 20502 static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 20503 model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); 20504 static int32_t param39_init[] = {0}; 20505 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20506 static float param40_init[] = {0.3f}; 20507 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 20508 static int32_t param41_init[] = {-1}; 20509 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20510 static int32_t param42_init[] = {0}; 20511 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20512 static float param43_init[] = {0.4f}; 20513 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 20514 static float param44_init[] = {1.0f}; 20515 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 20516 static float param45_init[] = {0.3f}; 20517 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 20518 static int32_t param46_init[] = {4}; 20519 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20520 static int32_t param47_init[] = {4}; 20521 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20522 static float param48_init[] = {2.0f}; 20523 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 20524 static float param49_init[] = {2.0f}; 20525 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 20526 static int32_t param50_init[] = {4}; 20527 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20528 static int32_t param51_init[] = {4}; 20529 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20530 static bool8 layout_init[] = {true}; 20531 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20532 static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 20533 model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); 20534 static float bias1_init[] = {-1.5f}; 20535 model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); 20536 static int32_t param52_init[] = {1}; 20537 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20538 static int32_t param53_init[] = {2}; 20539 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20540 static int32_t param54_init[] = {2}; 20541 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20542 static int32_t param55_init[] = {1}; 20543 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20544 static int32_t param56_init[] = {1}; 20545 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20546 static int32_t param57_init[] = {1}; 20547 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20548 static int32_t param58_init[] = {0}; 20549 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20550 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20551 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20552 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20553 // Phase 3, inputs and outputs 20554 model->identifyInputsAndOutputs( 20555 {in1}, 20556 {scoresOut1, classesOut1, out1}); 20557 // Phase 4: set relaxed execution 20558 model->relaxComputationFloat32toFloat16(true); 20559 assert(model->isValid()); 20560 } 20561 20562 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed_2(int i) { 20563 static std::set<int> ignore = {}; 20564 return ignore.find(i) != ignore.end(); 20565 } 20566 20567 void CreateModel_zero_sized_dynamic_output_shape_nchw_quant8_2(Model *model) { 20568 OperandType type0(Type::BOOL, {}); 20569 OperandType type18(Type::TENSOR_INT32, {0}); 20570 OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); 20571 OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); 20572 OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); 20573 OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); 20574 OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); 20575 OperandType type20(Type::TENSOR_INT32, {1}); 20576 OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); 20577 OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); 20578 OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); 20579 OperandType type21(Type::FLOAT32, {}); 20580 OperandType type214(Type::TENSOR_QUANT8_ASYMM, {0, 1, 4, 4}, 0.1f, 128); 20581 OperandType type5(Type::INT32, {}); 20582 // Phase 1, operands 20583 auto scores1 = model->addOperand(&type187); 20584 auto roi1 = model->addOperand(&type185); 20585 auto param39 = model->addOperand(&type20); 20586 auto param40 = model->addOperand(&type21); 20587 auto param41 = model->addOperand(&type5); 20588 auto param42 = model->addOperand(&type5); 20589 auto param43 = model->addOperand(&type21); 20590 auto param44 = model->addOperand(&type21); 20591 auto param45 = model->addOperand(&type21); 20592 auto scoresOut1 = model->addOperand(&type188); 20593 auto roiOut1 = model->addOperand(&type186); 20594 auto classesOut1 = model->addOperand(&type18); 20595 auto batchSplitOut1 = model->addOperand(&type18); 20596 auto in1 = model->addOperand(&type183); 20597 auto param46 = model->addOperand(&type5); 20598 auto param47 = model->addOperand(&type5); 20599 auto param48 = model->addOperand(&type21); 20600 auto param49 = model->addOperand(&type21); 20601 auto param50 = model->addOperand(&type5); 20602 auto param51 = model->addOperand(&type5); 20603 auto layout = model->addOperand(&type0); 20604 auto featureMap1 = model->addOperand(&type214); 20605 auto weights1 = model->addOperand(&type209); 20606 auto bias1 = model->addOperand(&type206); 20607 auto param52 = model->addOperand(&type5); 20608 auto param53 = model->addOperand(&type5); 20609 auto param54 = model->addOperand(&type5); 20610 auto param55 = model->addOperand(&type5); 20611 auto param56 = model->addOperand(&type5); 20612 auto param57 = model->addOperand(&type5); 20613 auto param58 = model->addOperand(&type5); 20614 auto out1 = model->addOperand(&type204); 20615 // Phase 2, operations 20616 static uint8_t scores1_init[] = {137, 129}; 20617 model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); 20618 static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; 20619 model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); 20620 static int32_t param39_init[] = {0}; 20621 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20622 static float param40_init[] = {0.3f}; 20623 model->setOperandValue(param40, param40_init, sizeof(float) * 1); 20624 static int32_t param41_init[] = {-1}; 20625 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20626 static int32_t param42_init[] = {0}; 20627 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20628 static float param43_init[] = {0.4f}; 20629 model->setOperandValue(param43, param43_init, sizeof(float) * 1); 20630 static float param44_init[] = {1.0f}; 20631 model->setOperandValue(param44, param44_init, sizeof(float) * 1); 20632 static float param45_init[] = {0.3f}; 20633 model->setOperandValue(param45, param45_init, sizeof(float) * 1); 20634 static int32_t param46_init[] = {4}; 20635 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20636 static int32_t param47_init[] = {4}; 20637 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20638 static float param48_init[] = {2.0f}; 20639 model->setOperandValue(param48, param48_init, sizeof(float) * 1); 20640 static float param49_init[] = {2.0f}; 20641 model->setOperandValue(param49, param49_init, sizeof(float) * 1); 20642 static int32_t param50_init[] = {4}; 20643 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20644 static int32_t param51_init[] = {4}; 20645 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20646 static bool8 layout_init[] = {true}; 20647 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20648 static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; 20649 model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); 20650 static int32_t bias1_init[] = {-150}; 20651 model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); 20652 static int32_t param52_init[] = {1}; 20653 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20654 static int32_t param53_init[] = {2}; 20655 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20656 static int32_t param54_init[] = {2}; 20657 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20658 static int32_t param55_init[] = {1}; 20659 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20660 static int32_t param56_init[] = {1}; 20661 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20662 static int32_t param57_init[] = {1}; 20663 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20664 static int32_t param58_init[] = {0}; 20665 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20666 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20667 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20668 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20669 // Phase 3, inputs and outputs 20670 model->identifyInputsAndOutputs( 20671 {in1}, 20672 {scoresOut1, classesOut1, out1}); 20673 assert(model->isValid()); 20674 } 20675 20676 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8_2(int i) { 20677 static std::set<int> ignore = {}; 20678 return ignore.find(i) != ignore.end(); 20679 } 20680 20681 void CreateModel_zero_sized_dynamic_output_shape_nchw_float16_2(Model *model) { 20682 OperandType type0(Type::BOOL, {}); 20683 OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); 20684 OperandType type135(Type::TENSOR_FLOAT16, {1}); 20685 OperandType type18(Type::TENSOR_INT32, {0}); 20686 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 20687 OperandType type193(Type::FLOAT16, {}); 20688 OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); 20689 OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); 20690 OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); 20691 OperandType type20(Type::TENSOR_INT32, {1}); 20692 OperandType type205(Type::TENSOR_FLOAT16, {0}); 20693 OperandType type216(Type::TENSOR_FLOAT16, {0, 1, 4, 4}); 20694 OperandType type5(Type::INT32, {}); 20695 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 20696 // Phase 1, operands 20697 auto scores1 = model->addOperand(&type196); 20698 auto roi1 = model->addOperand(&type194); 20699 auto param39 = model->addOperand(&type20); 20700 auto param40 = model->addOperand(&type193); 20701 auto param41 = model->addOperand(&type5); 20702 auto param42 = model->addOperand(&type5); 20703 auto param43 = model->addOperand(&type193); 20704 auto param44 = model->addOperand(&type193); 20705 auto param45 = model->addOperand(&type193); 20706 auto scoresOut1 = model->addOperand(&type205); 20707 auto roiOut1 = model->addOperand(&type195); 20708 auto classesOut1 = model->addOperand(&type18); 20709 auto batchSplitOut1 = model->addOperand(&type18); 20710 auto in1 = model->addOperand(&type191); 20711 auto param46 = model->addOperand(&type5); 20712 auto param47 = model->addOperand(&type5); 20713 auto param48 = model->addOperand(&type193); 20714 auto param49 = model->addOperand(&type193); 20715 auto param50 = model->addOperand(&type5); 20716 auto param51 = model->addOperand(&type5); 20717 auto layout = model->addOperand(&type0); 20718 auto featureMap1 = model->addOperand(&type216); 20719 auto weights1 = model->addOperand(&type134); 20720 auto bias1 = model->addOperand(&type135); 20721 auto param52 = model->addOperand(&type5); 20722 auto param53 = model->addOperand(&type5); 20723 auto param54 = model->addOperand(&type5); 20724 auto param55 = model->addOperand(&type5); 20725 auto param56 = model->addOperand(&type5); 20726 auto param57 = model->addOperand(&type5); 20727 auto param58 = model->addOperand(&type5); 20728 auto out1 = model->addOperand(&type96); 20729 // Phase 2, operations 20730 static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; 20731 model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); 20732 static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; 20733 model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); 20734 static int32_t param39_init[] = {0}; 20735 model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); 20736 static _Float16 param40_init[] = {0.30000001192092896f}; 20737 model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); 20738 static int32_t param41_init[] = {-1}; 20739 model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); 20740 static int32_t param42_init[] = {0}; 20741 model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); 20742 static _Float16 param43_init[] = {0.4000000059604645f}; 20743 model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); 20744 static _Float16 param44_init[] = {1.0f}; 20745 model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); 20746 static _Float16 param45_init[] = {0.30000001192092896f}; 20747 model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); 20748 static int32_t param46_init[] = {4}; 20749 model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); 20750 static int32_t param47_init[] = {4}; 20751 model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); 20752 static _Float16 param48_init[] = {2.0f}; 20753 model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); 20754 static _Float16 param49_init[] = {2.0f}; 20755 model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); 20756 static int32_t param50_init[] = {4}; 20757 model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); 20758 static int32_t param51_init[] = {4}; 20759 model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); 20760 static bool8 layout_init[] = {true}; 20761 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20762 static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; 20763 model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); 20764 static _Float16 bias1_init[] = {-1.5f}; 20765 model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); 20766 static int32_t param52_init[] = {1}; 20767 model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); 20768 static int32_t param53_init[] = {2}; 20769 model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); 20770 static int32_t param54_init[] = {2}; 20771 model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); 20772 static int32_t param55_init[] = {1}; 20773 model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); 20774 static int32_t param56_init[] = {1}; 20775 model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); 20776 static int32_t param57_init[] = {1}; 20777 model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); 20778 static int32_t param58_init[] = {0}; 20779 model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); 20780 model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); 20781 model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); 20782 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); 20783 // Phase 3, inputs and outputs 20784 model->identifyInputsAndOutputs( 20785 {in1}, 20786 {scoresOut1, classesOut1, out1}); 20787 assert(model->isValid()); 20788 } 20789 20790 inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16_2(int i) { 20791 static std::set<int> ignore = {}; 20792 return ignore.find(i) != ignore.end(); 20793 } 20794 20795 void CreateModel_nhwc_5(Model *model) { 20796 OperandType type0(Type::BOOL, {}); 20797 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 20798 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 20799 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20800 OperandType type4(Type::TENSOR_INT32, {4}); 20801 OperandType type5(Type::INT32, {}); 20802 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20803 // Phase 1, operands 20804 auto op15 = model->addOperand(&type1); 20805 auto op25 = model->addOperand(&type22); 20806 auto op35 = model->addOperand(&type9); 20807 auto shape5 = model->addOperand(&type4); 20808 auto param59 = model->addOperand(&type5); 20809 auto param60 = model->addOperand(&type5); 20810 auto param61 = model->addOperand(&type5); 20811 auto param62 = model->addOperand(&type5); 20812 auto layout = model->addOperand(&type0); 20813 auto op45 = model->addOperand(&type13); 20814 // Phase 2, operations 20815 static float op25_init[] = {2.0f}; 20816 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 20817 static float op35_init[] = {0.0f}; 20818 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 20819 static int32_t shape5_init[] = {1, 4, 4, 1}; 20820 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 20821 static int32_t param59_init[] = {1}; 20822 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 20823 static int32_t param60_init[] = {2}; 20824 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 20825 static int32_t param61_init[] = {2}; 20826 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 20827 static int32_t param62_init[] = {0}; 20828 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 20829 static bool8 layout_init[] = {false}; 20830 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20831 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 20832 // Phase 3, inputs and outputs 20833 model->identifyInputsAndOutputs( 20834 {op15}, 20835 {op45}); 20836 assert(model->isValid()); 20837 } 20838 20839 inline bool is_ignored_nhwc_5(int i) { 20840 static std::set<int> ignore = {}; 20841 return ignore.find(i) != ignore.end(); 20842 } 20843 20844 void CreateModel_nhwc_weight_as_input_5(Model *model) { 20845 OperandType type0(Type::BOOL, {}); 20846 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 20847 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 20848 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20849 OperandType type4(Type::TENSOR_INT32, {4}); 20850 OperandType type5(Type::INT32, {}); 20851 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20852 // Phase 1, operands 20853 auto op15 = model->addOperand(&type1); 20854 auto op25 = model->addOperand(&type22); 20855 auto op35 = model->addOperand(&type9); 20856 auto shape5 = model->addOperand(&type4); 20857 auto param59 = model->addOperand(&type5); 20858 auto param60 = model->addOperand(&type5); 20859 auto param61 = model->addOperand(&type5); 20860 auto param62 = model->addOperand(&type5); 20861 auto layout = model->addOperand(&type0); 20862 auto op45 = model->addOperand(&type13); 20863 // Phase 2, operations 20864 static int32_t shape5_init[] = {1, 4, 4, 1}; 20865 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 20866 static int32_t param59_init[] = {1}; 20867 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 20868 static int32_t param60_init[] = {2}; 20869 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 20870 static int32_t param61_init[] = {2}; 20871 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 20872 static int32_t param62_init[] = {0}; 20873 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 20874 static bool8 layout_init[] = {false}; 20875 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20876 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 20877 // Phase 3, inputs and outputs 20878 model->identifyInputsAndOutputs( 20879 {op15, op25, op35}, 20880 {op45}); 20881 assert(model->isValid()); 20882 } 20883 20884 inline bool is_ignored_nhwc_weight_as_input_5(int i) { 20885 static std::set<int> ignore = {}; 20886 return ignore.find(i) != ignore.end(); 20887 } 20888 20889 void CreateModel_nhwc_relaxed_5(Model *model) { 20890 OperandType type0(Type::BOOL, {}); 20891 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 20892 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 20893 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20894 OperandType type4(Type::TENSOR_INT32, {4}); 20895 OperandType type5(Type::INT32, {}); 20896 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20897 // Phase 1, operands 20898 auto op15 = model->addOperand(&type1); 20899 auto op25 = model->addOperand(&type22); 20900 auto op35 = model->addOperand(&type9); 20901 auto shape5 = model->addOperand(&type4); 20902 auto param59 = model->addOperand(&type5); 20903 auto param60 = model->addOperand(&type5); 20904 auto param61 = model->addOperand(&type5); 20905 auto param62 = model->addOperand(&type5); 20906 auto layout = model->addOperand(&type0); 20907 auto op45 = model->addOperand(&type13); 20908 // Phase 2, operations 20909 static float op25_init[] = {2.0f}; 20910 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 20911 static float op35_init[] = {0.0f}; 20912 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 20913 static int32_t shape5_init[] = {1, 4, 4, 1}; 20914 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 20915 static int32_t param59_init[] = {1}; 20916 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 20917 static int32_t param60_init[] = {2}; 20918 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 20919 static int32_t param61_init[] = {2}; 20920 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 20921 static int32_t param62_init[] = {0}; 20922 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 20923 static bool8 layout_init[] = {false}; 20924 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20925 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 20926 // Phase 3, inputs and outputs 20927 model->identifyInputsAndOutputs( 20928 {op15}, 20929 {op45}); 20930 // Phase 4: set relaxed execution 20931 model->relaxComputationFloat32toFloat16(true); 20932 assert(model->isValid()); 20933 } 20934 20935 inline bool is_ignored_nhwc_relaxed_5(int i) { 20936 static std::set<int> ignore = {}; 20937 return ignore.find(i) != ignore.end(); 20938 } 20939 20940 void CreateModel_nhwc_relaxed_weight_as_input_5(Model *model) { 20941 OperandType type0(Type::BOOL, {}); 20942 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 20943 OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); 20944 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 20945 OperandType type4(Type::TENSOR_INT32, {4}); 20946 OperandType type5(Type::INT32, {}); 20947 OperandType type9(Type::TENSOR_FLOAT32, {1}); 20948 // Phase 1, operands 20949 auto op15 = model->addOperand(&type1); 20950 auto op25 = model->addOperand(&type22); 20951 auto op35 = model->addOperand(&type9); 20952 auto shape5 = model->addOperand(&type4); 20953 auto param59 = model->addOperand(&type5); 20954 auto param60 = model->addOperand(&type5); 20955 auto param61 = model->addOperand(&type5); 20956 auto param62 = model->addOperand(&type5); 20957 auto layout = model->addOperand(&type0); 20958 auto op45 = model->addOperand(&type13); 20959 // Phase 2, operations 20960 static int32_t shape5_init[] = {1, 4, 4, 1}; 20961 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 20962 static int32_t param59_init[] = {1}; 20963 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 20964 static int32_t param60_init[] = {2}; 20965 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 20966 static int32_t param61_init[] = {2}; 20967 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 20968 static int32_t param62_init[] = {0}; 20969 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 20970 static bool8 layout_init[] = {false}; 20971 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 20972 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 20973 // Phase 3, inputs and outputs 20974 model->identifyInputsAndOutputs( 20975 {op15, op25, op35}, 20976 {op45}); 20977 // Phase 4: set relaxed execution 20978 model->relaxComputationFloat32toFloat16(true); 20979 assert(model->isValid()); 20980 } 20981 20982 inline bool is_ignored_nhwc_relaxed_weight_as_input_5(int i) { 20983 static std::set<int> ignore = {}; 20984 return ignore.find(i) != ignore.end(); 20985 } 20986 20987 void CreateModel_nhwc_quant8_5(Model *model) { 20988 OperandType type0(Type::BOOL, {}); 20989 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 20990 OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); 20991 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 20992 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 20993 OperandType type4(Type::TENSOR_INT32, {4}); 20994 OperandType type5(Type::INT32, {}); 20995 // Phase 1, operands 20996 auto op15 = model->addOperand(&type31); 20997 auto op25 = model->addOperand(&type218); 20998 auto op35 = model->addOperand(&type154); 20999 auto shape5 = model->addOperand(&type4); 21000 auto param59 = model->addOperand(&type5); 21001 auto param60 = model->addOperand(&type5); 21002 auto param61 = model->addOperand(&type5); 21003 auto param62 = model->addOperand(&type5); 21004 auto layout = model->addOperand(&type0); 21005 auto op45 = model->addOperand(&type155); 21006 // Phase 2, operations 21007 static uint8_t op25_init[] = {132}; 21008 model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); 21009 static int32_t op35_init[] = {0}; 21010 model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); 21011 static int32_t shape5_init[] = {1, 4, 4, 1}; 21012 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21013 static int32_t param59_init[] = {1}; 21014 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21015 static int32_t param60_init[] = {2}; 21016 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21017 static int32_t param61_init[] = {2}; 21018 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21019 static int32_t param62_init[] = {0}; 21020 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21021 static bool8 layout_init[] = {false}; 21022 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21023 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21024 // Phase 3, inputs and outputs 21025 model->identifyInputsAndOutputs( 21026 {op15}, 21027 {op45}); 21028 assert(model->isValid()); 21029 } 21030 21031 inline bool is_ignored_nhwc_quant8_5(int i) { 21032 static std::set<int> ignore = {}; 21033 return ignore.find(i) != ignore.end(); 21034 } 21035 21036 void CreateModel_nhwc_quant8_weight_as_input_5(Model *model) { 21037 OperandType type0(Type::BOOL, {}); 21038 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 21039 OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); 21040 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 21041 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 21042 OperandType type4(Type::TENSOR_INT32, {4}); 21043 OperandType type5(Type::INT32, {}); 21044 // Phase 1, operands 21045 auto op15 = model->addOperand(&type31); 21046 auto op25 = model->addOperand(&type218); 21047 auto op35 = model->addOperand(&type154); 21048 auto shape5 = model->addOperand(&type4); 21049 auto param59 = model->addOperand(&type5); 21050 auto param60 = model->addOperand(&type5); 21051 auto param61 = model->addOperand(&type5); 21052 auto param62 = model->addOperand(&type5); 21053 auto layout = model->addOperand(&type0); 21054 auto op45 = model->addOperand(&type155); 21055 // Phase 2, operations 21056 static int32_t shape5_init[] = {1, 4, 4, 1}; 21057 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21058 static int32_t param59_init[] = {1}; 21059 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21060 static int32_t param60_init[] = {2}; 21061 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21062 static int32_t param61_init[] = {2}; 21063 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21064 static int32_t param62_init[] = {0}; 21065 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21066 static bool8 layout_init[] = {false}; 21067 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21068 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21069 // Phase 3, inputs and outputs 21070 model->identifyInputsAndOutputs( 21071 {op15, op25, op35}, 21072 {op45}); 21073 assert(model->isValid()); 21074 } 21075 21076 inline bool is_ignored_nhwc_quant8_weight_as_input_5(int i) { 21077 static std::set<int> ignore = {}; 21078 return ignore.find(i) != ignore.end(); 21079 } 21080 21081 void CreateModel_nhwc_float16_5(Model *model) { 21082 OperandType type0(Type::BOOL, {}); 21083 OperandType type135(Type::TENSOR_FLOAT16, {1}); 21084 OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); 21085 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 21086 OperandType type4(Type::TENSOR_INT32, {4}); 21087 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 21088 OperandType type5(Type::INT32, {}); 21089 // Phase 1, operands 21090 auto op15 = model->addOperand(&type44); 21091 auto op25 = model->addOperand(&type191); 21092 auto op35 = model->addOperand(&type135); 21093 auto shape5 = model->addOperand(&type4); 21094 auto param59 = model->addOperand(&type5); 21095 auto param60 = model->addOperand(&type5); 21096 auto param61 = model->addOperand(&type5); 21097 auto param62 = model->addOperand(&type5); 21098 auto layout = model->addOperand(&type0); 21099 auto op45 = model->addOperand(&type158); 21100 // Phase 2, operations 21101 static _Float16 op25_init[] = {2.0f}; 21102 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); 21103 static _Float16 op35_init[] = {0.0f}; 21104 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); 21105 static int32_t shape5_init[] = {1, 4, 4, 1}; 21106 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21107 static int32_t param59_init[] = {1}; 21108 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21109 static int32_t param60_init[] = {2}; 21110 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21111 static int32_t param61_init[] = {2}; 21112 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21113 static int32_t param62_init[] = {0}; 21114 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21115 static bool8 layout_init[] = {false}; 21116 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21117 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21118 // Phase 3, inputs and outputs 21119 model->identifyInputsAndOutputs( 21120 {op15}, 21121 {op45}); 21122 assert(model->isValid()); 21123 } 21124 21125 inline bool is_ignored_nhwc_float16_5(int i) { 21126 static std::set<int> ignore = {}; 21127 return ignore.find(i) != ignore.end(); 21128 } 21129 21130 void CreateModel_nhwc_float16_weight_as_input_5(Model *model) { 21131 OperandType type0(Type::BOOL, {}); 21132 OperandType type138(Type::TENSOR_FLOAT16, {1}); 21133 OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); 21134 OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 21135 OperandType type4(Type::TENSOR_INT32, {4}); 21136 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 21137 OperandType type5(Type::INT32, {}); 21138 // Phase 1, operands 21139 auto op15 = model->addOperand(&type44); 21140 auto op25 = model->addOperand(&type219); 21141 auto op35 = model->addOperand(&type138); 21142 auto shape5 = model->addOperand(&type4); 21143 auto param59 = model->addOperand(&type5); 21144 auto param60 = model->addOperand(&type5); 21145 auto param61 = model->addOperand(&type5); 21146 auto param62 = model->addOperand(&type5); 21147 auto layout = model->addOperand(&type0); 21148 auto op45 = model->addOperand(&type158); 21149 // Phase 2, operations 21150 static int32_t shape5_init[] = {1, 4, 4, 1}; 21151 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21152 static int32_t param59_init[] = {1}; 21153 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21154 static int32_t param60_init[] = {2}; 21155 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21156 static int32_t param61_init[] = {2}; 21157 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21158 static int32_t param62_init[] = {0}; 21159 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21160 static bool8 layout_init[] = {false}; 21161 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21162 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21163 // Phase 3, inputs and outputs 21164 model->identifyInputsAndOutputs( 21165 {op15, op25, op35}, 21166 {op45}); 21167 assert(model->isValid()); 21168 } 21169 21170 inline bool is_ignored_nhwc_float16_weight_as_input_5(int i) { 21171 static std::set<int> ignore = {}; 21172 return ignore.find(i) != ignore.end(); 21173 } 21174 21175 void CreateModel_nchw_5(Model *model) { 21176 OperandType type0(Type::BOOL, {}); 21177 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 21178 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21179 OperandType type4(Type::TENSOR_INT32, {4}); 21180 OperandType type5(Type::INT32, {}); 21181 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 21182 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21183 // Phase 1, operands 21184 auto op15 = model->addOperand(&type62); 21185 auto op25 = model->addOperand(&type22); 21186 auto op35 = model->addOperand(&type9); 21187 auto shape5 = model->addOperand(&type4); 21188 auto param59 = model->addOperand(&type5); 21189 auto param60 = model->addOperand(&type5); 21190 auto param61 = model->addOperand(&type5); 21191 auto param62 = model->addOperand(&type5); 21192 auto layout = model->addOperand(&type0); 21193 auto op45 = model->addOperand(&type161); 21194 // Phase 2, operations 21195 static float op25_init[] = {2.0f}; 21196 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 21197 static float op35_init[] = {0.0f}; 21198 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 21199 static int32_t shape5_init[] = {1, 1, 4, 4}; 21200 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21201 static int32_t param59_init[] = {1}; 21202 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21203 static int32_t param60_init[] = {2}; 21204 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21205 static int32_t param61_init[] = {2}; 21206 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21207 static int32_t param62_init[] = {0}; 21208 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21209 static bool8 layout_init[] = {true}; 21210 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21211 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21212 // Phase 3, inputs and outputs 21213 model->identifyInputsAndOutputs( 21214 {op15}, 21215 {op45}); 21216 assert(model->isValid()); 21217 } 21218 21219 inline bool is_ignored_nchw_5(int i) { 21220 static std::set<int> ignore = {}; 21221 return ignore.find(i) != ignore.end(); 21222 } 21223 21224 void CreateModel_nchw_weight_as_input_5(Model *model) { 21225 OperandType type0(Type::BOOL, {}); 21226 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 21227 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21228 OperandType type4(Type::TENSOR_INT32, {4}); 21229 OperandType type5(Type::INT32, {}); 21230 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 21231 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21232 // Phase 1, operands 21233 auto op15 = model->addOperand(&type62); 21234 auto op25 = model->addOperand(&type22); 21235 auto op35 = model->addOperand(&type9); 21236 auto shape5 = model->addOperand(&type4); 21237 auto param59 = model->addOperand(&type5); 21238 auto param60 = model->addOperand(&type5); 21239 auto param61 = model->addOperand(&type5); 21240 auto param62 = model->addOperand(&type5); 21241 auto layout = model->addOperand(&type0); 21242 auto op45 = model->addOperand(&type161); 21243 // Phase 2, operations 21244 static int32_t shape5_init[] = {1, 1, 4, 4}; 21245 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21246 static int32_t param59_init[] = {1}; 21247 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21248 static int32_t param60_init[] = {2}; 21249 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21250 static int32_t param61_init[] = {2}; 21251 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21252 static int32_t param62_init[] = {0}; 21253 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21254 static bool8 layout_init[] = {true}; 21255 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21256 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21257 // Phase 3, inputs and outputs 21258 model->identifyInputsAndOutputs( 21259 {op15, op25, op35}, 21260 {op45}); 21261 assert(model->isValid()); 21262 } 21263 21264 inline bool is_ignored_nchw_weight_as_input_5(int i) { 21265 static std::set<int> ignore = {}; 21266 return ignore.find(i) != ignore.end(); 21267 } 21268 21269 void CreateModel_nchw_relaxed_5(Model *model) { 21270 OperandType type0(Type::BOOL, {}); 21271 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 21272 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21273 OperandType type4(Type::TENSOR_INT32, {4}); 21274 OperandType type5(Type::INT32, {}); 21275 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 21276 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21277 // Phase 1, operands 21278 auto op15 = model->addOperand(&type62); 21279 auto op25 = model->addOperand(&type22); 21280 auto op35 = model->addOperand(&type9); 21281 auto shape5 = model->addOperand(&type4); 21282 auto param59 = model->addOperand(&type5); 21283 auto param60 = model->addOperand(&type5); 21284 auto param61 = model->addOperand(&type5); 21285 auto param62 = model->addOperand(&type5); 21286 auto layout = model->addOperand(&type0); 21287 auto op45 = model->addOperand(&type161); 21288 // Phase 2, operations 21289 static float op25_init[] = {2.0f}; 21290 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 21291 static float op35_init[] = {0.0f}; 21292 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 21293 static int32_t shape5_init[] = {1, 1, 4, 4}; 21294 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21295 static int32_t param59_init[] = {1}; 21296 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21297 static int32_t param60_init[] = {2}; 21298 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21299 static int32_t param61_init[] = {2}; 21300 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21301 static int32_t param62_init[] = {0}; 21302 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21303 static bool8 layout_init[] = {true}; 21304 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21305 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21306 // Phase 3, inputs and outputs 21307 model->identifyInputsAndOutputs( 21308 {op15}, 21309 {op45}); 21310 // Phase 4: set relaxed execution 21311 model->relaxComputationFloat32toFloat16(true); 21312 assert(model->isValid()); 21313 } 21314 21315 inline bool is_ignored_nchw_relaxed_5(int i) { 21316 static std::set<int> ignore = {}; 21317 return ignore.find(i) != ignore.end(); 21318 } 21319 21320 void CreateModel_nchw_relaxed_weight_as_input_5(Model *model) { 21321 OperandType type0(Type::BOOL, {}); 21322 OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); 21323 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21324 OperandType type4(Type::TENSOR_INT32, {4}); 21325 OperandType type5(Type::INT32, {}); 21326 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 21327 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21328 // Phase 1, operands 21329 auto op15 = model->addOperand(&type62); 21330 auto op25 = model->addOperand(&type22); 21331 auto op35 = model->addOperand(&type9); 21332 auto shape5 = model->addOperand(&type4); 21333 auto param59 = model->addOperand(&type5); 21334 auto param60 = model->addOperand(&type5); 21335 auto param61 = model->addOperand(&type5); 21336 auto param62 = model->addOperand(&type5); 21337 auto layout = model->addOperand(&type0); 21338 auto op45 = model->addOperand(&type161); 21339 // Phase 2, operations 21340 static int32_t shape5_init[] = {1, 1, 4, 4}; 21341 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21342 static int32_t param59_init[] = {1}; 21343 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21344 static int32_t param60_init[] = {2}; 21345 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21346 static int32_t param61_init[] = {2}; 21347 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21348 static int32_t param62_init[] = {0}; 21349 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21350 static bool8 layout_init[] = {true}; 21351 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21352 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21353 // Phase 3, inputs and outputs 21354 model->identifyInputsAndOutputs( 21355 {op15, op25, op35}, 21356 {op45}); 21357 // Phase 4: set relaxed execution 21358 model->relaxComputationFloat32toFloat16(true); 21359 assert(model->isValid()); 21360 } 21361 21362 inline bool is_ignored_nchw_relaxed_weight_as_input_5(int i) { 21363 static std::set<int> ignore = {}; 21364 return ignore.find(i) != ignore.end(); 21365 } 21366 21367 void CreateModel_nchw_quant8_5(Model *model) { 21368 OperandType type0(Type::BOOL, {}); 21369 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 21370 OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); 21371 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 21372 OperandType type4(Type::TENSOR_INT32, {4}); 21373 OperandType type5(Type::INT32, {}); 21374 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 21375 // Phase 1, operands 21376 auto op15 = model->addOperand(&type66); 21377 auto op25 = model->addOperand(&type218); 21378 auto op35 = model->addOperand(&type154); 21379 auto shape5 = model->addOperand(&type4); 21380 auto param59 = model->addOperand(&type5); 21381 auto param60 = model->addOperand(&type5); 21382 auto param61 = model->addOperand(&type5); 21383 auto param62 = model->addOperand(&type5); 21384 auto layout = model->addOperand(&type0); 21385 auto op45 = model->addOperand(&type163); 21386 // Phase 2, operations 21387 static uint8_t op25_init[] = {132}; 21388 model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); 21389 static int32_t op35_init[] = {0}; 21390 model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); 21391 static int32_t shape5_init[] = {1, 1, 4, 4}; 21392 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21393 static int32_t param59_init[] = {1}; 21394 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21395 static int32_t param60_init[] = {2}; 21396 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21397 static int32_t param61_init[] = {2}; 21398 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21399 static int32_t param62_init[] = {0}; 21400 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21401 static bool8 layout_init[] = {true}; 21402 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21403 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21404 // Phase 3, inputs and outputs 21405 model->identifyInputsAndOutputs( 21406 {op15}, 21407 {op45}); 21408 assert(model->isValid()); 21409 } 21410 21411 inline bool is_ignored_nchw_quant8_5(int i) { 21412 static std::set<int> ignore = {}; 21413 return ignore.find(i) != ignore.end(); 21414 } 21415 21416 void CreateModel_nchw_quant8_weight_as_input_5(Model *model) { 21417 OperandType type0(Type::BOOL, {}); 21418 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 21419 OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); 21420 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 21421 OperandType type4(Type::TENSOR_INT32, {4}); 21422 OperandType type5(Type::INT32, {}); 21423 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 21424 // Phase 1, operands 21425 auto op15 = model->addOperand(&type66); 21426 auto op25 = model->addOperand(&type218); 21427 auto op35 = model->addOperand(&type154); 21428 auto shape5 = model->addOperand(&type4); 21429 auto param59 = model->addOperand(&type5); 21430 auto param60 = model->addOperand(&type5); 21431 auto param61 = model->addOperand(&type5); 21432 auto param62 = model->addOperand(&type5); 21433 auto layout = model->addOperand(&type0); 21434 auto op45 = model->addOperand(&type163); 21435 // Phase 2, operations 21436 static int32_t shape5_init[] = {1, 1, 4, 4}; 21437 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21438 static int32_t param59_init[] = {1}; 21439 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21440 static int32_t param60_init[] = {2}; 21441 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21442 static int32_t param61_init[] = {2}; 21443 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21444 static int32_t param62_init[] = {0}; 21445 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21446 static bool8 layout_init[] = {true}; 21447 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21448 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21449 // Phase 3, inputs and outputs 21450 model->identifyInputsAndOutputs( 21451 {op15, op25, op35}, 21452 {op45}); 21453 assert(model->isValid()); 21454 } 21455 21456 inline bool is_ignored_nchw_quant8_weight_as_input_5(int i) { 21457 static std::set<int> ignore = {}; 21458 return ignore.find(i) != ignore.end(); 21459 } 21460 21461 void CreateModel_nchw_float16_5(Model *model) { 21462 OperandType type0(Type::BOOL, {}); 21463 OperandType type135(Type::TENSOR_FLOAT16, {1}); 21464 OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); 21465 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 21466 OperandType type4(Type::TENSOR_INT32, {4}); 21467 OperandType type5(Type::INT32, {}); 21468 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 21469 // Phase 1, operands 21470 auto op15 = model->addOperand(&type74); 21471 auto op25 = model->addOperand(&type191); 21472 auto op35 = model->addOperand(&type135); 21473 auto shape5 = model->addOperand(&type4); 21474 auto param59 = model->addOperand(&type5); 21475 auto param60 = model->addOperand(&type5); 21476 auto param61 = model->addOperand(&type5); 21477 auto param62 = model->addOperand(&type5); 21478 auto layout = model->addOperand(&type0); 21479 auto op45 = model->addOperand(&type165); 21480 // Phase 2, operations 21481 static _Float16 op25_init[] = {2.0f}; 21482 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); 21483 static _Float16 op35_init[] = {0.0f}; 21484 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); 21485 static int32_t shape5_init[] = {1, 1, 4, 4}; 21486 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21487 static int32_t param59_init[] = {1}; 21488 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21489 static int32_t param60_init[] = {2}; 21490 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21491 static int32_t param61_init[] = {2}; 21492 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21493 static int32_t param62_init[] = {0}; 21494 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21495 static bool8 layout_init[] = {true}; 21496 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21497 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21498 // Phase 3, inputs and outputs 21499 model->identifyInputsAndOutputs( 21500 {op15}, 21501 {op45}); 21502 assert(model->isValid()); 21503 } 21504 21505 inline bool is_ignored_nchw_float16_5(int i) { 21506 static std::set<int> ignore = {}; 21507 return ignore.find(i) != ignore.end(); 21508 } 21509 21510 void CreateModel_nchw_float16_weight_as_input_5(Model *model) { 21511 OperandType type0(Type::BOOL, {}); 21512 OperandType type138(Type::TENSOR_FLOAT16, {1}); 21513 OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); 21514 OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 21515 OperandType type4(Type::TENSOR_INT32, {4}); 21516 OperandType type5(Type::INT32, {}); 21517 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 21518 // Phase 1, operands 21519 auto op15 = model->addOperand(&type74); 21520 auto op25 = model->addOperand(&type219); 21521 auto op35 = model->addOperand(&type138); 21522 auto shape5 = model->addOperand(&type4); 21523 auto param59 = model->addOperand(&type5); 21524 auto param60 = model->addOperand(&type5); 21525 auto param61 = model->addOperand(&type5); 21526 auto param62 = model->addOperand(&type5); 21527 auto layout = model->addOperand(&type0); 21528 auto op45 = model->addOperand(&type165); 21529 // Phase 2, operations 21530 static int32_t shape5_init[] = {1, 1, 4, 4}; 21531 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21532 static int32_t param59_init[] = {1}; 21533 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21534 static int32_t param60_init[] = {2}; 21535 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21536 static int32_t param61_init[] = {2}; 21537 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21538 static int32_t param62_init[] = {0}; 21539 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21540 static bool8 layout_init[] = {true}; 21541 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21542 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21543 // Phase 3, inputs and outputs 21544 model->identifyInputsAndOutputs( 21545 {op15, op25, op35}, 21546 {op45}); 21547 assert(model->isValid()); 21548 } 21549 21550 inline bool is_ignored_nchw_float16_weight_as_input_5(int i) { 21551 static std::set<int> ignore = {}; 21552 return ignore.find(i) != ignore.end(); 21553 } 21554 21555 void CreateModel_dynamic_output_shape_nhwc_5(Model *model) { 21556 OperandType type0(Type::BOOL, {}); 21557 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 21558 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21559 OperandType type4(Type::TENSOR_INT32, {4}); 21560 OperandType type5(Type::INT32, {}); 21561 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 21562 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21563 // Phase 1, operands 21564 auto op15 = model->addOperand(&type1); 21565 auto op25 = model->addOperand(&type22); 21566 auto op35 = model->addOperand(&type9); 21567 auto shape5 = model->addOperand(&type4); 21568 auto param59 = model->addOperand(&type5); 21569 auto param60 = model->addOperand(&type5); 21570 auto param61 = model->addOperand(&type5); 21571 auto param62 = model->addOperand(&type5); 21572 auto layout = model->addOperand(&type0); 21573 auto op45 = model->addOperand(&type88); 21574 // Phase 2, operations 21575 static float op25_init[] = {2.0f}; 21576 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 21577 static float op35_init[] = {0.0f}; 21578 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 21579 static int32_t shape5_init[] = {1, 4, 4, 1}; 21580 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21581 static int32_t param59_init[] = {1}; 21582 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21583 static int32_t param60_init[] = {2}; 21584 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21585 static int32_t param61_init[] = {2}; 21586 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21587 static int32_t param62_init[] = {0}; 21588 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21589 static bool8 layout_init[] = {false}; 21590 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21591 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21592 // Phase 3, inputs and outputs 21593 model->identifyInputsAndOutputs( 21594 {op15}, 21595 {op45}); 21596 assert(model->isValid()); 21597 } 21598 21599 inline bool is_ignored_dynamic_output_shape_nhwc_5(int i) { 21600 static std::set<int> ignore = {}; 21601 return ignore.find(i) != ignore.end(); 21602 } 21603 21604 void CreateModel_dynamic_output_shape_nhwc_weight_as_input_5(Model *model) { 21605 OperandType type0(Type::BOOL, {}); 21606 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 21607 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21608 OperandType type4(Type::TENSOR_INT32, {4}); 21609 OperandType type5(Type::INT32, {}); 21610 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 21611 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21612 // Phase 1, operands 21613 auto op15 = model->addOperand(&type1); 21614 auto op25 = model->addOperand(&type22); 21615 auto op35 = model->addOperand(&type9); 21616 auto shape5 = model->addOperand(&type4); 21617 auto param59 = model->addOperand(&type5); 21618 auto param60 = model->addOperand(&type5); 21619 auto param61 = model->addOperand(&type5); 21620 auto param62 = model->addOperand(&type5); 21621 auto layout = model->addOperand(&type0); 21622 auto op45 = model->addOperand(&type88); 21623 // Phase 2, operations 21624 static int32_t shape5_init[] = {1, 4, 4, 1}; 21625 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21626 static int32_t param59_init[] = {1}; 21627 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21628 static int32_t param60_init[] = {2}; 21629 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21630 static int32_t param61_init[] = {2}; 21631 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21632 static int32_t param62_init[] = {0}; 21633 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21634 static bool8 layout_init[] = {false}; 21635 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21636 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21637 // Phase 3, inputs and outputs 21638 model->identifyInputsAndOutputs( 21639 {op15, op25, op35}, 21640 {op45}); 21641 assert(model->isValid()); 21642 } 21643 21644 inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_5(int i) { 21645 static std::set<int> ignore = {}; 21646 return ignore.find(i) != ignore.end(); 21647 } 21648 21649 void CreateModel_dynamic_output_shape_nhwc_relaxed_5(Model *model) { 21650 OperandType type0(Type::BOOL, {}); 21651 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 21652 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21653 OperandType type4(Type::TENSOR_INT32, {4}); 21654 OperandType type5(Type::INT32, {}); 21655 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 21656 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21657 // Phase 1, operands 21658 auto op15 = model->addOperand(&type1); 21659 auto op25 = model->addOperand(&type22); 21660 auto op35 = model->addOperand(&type9); 21661 auto shape5 = model->addOperand(&type4); 21662 auto param59 = model->addOperand(&type5); 21663 auto param60 = model->addOperand(&type5); 21664 auto param61 = model->addOperand(&type5); 21665 auto param62 = model->addOperand(&type5); 21666 auto layout = model->addOperand(&type0); 21667 auto op45 = model->addOperand(&type88); 21668 // Phase 2, operations 21669 static float op25_init[] = {2.0f}; 21670 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 21671 static float op35_init[] = {0.0f}; 21672 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 21673 static int32_t shape5_init[] = {1, 4, 4, 1}; 21674 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21675 static int32_t param59_init[] = {1}; 21676 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21677 static int32_t param60_init[] = {2}; 21678 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21679 static int32_t param61_init[] = {2}; 21680 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21681 static int32_t param62_init[] = {0}; 21682 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21683 static bool8 layout_init[] = {false}; 21684 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21685 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21686 // Phase 3, inputs and outputs 21687 model->identifyInputsAndOutputs( 21688 {op15}, 21689 {op45}); 21690 // Phase 4: set relaxed execution 21691 model->relaxComputationFloat32toFloat16(true); 21692 assert(model->isValid()); 21693 } 21694 21695 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_5(int i) { 21696 static std::set<int> ignore = {}; 21697 return ignore.find(i) != ignore.end(); 21698 } 21699 21700 void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_5(Model *model) { 21701 OperandType type0(Type::BOOL, {}); 21702 OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); 21703 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21704 OperandType type4(Type::TENSOR_INT32, {4}); 21705 OperandType type5(Type::INT32, {}); 21706 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 21707 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21708 // Phase 1, operands 21709 auto op15 = model->addOperand(&type1); 21710 auto op25 = model->addOperand(&type22); 21711 auto op35 = model->addOperand(&type9); 21712 auto shape5 = model->addOperand(&type4); 21713 auto param59 = model->addOperand(&type5); 21714 auto param60 = model->addOperand(&type5); 21715 auto param61 = model->addOperand(&type5); 21716 auto param62 = model->addOperand(&type5); 21717 auto layout = model->addOperand(&type0); 21718 auto op45 = model->addOperand(&type88); 21719 // Phase 2, operations 21720 static int32_t shape5_init[] = {1, 4, 4, 1}; 21721 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21722 static int32_t param59_init[] = {1}; 21723 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21724 static int32_t param60_init[] = {2}; 21725 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21726 static int32_t param61_init[] = {2}; 21727 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21728 static int32_t param62_init[] = {0}; 21729 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21730 static bool8 layout_init[] = {false}; 21731 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21732 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21733 // Phase 3, inputs and outputs 21734 model->identifyInputsAndOutputs( 21735 {op15, op25, op35}, 21736 {op45}); 21737 // Phase 4: set relaxed execution 21738 model->relaxComputationFloat32toFloat16(true); 21739 assert(model->isValid()); 21740 } 21741 21742 inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_5(int i) { 21743 static std::set<int> ignore = {}; 21744 return ignore.find(i) != ignore.end(); 21745 } 21746 21747 void CreateModel_dynamic_output_shape_nhwc_quant8_5(Model *model) { 21748 OperandType type0(Type::BOOL, {}); 21749 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 21750 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 21751 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 21752 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 21753 OperandType type4(Type::TENSOR_INT32, {4}); 21754 OperandType type5(Type::INT32, {}); 21755 // Phase 1, operands 21756 auto op15 = model->addOperand(&type31); 21757 auto op25 = model->addOperand(&type218); 21758 auto op35 = model->addOperand(&type154); 21759 auto shape5 = model->addOperand(&type4); 21760 auto param59 = model->addOperand(&type5); 21761 auto param60 = model->addOperand(&type5); 21762 auto param61 = model->addOperand(&type5); 21763 auto param62 = model->addOperand(&type5); 21764 auto layout = model->addOperand(&type0); 21765 auto op45 = model->addOperand(&type166); 21766 // Phase 2, operations 21767 static uint8_t op25_init[] = {132}; 21768 model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); 21769 static int32_t op35_init[] = {0}; 21770 model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); 21771 static int32_t shape5_init[] = {1, 4, 4, 1}; 21772 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21773 static int32_t param59_init[] = {1}; 21774 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21775 static int32_t param60_init[] = {2}; 21776 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21777 static int32_t param61_init[] = {2}; 21778 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21779 static int32_t param62_init[] = {0}; 21780 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21781 static bool8 layout_init[] = {false}; 21782 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21783 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21784 // Phase 3, inputs and outputs 21785 model->identifyInputsAndOutputs( 21786 {op15}, 21787 {op45}); 21788 assert(model->isValid()); 21789 } 21790 21791 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_5(int i) { 21792 static std::set<int> ignore = {}; 21793 return ignore.find(i) != ignore.end(); 21794 } 21795 21796 void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_5(Model *model) { 21797 OperandType type0(Type::BOOL, {}); 21798 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 21799 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 21800 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 21801 OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); 21802 OperandType type4(Type::TENSOR_INT32, {4}); 21803 OperandType type5(Type::INT32, {}); 21804 // Phase 1, operands 21805 auto op15 = model->addOperand(&type31); 21806 auto op25 = model->addOperand(&type218); 21807 auto op35 = model->addOperand(&type154); 21808 auto shape5 = model->addOperand(&type4); 21809 auto param59 = model->addOperand(&type5); 21810 auto param60 = model->addOperand(&type5); 21811 auto param61 = model->addOperand(&type5); 21812 auto param62 = model->addOperand(&type5); 21813 auto layout = model->addOperand(&type0); 21814 auto op45 = model->addOperand(&type166); 21815 // Phase 2, operations 21816 static int32_t shape5_init[] = {1, 4, 4, 1}; 21817 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21818 static int32_t param59_init[] = {1}; 21819 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21820 static int32_t param60_init[] = {2}; 21821 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21822 static int32_t param61_init[] = {2}; 21823 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21824 static int32_t param62_init[] = {0}; 21825 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21826 static bool8 layout_init[] = {false}; 21827 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21828 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21829 // Phase 3, inputs and outputs 21830 model->identifyInputsAndOutputs( 21831 {op15, op25, op35}, 21832 {op45}); 21833 assert(model->isValid()); 21834 } 21835 21836 inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_5(int i) { 21837 static std::set<int> ignore = {}; 21838 return ignore.find(i) != ignore.end(); 21839 } 21840 21841 void CreateModel_dynamic_output_shape_nhwc_float16_5(Model *model) { 21842 OperandType type0(Type::BOOL, {}); 21843 OperandType type135(Type::TENSOR_FLOAT16, {1}); 21844 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 21845 OperandType type4(Type::TENSOR_INT32, {4}); 21846 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 21847 OperandType type5(Type::INT32, {}); 21848 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 21849 // Phase 1, operands 21850 auto op15 = model->addOperand(&type44); 21851 auto op25 = model->addOperand(&type191); 21852 auto op35 = model->addOperand(&type135); 21853 auto shape5 = model->addOperand(&type4); 21854 auto param59 = model->addOperand(&type5); 21855 auto param60 = model->addOperand(&type5); 21856 auto param61 = model->addOperand(&type5); 21857 auto param62 = model->addOperand(&type5); 21858 auto layout = model->addOperand(&type0); 21859 auto op45 = model->addOperand(&type96); 21860 // Phase 2, operations 21861 static _Float16 op25_init[] = {2.0f}; 21862 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); 21863 static _Float16 op35_init[] = {0.0f}; 21864 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); 21865 static int32_t shape5_init[] = {1, 4, 4, 1}; 21866 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21867 static int32_t param59_init[] = {1}; 21868 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21869 static int32_t param60_init[] = {2}; 21870 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21871 static int32_t param61_init[] = {2}; 21872 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21873 static int32_t param62_init[] = {0}; 21874 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21875 static bool8 layout_init[] = {false}; 21876 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21877 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21878 // Phase 3, inputs and outputs 21879 model->identifyInputsAndOutputs( 21880 {op15}, 21881 {op45}); 21882 assert(model->isValid()); 21883 } 21884 21885 inline bool is_ignored_dynamic_output_shape_nhwc_float16_5(int i) { 21886 static std::set<int> ignore = {}; 21887 return ignore.find(i) != ignore.end(); 21888 } 21889 21890 void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_5(Model *model) { 21891 OperandType type0(Type::BOOL, {}); 21892 OperandType type138(Type::TENSOR_FLOAT16, {1}); 21893 OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 21894 OperandType type4(Type::TENSOR_INT32, {4}); 21895 OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); 21896 OperandType type5(Type::INT32, {}); 21897 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 21898 // Phase 1, operands 21899 auto op15 = model->addOperand(&type44); 21900 auto op25 = model->addOperand(&type219); 21901 auto op35 = model->addOperand(&type138); 21902 auto shape5 = model->addOperand(&type4); 21903 auto param59 = model->addOperand(&type5); 21904 auto param60 = model->addOperand(&type5); 21905 auto param61 = model->addOperand(&type5); 21906 auto param62 = model->addOperand(&type5); 21907 auto layout = model->addOperand(&type0); 21908 auto op45 = model->addOperand(&type96); 21909 // Phase 2, operations 21910 static int32_t shape5_init[] = {1, 4, 4, 1}; 21911 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21912 static int32_t param59_init[] = {1}; 21913 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21914 static int32_t param60_init[] = {2}; 21915 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21916 static int32_t param61_init[] = {2}; 21917 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21918 static int32_t param62_init[] = {0}; 21919 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21920 static bool8 layout_init[] = {false}; 21921 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21922 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21923 // Phase 3, inputs and outputs 21924 model->identifyInputsAndOutputs( 21925 {op15, op25, op35}, 21926 {op45}); 21927 assert(model->isValid()); 21928 } 21929 21930 inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_5(int i) { 21931 static std::set<int> ignore = {}; 21932 return ignore.find(i) != ignore.end(); 21933 } 21934 21935 void CreateModel_dynamic_output_shape_nchw_5(Model *model) { 21936 OperandType type0(Type::BOOL, {}); 21937 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21938 OperandType type4(Type::TENSOR_INT32, {4}); 21939 OperandType type5(Type::INT32, {}); 21940 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 21941 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 21942 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21943 // Phase 1, operands 21944 auto op15 = model->addOperand(&type62); 21945 auto op25 = model->addOperand(&type22); 21946 auto op35 = model->addOperand(&type9); 21947 auto shape5 = model->addOperand(&type4); 21948 auto param59 = model->addOperand(&type5); 21949 auto param60 = model->addOperand(&type5); 21950 auto param61 = model->addOperand(&type5); 21951 auto param62 = model->addOperand(&type5); 21952 auto layout = model->addOperand(&type0); 21953 auto op45 = model->addOperand(&type88); 21954 // Phase 2, operations 21955 static float op25_init[] = {2.0f}; 21956 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 21957 static float op35_init[] = {0.0f}; 21958 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 21959 static int32_t shape5_init[] = {1, 1, 4, 4}; 21960 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 21961 static int32_t param59_init[] = {1}; 21962 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 21963 static int32_t param60_init[] = {2}; 21964 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 21965 static int32_t param61_init[] = {2}; 21966 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 21967 static int32_t param62_init[] = {0}; 21968 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 21969 static bool8 layout_init[] = {true}; 21970 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 21971 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 21972 // Phase 3, inputs and outputs 21973 model->identifyInputsAndOutputs( 21974 {op15}, 21975 {op45}); 21976 assert(model->isValid()); 21977 } 21978 21979 inline bool is_ignored_dynamic_output_shape_nchw_5(int i) { 21980 static std::set<int> ignore = {}; 21981 return ignore.find(i) != ignore.end(); 21982 } 21983 21984 void CreateModel_dynamic_output_shape_nchw_weight_as_input_5(Model *model) { 21985 OperandType type0(Type::BOOL, {}); 21986 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 21987 OperandType type4(Type::TENSOR_INT32, {4}); 21988 OperandType type5(Type::INT32, {}); 21989 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 21990 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 21991 OperandType type9(Type::TENSOR_FLOAT32, {1}); 21992 // Phase 1, operands 21993 auto op15 = model->addOperand(&type62); 21994 auto op25 = model->addOperand(&type22); 21995 auto op35 = model->addOperand(&type9); 21996 auto shape5 = model->addOperand(&type4); 21997 auto param59 = model->addOperand(&type5); 21998 auto param60 = model->addOperand(&type5); 21999 auto param61 = model->addOperand(&type5); 22000 auto param62 = model->addOperand(&type5); 22001 auto layout = model->addOperand(&type0); 22002 auto op45 = model->addOperand(&type88); 22003 // Phase 2, operations 22004 static int32_t shape5_init[] = {1, 1, 4, 4}; 22005 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22006 static int32_t param59_init[] = {1}; 22007 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22008 static int32_t param60_init[] = {2}; 22009 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22010 static int32_t param61_init[] = {2}; 22011 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22012 static int32_t param62_init[] = {0}; 22013 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22014 static bool8 layout_init[] = {true}; 22015 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22016 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22017 // Phase 3, inputs and outputs 22018 model->identifyInputsAndOutputs( 22019 {op15, op25, op35}, 22020 {op45}); 22021 assert(model->isValid()); 22022 } 22023 22024 inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_5(int i) { 22025 static std::set<int> ignore = {}; 22026 return ignore.find(i) != ignore.end(); 22027 } 22028 22029 void CreateModel_dynamic_output_shape_nchw_relaxed_5(Model *model) { 22030 OperandType type0(Type::BOOL, {}); 22031 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 22032 OperandType type4(Type::TENSOR_INT32, {4}); 22033 OperandType type5(Type::INT32, {}); 22034 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 22035 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 22036 OperandType type9(Type::TENSOR_FLOAT32, {1}); 22037 // Phase 1, operands 22038 auto op15 = model->addOperand(&type62); 22039 auto op25 = model->addOperand(&type22); 22040 auto op35 = model->addOperand(&type9); 22041 auto shape5 = model->addOperand(&type4); 22042 auto param59 = model->addOperand(&type5); 22043 auto param60 = model->addOperand(&type5); 22044 auto param61 = model->addOperand(&type5); 22045 auto param62 = model->addOperand(&type5); 22046 auto layout = model->addOperand(&type0); 22047 auto op45 = model->addOperand(&type88); 22048 // Phase 2, operations 22049 static float op25_init[] = {2.0f}; 22050 model->setOperandValue(op25, op25_init, sizeof(float) * 1); 22051 static float op35_init[] = {0.0f}; 22052 model->setOperandValue(op35, op35_init, sizeof(float) * 1); 22053 static int32_t shape5_init[] = {1, 1, 4, 4}; 22054 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22055 static int32_t param59_init[] = {1}; 22056 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22057 static int32_t param60_init[] = {2}; 22058 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22059 static int32_t param61_init[] = {2}; 22060 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22061 static int32_t param62_init[] = {0}; 22062 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22063 static bool8 layout_init[] = {true}; 22064 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22065 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22066 // Phase 3, inputs and outputs 22067 model->identifyInputsAndOutputs( 22068 {op15}, 22069 {op45}); 22070 // Phase 4: set relaxed execution 22071 model->relaxComputationFloat32toFloat16(true); 22072 assert(model->isValid()); 22073 } 22074 22075 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_5(int i) { 22076 static std::set<int> ignore = {}; 22077 return ignore.find(i) != ignore.end(); 22078 } 22079 22080 void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_5(Model *model) { 22081 OperandType type0(Type::BOOL, {}); 22082 OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); 22083 OperandType type4(Type::TENSOR_INT32, {4}); 22084 OperandType type5(Type::INT32, {}); 22085 OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); 22086 OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); 22087 OperandType type9(Type::TENSOR_FLOAT32, {1}); 22088 // Phase 1, operands 22089 auto op15 = model->addOperand(&type62); 22090 auto op25 = model->addOperand(&type22); 22091 auto op35 = model->addOperand(&type9); 22092 auto shape5 = model->addOperand(&type4); 22093 auto param59 = model->addOperand(&type5); 22094 auto param60 = model->addOperand(&type5); 22095 auto param61 = model->addOperand(&type5); 22096 auto param62 = model->addOperand(&type5); 22097 auto layout = model->addOperand(&type0); 22098 auto op45 = model->addOperand(&type88); 22099 // Phase 2, operations 22100 static int32_t shape5_init[] = {1, 1, 4, 4}; 22101 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22102 static int32_t param59_init[] = {1}; 22103 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22104 static int32_t param60_init[] = {2}; 22105 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22106 static int32_t param61_init[] = {2}; 22107 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22108 static int32_t param62_init[] = {0}; 22109 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22110 static bool8 layout_init[] = {true}; 22111 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22112 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22113 // Phase 3, inputs and outputs 22114 model->identifyInputsAndOutputs( 22115 {op15, op25, op35}, 22116 {op45}); 22117 // Phase 4: set relaxed execution 22118 model->relaxComputationFloat32toFloat16(true); 22119 assert(model->isValid()); 22120 } 22121 22122 inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_5(int i) { 22123 static std::set<int> ignore = {}; 22124 return ignore.find(i) != ignore.end(); 22125 } 22126 22127 void CreateModel_dynamic_output_shape_nchw_quant8_5(Model *model) { 22128 OperandType type0(Type::BOOL, {}); 22129 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 22130 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 22131 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 22132 OperandType type4(Type::TENSOR_INT32, {4}); 22133 OperandType type5(Type::INT32, {}); 22134 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 22135 // Phase 1, operands 22136 auto op15 = model->addOperand(&type66); 22137 auto op25 = model->addOperand(&type218); 22138 auto op35 = model->addOperand(&type154); 22139 auto shape5 = model->addOperand(&type4); 22140 auto param59 = model->addOperand(&type5); 22141 auto param60 = model->addOperand(&type5); 22142 auto param61 = model->addOperand(&type5); 22143 auto param62 = model->addOperand(&type5); 22144 auto layout = model->addOperand(&type0); 22145 auto op45 = model->addOperand(&type166); 22146 // Phase 2, operations 22147 static uint8_t op25_init[] = {132}; 22148 model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); 22149 static int32_t op35_init[] = {0}; 22150 model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); 22151 static int32_t shape5_init[] = {1, 1, 4, 4}; 22152 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22153 static int32_t param59_init[] = {1}; 22154 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22155 static int32_t param60_init[] = {2}; 22156 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22157 static int32_t param61_init[] = {2}; 22158 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22159 static int32_t param62_init[] = {0}; 22160 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22161 static bool8 layout_init[] = {true}; 22162 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22163 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22164 // Phase 3, inputs and outputs 22165 model->identifyInputsAndOutputs( 22166 {op15}, 22167 {op45}); 22168 assert(model->isValid()); 22169 } 22170 22171 inline bool is_ignored_dynamic_output_shape_nchw_quant8_5(int i) { 22172 static std::set<int> ignore = {}; 22173 return ignore.find(i) != ignore.end(); 22174 } 22175 22176 void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_5(Model *model) { 22177 OperandType type0(Type::BOOL, {}); 22178 OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); 22179 OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); 22180 OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); 22181 OperandType type4(Type::TENSOR_INT32, {4}); 22182 OperandType type5(Type::INT32, {}); 22183 OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); 22184 // Phase 1, operands 22185 auto op15 = model->addOperand(&type66); 22186 auto op25 = model->addOperand(&type218); 22187 auto op35 = model->addOperand(&type154); 22188 auto shape5 = model->addOperand(&type4); 22189 auto param59 = model->addOperand(&type5); 22190 auto param60 = model->addOperand(&type5); 22191 auto param61 = model->addOperand(&type5); 22192 auto param62 = model->addOperand(&type5); 22193 auto layout = model->addOperand(&type0); 22194 auto op45 = model->addOperand(&type166); 22195 // Phase 2, operations 22196 static int32_t shape5_init[] = {1, 1, 4, 4}; 22197 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22198 static int32_t param59_init[] = {1}; 22199 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22200 static int32_t param60_init[] = {2}; 22201 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22202 static int32_t param61_init[] = {2}; 22203 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22204 static int32_t param62_init[] = {0}; 22205 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22206 static bool8 layout_init[] = {true}; 22207 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22208 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22209 // Phase 3, inputs and outputs 22210 model->identifyInputsAndOutputs( 22211 {op15, op25, op35}, 22212 {op45}); 22213 assert(model->isValid()); 22214 } 22215 22216 inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_5(int i) { 22217 static std::set<int> ignore = {}; 22218 return ignore.find(i) != ignore.end(); 22219 } 22220 22221 void CreateModel_dynamic_output_shape_nchw_float16_5(Model *model) { 22222 OperandType type0(Type::BOOL, {}); 22223 OperandType type135(Type::TENSOR_FLOAT16, {1}); 22224 OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 22225 OperandType type4(Type::TENSOR_INT32, {4}); 22226 OperandType type5(Type::INT32, {}); 22227 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 22228 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 22229 // Phase 1, operands 22230 auto op15 = model->addOperand(&type74); 22231 auto op25 = model->addOperand(&type191); 22232 auto op35 = model->addOperand(&type135); 22233 auto shape5 = model->addOperand(&type4); 22234 auto param59 = model->addOperand(&type5); 22235 auto param60 = model->addOperand(&type5); 22236 auto param61 = model->addOperand(&type5); 22237 auto param62 = model->addOperand(&type5); 22238 auto layout = model->addOperand(&type0); 22239 auto op45 = model->addOperand(&type96); 22240 // Phase 2, operations 22241 static _Float16 op25_init[] = {2.0f}; 22242 model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); 22243 static _Float16 op35_init[] = {0.0f}; 22244 model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); 22245 static int32_t shape5_init[] = {1, 1, 4, 4}; 22246 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22247 static int32_t param59_init[] = {1}; 22248 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22249 static int32_t param60_init[] = {2}; 22250 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22251 static int32_t param61_init[] = {2}; 22252 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22253 static int32_t param62_init[] = {0}; 22254 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22255 static bool8 layout_init[] = {true}; 22256 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22257 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22258 // Phase 3, inputs and outputs 22259 model->identifyInputsAndOutputs( 22260 {op15}, 22261 {op45}); 22262 assert(model->isValid()); 22263 } 22264 22265 inline bool is_ignored_dynamic_output_shape_nchw_float16_5(int i) { 22266 static std::set<int> ignore = {}; 22267 return ignore.find(i) != ignore.end(); 22268 } 22269 22270 void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_5(Model *model) { 22271 OperandType type0(Type::BOOL, {}); 22272 OperandType type138(Type::TENSOR_FLOAT16, {1}); 22273 OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); 22274 OperandType type4(Type::TENSOR_INT32, {4}); 22275 OperandType type5(Type::INT32, {}); 22276 OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); 22277 OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); 22278 // Phase 1, operands 22279 auto op15 = model->addOperand(&type74); 22280 auto op25 = model->addOperand(&type219); 22281 auto op35 = model->addOperand(&type138); 22282 auto shape5 = model->addOperand(&type4); 22283 auto param59 = model->addOperand(&type5); 22284 auto param60 = model->addOperand(&type5); 22285 auto param61 = model->addOperand(&type5); 22286 auto param62 = model->addOperand(&type5); 22287 auto layout = model->addOperand(&type0); 22288 auto op45 = model->addOperand(&type96); 22289 // Phase 2, operations 22290 static int32_t shape5_init[] = {1, 1, 4, 4}; 22291 model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); 22292 static int32_t param59_init[] = {1}; 22293 model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); 22294 static int32_t param60_init[] = {2}; 22295 model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); 22296 static int32_t param61_init[] = {2}; 22297 model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); 22298 static int32_t param62_init[] = {0}; 22299 model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); 22300 static bool8 layout_init[] = {true}; 22301 model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); 22302 model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); 22303 // Phase 3, inputs and outputs 22304 model->identifyInputsAndOutputs( 22305 {op15, op25, op35}, 22306 {op45}); 22307 assert(model->isValid()); 22308 } 22309 22310 inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_5(int i) { 22311 static std::set<int> ignore = {}; 22312 return ignore.find(i) != ignore.end(); 22313 } 22314 22315