Home | History | Annotate | Download | only in models
      1 // clang-format off
      2 // Generated file (from: lsh_projection_relaxed.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, {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 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[] = {2};
     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   // Phase 4: set relaxed execution
     26   model->relaxComputationFloat32toFloat16(true);
     27   assert(model->isValid());
     28 }
     29 
     30 inline bool is_ignored(int i) {
     31   static std::set<int> ignore = {};
     32   return ignore.find(i) != ignore.end();
     33 }
     34 
     35 void CreateModel_dynamic_output_shape(Model *model) {
     36   OperandType type0(Type::TENSOR_FLOAT32, {4, 2});
     37   OperandType type1(Type::TENSOR_INT32, {3, 2});
     38   OperandType type2(Type::TENSOR_FLOAT32, {3});
     39   OperandType type3(Type::INT32, {});
     40   OperandType type5(Type::TENSOR_INT32, {0});
     41   // Phase 1, operands
     42   auto hash = model->addOperand(&type0);
     43   auto lookup = model->addOperand(&type1);
     44   auto weight = model->addOperand(&type2);
     45   auto type_param = model->addOperand(&type3);
     46   auto output = model->addOperand(&type5);
     47   // Phase 2, operations
     48   static float hash_init[] = {0.123f, 0.456f, -0.321f, -0.654f, 1.234f, 5.678f, -4.321f, -8.765f};
     49   model->setOperandValue(hash, hash_init, sizeof(float) * 8);
     50   static int32_t type_param_init[] = {2};
     51   model->setOperandValue(type_param, type_param_init, sizeof(int32_t) * 1);
     52   model->addOperation(ANEURALNETWORKS_LSH_PROJECTION, {hash, lookup, weight, type_param}, {output});
     53   // Phase 3, inputs and outputs
     54   model->identifyInputsAndOutputs(
     55     {lookup, weight},
     56     {output});
     57   // Phase 4: set relaxed execution
     58   model->relaxComputationFloat32toFloat16(true);
     59   assert(model->isValid());
     60 }
     61 
     62 inline bool is_ignored_dynamic_output_shape(int i) {
     63   static std::set<int> ignore = {};
     64   return ignore.find(i) != ignore.end();
     65 }
     66 
     67