Miao Wang | 65db490 | 2018-02-20 14:31:16 -0800 | [diff] [blame] | 1 | // Generated file (from: strided_slice_quant8_4.mod.py). Do not edit |
| 2 | void CreateModel(Model *model) { |
| 3 | OperandType type2(Type::INT32, {}); |
| 4 | OperandType type1(Type::TENSOR_INT32, {1}); |
| 5 | OperandType type3(Type::TENSOR_QUANT8_ASYMM, {1}, 1.0, 0); |
| 6 | OperandType type0(Type::TENSOR_QUANT8_ASYMM, {4}, 1.0, 0); |
| 7 | // Phase 1, operands |
| 8 | auto input = model->addOperand(&type0); |
| 9 | auto begins = model->addOperand(&type1); |
| 10 | auto ends = model->addOperand(&type1); |
| 11 | auto strides = model->addOperand(&type1); |
| 12 | auto beginMask = model->addOperand(&type2); |
| 13 | auto endMask = model->addOperand(&type2); |
Miao Wang | b66b5ab | 2018-04-02 14:50:11 -0700 | [diff] [blame] | 14 | auto shrinkAxisMask = model->addOperand(&type2); |
Miao Wang | 65db490 | 2018-02-20 14:31:16 -0800 | [diff] [blame] | 15 | auto output = model->addOperand(&type3); |
| 16 | // Phase 2, operations |
| 17 | static int32_t begins_init[] = {1}; |
| 18 | model->setOperandValue(begins, begins_init, sizeof(int32_t) * 1); |
| 19 | static int32_t ends_init[] = {-2}; |
| 20 | model->setOperandValue(ends, ends_init, sizeof(int32_t) * 1); |
| 21 | static int32_t strides_init[] = {1}; |
| 22 | model->setOperandValue(strides, strides_init, sizeof(int32_t) * 1); |
| 23 | static int32_t beginMask_init[] = {0}; |
| 24 | model->setOperandValue(beginMask, beginMask_init, sizeof(int32_t) * 1); |
| 25 | static int32_t endMask_init[] = {0}; |
| 26 | model->setOperandValue(endMask, endMask_init, sizeof(int32_t) * 1); |
Miao Wang | b66b5ab | 2018-04-02 14:50:11 -0700 | [diff] [blame] | 27 | static int32_t shrinkAxisMask_init[] = {0}; |
| 28 | model->setOperandValue(shrinkAxisMask, shrinkAxisMask_init, sizeof(int32_t) * 1); |
| 29 | model->addOperation(ANEURALNETWORKS_STRIDED_SLICE, {input, begins, ends, strides, beginMask, endMask, shrinkAxisMask}, {output}); |
Miao Wang | 65db490 | 2018-02-20 14:31:16 -0800 | [diff] [blame] | 30 | // Phase 3, inputs and outputs |
| 31 | model->identifyInputsAndOutputs( |
| 32 | {input}, |
| 33 | {output}); |
| 34 | assert(model->isValid()); |
| 35 | } |
| 36 | |
| 37 | bool is_ignored(int i) { |
| 38 | static std::set<int> ignore = {}; |
| 39 | return ignore.find(i) != ignore.end(); |
| 40 | } |