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