1 // Generated file (from: lsh_projection_relaxed.mod.py). Do not edit
CreateModel(Model * model)2 void CreateModel(Model *model) {
3 OperandType type3(Type::INT32, {});
4 OperandType type2(Type::TENSOR_FLOAT32, {3});
5 OperandType type0(Type::TENSOR_FLOAT32, {4, 2});
6 OperandType type1(Type::TENSOR_INT32, {3, 2});
7 OperandType type4(Type::TENSOR_INT32, {8});
8 // Phase 1, operands
9 auto hash = model->addOperand(&type0);
10 auto lookup = model->addOperand(&type1);
11 auto weight = model->addOperand(&type2);
12 auto type_param = model->addOperand(&type3);
13 auto output = model->addOperand(&type4);
14 // Phase 2, operations
15 static float hash_init[] = {0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f};
16 model->setOperandValue(hash, hash_init, sizeof(float) * 8);
17 static int32_t type_param_init[] = {2};
18 model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1);
19 model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output});
20 // Phase 3, inputs and outputs
21 model->identifyInputsAndOutputs(
22 {lookup, weight},
23 {output});
24 // Phase 4: set relaxed execution
25 model->relaxComputationFloat32toFloat16(true);
26 assert(model->isValid());
27 }
28
is_ignored(int i)29 bool is_ignored(int i) {
30 static std::set<int> ignore = {};
31 return ignore.find(i) != ignore.end();
32 }
33