1 // clang-format off
2 // Generated file (from: svdf_state_relaxed.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, {4, 3});
6 OperandType type2(Type::TENSOR_FLOAT32, {4, 10});
7 OperandType type3(Type::TENSOR_FLOAT32, {4});
8 OperandType type4(Type::TENSOR_FLOAT32, {2, 40});
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[] = {1};
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 // Phase 4: set relaxed execution
32 model->relaxComputationFloat32toFloat16(true);
33 assert(model->isValid());
34 }
35
is_ignored(int i)36 inline bool is_ignored(int i) {
37 static std::set<int> ignore = {};
38 return ignore.find(i) != ignore.end();
39 }
40
CreateModel_dynamic_output_shape(Model * model)41 void CreateModel_dynamic_output_shape(Model *model) {
42 OperandType type0(Type::TENSOR_FLOAT32, {2, 3});
43 OperandType type1(Type::TENSOR_FLOAT32, {4, 3});
44 OperandType type2(Type::TENSOR_FLOAT32, {4, 10});
45 OperandType type3(Type::TENSOR_FLOAT32, {4});
46 OperandType type4(Type::TENSOR_FLOAT32, {2, 40});
47 OperandType type5(Type::INT32, {});
48 OperandType type7(Type::TENSOR_FLOAT32, {0, 0});
49 // Phase 1, operands
50 auto input = model->addOperand(&type0);
51 auto weights_feature = model->addOperand(&type1);
52 auto weights_time = model->addOperand(&type2);
53 auto bias = model->addOperand(&type3);
54 auto state_in = model->addOperand(&type4);
55 auto rank_param = model->addOperand(&type5);
56 auto activation_param = model->addOperand(&type5);
57 auto state_out = model->addOperand(&type7);
58 auto output = model->addOperand(&type7);
59 // Phase 2, operations
60 static int32_t rank_param_init[] = {1};
61 model->setOperandValue(rank_param, rank_param_init, sizeof(int32_t) * 1);
62 static int32_t activation_param_init[] = {0};
63 model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
64 model->addOperation(ANEURALNETWORKS_SVDF, {input, weights_feature, weights_time, bias, state_in, rank_param, activation_param}, {state_out, output});
65 // Phase 3, inputs and outputs
66 model->identifyInputsAndOutputs(
67 {input, weights_feature, weights_time, bias, state_in},
68 {state_out, output});
69 // Phase 4: set relaxed execution
70 model->relaxComputationFloat32toFloat16(true);
71 assert(model->isValid());
72 }
73
is_ignored_dynamic_output_shape(int i)74 inline bool is_ignored_dynamic_output_shape(int i) {
75 static std::set<int> ignore = {};
76 return ignore.find(i) != ignore.end();
77 }
78
79