1 // clang-format off
2 // Generated file (from: lsh_projection_weights_as_inputs_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {4, 2});
5   OperandType type1(Type::TENSOR_INT32, {3, 2});
6   OperandType type2(Type::TENSOR_FLOAT32, {3});
7   OperandType type3(Type::INT32, {});
8   OperandType type4(Type::TENSOR_INT32, {8});
9   // Phase 1, operands
10   auto hash = model->addOperand(&type0);
11   auto lookup = model->addOperand(&type1);
12   auto weight = model->addOperand(&type2);
13   auto type_param = model->addOperand(&type3);
14   auto output = model->addOperand(&type4);
15   // Phase 2, operations
16   static int32_t type_param_init[] = {2};
17   model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1);
18   model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output});
19   // Phase 3, inputs and outputs
20   model->identifyInputsAndOutputs(
21     {hash, lookup, weight},
22     {output});
23   // Phase 4: set relaxed execution
24   model->relaxComputationFloat32toFloat16(true);
25   assert(model->isValid());
26 }
27 
is_ignored(int i)28 inline bool is_ignored(int i) {
29   static std::set<int> ignore = {};
30   return ignore.find(i) != ignore.end();
31 }
32 
CreateModel_dynamic_output_shape(Model * model)33 void CreateModel_dynamic_output_shape(Model *model) {
34   OperandType type0(Type::TENSOR_FLOAT32, {4, 2});
35   OperandType type1(Type::TENSOR_INT32, {3, 2});
36   OperandType type2(Type::TENSOR_FLOAT32, {3});
37   OperandType type3(Type::INT32, {});
38   OperandType type5(Type::TENSOR_INT32, {0});
39   // Phase 1, operands
40   auto hash = model->addOperand(&type0);
41   auto lookup = model->addOperand(&type1);
42   auto weight = model->addOperand(&type2);
43   auto type_param = model->addOperand(&type3);
44   auto output = model->addOperand(&type5);
45   // Phase 2, operations
46   static int32_t type_param_init[] = {2};
47   model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1);
48   model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output});
49   // Phase 3, inputs and outputs
50   model->identifyInputsAndOutputs(
51     {hash, lookup, weight},
52     {output});
53   // Phase 4: set relaxed execution
54   model->relaxComputationFloat32toFloat16(true);
55   assert(model->isValid());
56 }
57 
is_ignored_dynamic_output_shape(int i)58 inline bool is_ignored_dynamic_output_shape(int i) {
59   static std::set<int> ignore = {};
60   return ignore.find(i) != ignore.end();
61 }
62 
63