• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: l2_pool_float_large.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   assert(model->isValid());
35 }
36 
is_ignored(int i)37 inline bool is_ignored(int i) {
38   static std::set<int> ignore = {};
39   return ignore.find(i) != ignore.end();
40 }
41 
CreateModel_dynamic_output_shape(Model * model)42 void CreateModel_dynamic_output_shape(Model *model) {
43   OperandType type0(Type::TENSOR_FLOAT32, {1, 2, 2, 3});
44   OperandType type1(Type::INT32, {});
45   OperandType type3(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
46   // Phase 1, operands
47   auto op1 = model->addOperand(&type0);
48   auto pad0 = model->addOperand(&type1);
49   auto stride_width = model->addOperand(&type1);
50   auto stride_height = model->addOperand(&type1);
51   auto filter_width = model->addOperand(&type1);
52   auto filter_height = model->addOperand(&type1);
53   auto act = model->addOperand(&type1);
54   auto op3 = model->addOperand(&type3);
55   // Phase 2, operations
56   static int32_t pad0_init[] = {0};
57   model->setOperandValue(pad0, pad0_init, sizeof(int32_t) * 1);
58   static int32_t stride_width_init[] = {1};
59   model->setOperandValue(stride_width, stride_width_init, sizeof(int32_t) * 1);
60   static int32_t stride_height_init[] = {1};
61   model->setOperandValue(stride_height, stride_height_init, sizeof(int32_t) * 1);
62   static int32_t filter_width_init[] = {2};
63   model->setOperandValue(filter_width, filter_width_init, sizeof(int32_t) * 1);
64   static int32_t filter_height_init[] = {2};
65   model->setOperandValue(filter_height, filter_height_init, sizeof(int32_t) * 1);
66   static int32_t act_init[] = {0};
67   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
68   model->addOperation(ANEURALNETWORKS_L2_POOL_2D, {op1, pad0, pad0, pad0, pad0, stride_width, stride_height, filter_width, filter_height, act}, {op3});
69   // Phase 3, inputs and outputs
70   model->identifyInputsAndOutputs(
71     {op1},
72     {op3});
73   assert(model->isValid());
74 }
75 
is_ignored_dynamic_output_shape(int i)76 inline bool is_ignored_dynamic_output_shape(int i) {
77   static std::set<int> ignore = {};
78   return ignore.find(i) != ignore.end();
79 }
80 
81