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