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