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