1 // clang-format off
2 // Generated file (from: lsh_projection_weights_as_inputs.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 assert(model->isValid());
24 }
25
is_ignored(int i)26 inline bool is_ignored(int i) {
27 static std::set<int> ignore = {};
28 return ignore.find(i) != ignore.end();
29 }
30
CreateModel_dynamic_output_shape(Model * model)31 void CreateModel_dynamic_output_shape(Model *model) {
32 OperandType type0(Type::TENSOR_FLOAT32, {4, 2});
33 OperandType type1(Type::TENSOR_INT32, {3, 2});
34 OperandType type2(Type::TENSOR_FLOAT32, {3});
35 OperandType type3(Type::INT32, {});
36 OperandType type5(Type::TENSOR_INT32, {0});
37 // Phase 1, operands
38 auto hash = model->addOperand(&type0);
39 auto lookup = model->addOperand(&type1);
40 auto weight = model->addOperand(&type2);
41 auto type_param = model->addOperand(&type3);
42 auto output = model->addOperand(&type5);
43 // Phase 2, operations
44 static int32_t type_param_init[] = {2};
45 model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1);
46 model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output});
47 // Phase 3, inputs and outputs
48 model->identifyInputsAndOutputs(
49 {hash, lookup, weight},
50 {output});
51 assert(model->isValid());
52 }
53
is_ignored_dynamic_output_shape(int i)54 inline bool is_ignored_dynamic_output_shape(int i) {
55 static std::set<int> ignore = {};
56 return ignore.find(i) != ignore.end();
57 }
58
59