• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated file (from: local_response_norm_float_1_relaxed.mod.py). Do not edit
CreateModel(Model * model)2 void CreateModel(Model *model) {
3   OperandType type2(Type::FLOAT32, {});
4   OperandType type1(Type::INT32, {});
5   OperandType type0(Type::TENSOR_FLOAT32, {1, 1, 1, 6});
6   // Phase 1, operands
7   auto input = model->addOperand(&type0);
8   auto radius = model->addOperand(&type1);
9   auto bias = model->addOperand(&type2);
10   auto alpha = model->addOperand(&type2);
11   auto beta = model->addOperand(&type2);
12   auto output = model->addOperand(&type0);
13   // Phase 2, operations
14   static int32_t radius_init[] = {20};
15   model->setOperandValue(radius, radius_init, sizeof(int32_t) * 1);
16   static float bias_init[] = {9.0f};
17   model->setOperandValue(bias, bias_init, sizeof(float) * 1);
18   static float alpha_init[] = {4.0f};
19   model->setOperandValue(alpha, alpha_init, sizeof(float) * 1);
20   static float beta_init[] = {0.5f};
21   model->setOperandValue(beta, beta_init, sizeof(float) * 1);
22   model->addOperation(ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION, {input, radius, bias, alpha, beta}, {output});
23   // Phase 3, inputs and outputs
24   model->identifyInputsAndOutputs(
25     {input},
26     {output});
27   // Phase 4: set relaxed execution
28   model->relaxComputationFloat32toFloat16(true);
29   assert(model->isValid());
30 }
31 
is_ignored(int i)32 bool is_ignored(int i) {
33   static std::set<int> ignore = {};
34   return ignore.find(i) != ignore.end();
35 }
36