1 // clang-format off
2 // Generated file (from: unidirectional_sequence_lstm_norm_peephole_projection.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {3, 2, 5});
5 OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
6 OperandType type10(Type::BOOL, {});
7 OperandType type11(Type::TENSOR_FLOAT32, {3, 2, 3});
8 OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
9 OperandType type3(Type::TENSOR_FLOAT32, {4});
10 OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
11 OperandType type5(Type::TENSOR_FLOAT32, {0});
12 OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
13 OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
14 OperandType type8(Type::INT32, {});
15 OperandType type9(Type::FLOAT32, {});
16 // Phase 1, operands
17 auto input = model->addOperand(&type0);
18 auto input_to_input_weights = model->addOperand(&type1);
19 auto input_to_forget_weights = model->addOperand(&type1);
20 auto input_to_cell_weights = model->addOperand(&type1);
21 auto input_to_output_weights = model->addOperand(&type1);
22 auto recurrent_to_intput_weights = model->addOperand(&type2);
23 auto recurrent_to_forget_weights = model->addOperand(&type2);
24 auto recurrent_to_cell_weights = model->addOperand(&type2);
25 auto recurrent_to_output_weights = model->addOperand(&type2);
26 auto cell_to_input_weights = model->addOperand(&type3);
27 auto cell_to_forget_weights = model->addOperand(&type3);
28 auto cell_to_output_weights = model->addOperand(&type3);
29 auto input_gate_bias = model->addOperand(&type3);
30 auto forget_gate_bias = model->addOperand(&type3);
31 auto cell_gate_bias = model->addOperand(&type3);
32 auto output_gate_bias = model->addOperand(&type3);
33 auto projection_weights = model->addOperand(&type4);
34 auto projection_bias = model->addOperand(&type5);
35 auto output_state_in = model->addOperand(&type6);
36 auto cell_state_in = model->addOperand(&type7);
37 auto activation_param = model->addOperand(&type8);
38 auto cell_clip_param = model->addOperand(&type9);
39 auto proj_clip_param = model->addOperand(&type9);
40 auto time_major_param = model->addOperand(&type10);
41 auto input_layer_norm_weights = model->addOperand(&type3);
42 auto forget_layer_norm_weights = model->addOperand(&type3);
43 auto cell_layer_norm_weights = model->addOperand(&type3);
44 auto output_layer_norm_weights = model->addOperand(&type3);
45 auto output = model->addOperand(&type11);
46 // Phase 2, operations
47 static int32_t activation_param_init[] = {4};
48 model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
49 static float cell_clip_param_init[] = {0.0f};
50 model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
51 static float proj_clip_param_init[] = {0.0f};
52 model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
53 static bool8 time_major_param_init[] = {true};
54 model->setOperandValue(time_major_param, time_major_param_init, sizeof(bool8) * 1);
55 model->addOperation(ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, time_major_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {output});
56 // Phase 3, inputs and outputs
57 model->identifyInputsAndOutputs(
58 {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
59 {output});
60 assert(model->isValid());
61 }
62
is_ignored(int i)63 inline bool is_ignored(int i) {
64 static std::set<int> ignore = {};
65 return ignore.find(i) != ignore.end();
66 }
67
CreateModel_dynamic_output_shape(Model * model)68 void CreateModel_dynamic_output_shape(Model *model) {
69 OperandType type0(Type::TENSOR_FLOAT32, {3, 2, 5});
70 OperandType type1(Type::TENSOR_FLOAT32, {4, 5});
71 OperandType type10(Type::BOOL, {});
72 OperandType type12(Type::TENSOR_FLOAT32, {0, 0, 0});
73 OperandType type2(Type::TENSOR_FLOAT32, {4, 3});
74 OperandType type3(Type::TENSOR_FLOAT32, {4});
75 OperandType type4(Type::TENSOR_FLOAT32, {3, 4});
76 OperandType type5(Type::TENSOR_FLOAT32, {0});
77 OperandType type6(Type::TENSOR_FLOAT32, {2, 3});
78 OperandType type7(Type::TENSOR_FLOAT32, {2, 4});
79 OperandType type8(Type::INT32, {});
80 OperandType type9(Type::FLOAT32, {});
81 // Phase 1, operands
82 auto input = model->addOperand(&type0);
83 auto input_to_input_weights = model->addOperand(&type1);
84 auto input_to_forget_weights = model->addOperand(&type1);
85 auto input_to_cell_weights = model->addOperand(&type1);
86 auto input_to_output_weights = model->addOperand(&type1);
87 auto recurrent_to_intput_weights = model->addOperand(&type2);
88 auto recurrent_to_forget_weights = model->addOperand(&type2);
89 auto recurrent_to_cell_weights = model->addOperand(&type2);
90 auto recurrent_to_output_weights = model->addOperand(&type2);
91 auto cell_to_input_weights = model->addOperand(&type3);
92 auto cell_to_forget_weights = model->addOperand(&type3);
93 auto cell_to_output_weights = model->addOperand(&type3);
94 auto input_gate_bias = model->addOperand(&type3);
95 auto forget_gate_bias = model->addOperand(&type3);
96 auto cell_gate_bias = model->addOperand(&type3);
97 auto output_gate_bias = model->addOperand(&type3);
98 auto projection_weights = model->addOperand(&type4);
99 auto projection_bias = model->addOperand(&type5);
100 auto output_state_in = model->addOperand(&type6);
101 auto cell_state_in = model->addOperand(&type7);
102 auto activation_param = model->addOperand(&type8);
103 auto cell_clip_param = model->addOperand(&type9);
104 auto proj_clip_param = model->addOperand(&type9);
105 auto time_major_param = model->addOperand(&type10);
106 auto input_layer_norm_weights = model->addOperand(&type3);
107 auto forget_layer_norm_weights = model->addOperand(&type3);
108 auto cell_layer_norm_weights = model->addOperand(&type3);
109 auto output_layer_norm_weights = model->addOperand(&type3);
110 auto output = model->addOperand(&type12);
111 // Phase 2, operations
112 static int32_t activation_param_init[] = {4};
113 model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
114 static float cell_clip_param_init[] = {0.0f};
115 model->setOperandValue(cell_clip_param, cell_clip_param_init, sizeof(float) * 1);
116 static float proj_clip_param_init[] = {0.0f};
117 model->setOperandValue(proj_clip_param, proj_clip_param_init, sizeof(float) * 1);
118 static bool8 time_major_param_init[] = {true};
119 model->setOperandValue(time_major_param, time_major_param_init, sizeof(bool8) * 1);
120 model->addOperation(ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM, {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, activation_param, cell_clip_param, proj_clip_param, time_major_param, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights}, {output});
121 // Phase 3, inputs and outputs
122 model->identifyInputsAndOutputs(
123 {input, input_to_input_weights, input_to_forget_weights, input_to_cell_weights, input_to_output_weights, recurrent_to_intput_weights, recurrent_to_forget_weights, recurrent_to_cell_weights, recurrent_to_output_weights, cell_to_input_weights, cell_to_forget_weights, cell_to_output_weights, input_gate_bias, forget_gate_bias, cell_gate_bias, output_gate_bias, projection_weights, projection_bias, output_state_in, cell_state_in, input_layer_norm_weights, forget_layer_norm_weights, cell_layer_norm_weights, output_layer_norm_weights},
124 {output});
125 assert(model->isValid());
126 }
127
is_ignored_dynamic_output_shape(int i)128 inline bool is_ignored_dynamic_output_shape(int i) {
129 static std::set<int> ignore = {};
130 return ignore.find(i) != ignore.end();
131 }
132
133