Yang Ni | 8db6e48 | 2017-10-05 15:05:49 -0700 | [diff] [blame] | 1 | // Generated file (from: svdf2.mod.py). Do not edit |
| 2 | void CreateModel(Model *model) { |
Michael Butler | 540bafe | 2018-03-27 11:01:39 -0700 | [diff] [blame^] | 3 | OperandType type5(Type::INT32, {}); |
Yang Ni | 8db6e48 | 2017-10-05 15:05:49 -0700 | [diff] [blame] | 4 | OperandType type0(Type::TENSOR_FLOAT32, {2, 3}); |
| 5 | OperandType type6(Type::TENSOR_FLOAT32, {2, 4}); |
| 6 | OperandType type4(Type::TENSOR_FLOAT32, {2, 80}); |
| 7 | OperandType type3(Type::TENSOR_FLOAT32, {4}); |
| 8 | OperandType type2(Type::TENSOR_FLOAT32, {8, 10}); |
| 9 | OperandType type1(Type::TENSOR_FLOAT32, {8, 3}); |
Yang Ni | 8db6e48 | 2017-10-05 15:05:49 -0700 | [diff] [blame] | 10 | // Phase 1, operands |
| 11 | auto input = model->addOperand(&type0); |
| 12 | auto weights_feature = model->addOperand(&type1); |
| 13 | auto weights_time = model->addOperand(&type2); |
| 14 | auto bias = model->addOperand(&type3); |
| 15 | auto state_in = model->addOperand(&type4); |
| 16 | auto rank_param = model->addOperand(&type5); |
| 17 | auto activation_param = model->addOperand(&type5); |
| 18 | auto state_out = model->addOperand(&type4); |
| 19 | auto output = model->addOperand(&type6); |
| 20 | // Phase 2, operations |
Michael Butler | 540bafe | 2018-03-27 11:01:39 -0700 | [diff] [blame^] | 21 | static int32_t rank_param_init[] = {2}; |
| 22 | model->setOperandValue(rank_param, rank_param_init, sizeof(int32_t) * 1); |
| 23 | static int32_t activation_param_init[] = {0}; |
| 24 | model->setOperandValue(activation_param, activation_param_init, sizeof(int32_t) * 1); |
Yang Ni | 8db6e48 | 2017-10-05 15:05:49 -0700 | [diff] [blame] | 25 | model->addOperation(ANEURALNETWORKS_SVDF, {input, weights_feature, weights_time, bias, state_in, rank_param, activation_param}, {state_out, output}); |
| 26 | // Phase 3, inputs and outputs |
| 27 | model->identifyInputsAndOutputs( |
Michael Butler | 540bafe | 2018-03-27 11:01:39 -0700 | [diff] [blame^] | 28 | {input, weights_feature, weights_time, bias, state_in}, |
Yang Ni | 8db6e48 | 2017-10-05 15:05:49 -0700 | [diff] [blame] | 29 | {state_out, output}); |
| 30 | assert(model->isValid()); |
| 31 | } |
| 32 | |
| 33 | bool is_ignored(int i) { |
| 34 | static std::set<int> ignore = {0}; |
| 35 | return ignore.find(i) != ignore.end(); |
| 36 | } |