• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Generated file (from: rnn.mod.py). Do not edit
CreateModel(Model * model)2 void CreateModel(Model *model) {
3   OperandType type5(Type::INT32, {});
4   OperandType type2(Type::TENSOR_FLOAT32, {16, 16});
5   OperandType type1(Type::TENSOR_FLOAT32, {16, 8});
6   OperandType type3(Type::TENSOR_FLOAT32, {16});
7   OperandType type4(Type::TENSOR_FLOAT32, {2, 16});
8   OperandType type0(Type::TENSOR_FLOAT32, {2, 8});
9   // Phase 1, operands
10   auto input = model->addOperand(&type0);
11   auto weights = model->addOperand(&type1);
12   auto recurrent_weights = model->addOperand(&type2);
13   auto bias = model->addOperand(&type3);
14   auto hidden_state_in = model->addOperand(&type4);
15   auto activation_param = model->addOperand(&type5);
16   auto hidden_state_out = model->addOperand(&type4);
17   auto output = model->addOperand(&type4);
18   // Phase 2, operations
19   static int32_t activation_param_init[] = {1};
20   model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1);
21   model->addOperation(ANEURALNETWORKS_RNN, {input, weights, recurrent_weights, bias, hidden_state_in, activation_param}, {hidden_state_out, output});
22   // Phase 3, inputs and outputs
23   model->identifyInputsAndOutputs(
24     {input, weights, recurrent_weights, bias, hidden_state_in},
25     {hidden_state_out, output});
26   assert(model->isValid());
27 }
28 
is_ignored(int i)29 bool is_ignored(int i) {
30   static std::set<int> ignore = {0};
31   return ignore.find(i) != ignore.end();
32 }
33