• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // clang-format off
2 // Generated file (from: svdf2.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4   OperandType type0(Type::TENSOR_FLOAT32, {2, 3});
5   OperandType type1(Type::TENSOR_FLOAT32, {8, 3});
6   OperandType type2(Type::TENSOR_FLOAT32, {8, 10});
7   OperandType type3(Type::TENSOR_FLOAT32, {4});
8   OperandType type4(Type::TENSOR_FLOAT32, {2, 80});
9   OperandType type5(Type::INT32, {});
10   OperandType type6(Type::TENSOR_FLOAT32, {2, 4});
11   // Phase 1, operands
12   auto input = model->addOperand(&type0);
13   auto weights_feature = model->addOperand(&type1);
14   auto weights_time = model->addOperand(&type2);
15   auto bias = model->addOperand(&type3);
16   auto state_in = model->addOperand(&type4);
17   auto rank_param = model->addOperand(&type5);
18   auto activation_param = model->addOperand(&type5);
19   auto state_out = model->addOperand(&type4);
20   auto output = model->addOperand(&type6);
21   // Phase 2, operations
22   static int32_t rank_param_init[] = {2};
23   model->setOperandValue(rank_param, rank_param_init, sizeof(int32_t) * 1);
24   static int32_t activation_param_init[] = {0};
25   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
26   model->addOperation(ANEURALNETWORKS_SVDF, {input, weights_feature, weights_time, bias, state_in, rank_param, activation_param}, {state_out, output});
27   // Phase 3, inputs and outputs
28   model->identifyInputsAndOutputs(
29     {input, weights_feature, weights_time, bias, state_in},
30     {state_out, output});
31   assert(model->isValid());
32 }
33 
is_ignored(int i)34 inline bool is_ignored(int i) {
35   static std::set<int> ignore = {0};
36   return ignore.find(i) != ignore.end();
37 }
38 
CreateModel_dynamic_output_shape(Model * model)39 void CreateModel_dynamic_output_shape(Model *model) {
40   OperandType type0(Type::TENSOR_FLOAT32, {2, 3});
41   OperandType type1(Type::TENSOR_FLOAT32, {8, 3});
42   OperandType type2(Type::TENSOR_FLOAT32, {8, 10});
43   OperandType type3(Type::TENSOR_FLOAT32, {4});
44   OperandType type4(Type::TENSOR_FLOAT32, {2, 80});
45   OperandType type5(Type::INT32, {});
46   OperandType type7(Type::TENSOR_FLOAT32, {0, 0});
47   // Phase 1, operands
48   auto input = model->addOperand(&type0);
49   auto weights_feature = model->addOperand(&type1);
50   auto weights_time = model->addOperand(&type2);
51   auto bias = model->addOperand(&type3);
52   auto state_in = model->addOperand(&type4);
53   auto rank_param = model->addOperand(&type5);
54   auto activation_param = model->addOperand(&type5);
55   auto state_out = model->addOperand(&type7);
56   auto output = model->addOperand(&type7);
57   // Phase 2, operations
58   static int32_t rank_param_init[] = {2};
59   model->setOperandValue(rank_param, rank_param_init, sizeof(int32_t) * 1);
60   static int32_t activation_param_init[] = {0};
61   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
62   model->addOperation(ANEURALNETWORKS_SVDF, {input, weights_feature, weights_time, bias, state_in, rank_param, activation_param}, {state_out, output});
63   // Phase 3, inputs and outputs
64   model->identifyInputsAndOutputs(
65     {input, weights_feature, weights_time, bias, state_in},
66     {state_out, output});
67   assert(model->isValid());
68 }
69 
is_ignored_dynamic_output_shape(int i)70 inline bool is_ignored_dynamic_output_shape(int i) {
71   static std::set<int> ignore = {0};
72   return ignore.find(i) != ignore.end();
73 }
74 
75