1 // clang-format off
2 // Generated file (from: avg_pool_quant8_3.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 100, 100, 1}, 0.5f, 0);
5 OperandType type1(Type::INT32, {});
6 OperandType type2(Type::TENSOR_QUANT8_ASYMM, {1, 23, 23, 1}, 0.5f, 0);
7 // Phase 1, operands
8 auto i0 = model->addOperand(&type0);
9 auto padding = model->addOperand(&type1);
10 auto stride = model->addOperand(&type1);
11 auto filter = model->addOperand(&type1);
12 auto activation = model->addOperand(&type1);
13 auto output = model->addOperand(&type2);
14 // Phase 2, operations
15 static int32_t padding_init[] = {0};
16 model->setOperandValue(padding, padding_init, sizeof(int32_t) * 1);
17 static int32_t stride_init[] = {4};
18 model->setOperandValue(stride, stride_init, sizeof(int32_t) * 1);
19 static int32_t filter_init[] = {10};
20 model->setOperandValue(filter, filter_init, sizeof(int32_t) * 1);
21 static int32_t activation_init[] = {0};
22 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
23 model->addOperation(ANEURALNETWORKS_AVERAGE_POOL_2D, {i0, padding, padding, padding, padding, stride, stride, filter, filter, activation}, {output});
24 // Phase 3, inputs and outputs
25 model->identifyInputsAndOutputs(
26 {i0},
27 {output});
28 assert(model->isValid());
29 }
30
is_ignored(int i)31 inline bool is_ignored(int i) {
32 static std::set<int> ignore = {};
33 return ignore.find(i) != ignore.end();
34 }
35
CreateModel_dynamic_output_shape(Model * model)36 void CreateModel_dynamic_output_shape(Model *model) {
37 OperandType type0(Type::TENSOR_QUANT8_ASYMM, {1, 100, 100, 1}, 0.5f, 0);
38 OperandType type1(Type::INT32, {});
39 OperandType type3(Type::TENSOR_QUANT8_ASYMM, {0, 0, 0, 0}, 0.5f, 0);
40 // Phase 1, operands
41 auto i0 = model->addOperand(&type0);
42 auto padding = model->addOperand(&type1);
43 auto stride = model->addOperand(&type1);
44 auto filter = model->addOperand(&type1);
45 auto activation = model->addOperand(&type1);
46 auto output = model->addOperand(&type3);
47 // Phase 2, operations
48 static int32_t padding_init[] = {0};
49 model->setOperandValue(padding, padding_init, sizeof(int32_t) * 1);
50 static int32_t stride_init[] = {4};
51 model->setOperandValue(stride, stride_init, sizeof(int32_t) * 1);
52 static int32_t filter_init[] = {10};
53 model->setOperandValue(filter, filter_init, sizeof(int32_t) * 1);
54 static int32_t activation_init[] = {0};
55 model->setOperandValue(activation, activation_init, sizeof(int32_t) * 1);
56 model->addOperation(ANEURALNETWORKS_AVERAGE_POOL_2D, {i0, padding, padding, padding, padding, stride, stride, filter, filter, activation}, {output});
57 // Phase 3, inputs and outputs
58 model->identifyInputsAndOutputs(
59 {i0},
60 {output});
61 assert(model->isValid());
62 }
63
is_ignored_dynamic_output_shape(int i)64 inline bool is_ignored_dynamic_output_shape(int i) {
65 static std::set<int> ignore = {};
66 return ignore.find(i) != ignore.end();
67 }
68
69