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