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