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