| // clang-format off |
| // Generated file (from: transpose_conv2d.mod.py). Do not edit |
| void CreateModel_nhwc_none(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type38(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type39(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type38); |
| auto op3 = model->addOperand(&type39); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type42(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type43(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type42); |
| auto op3 = model->addOperand(&type43); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_none_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_none_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type50(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type51(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type50); |
| auto op3 = model->addOperand(&type51); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type52(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type53(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type52); |
| auto op3 = model->addOperand(&type53); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type54(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type55(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type54); |
| auto op3 = model->addOperand(&type55); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type56(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type57(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type56); |
| auto op3 = model->addOperand(&type57); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu1_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu1_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type6(Type::TENSOR_FLOAT32, {1, 5, 5, 2}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type6); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type30(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type30); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type37(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.5f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type58(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type59(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type58); |
| auto op3 = model->addOperand(&type59); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type37); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type33(Type::TENSOR_QUANT8_ASYMM, {1, 5, 5, 2}, 0.1f, 80); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type60(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type61(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type60); |
| auto op3 = model->addOperand(&type61); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type33); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relu6_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type47(Type::TENSOR_FLOAT16, {1, 5, 5, 2}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type47); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relu6_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| OperandType type70(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type71(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type70); |
| auto op3 = model->addOperand(&type71); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type72(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type73(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type72); |
| auto op3 = model->addOperand(&type73); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_none_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_none_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| OperandType type76(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type77(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type76); |
| auto op3 = model->addOperand(&type77); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type78(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type79(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type78); |
| auto op3 = model->addOperand(&type79); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| OperandType type80(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type81(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type80); |
| auto op3 = model->addOperand(&type81); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type82(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type83(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type82); |
| auto op3 = model->addOperand(&type83); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu1_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu1_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type63(Type::TENSOR_FLOAT32, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type63); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type65(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type65); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type69(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.5f, 80); |
| OperandType type84(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type85(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type84); |
| auto op3 = model->addOperand(&type85); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type69); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type67(Type::TENSOR_QUANT8_ASYMM, {1, 2, 5, 5}, 0.1f, 80); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type86(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type87(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type86); |
| auto op3 = model->addOperand(&type87); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type67); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relu6_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type75(Type::TENSOR_FLOAT16, {1, 2, 5, 5}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type75); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relu6_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| OperandType type92(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type93(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type92); |
| auto op3 = model->addOperand(&type93); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| OperandType type94(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type95(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type94); |
| auto op3 = model->addOperand(&type95); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_none_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_none_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| OperandType type97(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type98(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type97); |
| auto op3 = model->addOperand(&type98); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type100(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| OperandType type99(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type99); |
| auto op3 = model->addOperand(&type100); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type101(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type102(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type101); |
| auto op3 = model->addOperand(&type102); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type103(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type104(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type103); |
| auto op3 = model->addOperand(&type104); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu1_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu1_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type1); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type27(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 0); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type27); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type31); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type105(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type106(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type105); |
| auto op3 = model->addOperand(&type106); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type107(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type108(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type34(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.25f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type34); |
| auto op2 = model->addOperand(&type107); |
| auto op3 = model->addOperand(&type108); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relu6_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type44); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 5, 5, 2}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relu6_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type109(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type110(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type109); |
| auto op3 = model->addOperand(&type110); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type111(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type112(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type111); |
| auto op3 = model->addOperand(&type112); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_none_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {0}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_none_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type113(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type114(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type113); |
| auto op3 = model->addOperand(&type114); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type115(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type116(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type115); |
| auto op3 = model->addOperand(&type116); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {1}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type117(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type118(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type117); |
| auto op3 = model->addOperand(&type118); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type119(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type120(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type119); |
| auto op3 = model->addOperand(&type120); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu1_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {2}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu1_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(float) * 18); |
| static float op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(float) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type62); |
| auto op2 = model->addOperand(&type2); |
| auto op3 = model->addOperand(&type3); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {2, 6, 10, 14, 18, 22, 26, 30, 34, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type28(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 0); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type64(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 0); |
| OperandType type89(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type64); |
| auto op2 = model->addOperand(&type28); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type89); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static uint8_t op2_init[] = {130, 134, 138, 142, 146, 150, 154, 158, 162, 132, 136, 140, 144, 148, 152, 156, 160, 164}; |
| model->setOperandValue(op2, op2_init, sizeof(uint8_t) * 18); |
| static int32_t op3_init[] = {-6, -8}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type29(Type::TENSOR_INT32, {2}, 0.25f, 0); |
| OperandType type32(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type66); |
| auto op2 = model->addOperand(&type32); |
| auto op3 = model->addOperand(&type29); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type35(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type36(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type35); |
| auto op3 = model->addOperand(&type36); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type121(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type122(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type91(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type121); |
| auto op3 = model->addOperand(&type122); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type91); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type40(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type41(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type40); |
| auto op3 = model->addOperand(&type41); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int8_t op2_init[] = {4, 12, 20, 28, 36, 44, 52, 60, 68, 4, 8, 12, 16, 20, 24, 28, 32, 36}; |
| model->setOperandValue(op2, op2_init, sizeof(int8_t) * 18); |
| static int32_t op3_init[] = {-24, -16}; |
| model->setOperandValue(op3, op3_init, sizeof(int32_t) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type123(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {2, 3, 3, 1}, SymmPerChannelQuantParams({0.25f, 0.5f},0)); |
| OperandType type124(Type::TENSOR_INT32, {2}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type68(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.25f, 100); |
| OperandType type90(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 80); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type68); |
| auto op2 = model->addOperand(&type123); |
| auto op3 = model->addOperand(&type124); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type90); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_channelQuant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type45); |
| auto op3 = model->addOperand(&type46); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op2, op2_init, sizeof(_Float16) * 18); |
| static _Float16 op3_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(op3, op3_init, sizeof(_Float16) * 2); |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relu6_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type48(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type49(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op1 = model->addOperand(&type74); |
| auto op2 = model->addOperand(&type48); |
| auto op3 = model->addOperand(&type49); |
| auto shape = model->addOperand(&type4); |
| auto param = model->addOperand(&type5); |
| auto param1 = model->addOperand(&type5); |
| auto param2 = model->addOperand(&type5); |
| auto act = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op4 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape_init[] = {1, 2, 5, 5}; |
| model->setOperandValue(shape, shape_init, sizeof(int32_t) * 4); |
| static int32_t param_init[] = {2}; |
| model->setOperandValue(param, param_init, sizeof(int32_t) * 1); |
| static int32_t param1_init[] = {2}; |
| model->setOperandValue(param1, param1_init, sizeof(int32_t) * 1); |
| static int32_t param2_init[] = {2}; |
| model->setOperandValue(param2, param2_init, sizeof(int32_t) * 1); |
| static int32_t act_init[] = {3}; |
| model->setOperandValue(act, act_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op1, op2, op3, shape, param, param1, param2, act, layout}, {op4}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op1, op2, op3}, |
| {op4}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relu6_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type10); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type10); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type10); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type10(Type::TENSOR_FLOAT32, {1, 3, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type10); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type128); |
| // Phase 2, operations |
| static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; |
| model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type128); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); |
| OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type129); |
| auto op31 = model->addOperand(&type130); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type128); |
| // Phase 2, operations |
| static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; |
| model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type128(Type::TENSOR_QUANT8_ASYMM, {1, 3, 4, 1}, 20.0f, 50); |
| OperandType type131(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type132(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type131); |
| auto op31 = model->addOperand(&type132); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type128); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type136(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type133); |
| auto op21 = model->addOperand(&type134); |
| auto op31 = model->addOperand(&type135); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type136); |
| // Phase 2, operations |
| static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); |
| static _Float16 op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); |
| OperandType type136(Type::TENSOR_FLOAT16, {1, 3, 4, 1}); |
| OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type133); |
| auto op21 = model->addOperand(&type137); |
| auto op31 = model->addOperand(&type138); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type136); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type140); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type140); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type140); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type140(Type::TENSOR_FLOAT32, {1, 1, 3, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type140); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type142); |
| // Phase 2, operations |
| static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; |
| model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type142); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type129); |
| auto op31 = model->addOperand(&type130); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type142); |
| // Phase 2, operations |
| static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; |
| model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type142(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 4}, 20.0f, 50); |
| OperandType type143(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type144(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type143); |
| auto op31 = model->addOperand(&type144); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type142); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); |
| OperandType type146(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type145); |
| auto op21 = model->addOperand(&type134); |
| auto op31 = model->addOperand(&type135); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type146); |
| // Phase 2, operations |
| static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); |
| static _Float16 op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); |
| OperandType type146(Type::TENSOR_FLOAT16, {1, 1, 3, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type145); |
| auto op21 = model->addOperand(&type137); |
| auto op31 = model->addOperand(&type138); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type146); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type7(Type::TENSOR_FLOAT32, {1, 1, 2, 1}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type7); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; |
| model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type129); |
| auto op31 = model->addOperand(&type130); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; |
| model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type125(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 1}, 2.0f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type148(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type149(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type125); |
| auto op21 = model->addOperand(&type148); |
| auto op31 = model->addOperand(&type149); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type133); |
| auto op21 = model->addOperand(&type134); |
| auto op31 = model->addOperand(&type135); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); |
| static _Float16 op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type133(Type::TENSOR_FLOAT16, {1, 1, 2, 1}); |
| OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type133); |
| auto op21 = model->addOperand(&type137); |
| auto op31 = model->addOperand(&type138); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 3, 4, 1}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(float) * 9); |
| static float op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(float) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type139(Type::TENSOR_FLOAT32, {1, 1, 1, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type139); |
| auto op21 = model->addOperand(&type8); |
| auto op31 = model->addOperand(&type9); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static uint8_t op21_init[] = {164, 148, 152, 164, 160, 148, 140, 132, 144}; |
| model->setOperandValue(op21, op21_init, sizeof(uint8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type126(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.25f, 128); |
| OperandType type127(Type::TENSOR_INT32, {1}, 0.5f, 0); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type126); |
| auto op31 = model->addOperand(&type127); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_channelQuant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type129(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type130(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type129); |
| auto op31 = model->addOperand(&type130); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int8_t op21_init[] = {36, 20, 24, 36, 32, 20, 12, 4, 16}; |
| model->setOperandValue(op21, op21_init, sizeof(int8_t) * 9); |
| static int32_t op31_init[] = {-2000}; |
| model->setOperandValue(op31, op31_init, sizeof(int32_t) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_channelQuant8_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type141(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 2}, 2.0f, 0); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type150(Type::TENSOR_QUANT8_SYMM_PER_CHANNEL, {1, 3, 3, 1}, SymmPerChannelQuantParams({0.25f},0)); |
| OperandType type151(Type::TENSOR_INT32, {1}, 0.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type141); |
| auto op21 = model->addOperand(&type150); |
| auto op31 = model->addOperand(&type151); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_channelQuant8_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type145); |
| auto op21 = model->addOperand(&type134); |
| auto op31 = model->addOperand(&type135); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 op21_init[] = {9.0f, 5.0f, 6.0f, 9.0f, 8.0f, 5.0f, 3.0f, 1.0f, 4.0f}; |
| model->setOperandValue(op21, op21_init, sizeof(_Float16) * 9); |
| static _Float16 op31_init[] = {-1000.0f}; |
| model->setOperandValue(op31, op31_init, sizeof(_Float16) * 1); |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type137(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type145(Type::TENSOR_FLOAT16, {1, 1, 1, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op11 = model->addOperand(&type145); |
| auto op21 = model->addOperand(&type137); |
| auto op31 = model->addOperand(&type138); |
| auto shape1 = model->addOperand(&type4); |
| auto param3 = model->addOperand(&type5); |
| auto param4 = model->addOperand(&type5); |
| auto param5 = model->addOperand(&type5); |
| auto param6 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op41 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape1_init[] = {1, 1, 3, 4}; |
| model->setOperandValue(shape1, shape1_init, sizeof(int32_t) * 4); |
| static int32_t param3_init[] = {1}; |
| model->setOperandValue(param3, param3_init, sizeof(int32_t) * 1); |
| static int32_t param4_init[] = {3}; |
| model->setOperandValue(param4, param4_init, sizeof(int32_t) * 1); |
| static int32_t param5_init[] = {3}; |
| model->setOperandValue(param5, param5_init, sizeof(int32_t) * 1); |
| static int32_t param6_init[] = {1}; |
| model->setOperandValue(param6, param6_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op11, op21, op31, shape1, param3, param4, param5, param6, layout}, {op41}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op11, op21, op31}, |
| {op41}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type13); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type13); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type13); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type13); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type152); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type155); |
| // Phase 2, operations |
| static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); |
| static int32_t op32_init[] = {0}; |
| model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type152); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type155); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type156); |
| auto op22 = model->addOperand(&type157); |
| auto op32 = model->addOperand(&type135); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type158); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); |
| static _Float16 op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type156); |
| auto op22 = model->addOperand(&type159); |
| auto op32 = model->addOperand(&type138); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type158); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type161); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type161); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type161); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type161); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type162); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type163); |
| // Phase 2, operations |
| static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); |
| static int32_t op32_init[] = {0}; |
| model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type162); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type163); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type164); |
| auto op22 = model->addOperand(&type157); |
| auto op32 = model->addOperand(&type135); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type165); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); |
| static _Float16 op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type164); |
| auto op22 = model->addOperand(&type159); |
| auto op32 = model->addOperand(&type138); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type165); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type11); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type152); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type166); |
| // Phase 2, operations |
| static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); |
| static int32_t op32_init[] = {0}; |
| model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type152); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type166); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type156); |
| auto op22 = model->addOperand(&type157); |
| auto op32 = model->addOperand(&type135); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); |
| static _Float16 op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type156); |
| auto op22 = model->addOperand(&type159); |
| auto op32 = model->addOperand(&type138); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(float) * 18); |
| static float op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(float) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type160); |
| auto op22 = model->addOperand(&type12); |
| auto op32 = model->addOperand(&type9); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type162); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type166); |
| // Phase 2, operations |
| static uint8_t op22_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op22, op22_init, sizeof(uint8_t) * 18); |
| static int32_t op32_init[] = {0}; |
| model->setOperandValue(op32, op32_init, sizeof(int32_t) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type162); |
| auto op22 = model->addOperand(&type153); |
| auto op32 = model->addOperand(&type154); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type166); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type164); |
| auto op22 = model->addOperand(&type157); |
| auto op32 = model->addOperand(&type135); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op22, op22_init, sizeof(_Float16) * 18); |
| static _Float16 op32_init[] = {0.0f}; |
| model->setOperandValue(op32, op32_init, sizeof(_Float16) * 1); |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op12 = model->addOperand(&type164); |
| auto op22 = model->addOperand(&type159); |
| auto op32 = model->addOperand(&type138); |
| auto shape2 = model->addOperand(&type4); |
| auto param7 = model->addOperand(&type5); |
| auto param8 = model->addOperand(&type5); |
| auto param9 = model->addOperand(&type5); |
| auto param10 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op42 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape2_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape2, shape2_init, sizeof(int32_t) * 4); |
| static int32_t param7_init[] = {1}; |
| model->setOperandValue(param7, param7_init, sizeof(int32_t) * 1); |
| static int32_t param8_init[] = {1}; |
| model->setOperandValue(param8, param8_init, sizeof(int32_t) * 1); |
| static int32_t param9_init[] = {1}; |
| model->setOperandValue(param9, param9_init, sizeof(int32_t) * 1); |
| static int32_t param10_init[] = {0}; |
| model->setOperandValue(param10, param10_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op12, op22, op32, shape2, param7, param8, param9, param10, layout}, {op42}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op12, op22, op32}, |
| {op42}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type14); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type14); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type14); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type14(Type::TENSOR_FLOAT32, {1, 6, 6, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type14); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type169(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type167); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type169); |
| // Phase 2, operations |
| static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); |
| static int32_t op33_init[] = {0}; |
| model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type169(Type::TENSOR_QUANT8_ASYMM, {1, 6, 6, 1}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type167); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type169); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type170(Type::TENSOR_FLOAT16, {1, 6, 6, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type156); |
| auto op23 = model->addOperand(&type157); |
| auto op33 = model->addOperand(&type135); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type170); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); |
| static _Float16 op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type170(Type::TENSOR_FLOAT16, {1, 6, 6, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type156); |
| auto op23 = model->addOperand(&type159); |
| auto op33 = model->addOperand(&type138); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type170); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type171); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type171); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type171); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type171(Type::TENSOR_FLOAT32, {1, 1, 6, 6}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type171); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); |
| OperandType type173(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type172); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type173); |
| // Phase 2, operations |
| static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); |
| static int32_t op33_init[] = {0}; |
| model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); |
| OperandType type173(Type::TENSOR_QUANT8_ASYMM, {1, 1, 6, 6}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type172); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type173); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type174(Type::TENSOR_FLOAT16, {1, 1, 6, 6}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type164); |
| auto op23 = model->addOperand(&type157); |
| auto op33 = model->addOperand(&type135); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type174); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); |
| static _Float16 op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type174(Type::TENSOR_FLOAT16, {1, 1, 6, 6}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type164); |
| auto op23 = model->addOperand(&type159); |
| auto op33 = model->addOperand(&type138); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type174); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type11); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type167); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type175); |
| // Phase 2, operations |
| static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); |
| static int32_t op33_init[] = {0}; |
| model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type167(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.25f, 10); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type167); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type175); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type156); |
| auto op23 = model->addOperand(&type157); |
| auto op33 = model->addOperand(&type135); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); |
| static _Float16 op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type156); |
| auto op23 = model->addOperand(&type159); |
| auto op33 = model->addOperand(&type138); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 6, 6, 1}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(float) * 18); |
| static float op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(float) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type160); |
| auto op23 = model->addOperand(&type12); |
| auto op33 = model->addOperand(&type9); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); |
| OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type172); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type175); |
| // Phase 2, operations |
| static uint8_t op23_init[] = {130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164}; |
| model->setOperandValue(op23, op23_init, sizeof(uint8_t) * 18); |
| static int32_t op33_init[] = {0}; |
| model->setOperandValue(op33, op33_init, sizeof(int32_t) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type153(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.5f, 128); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type172(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.25f, 10); |
| OperandType type175(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 32.0f, 80); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type172); |
| auto op23 = model->addOperand(&type153); |
| auto op33 = model->addOperand(&type168); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type175); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type164); |
| auto op23 = model->addOperand(&type157); |
| auto op33 = model->addOperand(&type135); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op23, op23_init, sizeof(_Float16) * 18); |
| static _Float16 op33_init[] = {0.0f}; |
| model->setOperandValue(op33, op33_init, sizeof(_Float16) * 1); |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_3(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op13 = model->addOperand(&type164); |
| auto op23 = model->addOperand(&type159); |
| auto op33 = model->addOperand(&type138); |
| auto shape3 = model->addOperand(&type4); |
| auto param11 = model->addOperand(&type5); |
| auto param12 = model->addOperand(&type5); |
| auto param13 = model->addOperand(&type5); |
| auto param14 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op43 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape3_init[] = {1, 1, 6, 6}; |
| model->setOperandValue(shape3, shape3_init, sizeof(int32_t) * 4); |
| static int32_t param11_init[] = {2}; |
| model->setOperandValue(param11, param11_init, sizeof(int32_t) * 1); |
| static int32_t param12_init[] = {1}; |
| model->setOperandValue(param12, param12_init, sizeof(int32_t) * 1); |
| static int32_t param13_init[] = {1}; |
| model->setOperandValue(param13, param13_init, sizeof(int32_t) * 1); |
| static int32_t param14_init[] = {0}; |
| model->setOperandValue(param14, param14_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op13, op23, op33, shape3, param11, param12, param13, param14, layout}, {op43}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op13, op23, op33}, |
| {op43}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_3(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type8); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type8); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type8); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type8); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type177(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 20.0f, 50); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type152); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type177); |
| // Phase 2, operations |
| static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; |
| model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); |
| static int32_t op34_init[] = {0}; |
| model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type177(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 20.0f, 50); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type152); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type177); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type156); |
| auto op24 = model->addOperand(&type157); |
| auto op34 = model->addOperand(&type135); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type134); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); |
| static _Float16 op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type156); |
| auto op24 = model->addOperand(&type159); |
| auto op34 = model->addOperand(&type138); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type134); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type178); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type178); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type178); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type178(Type::TENSOR_FLOAT32, {1, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type178); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type179(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 20.0f, 50); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type162); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type179); |
| // Phase 2, operations |
| static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; |
| model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); |
| static int32_t op34_init[] = {0}; |
| model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type179(Type::TENSOR_QUANT8_ASYMM, {1, 1, 3, 3}, 20.0f, 50); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type162); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type179); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type180(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type164); |
| auto op24 = model->addOperand(&type157); |
| auto op34 = model->addOperand(&type135); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type180); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); |
| static _Float16 op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type180(Type::TENSOR_FLOAT16, {1, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type164); |
| auto op24 = model->addOperand(&type159); |
| auto op34 = model->addOperand(&type138); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type180); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type11(Type::TENSOR_FLOAT32, {1, 4, 4, 2}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type11); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type152); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type147); |
| // Phase 2, operations |
| static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; |
| model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); |
| static int32_t op34_init[] = {0}; |
| model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type152(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 2}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type152); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type156); |
| auto op24 = model->addOperand(&type157); |
| auto op34 = model->addOperand(&type135); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); |
| static _Float16 op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type156(Type::TENSOR_FLOAT16, {1, 4, 4, 2}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type156); |
| auto op24 = model->addOperand(&type159); |
| auto op34 = model->addOperand(&type138); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(float) * 18); |
| static float op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(float) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type12(Type::TENSOR_FLOAT32, {1, 3, 3, 2}); |
| OperandType type160(Type::TENSOR_FLOAT32, {1, 2, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type160); |
| auto op24 = model->addOperand(&type12); |
| auto op34 = model->addOperand(&type9); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type162); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type147); |
| // Phase 2, operations |
| static uint8_t op24_init[] = {132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200}; |
| model->setOperandValue(op24, op24_init, sizeof(uint8_t) * 18); |
| static int32_t op34_init[] = {0}; |
| model->setOperandValue(op34, op34_init, sizeof(int32_t) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type147(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 20.0f, 50); |
| OperandType type162(Type::TENSOR_QUANT8_ASYMM, {1, 2, 4, 4}, 0.5f, 100); |
| OperandType type168(Type::TENSOR_INT32, {1}, 0.125f, 0); |
| OperandType type176(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 2}, 0.25f, 128); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type162); |
| auto op24 = model->addOperand(&type176); |
| auto op34 = model->addOperand(&type168); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type147); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type157(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type164); |
| auto op24 = model->addOperand(&type157); |
| auto op34 = model->addOperand(&type135); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type96); |
| // Phase 2, operations |
| 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}; |
| model->setOperandValue(op24, op24_init, sizeof(_Float16) * 18); |
| static _Float16 op34_init[] = {0.0f}; |
| model->setOperandValue(op34, op34_init, sizeof(_Float16) * 1); |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_4(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type159(Type::TENSOR_FLOAT16, {1, 3, 3, 2}); |
| OperandType type164(Type::TENSOR_FLOAT16, {1, 2, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op14 = model->addOperand(&type164); |
| auto op24 = model->addOperand(&type159); |
| auto op34 = model->addOperand(&type138); |
| auto param15 = model->addOperand(&type5); |
| auto param16 = model->addOperand(&type5); |
| auto param17 = model->addOperand(&type5); |
| auto param18 = model->addOperand(&type5); |
| auto param19 = model->addOperand(&type5); |
| auto param20 = model->addOperand(&type5); |
| auto param21 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op44 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t param15_init[] = {1}; |
| model->setOperandValue(param15, param15_init, sizeof(int32_t) * 1); |
| static int32_t param16_init[] = {2}; |
| model->setOperandValue(param16, param16_init, sizeof(int32_t) * 1); |
| static int32_t param17_init[] = {2}; |
| model->setOperandValue(param17, param17_init, sizeof(int32_t) * 1); |
| static int32_t param18_init[] = {1}; |
| model->setOperandValue(param18, param18_init, sizeof(int32_t) * 1); |
| static int32_t param19_init[] = {1}; |
| model->setOperandValue(param19, param19_init, sizeof(int32_t) * 1); |
| static int32_t param20_init[] = {1}; |
| model->setOperandValue(param20, param20_init, sizeof(int32_t) * 1); |
| static int32_t param21_init[] = {0}; |
| model->setOperandValue(param21, param21_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op14, op24, op34, param15, param16, param17, param18, param19, param20, param21, layout}, {op44}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op14, op24, op34}, |
| {op44}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_4(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); |
| OperandType type24(Type::TENSOR_FLOAT32, {0, 5, 5, 2}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type23); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type24); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); |
| OperandType type24(Type::TENSOR_FLOAT32, {0, 5, 5, 2}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type23); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type24); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); |
| OperandType type182(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type184(Type::TENSOR_QUANT8_ASYMM, {0, 5, 5, 2}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type187); |
| auto roi = model->addOperand(&type185); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type188); |
| auto roiOut = model->addOperand(&type186); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type183); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type182); |
| auto weights = model->addOperand(&type189); |
| auto bias = model->addOperand(&type181); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type184); |
| // Phase 2, operations |
| static uint8_t scores_init[] = {137, 129}; |
| model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); |
| static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; |
| model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); |
| static int32_t bias_init[] = {-150, -200}; |
| model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type190(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type192(Type::TENSOR_FLOAT16, {0, 5, 5, 2}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type197(Type::TENSOR_FLOAT16, {0}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type196); |
| auto roi = model->addOperand(&type194); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type193); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type193); |
| auto param27 = model->addOperand(&type193); |
| auto param28 = model->addOperand(&type193); |
| auto scoresOut = model->addOperand(&type197); |
| auto roiOut = model->addOperand(&type195); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type191); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type193); |
| auto param32 = model->addOperand(&type193); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type190); |
| auto weights = model->addOperand(&type45); |
| auto bias = model->addOperand(&type46); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type192); |
| // Phase 2, operations |
| static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); |
| static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static _Float16 param23_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static _Float16 param26_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); |
| static _Float16 param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); |
| static _Float16 param28_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static _Float16 param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); |
| static _Float16 param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); |
| static _Float16 bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); |
| OperandType type199(Type::TENSOR_FLOAT32, {0, 2, 5, 5}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type198); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type199); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); |
| OperandType type199(Type::TENSOR_FLOAT32, {0, 2, 5, 5}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type198); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type199); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type200(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); |
| OperandType type201(Type::TENSOR_QUANT8_ASYMM, {0, 2, 5, 5}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type187); |
| auto roi = model->addOperand(&type185); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type188); |
| auto roiOut = model->addOperand(&type186); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type183); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type200); |
| auto weights = model->addOperand(&type189); |
| auto bias = model->addOperand(&type181); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type201); |
| // Phase 2, operations |
| static uint8_t scores_init[] = {137, 129}; |
| model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); |
| static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; |
| model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); |
| static int32_t bias_init[] = {-150, -200}; |
| model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type197(Type::TENSOR_FLOAT16, {0}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type202(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); |
| OperandType type203(Type::TENSOR_FLOAT16, {0, 2, 5, 5}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type196); |
| auto roi = model->addOperand(&type194); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type193); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type193); |
| auto param27 = model->addOperand(&type193); |
| auto param28 = model->addOperand(&type193); |
| auto scoresOut = model->addOperand(&type197); |
| auto roiOut = model->addOperand(&type195); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type191); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type193); |
| auto param32 = model->addOperand(&type193); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type202); |
| auto weights = model->addOperand(&type45); |
| auto bias = model->addOperand(&type46); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type203); |
| // Phase 2, operations |
| static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); |
| static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static _Float16 param23_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static _Float16 param26_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); |
| static _Float16 param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); |
| static _Float16 param28_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static _Float16 param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); |
| static _Float16 param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); |
| static _Float16 bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type23); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type23(Type::TENSOR_FLOAT32, {0, 2, 2, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type23); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); |
| OperandType type182(Type::TENSOR_QUANT8_ASYMM, {0, 2, 2, 1}, 0.1f, 128); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type187); |
| auto roi = model->addOperand(&type185); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type188); |
| auto roiOut = model->addOperand(&type186); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type183); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type182); |
| auto weights = model->addOperand(&type189); |
| auto bias = model->addOperand(&type181); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type204); |
| // Phase 2, operations |
| static uint8_t scores_init[] = {137, 129}; |
| model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); |
| static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; |
| model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); |
| static int32_t bias_init[] = {-150, -200}; |
| model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type190(Type::TENSOR_FLOAT16, {0, 2, 2, 1}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type205(Type::TENSOR_FLOAT16, {0}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type196); |
| auto roi = model->addOperand(&type194); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type193); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type193); |
| auto param27 = model->addOperand(&type193); |
| auto param28 = model->addOperand(&type193); |
| auto scoresOut = model->addOperand(&type205); |
| auto roiOut = model->addOperand(&type195); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type191); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type193); |
| auto param32 = model->addOperand(&type193); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type190); |
| auto weights = model->addOperand(&type45); |
| auto bias = model->addOperand(&type46); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); |
| static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static _Float16 param23_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static _Float16 param26_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); |
| static _Float16 param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); |
| static _Float16 param28_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static _Float16 param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); |
| static _Float16 param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); |
| static _Float16 bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); |
| static int32_t shape4_init[] = {0, 5, 5, 2}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type198); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_relaxed(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type198(Type::TENSOR_FLOAT32, {0, 1, 2, 2}); |
| OperandType type2(Type::TENSOR_FLOAT32, {2, 3, 3, 1}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type3(Type::TENSOR_FLOAT32, {2}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type15); |
| auto roi = model->addOperand(&type16); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type17); |
| auto roiOut = model->addOperand(&type19); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type22); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type198); |
| auto weights = model->addOperand(&type2); |
| auto bias = model->addOperand(&type3); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores, scores_init, sizeof(float) * 2); |
| static float roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(float) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(float) * 18); |
| static float bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(float) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_quant8(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type181(Type::TENSOR_INT32, {2}, 0.01f, 0); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type189(Type::TENSOR_QUANT8_ASYMM, {2, 3, 3, 1}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type200(Type::TENSOR_QUANT8_ASYMM, {0, 1, 2, 2}, 0.1f, 128); |
| OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type187); |
| auto roi = model->addOperand(&type185); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type21); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type21); |
| auto param27 = model->addOperand(&type21); |
| auto param28 = model->addOperand(&type21); |
| auto scoresOut = model->addOperand(&type188); |
| auto roiOut = model->addOperand(&type186); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type183); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type21); |
| auto param32 = model->addOperand(&type21); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type200); |
| auto weights = model->addOperand(&type189); |
| auto bias = model->addOperand(&type181); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type204); |
| // Phase 2, operations |
| static uint8_t scores_init[] = {137, 129}; |
| model->setOperandValue(scores, scores_init, sizeof(uint8_t) * 2); |
| static uint16_t roi_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi, roi_init, sizeof(uint16_t) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static float param23_init[] = {0.3f}; |
| model->setOperandValue(param23, param23_init, sizeof(float) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static float param26_init[] = {0.4f}; |
| model->setOperandValue(param26, param26_init, sizeof(float) * 1); |
| static float param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(float) * 1); |
| static float param28_init[] = {0.3f}; |
| model->setOperandValue(param28, param28_init, sizeof(float) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static float param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(float) * 1); |
| static float param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(float) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178, 148, 168, 188, 208, 228, 248, 228, 208, 188}; |
| model->setOperandValue(weights, weights_init, sizeof(uint8_t) * 18); |
| static int32_t bias_init[] = {-150, -200}; |
| model->setOperandValue(bias, bias_init, sizeof(int32_t) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_float16(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type202(Type::TENSOR_FLOAT16, {0, 1, 2, 2}); |
| OperandType type205(Type::TENSOR_FLOAT16, {0}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type45(Type::TENSOR_FLOAT16, {2, 3, 3, 1}); |
| OperandType type46(Type::TENSOR_FLOAT16, {2}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores = model->addOperand(&type196); |
| auto roi = model->addOperand(&type194); |
| auto param22 = model->addOperand(&type20); |
| auto param23 = model->addOperand(&type193); |
| auto param24 = model->addOperand(&type5); |
| auto param25 = model->addOperand(&type5); |
| auto param26 = model->addOperand(&type193); |
| auto param27 = model->addOperand(&type193); |
| auto param28 = model->addOperand(&type193); |
| auto scoresOut = model->addOperand(&type205); |
| auto roiOut = model->addOperand(&type195); |
| auto classesOut = model->addOperand(&type18); |
| auto batchSplitOut = model->addOperand(&type18); |
| auto in = model->addOperand(&type191); |
| auto param29 = model->addOperand(&type5); |
| auto param30 = model->addOperand(&type5); |
| auto param31 = model->addOperand(&type193); |
| auto param32 = model->addOperand(&type193); |
| auto param33 = model->addOperand(&type5); |
| auto param34 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap = model->addOperand(&type202); |
| auto weights = model->addOperand(&type45); |
| auto bias = model->addOperand(&type46); |
| auto shape4 = model->addOperand(&type4); |
| auto param35 = model->addOperand(&type5); |
| auto param36 = model->addOperand(&type5); |
| auto param37 = model->addOperand(&type5); |
| auto param38 = model->addOperand(&type5); |
| auto out = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 scores_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores, scores_init, sizeof(_Float16) * 2); |
| static _Float16 roi_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi, roi_init, sizeof(_Float16) * 8); |
| static int32_t param22_init[] = {0}; |
| model->setOperandValue(param22, param22_init, sizeof(int32_t) * 1); |
| static _Float16 param23_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param23, param23_init, sizeof(_Float16) * 1); |
| static int32_t param24_init[] = {-1}; |
| model->setOperandValue(param24, param24_init, sizeof(int32_t) * 1); |
| static int32_t param25_init[] = {0}; |
| model->setOperandValue(param25, param25_init, sizeof(int32_t) * 1); |
| static _Float16 param26_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param26, param26_init, sizeof(_Float16) * 1); |
| static _Float16 param27_init[] = {1.0f}; |
| model->setOperandValue(param27, param27_init, sizeof(_Float16) * 1); |
| static _Float16 param28_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param28, param28_init, sizeof(_Float16) * 1); |
| static int32_t param29_init[] = {2}; |
| model->setOperandValue(param29, param29_init, sizeof(int32_t) * 1); |
| static int32_t param30_init[] = {2}; |
| model->setOperandValue(param30, param30_init, sizeof(int32_t) * 1); |
| static _Float16 param31_init[] = {2.0f}; |
| model->setOperandValue(param31, param31_init, sizeof(_Float16) * 1); |
| static _Float16 param32_init[] = {2.0f}; |
| model->setOperandValue(param32, param32_init, sizeof(_Float16) * 1); |
| static int32_t param33_init[] = {4}; |
| model->setOperandValue(param33, param33_init, sizeof(int32_t) * 1); |
| static int32_t param34_init[] = {4}; |
| model->setOperandValue(param34, param34_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| 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}; |
| model->setOperandValue(weights, weights_init, sizeof(_Float16) * 18); |
| static _Float16 bias_init[] = {-1.5f, -2.0f}; |
| model->setOperandValue(bias, bias_init, sizeof(_Float16) * 2); |
| static int32_t shape4_init[] = {0, 2, 5, 5}; |
| model->setOperandValue(shape4, shape4_init, sizeof(int32_t) * 4); |
| static int32_t param35_init[] = {2}; |
| model->setOperandValue(param35, param35_init, sizeof(int32_t) * 1); |
| static int32_t param36_init[] = {2}; |
| model->setOperandValue(param36, param36_init, sizeof(int32_t) * 1); |
| static int32_t param37_init[] = {2}; |
| model->setOperandValue(param37, param37_init, sizeof(int32_t) * 1); |
| static int32_t param38_init[] = {0}; |
| model->setOperandValue(param38, param38_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores, roi, param22, param23, param24, param25, param26, param27, param28}, {scoresOut, roiOut, classesOut, batchSplitOut}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in, roiOut, batchSplitOut, param29, param30, param31, param32, param33, param34, layout}, {featureMap}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap, weights, bias, shape4, param35, param36, param37, param38, layout}, {out}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in}, |
| {scoresOut, classesOut, out}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); |
| OperandType type26(Type::TENSOR_FLOAT32, {0, 3, 3, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type25); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type26); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); |
| OperandType type26(Type::TENSOR_FLOAT32, {0, 3, 3, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type25); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type26); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); |
| OperandType type207(Type::TENSOR_QUANT8_ASYMM, {0, 4, 4, 1}, 0.1f, 128); |
| OperandType type208(Type::TENSOR_QUANT8_ASYMM, {0, 3, 3, 1}, 0.1f, 128); |
| OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type187); |
| auto roi1 = model->addOperand(&type185); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type188); |
| auto roiOut1 = model->addOperand(&type186); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type183); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type207); |
| auto weights1 = model->addOperand(&type209); |
| auto bias1 = model->addOperand(&type206); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type208); |
| // Phase 2, operations |
| static uint8_t scores1_init[] = {137, 129}; |
| model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); |
| static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; |
| model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); |
| static int32_t bias1_init[] = {-150}; |
| model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nhwc_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type197(Type::TENSOR_FLOAT16, {0}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type210(Type::TENSOR_FLOAT16, {0, 4, 4, 1}); |
| OperandType type211(Type::TENSOR_FLOAT16, {0, 3, 3, 1}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type196); |
| auto roi1 = model->addOperand(&type194); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type193); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type193); |
| auto param44 = model->addOperand(&type193); |
| auto param45 = model->addOperand(&type193); |
| auto scoresOut1 = model->addOperand(&type197); |
| auto roiOut1 = model->addOperand(&type195); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type191); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type193); |
| auto param49 = model->addOperand(&type193); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type210); |
| auto weights1 = model->addOperand(&type134); |
| auto bias1 = model->addOperand(&type135); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type211); |
| // Phase 2, operations |
| static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); |
| static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static _Float16 param40_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static _Float16 param43_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); |
| static _Float16 param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); |
| static _Float16 param45_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static _Float16 param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); |
| static _Float16 param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); |
| static _Float16 bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nhwc_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); |
| OperandType type213(Type::TENSOR_FLOAT32, {0, 1, 3, 3}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type212); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type213); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); |
| OperandType type213(Type::TENSOR_FLOAT32, {0, 1, 3, 3}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type212); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type213); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); |
| OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type214(Type::TENSOR_QUANT8_ASYMM, {0, 1, 4, 4}, 0.1f, 128); |
| OperandType type215(Type::TENSOR_QUANT8_ASYMM, {0, 1, 3, 3}, 0.1f, 128); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type187); |
| auto roi1 = model->addOperand(&type185); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type188); |
| auto roiOut1 = model->addOperand(&type186); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type183); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type214); |
| auto weights1 = model->addOperand(&type209); |
| auto bias1 = model->addOperand(&type206); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type215); |
| // Phase 2, operations |
| static uint8_t scores1_init[] = {137, 129}; |
| model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); |
| static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; |
| model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); |
| static int32_t bias1_init[] = {-150}; |
| model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_nchw_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type197(Type::TENSOR_FLOAT16, {0}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type216(Type::TENSOR_FLOAT16, {0, 1, 4, 4}); |
| OperandType type217(Type::TENSOR_FLOAT16, {0, 1, 3, 3}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type196); |
| auto roi1 = model->addOperand(&type194); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type193); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type193); |
| auto param44 = model->addOperand(&type193); |
| auto param45 = model->addOperand(&type193); |
| auto scoresOut1 = model->addOperand(&type197); |
| auto roiOut1 = model->addOperand(&type195); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type191); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type193); |
| auto param49 = model->addOperand(&type193); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type216); |
| auto weights1 = model->addOperand(&type134); |
| auto bias1 = model->addOperand(&type135); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type217); |
| // Phase 2, operations |
| static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); |
| static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static _Float16 param40_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static _Float16 param43_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); |
| static _Float16 param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); |
| static _Float16 param45_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static _Float16 param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); |
| static _Float16 param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); |
| static _Float16 bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_nchw_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type25); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type25(Type::TENSOR_FLOAT32, {0, 4, 4, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type25); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); |
| OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); |
| OperandType type207(Type::TENSOR_QUANT8_ASYMM, {0, 4, 4, 1}, 0.1f, 128); |
| OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type187); |
| auto roi1 = model->addOperand(&type185); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type188); |
| auto roiOut1 = model->addOperand(&type186); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type183); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type207); |
| auto weights1 = model->addOperand(&type209); |
| auto bias1 = model->addOperand(&type206); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type204); |
| // Phase 2, operations |
| static uint8_t scores1_init[] = {137, 129}; |
| model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); |
| static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; |
| model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); |
| static int32_t bias1_init[] = {-150}; |
| model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nhwc_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type205(Type::TENSOR_FLOAT16, {0}); |
| OperandType type210(Type::TENSOR_FLOAT16, {0, 4, 4, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type196); |
| auto roi1 = model->addOperand(&type194); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type193); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type193); |
| auto param44 = model->addOperand(&type193); |
| auto param45 = model->addOperand(&type193); |
| auto scoresOut1 = model->addOperand(&type205); |
| auto roiOut1 = model->addOperand(&type195); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type191); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type193); |
| auto param49 = model->addOperand(&type193); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type210); |
| auto weights1 = model->addOperand(&type134); |
| auto bias1 = model->addOperand(&type135); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); |
| static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static _Float16 param40_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static _Float16 param43_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); |
| static _Float16 param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); |
| static _Float16 param45_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static _Float16 param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); |
| static _Float16 param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); |
| static _Float16 bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nhwc_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type212); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_relaxed_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type15(Type::TENSOR_FLOAT32, {1, 2}); |
| OperandType type16(Type::TENSOR_FLOAT32, {1, 8}); |
| OperandType type17(Type::TENSOR_FLOAT32, {0}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type19(Type::TENSOR_FLOAT32, {0, 4}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type212(Type::TENSOR_FLOAT32, {0, 1, 4, 4}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type8(Type::TENSOR_FLOAT32, {1, 3, 3, 1}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type15); |
| auto roi1 = model->addOperand(&type16); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type17); |
| auto roiOut1 = model->addOperand(&type19); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type22); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type212); |
| auto weights1 = model->addOperand(&type8); |
| auto bias1 = model->addOperand(&type9); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float scores1_init[] = {0.9f, 0.1f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(float) * 2); |
| static float roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(float) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static float weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(float) * 9); |
| static float bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(float) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_relaxed_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_quant8_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type183(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.1f, 128); |
| OperandType type185(Type::TENSOR_QUANT16_ASYMM, {1, 8}, 0.125f, 0); |
| OperandType type186(Type::TENSOR_QUANT16_ASYMM, {0, 4}, 0.125f, 0); |
| OperandType type187(Type::TENSOR_QUANT8_ASYMM, {1, 2}, 0.1f, 128); |
| OperandType type188(Type::TENSOR_QUANT8_ASYMM, {0}, 0.1f, 128); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type204(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.1f, 128); |
| OperandType type206(Type::TENSOR_INT32, {1}, 0.01f, 0); |
| OperandType type209(Type::TENSOR_QUANT8_ASYMM, {1, 3, 3, 1}, 0.1f, 128); |
| OperandType type21(Type::FLOAT32, {}); |
| OperandType type214(Type::TENSOR_QUANT8_ASYMM, {0, 1, 4, 4}, 0.1f, 128); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type187); |
| auto roi1 = model->addOperand(&type185); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type21); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type21); |
| auto param44 = model->addOperand(&type21); |
| auto param45 = model->addOperand(&type21); |
| auto scoresOut1 = model->addOperand(&type188); |
| auto roiOut1 = model->addOperand(&type186); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type183); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type21); |
| auto param49 = model->addOperand(&type21); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type214); |
| auto weights1 = model->addOperand(&type209); |
| auto bias1 = model->addOperand(&type206); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type204); |
| // Phase 2, operations |
| static uint8_t scores1_init[] = {137, 129}; |
| model->setOperandValue(scores1, scores1_init, sizeof(uint8_t) * 2); |
| static uint16_t roi1_init[] = {8, 8, 80, 80, 0, 0, 80, 80}; |
| model->setOperandValue(roi1, roi1_init, sizeof(uint16_t) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static float param40_init[] = {0.3f}; |
| model->setOperandValue(param40, param40_init, sizeof(float) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static float param43_init[] = {0.4f}; |
| model->setOperandValue(param43, param43_init, sizeof(float) * 1); |
| static float param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(float) * 1); |
| static float param45_init[] = {0.3f}; |
| model->setOperandValue(param45, param45_init, sizeof(float) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static float param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(float) * 1); |
| static float param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(float) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static uint8_t weights1_init[] = {138, 158, 178, 198, 218, 238, 218, 198, 178}; |
| model->setOperandValue(weights1, weights1_init, sizeof(uint8_t) * 9); |
| static int32_t bias1_init[] = {-150}; |
| model->setOperandValue(bias1, bias1_init, sizeof(int32_t) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_quant8_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_zero_sized_dynamic_output_shape_nchw_float16_2(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type134(Type::TENSOR_FLOAT16, {1, 3, 3, 1}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type18(Type::TENSOR_INT32, {0}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type193(Type::FLOAT16, {}); |
| OperandType type194(Type::TENSOR_FLOAT16, {1, 8}); |
| OperandType type195(Type::TENSOR_FLOAT16, {0, 4}); |
| OperandType type196(Type::TENSOR_FLOAT16, {1, 2}); |
| OperandType type20(Type::TENSOR_INT32, {1}); |
| OperandType type205(Type::TENSOR_FLOAT16, {0}); |
| OperandType type216(Type::TENSOR_FLOAT16, {0, 1, 4, 4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto scores1 = model->addOperand(&type196); |
| auto roi1 = model->addOperand(&type194); |
| auto param39 = model->addOperand(&type20); |
| auto param40 = model->addOperand(&type193); |
| auto param41 = model->addOperand(&type5); |
| auto param42 = model->addOperand(&type5); |
| auto param43 = model->addOperand(&type193); |
| auto param44 = model->addOperand(&type193); |
| auto param45 = model->addOperand(&type193); |
| auto scoresOut1 = model->addOperand(&type205); |
| auto roiOut1 = model->addOperand(&type195); |
| auto classesOut1 = model->addOperand(&type18); |
| auto batchSplitOut1 = model->addOperand(&type18); |
| auto in1 = model->addOperand(&type191); |
| auto param46 = model->addOperand(&type5); |
| auto param47 = model->addOperand(&type5); |
| auto param48 = model->addOperand(&type193); |
| auto param49 = model->addOperand(&type193); |
| auto param50 = model->addOperand(&type5); |
| auto param51 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto featureMap1 = model->addOperand(&type216); |
| auto weights1 = model->addOperand(&type134); |
| auto bias1 = model->addOperand(&type135); |
| auto param52 = model->addOperand(&type5); |
| auto param53 = model->addOperand(&type5); |
| auto param54 = model->addOperand(&type5); |
| auto param55 = model->addOperand(&type5); |
| auto param56 = model->addOperand(&type5); |
| auto param57 = model->addOperand(&type5); |
| auto param58 = model->addOperand(&type5); |
| auto out1 = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 scores1_init[] = {0.8999999761581421f, 0.10000000149011612f}; |
| model->setOperandValue(scores1, scores1_init, sizeof(_Float16) * 2); |
| static _Float16 roi1_init[] = {1.0f, 1.0f, 10.0f, 10.0f, 0.0f, 0.0f, 10.0f, 10.0f}; |
| model->setOperandValue(roi1, roi1_init, sizeof(_Float16) * 8); |
| static int32_t param39_init[] = {0}; |
| model->setOperandValue(param39, param39_init, sizeof(int32_t) * 1); |
| static _Float16 param40_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param40, param40_init, sizeof(_Float16) * 1); |
| static int32_t param41_init[] = {-1}; |
| model->setOperandValue(param41, param41_init, sizeof(int32_t) * 1); |
| static int32_t param42_init[] = {0}; |
| model->setOperandValue(param42, param42_init, sizeof(int32_t) * 1); |
| static _Float16 param43_init[] = {0.4000000059604645f}; |
| model->setOperandValue(param43, param43_init, sizeof(_Float16) * 1); |
| static _Float16 param44_init[] = {1.0f}; |
| model->setOperandValue(param44, param44_init, sizeof(_Float16) * 1); |
| static _Float16 param45_init[] = {0.30000001192092896f}; |
| model->setOperandValue(param45, param45_init, sizeof(_Float16) * 1); |
| static int32_t param46_init[] = {4}; |
| model->setOperandValue(param46, param46_init, sizeof(int32_t) * 1); |
| static int32_t param47_init[] = {4}; |
| model->setOperandValue(param47, param47_init, sizeof(int32_t) * 1); |
| static _Float16 param48_init[] = {2.0f}; |
| model->setOperandValue(param48, param48_init, sizeof(_Float16) * 1); |
| static _Float16 param49_init[] = {2.0f}; |
| model->setOperandValue(param49, param49_init, sizeof(_Float16) * 1); |
| static int32_t param50_init[] = {4}; |
| model->setOperandValue(param50, param50_init, sizeof(int32_t) * 1); |
| static int32_t param51_init[] = {4}; |
| model->setOperandValue(param51, param51_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| static _Float16 weights1_init[] = {1.0f, 3.0f, 5.0f, 7.0f, 9.0f, 11.0f, 9.0f, 7.0f, 5.0f}; |
| model->setOperandValue(weights1, weights1_init, sizeof(_Float16) * 9); |
| static _Float16 bias1_init[] = {-1.5f}; |
| model->setOperandValue(bias1, bias1_init, sizeof(_Float16) * 1); |
| static int32_t param52_init[] = {1}; |
| model->setOperandValue(param52, param52_init, sizeof(int32_t) * 1); |
| static int32_t param53_init[] = {2}; |
| model->setOperandValue(param53, param53_init, sizeof(int32_t) * 1); |
| static int32_t param54_init[] = {2}; |
| model->setOperandValue(param54, param54_init, sizeof(int32_t) * 1); |
| static int32_t param55_init[] = {1}; |
| model->setOperandValue(param55, param55_init, sizeof(int32_t) * 1); |
| static int32_t param56_init[] = {1}; |
| model->setOperandValue(param56, param56_init, sizeof(int32_t) * 1); |
| static int32_t param57_init[] = {1}; |
| model->setOperandValue(param57, param57_init, sizeof(int32_t) * 1); |
| static int32_t param58_init[] = {0}; |
| model->setOperandValue(param58, param58_init, sizeof(int32_t) * 1); |
| model->addOperation(ANEURALNETWORKS_BOX_WITH_NMS_LIMIT, {scores1, roi1, param39, param40, param41, param42, param43, param44, param45}, {scoresOut1, roiOut1, classesOut1, batchSplitOut1}); |
| model->addOperation(ANEURALNETWORKS_ROI_ALIGN, {in1, roiOut1, batchSplitOut1, param46, param47, param48, param49, param50, param51, layout}, {featureMap1}); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {featureMap1, weights1, bias1, param52, param53, param54, param55, param56, param57, param58, layout}, {out1}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {in1}, |
| {scoresOut1, classesOut1, out1}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_zero_sized_dynamic_output_shape_nchw_float16_2(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type13); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type13); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type13); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_relaxed_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type13(Type::TENSOR_FLOAT32, {1, 4, 4, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type13); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_relaxed_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type31); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type155); |
| // Phase 2, operations |
| static uint8_t op25_init[] = {132}; |
| model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); |
| static int32_t op35_init[] = {0}; |
| model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_quant8_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type155(Type::TENSOR_QUANT8_ASYMM, {1, 4, 4, 1}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type31); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type155); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_quant8_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type44); |
| auto op25 = model->addOperand(&type191); |
| auto op35 = model->addOperand(&type135); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type158); |
| // Phase 2, operations |
| static _Float16 op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); |
| static _Float16 op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nhwc_float16_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type158(Type::TENSOR_FLOAT16, {1, 4, 4, 1}); |
| OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type44); |
| auto op25 = model->addOperand(&type219); |
| auto op35 = model->addOperand(&type138); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type158); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nhwc_float16_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type161); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type161); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type161); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_relaxed_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type161(Type::TENSOR_FLOAT32, {1, 1, 4, 4}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type161); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_relaxed_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type66); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type163); |
| // Phase 2, operations |
| static uint8_t op25_init[] = {132}; |
| model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); |
| static int32_t op35_init[] = {0}; |
| model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_quant8_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type163(Type::TENSOR_QUANT8_ASYMM, {1, 1, 4, 4}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type66); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type163); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_quant8_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type74); |
| auto op25 = model->addOperand(&type191); |
| auto op35 = model->addOperand(&type135); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type165); |
| // Phase 2, operations |
| static _Float16 op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); |
| static _Float16 op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_nchw_float16_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type165(Type::TENSOR_FLOAT16, {1, 1, 4, 4}); |
| OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type74); |
| auto op25 = model->addOperand(&type219); |
| auto op35 = model->addOperand(&type138); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type165); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_nchw_float16_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_relaxed_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type1(Type::TENSOR_FLOAT32, {1, 2, 2, 1}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type1); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_relaxed_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type31); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type166); |
| // Phase 2, operations |
| static uint8_t op25_init[] = {132}; |
| model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); |
| static int32_t op35_init[] = {0}; |
| model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_quant8_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type31(Type::TENSOR_QUANT8_ASYMM, {1, 2, 2, 1}, 0.5f, 100); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type31); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type166); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_quant8_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type44); |
| auto op25 = model->addOperand(&type191); |
| auto op35 = model->addOperand(&type135); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); |
| static _Float16 op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nhwc_float16_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type44(Type::TENSOR_FLOAT16, {1, 2, 2, 1}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type44); |
| auto op25 = model->addOperand(&type219); |
| auto op35 = model->addOperand(&type138); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 4, 4, 1}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {false}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nhwc_float16_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static float op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(float) * 1); |
| static float op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(float) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_relaxed_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type22(Type::TENSOR_FLOAT32, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type62(Type::TENSOR_FLOAT32, {1, 1, 2, 2}); |
| OperandType type88(Type::TENSOR_FLOAT32, {0, 0, 0, 0}); |
| OperandType type9(Type::TENSOR_FLOAT32, {1}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type62); |
| auto op25 = model->addOperand(&type22); |
| auto op35 = model->addOperand(&type9); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type88); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| // Phase 4: set relaxed execution |
| model->relaxComputationFloat32toFloat16(true); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_relaxed_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type66); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type166); |
| // Phase 2, operations |
| static uint8_t op25_init[] = {132}; |
| model->setOperandValue(op25, op25_init, sizeof(uint8_t) * 1); |
| static int32_t op35_init[] = {0}; |
| model->setOperandValue(op35, op35_init, sizeof(int32_t) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_quant8_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type154(Type::TENSOR_INT32, {1}, 0.25f, 0); |
| OperandType type166(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 16.0f, 0); |
| OperandType type218(Type::TENSOR_QUANT8_ASYMM, {1, 1, 1, 1}, 0.5f, 128); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type66(Type::TENSOR_QUANT8_ASYMM, {1, 1, 2, 2}, 0.5f, 100); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type66); |
| auto op25 = model->addOperand(&type218); |
| auto op35 = model->addOperand(&type154); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type166); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_quant8_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type135(Type::TENSOR_FLOAT16, {1}); |
| OperandType type191(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type74); |
| auto op25 = model->addOperand(&type191); |
| auto op35 = model->addOperand(&type135); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type96); |
| // Phase 2, operations |
| static _Float16 op25_init[] = {2.0f}; |
| model->setOperandValue(op25, op25_init, sizeof(_Float16) * 1); |
| static _Float16 op35_init[] = {0.0f}; |
| model->setOperandValue(op35, op35_init, sizeof(_Float16) * 1); |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |
| void CreateModel_dynamic_output_shape_nchw_float16_weight_as_input_5(Model *model) { |
| OperandType type0(Type::BOOL, {}); |
| OperandType type138(Type::TENSOR_FLOAT16, {1}); |
| OperandType type219(Type::TENSOR_FLOAT16, {1, 1, 1, 1}); |
| OperandType type4(Type::TENSOR_INT32, {4}); |
| OperandType type5(Type::INT32, {}); |
| OperandType type74(Type::TENSOR_FLOAT16, {1, 1, 2, 2}); |
| OperandType type96(Type::TENSOR_FLOAT16, {0, 0, 0, 0}); |
| // Phase 1, operands |
| auto op15 = model->addOperand(&type74); |
| auto op25 = model->addOperand(&type219); |
| auto op35 = model->addOperand(&type138); |
| auto shape5 = model->addOperand(&type4); |
| auto param59 = model->addOperand(&type5); |
| auto param60 = model->addOperand(&type5); |
| auto param61 = model->addOperand(&type5); |
| auto param62 = model->addOperand(&type5); |
| auto layout = model->addOperand(&type0); |
| auto op45 = model->addOperand(&type96); |
| // Phase 2, operations |
| static int32_t shape5_init[] = {1, 1, 4, 4}; |
| model->setOperandValue(shape5, shape5_init, sizeof(int32_t) * 4); |
| static int32_t param59_init[] = {1}; |
| model->setOperandValue(param59, param59_init, sizeof(int32_t) * 1); |
| static int32_t param60_init[] = {2}; |
| model->setOperandValue(param60, param60_init, sizeof(int32_t) * 1); |
| static int32_t param61_init[] = {2}; |
| model->setOperandValue(param61, param61_init, sizeof(int32_t) * 1); |
| static int32_t param62_init[] = {0}; |
| model->setOperandValue(param62, param62_init, sizeof(int32_t) * 1); |
| static bool8 layout_init[] = {true}; |
| model->setOperandValue(layout, layout_init, sizeof(bool8) * 1); |
| model->addOperation(ANEURALNETWORKS_TRANSPOSE_CONV_2D, {op15, op25, op35, shape5, param59, param60, param61, param62, layout}, {op45}); |
| // Phase 3, inputs and outputs |
| model->identifyInputsAndOutputs( |
| {op15, op25, op35}, |
| {op45}); |
| assert(model->isValid()); |
| } |
| |
| inline bool is_ignored_dynamic_output_shape_nchw_float16_weight_as_input_5(int i) { |
| static std::set<int> ignore = {}; |
| return ignore.find(i) != ignore.end(); |
| } |
| |