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