1 // clang-format off
2 // Generated file (from: strided_slice_quant8_7.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_QUANT8_ASYMM, {3}, 1.0f, 0);
5 OperandType type1(Type::TENSOR_INT32, {1});
6 OperandType type2(Type::INT32, {});
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);
14 auto shrinkAxisMask = model->addOperand(&type2);
15 auto output = model->addOperand(&type0);
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[] = {-4};
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);
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});
30 // Phase 3, inputs and outputs
31 model->identifyInputsAndOutputs(
32 {input},
33 {output});
34 assert(model->isValid());
35 }
36
is_ignored(int i)37 inline bool is_ignored(int i) {
38 static std::set<int> ignore = {};
39 return ignore.find(i) != ignore.end();
40 }
41
CreateModel_dynamic_output_shape(Model * model)42 void CreateModel_dynamic_output_shape(Model *model) {
43 OperandType type0(Type::TENSOR_QUANT8_ASYMM, {3}, 1.0f, 0);
44 OperandType type1(Type::TENSOR_INT32, {1});
45 OperandType type2(Type::INT32, {});
46 OperandType type3(Type::TENSOR_QUANT8_ASYMM, {0}, 1.0f, 0);
47 // Phase 1, operands
48 auto input = model->addOperand(&type0);
49 auto begins = model->addOperand(&type1);
50 auto ends = model->addOperand(&type1);
51 auto strides = model->addOperand(&type1);
52 auto beginMask = model->addOperand(&type2);
53 auto endMask = model->addOperand(&type2);
54 auto shrinkAxisMask = model->addOperand(&type2);
55 auto output = model->addOperand(&type3);
56 // Phase 2, operations
57 static int32_t begins_init[] = {-1};
58 model->setOperandValue(begins, begins_init, sizeof(int32_t) * 1);
59 static int32_t ends_init[] = {-4};
60 model->setOperandValue(ends, ends_init, sizeof(int32_t) * 1);
61 static int32_t strides_init[] = {-1};
62 model->setOperandValue(strides, strides_init, sizeof(int32_t) * 1);
63 static int32_t beginMask_init[] = {0};
64 model->setOperandValue(beginMask, beginMask_init, sizeof(int32_t) * 1);
65 static int32_t endMask_init[] = {0};
66 model->setOperandValue(endMask, endMask_init, sizeof(int32_t) * 1);
67 static int32_t shrinkAxisMask_init[] = {0};
68 model->setOperandValue(shrinkAxisMask, shrinkAxisMask_init, sizeof(int32_t) * 1);
69 model->addOperation(ANEURALNETWORKS_STRIDED_SLICE, {input, begins, ends, strides, beginMask, endMask, shrinkAxisMask}, {output});
70 // Phase 3, inputs and outputs
71 model->identifyInputsAndOutputs(
72 {input},
73 {output});
74 assert(model->isValid());
75 }
76
is_ignored_dynamic_output_shape(int i)77 inline bool is_ignored_dynamic_output_shape(int i) {
78 static std::set<int> ignore = {};
79 return ignore.find(i) != ignore.end();
80 }
81
82