1 // clang-format off
2 // Generated file (from: l2_pool_float_2_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 4, 1});
5 OperandType type1(Type::INT32, {});
6 OperandType type2(Type::TENSOR_FLOAT32, {1, 1, 2, 1});
7 // Phase 1, operands
8 auto op1 = model->addOperand(&type0);
9 auto pad_same = model->addOperand(&type1);
10 auto cons2 = model->addOperand(&type1);
11 auto act_none = model->addOperand(&type1);
12 auto op3 = model->addOperand(&type2);
13 // Phase 2, operations
14 static int32_t pad_same_init[] = {1};
15 model->setOperandValue(pad_same, pad_same_init, sizeof(int32_t) * 1);
16 static int32_t cons2_init[] = {2};
17 model->setOperandValue(cons2, cons2_init, sizeof(int32_t) * 1);
18 static int32_t act_none_init[] = {0};
19 model->setOperandValue(act_none, act_none_init, sizeof(int32_t) * 1);
20 model->addOperation(ANEURALNETWORKS_L2_POOL_2D, {op1, pad_same, cons2, cons2, cons2, cons2, act_none}, {op3});
21 // Phase 3, inputs and outputs
22 model->identifyInputsAndOutputs(
23 {op1},
24 {op3});
25 // Phase 4: set relaxed execution
26 model->relaxComputationFloat32toFloat16(true);
27 assert(model->isValid());
28 }
29
is_ignored(int i)30 inline bool is_ignored(int i) {
31 static std::set<int> ignore = {};
32 return ignore.find(i) != ignore.end();
33 }
34
CreateModel_dynamic_output_shape(Model * model)35 void CreateModel_dynamic_output_shape(Model *model) {
36 OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 4, 1});
37 OperandType type1(Type::INT32, {});
38 OperandType type3(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
39 // Phase 1, operands
40 auto op1 = model->addOperand(&type0);
41 auto pad_same = model->addOperand(&type1);
42 auto cons2 = model->addOperand(&type1);
43 auto act_none = model->addOperand(&type1);
44 auto op3 = model->addOperand(&type3);
45 // Phase 2, operations
46 static int32_t pad_same_init[] = {1};
47 model->setOperandValue(pad_same, pad_same_init, sizeof(int32_t) * 1);
48 static int32_t cons2_init[] = {2};
49 model->setOperandValue(cons2, cons2_init, sizeof(int32_t) * 1);
50 static int32_t act_none_init[] = {0};
51 model->setOperandValue(act_none, act_none_init, sizeof(int32_t) * 1);
52 model->addOperation(ANEURALNETWORKS_L2_POOL_2D, {op1, pad_same, cons2, cons2, cons2, cons2, act_none}, {op3});
53 // Phase 3, inputs and outputs
54 model->identifyInputsAndOutputs(
55 {op1},
56 {op3});
57 // Phase 4: set relaxed execution
58 model->relaxComputationFloat32toFloat16(true);
59 assert(model->isValid());
60 }
61
is_ignored_dynamic_output_shape(int i)62 inline bool is_ignored_dynamic_output_shape(int i) {
63 static std::set<int> ignore = {};
64 return ignore.find(i) != ignore.end();
65 }
66
67