1 // clang-format off
2 // Generated file (from: space_to_batch_float_1_relaxed.mod.py). Do not edit
CreateModel(Model * model)3 void CreateModel(Model *model) {
4 OperandType type0(Type::TENSOR_FLOAT32, {1, 4, 4, 1});
5 OperandType type1(Type::TENSOR_INT32, {2});
6 OperandType type2(Type::TENSOR_INT32, {2, 2});
7 OperandType type3(Type::TENSOR_FLOAT32, {4, 2, 2, 1});
8 // Phase 1, operands
9 auto input = model->addOperand(&type0);
10 auto block_size = model->addOperand(&type1);
11 auto paddings = model->addOperand(&type2);
12 auto output = model->addOperand(&type3);
13 // Phase 2, operations
14 static int32_t block_size_init[] = {2, 2};
15 model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 2);
16 static int32_t paddings_init[] = {0, 0, 0, 0};
17 model->setOperandValue(paddings, paddings_init, sizeof(int32_t) * 4);
18 model->addOperation(ANEURALNETWORKS_SPACE_TO_BATCH_ND, {input, block_size, paddings}, {output});
19 // Phase 3, inputs and outputs
20 model->identifyInputsAndOutputs(
21 {input},
22 {output});
23 // Phase 4: set relaxed execution
24 model->relaxComputationFloat32toFloat16(true);
25 assert(model->isValid());
26 }
27
is_ignored(int i)28 inline bool is_ignored(int i) {
29 static std::set<int> ignore = {};
30 return ignore.find(i) != ignore.end();
31 }
32
CreateModel_dynamic_output_shape(Model * model)33 void CreateModel_dynamic_output_shape(Model *model) {
34 OperandType type0(Type::TENSOR_FLOAT32, {1, 4, 4, 1});
35 OperandType type1(Type::TENSOR_INT32, {2});
36 OperandType type2(Type::TENSOR_INT32, {2, 2});
37 OperandType type4(Type::TENSOR_FLOAT32, {0, 0, 0, 0});
38 // Phase 1, operands
39 auto input = model->addOperand(&type0);
40 auto block_size = model->addOperand(&type1);
41 auto paddings = model->addOperand(&type2);
42 auto output = model->addOperand(&type4);
43 // Phase 2, operations
44 static int32_t block_size_init[] = {2, 2};
45 model->setOperandValue(block_size, block_size_init, sizeof(int32_t) * 2);
46 static int32_t paddings_init[] = {0, 0, 0, 0};
47 model->setOperandValue(paddings, paddings_init, sizeof(int32_t) * 4);
48 model->addOperation(ANEURALNETWORKS_SPACE_TO_BATCH_ND, {input, block_size, paddings}, {output});
49 // Phase 3, inputs and outputs
50 model->identifyInputsAndOutputs(
51 {input},
52 {output});
53 // Phase 4: set relaxed execution
54 model->relaxComputationFloat32toFloat16(true);
55 assert(model->isValid());
56 }
57
is_ignored_dynamic_output_shape(int i)58 inline bool is_ignored_dynamic_output_shape(int i) {
59 static std::set<int> ignore = {};
60 return ignore.find(i) != ignore.end();
61 }
62
63