1 /*
2  * Copyright (C) 2019 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 #include <android/hardware/neuralnetworks/1.1/types.h>
18 #include "TestHarness.h"
19 
20 namespace android::hardware::neuralnetworks::V1_1 {
21 
22 // Make sure that the HIDL enums are compatible with the values defined in
23 // frameworks/ml/nn/tools/test_generator/test_harness/include/TestHarness.h.
24 using namespace test_helper;
25 #define CHECK_TEST_ENUM(EnumType, enumValue) \
26     static_assert(static_cast<EnumType>(Test##EnumType::enumValue) == EnumType::enumValue)
27 
28 CHECK_TEST_ENUM(OperationType, ADD);
29 CHECK_TEST_ENUM(OperationType, AVERAGE_POOL_2D);
30 CHECK_TEST_ENUM(OperationType, CONCATENATION);
31 CHECK_TEST_ENUM(OperationType, CONV_2D);
32 CHECK_TEST_ENUM(OperationType, DEPTHWISE_CONV_2D);
33 CHECK_TEST_ENUM(OperationType, DEPTH_TO_SPACE);
34 CHECK_TEST_ENUM(OperationType, DEQUANTIZE);
35 CHECK_TEST_ENUM(OperationType, EMBEDDING_LOOKUP);
36 CHECK_TEST_ENUM(OperationType, FLOOR);
37 CHECK_TEST_ENUM(OperationType, FULLY_CONNECTED);
38 CHECK_TEST_ENUM(OperationType, HASHTABLE_LOOKUP);
39 CHECK_TEST_ENUM(OperationType, L2_NORMALIZATION);
40 CHECK_TEST_ENUM(OperationType, L2_POOL_2D);
41 CHECK_TEST_ENUM(OperationType, LOCAL_RESPONSE_NORMALIZATION);
42 CHECK_TEST_ENUM(OperationType, LOGISTIC);
43 CHECK_TEST_ENUM(OperationType, LSH_PROJECTION);
44 CHECK_TEST_ENUM(OperationType, LSTM);
45 CHECK_TEST_ENUM(OperationType, MAX_POOL_2D);
46 CHECK_TEST_ENUM(OperationType, MUL);
47 CHECK_TEST_ENUM(OperationType, RELU);
48 CHECK_TEST_ENUM(OperationType, RELU1);
49 CHECK_TEST_ENUM(OperationType, RELU6);
50 CHECK_TEST_ENUM(OperationType, RESHAPE);
51 CHECK_TEST_ENUM(OperationType, RESIZE_BILINEAR);
52 CHECK_TEST_ENUM(OperationType, RNN);
53 CHECK_TEST_ENUM(OperationType, SOFTMAX);
54 CHECK_TEST_ENUM(OperationType, SPACE_TO_DEPTH);
55 CHECK_TEST_ENUM(OperationType, SVDF);
56 CHECK_TEST_ENUM(OperationType, TANH);
57 CHECK_TEST_ENUM(OperationType, BATCH_TO_SPACE_ND);
58 CHECK_TEST_ENUM(OperationType, DIV);
59 CHECK_TEST_ENUM(OperationType, MEAN);
60 CHECK_TEST_ENUM(OperationType, PAD);
61 CHECK_TEST_ENUM(OperationType, SPACE_TO_BATCH_ND);
62 CHECK_TEST_ENUM(OperationType, SQUEEZE);
63 CHECK_TEST_ENUM(OperationType, STRIDED_SLICE);
64 CHECK_TEST_ENUM(OperationType, SUB);
65 CHECK_TEST_ENUM(OperationType, TRANSPOSE);
66 
67 #undef CHECK_TEST_ENUM
68 
69 }  // namespace android::hardware::neuralnetworks::V1_1
70