• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: fully_connected_float_weights_as_inputs.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   assert(model->isValid());
23 }
24 
is_ignored(int i)25 inline bool is_ignored(int i) {
26   static std::set<int> ignore = {};
27   return ignore.find(i) != ignore.end();
28 }
29 
CreateModel_dynamic_output_shape(Model * model)30 void CreateModel_dynamic_output_shape(Model *model) {
31   OperandType type0(Type::TENSOR_FLOAT32, {3, 1});
32   OperandType type1(Type::TENSOR_FLOAT32, {1, 1});
33   OperandType type2(Type::TENSOR_FLOAT32, {1});
34   OperandType type3(Type::INT32, {});
35   OperandType type4(Type::TENSOR_FLOAT32, {0, 0});
36   // Phase 1, operands
37   auto op1 = model->addOperand(&type0);
38   auto op2 = model->addOperand(&type1);
39   auto b0 = model->addOperand(&type2);
40   auto act = model->addOperand(&type3);
41   auto op3 = model->addOperand(&type4);
42   // Phase 2, operations
43   static int32_t act_init[] = {0};
44   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
45   model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {op1, op2, b0, act}, {op3});
46   // Phase 3, inputs and outputs
47   model->identifyInputsAndOutputs(
48     {op1, op2, b0},
49     {op3});
50   assert(model->isValid());
51 }
52 
is_ignored_dynamic_output_shape(int i)53 inline bool is_ignored_dynamic_output_shape(int i) {
54   static std::set<int> ignore = {};
55   return ignore.find(i) != ignore.end();
56 }
57 
58