1 // clang-format off
2 // Generated file (from: fully_connected_float_large_weights_as_inputs_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 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, {1, 5});
34   OperandType type1(Type::TENSOR_FLOAT32, {1});
35   OperandType type3(Type::INT32, {});
36   OperandType type4(Type::TENSOR_FLOAT32, {0, 0});
37   // Phase 1, operands
38   auto op1 = model->addOperand(&type0);
39   auto op2 = model->addOperand(&type0);
40   auto b0 = model->addOperand(&type1);
41   auto act = model->addOperand(&type3);
42   auto op3 = model->addOperand(&type4);
43   // Phase 2, operations
44   static int32_t act_init[] = {0};
45   model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
46   model->addOperation(ANEURALNETWORKS_FULLY_CONNECTED, {op1, op2, b0, act}, {op3});
47   // Phase 3, inputs and outputs
48   model->identifyInputsAndOutputs(
49     {op1, op2, b0},
50     {op3});
51   // Phase 4: set relaxed execution
52   model->relaxComputationFloat32toFloat16(true);
53   assert(model->isValid());
54 }
55 
is_ignored_dynamic_output_shape(int i)56 inline bool is_ignored_dynamic_output_shape(int i) {
57   static std::set<int> ignore = {};
58   return ignore.find(i) != ignore.end();
59 }
60 
61