1 // clang-format off
2 // Generated file (from: sub_broadcast_float_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {1, 2});
5 OperandType type1(Type::TENSOR_FLOAT32, {2, 2});
6 OperandType type2(Type::INT32, {});
7 // Phase 1, operands
8 auto op1 = model->addOperand(&type0);
9 auto op2 = model->addOperand(&type1);
10 auto act = model->addOperand(&type2);
11 auto op3 = model->addOperand(&type1);
12 // Phase 2, operations
13 static int32_t act_init[] = {0};
14 model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
15 model->addOperation(ANEURALNETWORKS_SUB, {op1, op2, act}, {op3});
16 // Phase 3, inputs and outputs
17 model->identifyInputsAndOutputs(
18 {op1, op2},
19 {op3});
20 // Phase 4: set relaxed execution
21 model->relaxComputationFloat32toFloat16(true);
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, {1, 2});
32 OperandType type1(Type::TENSOR_FLOAT32, {2, 2});
33 OperandType type2(Type::INT32, {});
34 OperandType type3(Type::TENSOR_FLOAT32, {0, 0});
35 // Phase 1, operands
36 auto op1 = model->addOperand(&type0);
37 auto op2 = model->addOperand(&type1);
38 auto act = model->addOperand(&type2);
39 auto op3 = model->addOperand(&type3);
40 // Phase 2, operations
41 static int32_t act_init[] = {0};
42 model->setOperandValue(act, act_init, sizeof(int32_t) * 1);
43 model->addOperation(ANEURALNETWORKS_SUB, {op1, op2, act}, {op3});
44 // Phase 3, inputs and outputs
45 model->identifyInputsAndOutputs(
46 {op1, op2},
47 {op3});
48 // Phase 4: set relaxed execution
49 model->relaxComputationFloat32toFloat16(true);
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