1 // clang-format off
2 // Generated file (from: local_response_norm_float_2.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[] = {1.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 assert(model->isValid());
29 }
30
is_ignored(int i)31 inline bool is_ignored(int i) {
32 static std::set<int> ignore = {};
33 return ignore.find(i) != ignore.end();
34 }
35
CreateModel_dynamic_output_shape(Model * model)36 void CreateModel_dynamic_output_shape(Model *model) {
37 OperandType type0(Type::TENSOR_FLOAT32, {1, 1, 1, 6});
38 OperandType type1(Type::INT32, {});
39 OperandType type2(Type::FLOAT32, {});
40 OperandType type3(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
41 // Phase 1, operands
42 auto input = model->addOperand(&type0);
43 auto radius = model->addOperand(&type1);
44 auto bias = model->addOperand(&type2);
45 auto alpha = model->addOperand(&type2);
46 auto beta = model->addOperand(&type2);
47 auto output = model->addOperand(&type3);
48 // Phase 2, operations
49 static int32_t radius_init[] = {20};
50 model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
51 static float bias_init[] = {0.0f};
52 model->setOperandValue(bias, bias_init, sizeof(float) * 1);
53 static float alpha_init[] = {1.0f};
54 model->setOperandValue(alpha, alpha_init, sizeof(float) * 1);
55 static float beta_init[] = {0.5f};
56 model->setOperandValue(beta, beta_init, sizeof(float) * 1);
57 model->addOperation(ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION, {input, radius, bias, alpha, beta}, {output});
58 // Phase 3, inputs and outputs
59 model->identifyInputsAndOutputs(
60 {input},
61 {output});
62 assert(model->isValid());
63 }
64
is_ignored_dynamic_output_shape(int i)65 inline bool is_ignored_dynamic_output_shape(int i) {
66 static std::set<int> ignore = {};
67 return ignore.find(i) != ignore.end();
68 }
69
70