• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: hashtable_lookup_quant8.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_INT32, {4});
5   OperandType type1(Type::TENSOR_INT32, {3});
6   OperandType type2(Type::TENSOR_QUANT8_ASYMM, {3, 2}, 0.5f, 0);
7   OperandType type3(Type::TENSOR_QUANT8_ASYMM, {4, 2}, 0.5f, 0);
8   OperandType type4(Type::TENSOR_QUANT8_ASYMM, {4}, 1.0f, 0);
9   // Phase 1, operands
10   auto lookup = model->addOperand(&type0);
11   auto key = model->addOperand(&type1);
12   auto value = model->addOperand(&type2);
13   auto output = model->addOperand(&type3);
14   auto hits = model->addOperand(&type4);
15   // Phase 2, operations
16   model->addOperation(ANEURALNETWORKS_HASHTABLE_LOOKUP, {lookup, key, value}, {output, hits});
17   // Phase 3, inputs and outputs
18   model->identifyInputsAndOutputs(
19     {lookup, key, value},
20     {output, hits});
21   assert(model->isValid());
22 }
23 
is_ignored(int i)24 inline bool is_ignored(int i) {
25   static std::set<int> ignore = {};
26   return ignore.find(i) != ignore.end();
27 }
28 
CreateModel_dynamic_output_shape(Model * model)29 void CreateModel_dynamic_output_shape(Model *model) {
30   OperandType type0(Type::TENSOR_INT32, {4});
31   OperandType type1(Type::TENSOR_INT32, {3});
32   OperandType type2(Type::TENSOR_QUANT8_ASYMM, {3, 2}, 0.5f, 0);
33   OperandType type5(Type::TENSOR_QUANT8_ASYMM, {0, 0}, 0.5f, 0);
34   OperandType type6(Type::TENSOR_QUANT8_ASYMM, {0}, 1.0f, 0);
35   // Phase 1, operands
36   auto lookup = model->addOperand(&type0);
37   auto key = model->addOperand(&type1);
38   auto value = model->addOperand(&type2);
39   auto output = model->addOperand(&type5);
40   auto hits = model->addOperand(&type6);
41   // Phase 2, operations
42   model->addOperation(ANEURALNETWORKS_HASHTABLE_LOOKUP, {lookup, key, value}, {output, hits});
43   // Phase 3, inputs and outputs
44   model->identifyInputsAndOutputs(
45     {lookup, key, value},
46     {output, hits});
47   assert(model->isValid());
48 }
49 
is_ignored_dynamic_output_shape(int i)50 inline bool is_ignored_dynamic_output_shape(int i) {
51   static std::set<int> ignore = {};
52   return ignore.find(i) != ignore.end();
53 }
54 
55