1 // clang-format off 2 // Generated file (from: rnn_relaxed.mod.py). Do not edit 3 // Create the model 4 Model createTestModel() { 5 const std::vector<Operand> operands = { 6 { 7 .type = OperandType::TENSOR_FLOAT32, 8 .dimensions = {2, 8}, 9 .numberOfConsumers = 1, 10 .scale = 0.0f, 11 .zeroPoint = 0, 12 .lifetime = OperandLifeTime::MODEL_INPUT, 13 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 14 }, 15 { 16 .type = OperandType::TENSOR_FLOAT32, 17 .dimensions = {16, 8}, 18 .numberOfConsumers = 1, 19 .scale = 0.0f, 20 .zeroPoint = 0, 21 .lifetime = OperandLifeTime::MODEL_INPUT, 22 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 23 }, 24 { 25 .type = OperandType::TENSOR_FLOAT32, 26 .dimensions = {16, 16}, 27 .numberOfConsumers = 1, 28 .scale = 0.0f, 29 .zeroPoint = 0, 30 .lifetime = OperandLifeTime::MODEL_INPUT, 31 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 32 }, 33 { 34 .type = OperandType::TENSOR_FLOAT32, 35 .dimensions = {16}, 36 .numberOfConsumers = 1, 37 .scale = 0.0f, 38 .zeroPoint = 0, 39 .lifetime = OperandLifeTime::MODEL_INPUT, 40 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 41 }, 42 { 43 .type = OperandType::TENSOR_FLOAT32, 44 .dimensions = {2, 16}, 45 .numberOfConsumers = 1, 46 .scale = 0.0f, 47 .zeroPoint = 0, 48 .lifetime = OperandLifeTime::MODEL_INPUT, 49 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 50 }, 51 { 52 .type = OperandType::INT32, 53 .dimensions = {}, 54 .numberOfConsumers = 1, 55 .scale = 0.0f, 56 .zeroPoint = 0, 57 .lifetime = OperandLifeTime::CONSTANT_COPY, 58 .location = {.poolIndex = 0, .offset = 0, .length = 4}, 59 }, 60 { 61 .type = OperandType::TENSOR_FLOAT32, 62 .dimensions = {2, 16}, 63 .numberOfConsumers = 0, 64 .scale = 0.0f, 65 .zeroPoint = 0, 66 .lifetime = OperandLifeTime::MODEL_OUTPUT, 67 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 68 }, 69 { 70 .type = OperandType::TENSOR_FLOAT32, 71 .dimensions = {2, 16}, 72 .numberOfConsumers = 0, 73 .scale = 0.0f, 74 .zeroPoint = 0, 75 .lifetime = OperandLifeTime::MODEL_OUTPUT, 76 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 77 } 78 }; 79 80 const std::vector<Operation> operations = { 81 { 82 .type = OperationType::RNN, 83 .inputs = {0, 1, 2, 3, 4, 5}, 84 .outputs = {6, 7}, 85 } 86 }; 87 88 const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3, 4}; 89 const std::vector<uint32_t> outputIndexes = {6, 7}; 90 std::vector<uint8_t> operandValues = { 91 1, 0, 0, 0 92 }; 93 const std::vector<hidl_memory> pools = {}; 94 95 return { 96 .operands = operands, 97 .operations = operations, 98 .inputIndexes = inputIndexes, 99 .outputIndexes = outputIndexes, 100 .operandValues = operandValues, 101 .pools = pools, 102 .relaxComputationFloat32toFloat16 = true, 103 }; 104 } 105 106 inline bool is_ignored(int i) { 107 static std::set<int> ignore = {0}; 108 return ignore.find(i) != ignore.end(); 109 } 110 111 // Create the model 112 Model createTestModel_dynamic_output_shape() { 113 const std::vector<Operand> operands = { 114 { 115 .type = OperandType::TENSOR_FLOAT32, 116 .dimensions = {2, 8}, 117 .numberOfConsumers = 1, 118 .scale = 0.0f, 119 .zeroPoint = 0, 120 .lifetime = OperandLifeTime::MODEL_INPUT, 121 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 122 }, 123 { 124 .type = OperandType::TENSOR_FLOAT32, 125 .dimensions = {16, 8}, 126 .numberOfConsumers = 1, 127 .scale = 0.0f, 128 .zeroPoint = 0, 129 .lifetime = OperandLifeTime::MODEL_INPUT, 130 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 131 }, 132 { 133 .type = OperandType::TENSOR_FLOAT32, 134 .dimensions = {16, 16}, 135 .numberOfConsumers = 1, 136 .scale = 0.0f, 137 .zeroPoint = 0, 138 .lifetime = OperandLifeTime::MODEL_INPUT, 139 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 140 }, 141 { 142 .type = OperandType::TENSOR_FLOAT32, 143 .dimensions = {16}, 144 .numberOfConsumers = 1, 145 .scale = 0.0f, 146 .zeroPoint = 0, 147 .lifetime = OperandLifeTime::MODEL_INPUT, 148 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 149 }, 150 { 151 .type = OperandType::TENSOR_FLOAT32, 152 .dimensions = {2, 16}, 153 .numberOfConsumers = 1, 154 .scale = 0.0f, 155 .zeroPoint = 0, 156 .lifetime = OperandLifeTime::MODEL_INPUT, 157 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 158 }, 159 { 160 .type = OperandType::INT32, 161 .dimensions = {}, 162 .numberOfConsumers = 1, 163 .scale = 0.0f, 164 .zeroPoint = 0, 165 .lifetime = OperandLifeTime::CONSTANT_COPY, 166 .location = {.poolIndex = 0, .offset = 0, .length = 4}, 167 }, 168 { 169 .type = OperandType::TENSOR_FLOAT32, 170 .dimensions = {0, 0}, 171 .numberOfConsumers = 0, 172 .scale = 0.0f, 173 .zeroPoint = 0, 174 .lifetime = OperandLifeTime::MODEL_OUTPUT, 175 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 176 }, 177 { 178 .type = OperandType::TENSOR_FLOAT32, 179 .dimensions = {0, 0}, 180 .numberOfConsumers = 0, 181 .scale = 0.0f, 182 .zeroPoint = 0, 183 .lifetime = OperandLifeTime::MODEL_OUTPUT, 184 .location = {.poolIndex = 0, .offset = 0, .length = 0}, 185 } 186 }; 187 188 const std::vector<Operation> operations = { 189 { 190 .type = OperationType::RNN, 191 .inputs = {0, 1, 2, 3, 4, 5}, 192 .outputs = {6, 7}, 193 } 194 }; 195 196 const std::vector<uint32_t> inputIndexes = {0, 1, 2, 3, 4}; 197 const std::vector<uint32_t> outputIndexes = {6, 7}; 198 std::vector<uint8_t> operandValues = { 199 1, 0, 0, 0 200 }; 201 const std::vector<hidl_memory> pools = {}; 202 203 return { 204 .operands = operands, 205 .operations = operations, 206 .inputIndexes = inputIndexes, 207 .outputIndexes = outputIndexes, 208 .operandValues = operandValues, 209 .pools = pools, 210 .relaxComputationFloat32toFloat16 = true, 211 }; 212 } 213 214 inline bool is_ignored_dynamic_output_shape(int i) { 215 static std::set<int> ignore = {0}; 216 return ignore.find(i) != ignore.end(); 217 } 218 219