1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef VTS_HAL_NEURALNETWORKS_V1_1_VTS_FUNCTIONAL_MODELS_H 18 #define VTS_HAL_NEURALNETWORKS_V1_1_VTS_FUNCTIONAL_MODELS_H 19 20 #define LOG_TAG "neuralnetworks_hidl_hal_test" 21 22 #include "TestHarness.h" 23 24 #include <android/hardware/neuralnetworks/1.0/types.h> 25 #include <android/hardware/neuralnetworks/1.1/types.h> 26 27 namespace android { 28 namespace hardware { 29 namespace neuralnetworks { 30 namespace V1_1 { 31 namespace vts { 32 namespace functional { 33 34 using MixedTypedExample = test_helper::MixedTypedExampleType; 35 36 #define FOR_EACH_TEST_MODEL(FN) \ 37 FN(add) \ 38 FN(add_broadcast_quant8) \ 39 FN(add_quant8) \ 40 FN(add_relaxed) \ 41 FN(avg_pool_float_1) \ 42 FN(avg_pool_float_1_relaxed) \ 43 FN(avg_pool_float_2) \ 44 FN(avg_pool_float_2_relaxed) \ 45 FN(avg_pool_float_3) \ 46 FN(avg_pool_float_3_relaxed) \ 47 FN(avg_pool_float_4) \ 48 FN(avg_pool_float_4_relaxed) \ 49 FN(avg_pool_float_5) \ 50 FN(avg_pool_float_5_relaxed) \ 51 FN(avg_pool_quant8_1) \ 52 FN(avg_pool_quant8_2) \ 53 FN(avg_pool_quant8_3) \ 54 FN(avg_pool_quant8_4) \ 55 FN(avg_pool_quant8_5) \ 56 FN(batch_to_space) \ 57 FN(batch_to_space_float_1) \ 58 FN(batch_to_space_float_1_relaxed) \ 59 FN(batch_to_space_quant8_1) \ 60 FN(batch_to_space_relaxed) \ 61 FN(concat_float_1) \ 62 FN(concat_float_1_relaxed) \ 63 FN(concat_float_2) \ 64 FN(concat_float_2_relaxed) \ 65 FN(concat_float_3) \ 66 FN(concat_float_3_relaxed) \ 67 FN(concat_quant8_1) \ 68 FN(concat_quant8_2) \ 69 FN(concat_quant8_3) \ 70 FN(conv_1_h3_w2_SAME) \ 71 FN(conv_1_h3_w2_SAME_relaxed) \ 72 FN(conv_1_h3_w2_VALID) \ 73 FN(conv_1_h3_w2_VALID_relaxed) \ 74 FN(conv_3_h3_w2_SAME) \ 75 FN(conv_3_h3_w2_SAME_relaxed) \ 76 FN(conv_3_h3_w2_VALID) \ 77 FN(conv_3_h3_w2_VALID_relaxed) \ 78 FN(conv_float) \ 79 FN(conv_float_2) \ 80 FN(conv_float_2_relaxed) \ 81 FN(conv_float_channels) \ 82 FN(conv_float_channels_relaxed) \ 83 FN(conv_float_channels_weights_as_inputs) \ 84 FN(conv_float_channels_weights_as_inputs_relaxed) \ 85 FN(conv_float_large) \ 86 FN(conv_float_large_relaxed) \ 87 FN(conv_float_large_weights_as_inputs) \ 88 FN(conv_float_large_weights_as_inputs_relaxed) \ 89 FN(conv_float_relaxed) \ 90 FN(conv_float_weights_as_inputs) \ 91 FN(conv_float_weights_as_inputs_relaxed) \ 92 FN(conv_quant8) \ 93 FN(conv_quant8_2) \ 94 FN(conv_quant8_channels) \ 95 FN(conv_quant8_channels_weights_as_inputs) \ 96 FN(conv_quant8_large) \ 97 FN(conv_quant8_large_weights_as_inputs) \ 98 FN(conv_quant8_overflow) \ 99 FN(conv_quant8_overflow_weights_as_inputs) \ 100 FN(conv_quant8_weights_as_inputs) \ 101 FN(depth_to_space_float_1) \ 102 FN(depth_to_space_float_1_relaxed) \ 103 FN(depth_to_space_float_2) \ 104 FN(depth_to_space_float_2_relaxed) \ 105 FN(depth_to_space_float_3) \ 106 FN(depth_to_space_float_3_relaxed) \ 107 FN(depth_to_space_quant8_1) \ 108 FN(depth_to_space_quant8_2) \ 109 FN(depthwise_conv) \ 110 FN(depthwise_conv2d_float) \ 111 FN(depthwise_conv2d_float_2) \ 112 FN(depthwise_conv2d_float_2_relaxed) \ 113 FN(depthwise_conv2d_float_large) \ 114 FN(depthwise_conv2d_float_large_2) \ 115 FN(depthwise_conv2d_float_large_2_relaxed) \ 116 FN(depthwise_conv2d_float_large_2_weights_as_inputs) \ 117 FN(depthwise_conv2d_float_large_2_weights_as_inputs_relaxed) \ 118 FN(depthwise_conv2d_float_large_relaxed) \ 119 FN(depthwise_conv2d_float_large_weights_as_inputs) \ 120 FN(depthwise_conv2d_float_large_weights_as_inputs_relaxed) \ 121 FN(depthwise_conv2d_float_relaxed) \ 122 FN(depthwise_conv2d_float_weights_as_inputs) \ 123 FN(depthwise_conv2d_float_weights_as_inputs_relaxed) \ 124 FN(depthwise_conv2d_quant8) \ 125 FN(depthwise_conv2d_quant8_2) \ 126 FN(depthwise_conv2d_quant8_large) \ 127 FN(depthwise_conv2d_quant8_large_weights_as_inputs) \ 128 FN(depthwise_conv2d_quant8_weights_as_inputs) \ 129 FN(depthwise_conv_relaxed) \ 130 FN(dequantize) \ 131 FN(dequantize_relaxed) \ 132 FN(div) \ 133 FN(div_broadcast_float) \ 134 FN(div_broadcast_float_relaxed) \ 135 FN(div_relaxed) \ 136 FN(embedding_lookup) \ 137 FN(embedding_lookup_relaxed) \ 138 FN(floor) \ 139 FN(floor_relaxed) \ 140 FN(fully_connected_float) \ 141 FN(fully_connected_float_2) \ 142 FN(fully_connected_float_2_relaxed) \ 143 FN(fully_connected_float_4d_simple) \ 144 FN(fully_connected_float_4d_simple_relaxed) \ 145 FN(fully_connected_float_large) \ 146 FN(fully_connected_float_large_relaxed) \ 147 FN(fully_connected_float_large_weights_as_inputs) \ 148 FN(fully_connected_float_large_weights_as_inputs_relaxed) \ 149 FN(fully_connected_float_relaxed) \ 150 FN(fully_connected_float_weights_as_inputs) \ 151 FN(fully_connected_float_weights_as_inputs_relaxed) \ 152 FN(fully_connected_quant8) \ 153 FN(fully_connected_quant8_2) \ 154 FN(fully_connected_quant8_large) \ 155 FN(fully_connected_quant8_large_weights_as_inputs) \ 156 FN(fully_connected_quant8_weights_as_inputs) \ 157 FN(hashtable_lookup_float) \ 158 FN(hashtable_lookup_float_relaxed) \ 159 FN(hashtable_lookup_quant8) \ 160 FN(l2_normalization) \ 161 FN(l2_normalization_2) \ 162 FN(l2_normalization_2_relaxed) \ 163 FN(l2_normalization_large) \ 164 FN(l2_normalization_large_relaxed) \ 165 FN(l2_normalization_relaxed) \ 166 FN(l2_pool_float) \ 167 FN(l2_pool_float_2) \ 168 FN(l2_pool_float_2_relaxed) \ 169 FN(l2_pool_float_large) \ 170 FN(l2_pool_float_large_relaxed) \ 171 FN(l2_pool_float_relaxed) \ 172 FN(local_response_norm_float_1) \ 173 FN(local_response_norm_float_1_relaxed) \ 174 FN(local_response_norm_float_2) \ 175 FN(local_response_norm_float_2_relaxed) \ 176 FN(local_response_norm_float_3) \ 177 FN(local_response_norm_float_3_relaxed) \ 178 FN(local_response_norm_float_4) \ 179 FN(local_response_norm_float_4_relaxed) \ 180 FN(logistic_float_1) \ 181 FN(logistic_float_1_relaxed) \ 182 FN(logistic_float_2) \ 183 FN(logistic_float_2_relaxed) \ 184 FN(logistic_quant8_1) \ 185 FN(logistic_quant8_2) \ 186 FN(lsh_projection) \ 187 FN(lsh_projection_2) \ 188 FN(lsh_projection_2_relaxed) \ 189 FN(lsh_projection_relaxed) \ 190 FN(lsh_projection_weights_as_inputs) \ 191 FN(lsh_projection_weights_as_inputs_relaxed) \ 192 FN(lstm) \ 193 FN(lstm2) \ 194 FN(lstm2_relaxed) \ 195 FN(lstm2_state) \ 196 FN(lstm2_state2) \ 197 FN(lstm2_state2_relaxed) \ 198 FN(lstm2_state_relaxed) \ 199 FN(lstm3) \ 200 FN(lstm3_relaxed) \ 201 FN(lstm3_state) \ 202 FN(lstm3_state2) \ 203 FN(lstm3_state2_relaxed) \ 204 FN(lstm3_state3) \ 205 FN(lstm3_state3_relaxed) \ 206 FN(lstm3_state_relaxed) \ 207 FN(lstm_relaxed) \ 208 FN(lstm_state) \ 209 FN(lstm_state2) \ 210 FN(lstm_state2_relaxed) \ 211 FN(lstm_state_relaxed) \ 212 FN(max_pool_float_1) \ 213 FN(max_pool_float_1_relaxed) \ 214 FN(max_pool_float_2) \ 215 FN(max_pool_float_2_relaxed) \ 216 FN(max_pool_float_3) \ 217 FN(max_pool_float_3_relaxed) \ 218 FN(max_pool_float_4) \ 219 FN(max_pool_float_4_relaxed) \ 220 FN(max_pool_quant8_1) \ 221 FN(max_pool_quant8_2) \ 222 FN(max_pool_quant8_3) \ 223 FN(max_pool_quant8_4) \ 224 FN(mean) \ 225 FN(mean_float_1) \ 226 FN(mean_float_1_relaxed) \ 227 FN(mean_float_2) \ 228 FN(mean_float_2_relaxed) \ 229 FN(mean_quant8_1) \ 230 FN(mean_quant8_2) \ 231 FN(mean_relaxed) \ 232 FN(mobilenet_224_gender_basic_fixed) \ 233 FN(mobilenet_224_gender_basic_fixed_relaxed) \ 234 FN(mobilenet_quantized) \ 235 FN(mul) \ 236 FN(mul_broadcast_quant8) \ 237 FN(mul_quant8) \ 238 FN(mul_relaxed) \ 239 FN(mul_relu) \ 240 FN(mul_relu_relaxed) \ 241 FN(pad) \ 242 FN(pad_float_1) \ 243 FN(pad_float_1_relaxed) \ 244 FN(pad_relaxed) \ 245 FN(relu1_float_1) \ 246 FN(relu1_float_1_relaxed) \ 247 FN(relu1_float_2) \ 248 FN(relu1_float_2_relaxed) \ 249 FN(relu1_quant8_1) \ 250 FN(relu1_quant8_2) \ 251 FN(relu6_float_1) \ 252 FN(relu6_float_1_relaxed) \ 253 FN(relu6_float_2) \ 254 FN(relu6_float_2_relaxed) \ 255 FN(relu6_quant8_1) \ 256 FN(relu6_quant8_2) \ 257 FN(relu_float_1) \ 258 FN(relu_float_1_relaxed) \ 259 FN(relu_float_2) \ 260 FN(relu_float_2_relaxed) \ 261 FN(relu_quant8_1) \ 262 FN(relu_quant8_2) \ 263 FN(reshape) \ 264 FN(reshape_quant8) \ 265 FN(reshape_quant8_weights_as_inputs) \ 266 FN(reshape_relaxed) \ 267 FN(reshape_weights_as_inputs) \ 268 FN(reshape_weights_as_inputs_relaxed) \ 269 FN(resize_bilinear) \ 270 FN(resize_bilinear_2) \ 271 FN(resize_bilinear_2_relaxed) \ 272 FN(resize_bilinear_relaxed) \ 273 FN(rnn) \ 274 FN(rnn_relaxed) \ 275 FN(rnn_state) \ 276 FN(rnn_state_relaxed) \ 277 FN(softmax_float_1) \ 278 FN(softmax_float_1_relaxed) \ 279 FN(softmax_float_2) \ 280 FN(softmax_float_2_relaxed) \ 281 FN(softmax_quant8_1) \ 282 FN(softmax_quant8_2) \ 283 FN(space_to_batch) \ 284 FN(space_to_batch_float_1) \ 285 FN(space_to_batch_float_1_relaxed) \ 286 FN(space_to_batch_float_2) \ 287 FN(space_to_batch_float_2_relaxed) \ 288 FN(space_to_batch_float_3) \ 289 FN(space_to_batch_float_3_relaxed) \ 290 FN(space_to_batch_quant8_1) \ 291 FN(space_to_batch_quant8_2) \ 292 FN(space_to_batch_quant8_3) \ 293 FN(space_to_batch_relaxed) \ 294 FN(space_to_depth_float_1) \ 295 FN(space_to_depth_float_1_relaxed) \ 296 FN(space_to_depth_float_2) \ 297 FN(space_to_depth_float_2_relaxed) \ 298 FN(space_to_depth_float_3) \ 299 FN(space_to_depth_float_3_relaxed) \ 300 FN(space_to_depth_quant8_1) \ 301 FN(space_to_depth_quant8_2) \ 302 FN(squeeze) \ 303 FN(squeeze_float_1) \ 304 FN(squeeze_float_1_relaxed) \ 305 FN(squeeze_quant8_1) \ 306 FN(squeeze_relaxed) \ 307 FN(strided_slice) \ 308 FN(strided_slice_float_1) \ 309 FN(strided_slice_float_10) \ 310 FN(strided_slice_float_10_relaxed) \ 311 FN(strided_slice_float_11) \ 312 FN(strided_slice_float_11_relaxed) \ 313 FN(strided_slice_float_1_relaxed) \ 314 FN(strided_slice_float_2) \ 315 FN(strided_slice_float_2_relaxed) \ 316 FN(strided_slice_float_3) \ 317 FN(strided_slice_float_3_relaxed) \ 318 FN(strided_slice_float_4) \ 319 FN(strided_slice_float_4_relaxed) \ 320 FN(strided_slice_float_5) \ 321 FN(strided_slice_float_5_relaxed) \ 322 FN(strided_slice_float_6) \ 323 FN(strided_slice_float_6_relaxed) \ 324 FN(strided_slice_float_7) \ 325 FN(strided_slice_float_7_relaxed) \ 326 FN(strided_slice_float_8) \ 327 FN(strided_slice_float_8_relaxed) \ 328 FN(strided_slice_float_9) \ 329 FN(strided_slice_float_9_relaxed) \ 330 FN(strided_slice_qaunt8_10) \ 331 FN(strided_slice_qaunt8_11) \ 332 FN(strided_slice_quant8_1) \ 333 FN(strided_slice_quant8_2) \ 334 FN(strided_slice_quant8_3) \ 335 FN(strided_slice_quant8_4) \ 336 FN(strided_slice_quant8_5) \ 337 FN(strided_slice_quant8_6) \ 338 FN(strided_slice_quant8_7) \ 339 FN(strided_slice_quant8_8) \ 340 FN(strided_slice_quant8_9) \ 341 FN(strided_slice_relaxed) \ 342 FN(sub) \ 343 FN(sub_broadcast_float) \ 344 FN(sub_broadcast_float_relaxed) \ 345 FN(sub_relaxed) \ 346 FN(svdf) \ 347 FN(svdf2) \ 348 FN(svdf2_relaxed) \ 349 FN(svdf_relaxed) \ 350 FN(svdf_state) \ 351 FN(svdf_state_relaxed) \ 352 FN(tanh) \ 353 FN(tanh_relaxed) \ 354 FN(transpose) \ 355 FN(transpose_float_1) \ 356 FN(transpose_float_1_relaxed) \ 357 FN(transpose_quant8_1) \ 358 FN(transpose_relaxed) 359 360 #define FORWARD_DECLARE_GENERATED_OBJECTS(function) \ 361 namespace function { \ 362 extern std::vector<MixedTypedExample> examples; \ 363 Model createTestModel(); \ 364 } 365 366 FOR_EACH_TEST_MODEL(FORWARD_DECLARE_GENERATED_OBJECTS) 367 368 #undef FORWARD_DECLARE_GENERATED_OBJECTS 369 370 } // namespace functional 371 } // namespace vts 372 } // namespace V1_1 373 } // namespace neuralnetworks 374 } // namespace hardware 375 } // namespace android 376 377 #endif // VTS_HAL_NEURALNETWORKS_V1_1_VTS_FUNCTIONAL_MODELS_H 378