1 // clang-format off 2 // Generated file (from: lsh_projection_2.mod.py). Do not edit 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, {4}); 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 float hash_init[] = {0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}; 17 model->setOperandValue(hash, hash_init, sizeof(float) * 8); 18 static int32_t type_param_init[] = {1}; 19 model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1); 20 model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output}); 21 // Phase 3, inputs and outputs 22 model->identifyInputsAndOutputs( 23 {lookup, weight}, 24 {output}); 25 assert(model->isValid()); 26 } 27 28 inline bool is_ignored(int i) { 29 static std::set<int> ignore = {}; 30 return ignore.find(i) != ignore.end(); 31 } 32 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 float hash_init[] = {0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f}; 47 model->setOperandValue(hash, hash_init, sizeof(float) * 8); 48 static int32_t type_param_init[] = {1}; 49 model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1); 50 model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output}); 51 // Phase 3, inputs and outputs 52 model->identifyInputsAndOutputs( 53 {lookup, weight}, 54 {output}); 55 assert(model->isValid()); 56 } 57 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