• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: concat_float_1_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {2, 3});
5   OperandType type1(Type::INT32, {});
6   OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
7   // Phase 1, operands
8   auto op1 = model->addOperand(&type0);
9   auto op2 = model->addOperand(&type0);
10   auto axis0 = model->addOperand(&type1);
11   auto result = model->addOperand(&type2);
12   // Phase 2, operations
13   static int32_t axis0_init[] = {0};
14   model->setOperandValue(axis0, axis0_init, sizeof(int32_t) * 1);
15   model->addOperation(ANEURALNETWORKS_CONCATENATION, {op1, op2, axis0}, {result});
16   // Phase 3, inputs and outputs
17   model->identifyInputsAndOutputs(
18     {op1, op2},
19     {result});
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, {2, 3});
32   OperandType type1(Type::INT32, {});
33   OperandType type3(Type::TENSOR_FLOAT32, {0, 0});
34   // Phase 1, operands
35   auto op1 = model->addOperand(&type0);
36   auto op2 = model->addOperand(&type0);
37   auto axis0 = model->addOperand(&type1);
38   auto result = model->addOperand(&type3);
39   // Phase 2, operations
40   static int32_t axis0_init[] = {0};
41   model->setOperandValue(axis0, axis0_init, sizeof(int32_t) * 1);
42   model->addOperation(ANEURALNETWORKS_CONCATENATION, {op1, op2, axis0}, {result});
43   // Phase 3, inputs and outputs
44   model->identifyInputsAndOutputs(
45     {op1, op2},
46     {result});
47   // Phase 4: set relaxed execution
48   model->relaxComputationFloat32toFloat16(true);
49   assert(model->isValid());
50 }
51 
is_ignored_dynamic_output_shape(int i)52 inline bool is_ignored_dynamic_output_shape(int i) {
53   static std::set<int> ignore = {};
54   return ignore.find(i) != ignore.end();
55 }
56 
57