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