1 // clang-format off
2 // Generated file (from: local_response_norm_float_3_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {1, 1, 1, 6});
5 OperandType type1(Type::INT32, {});
6 OperandType type2(Type::FLOAT32, {});
7 // Phase 1, operands
8 auto input = model->addOperand(&type0);
9 auto radius = model->addOperand(&type1);
10 auto bias = model->addOperand(&type2);
11 auto alpha = model->addOperand(&type2);
12 auto beta = model->addOperand(&type2);
13 auto output = model->addOperand(&type0);
14 // Phase 2, operations
15 static int32_t radius_init[] = {20};
16 model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
17 static float bias_init[] = {0.0f};
18 model->setOperandValue(bias, bias_init, sizeof(float) * 1);
19 static float alpha_init[] = {4.0f};
20 model->setOperandValue(alpha, alpha_init, sizeof(float) * 1);
21 static float beta_init[] = {0.5f};
22 model->setOperandValue(beta, beta_init, sizeof(float) * 1);
23 model->addOperation(ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION, {input, radius, bias, alpha, beta}, {output});
24 // Phase 3, inputs and outputs
25 model->identifyInputsAndOutputs(
26 {input},
27 {output});
28 // Phase 4: set relaxed execution
29 model->relaxComputationFloat32toFloat16(true);
30 assert(model->isValid());
31 }
32
is_ignored(int i)33 inline bool is_ignored(int i) {
34 static std::set<int> ignore = {};
35 return ignore.find(i) != ignore.end();
36 }
37
CreateModel_dynamic_output_shape(Model * model)38 void CreateModel_dynamic_output_shape(Model *model) {
39 OperandType type0(Type::TENSOR_FLOAT32, {1, 1, 1, 6});
40 OperandType type1(Type::INT32, {});
41 OperandType type2(Type::FLOAT32, {});
42 OperandType type3(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
43 // Phase 1, operands
44 auto input = model->addOperand(&type0);
45 auto radius = model->addOperand(&type1);
46 auto bias = model->addOperand(&type2);
47 auto alpha = model->addOperand(&type2);
48 auto beta = model->addOperand(&type2);
49 auto output = model->addOperand(&type3);
50 // Phase 2, operations
51 static int32_t radius_init[] = {20};
52 model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
53 static float bias_init[] = {0.0f};
54 model->setOperandValue(bias, bias_init, sizeof(float) * 1);
55 static float alpha_init[] = {4.0f};
56 model->setOperandValue(alpha, alpha_init, sizeof(float) * 1);
57 static float beta_init[] = {0.5f};
58 model->setOperandValue(beta, beta_init, sizeof(float) * 1);
59 model->addOperation(ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION, {input, radius, bias, alpha, beta}, {output});
60 // Phase 3, inputs and outputs
61 model->identifyInputsAndOutputs(
62 {input},
63 {output});
64 // Phase 4: set relaxed execution
65 model->relaxComputationFloat32toFloat16(true);
66 assert(model->isValid());
67 }
68
is_ignored_dynamic_output_shape(int i)69 inline bool is_ignored_dynamic_output_shape(int i) {
70 static std::set<int> ignore = {};
71 return ignore.find(i) != ignore.end();
72 }
73
74