• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated file (from: lstm3_state3.mod.py). Do not edit
CreateModel(Model * model)2 void CreateModel(Model *model) {
3   OperandType type5(Type::TENSOR_FLOAT32, {0});
4   OperandType type4(Type::TENSOR_FLOAT32, {16,20});
5   OperandType type9(Type::TENSOR_FLOAT32, {1});
6   OperandType type6(Type::TENSOR_FLOAT32, {2, 16});
7   OperandType type7(Type::TENSOR_FLOAT32, {2, 20});
8   OperandType type0(Type::TENSOR_FLOAT32, {2, 5});
9   OperandType type10(Type::TENSOR_FLOAT32, {2, 80});
10   OperandType type2(Type::TENSOR_FLOAT32, {20, 16});
11   OperandType type1(Type::TENSOR_FLOAT32, {20, 5});
12   OperandType type3(Type::TENSOR_FLOAT32, {20});
13   OperandType type8(Type::TENSOR_INT32, {1});
14   // Phase 1, operands
15   auto input = model->addOperand(&type0);
16   auto input_to_input_weights = model->addOperand(&type1);
17   auto input_to_forget_weights = model->addOperand(&type1);
18   auto input_to_cell_weights = model->addOperand(&type1);
19   auto input_to_output_weights = model->addOperand(&type1);
20   auto recurrent_to_intput_weights = model->addOperand(&type2);
21   auto recurrent_to_forget_weights = model->addOperand(&type2);
22   auto recurrent_to_cell_weights = model->addOperand(&type2);
23   auto recurrent_to_output_weights = model->addOperand(&type2);
24   auto cell_to_input_weights = model->addOperand(&type3);
25   auto cell_to_forget_weights = model->addOperand(&type3);
26   auto cell_to_output_weights = model->addOperand(&type3);
27   auto input_gate_bias = model->addOperand(&type3);
28   auto forget_gate_bias = model->addOperand(&type3);
29   auto cell_gate_bias = model->addOperand(&type3);
30   auto output_gate_bias = model->addOperand(&type3);
31   auto projection_weights = model->addOperand(&type4);
32   auto projection_bias = model->addOperand(&type5);
33   auto output_state_in = model->addOperand(&type6);
34   auto cell_state_in = model->addOperand(&type7);
35   auto activation_param = model->addOperand(&type8);
36   auto cell_clip_param = model->addOperand(&type9);
37   auto proj_clip_param = model->addOperand(&type9);
38   auto scratch_buffer = model->addOperand(&type10);
39   auto output_state_out = model->addOperand(&type6);
40   auto cell_state_out = model->addOperand(&type7);
41   auto output = model->addOperand(&type6);
42   // Phase 2, operations
43   model->addOperation(ANEURALNETWORKS_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}, {scratch_buffer, output_state_out, cell_state_out, output});
44   // Phase 3, inputs and outputs
45   model->identifyInputsAndOutputs(
46     {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},
47     {scratch_buffer, output_state_out, cell_state_out, output});
48   assert(model->isValid());
49 }
50 
is_ignored(int i)51 bool is_ignored(int i) {
52   static std::set<int> ignore = {1, 2, 0};
53   return ignore.find(i) != ignore.end();
54 }
55