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