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.2/types.h> 18 #include "TestHarness.h" 19 20 namespace android::hardware::neuralnetworks::V1_2 { 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(OperandType, FLOAT32); 29 CHECK_TEST_ENUM(OperandType, INT32); 30 CHECK_TEST_ENUM(OperandType, UINT32); 31 CHECK_TEST_ENUM(OperandType, TENSOR_FLOAT32); 32 CHECK_TEST_ENUM(OperandType, TENSOR_INT32); 33 CHECK_TEST_ENUM(OperandType, TENSOR_QUANT8_ASYMM); 34 CHECK_TEST_ENUM(OperandType, BOOL); 35 CHECK_TEST_ENUM(OperandType, TENSOR_QUANT16_SYMM); 36 CHECK_TEST_ENUM(OperandType, TENSOR_FLOAT16); 37 CHECK_TEST_ENUM(OperandType, TENSOR_BOOL8); 38 CHECK_TEST_ENUM(OperandType, FLOAT16); 39 CHECK_TEST_ENUM(OperandType, TENSOR_QUANT8_SYMM_PER_CHANNEL); 40 CHECK_TEST_ENUM(OperandType, TENSOR_QUANT16_ASYMM); 41 CHECK_TEST_ENUM(OperandType, TENSOR_QUANT8_SYMM); 42 43 CHECK_TEST_ENUM(OperationType, ADD); 44 CHECK_TEST_ENUM(OperationType, AVERAGE_POOL_2D); 45 CHECK_TEST_ENUM(OperationType, CONCATENATION); 46 CHECK_TEST_ENUM(OperationType, CONV_2D); 47 CHECK_TEST_ENUM(OperationType, DEPTHWISE_CONV_2D); 48 CHECK_TEST_ENUM(OperationType, DEPTH_TO_SPACE); 49 CHECK_TEST_ENUM(OperationType, DEQUANTIZE); 50 CHECK_TEST_ENUM(OperationType, EMBEDDING_LOOKUP); 51 CHECK_TEST_ENUM(OperationType, FLOOR); 52 CHECK_TEST_ENUM(OperationType, FULLY_CONNECTED); 53 CHECK_TEST_ENUM(OperationType, HASHTABLE_LOOKUP); 54 CHECK_TEST_ENUM(OperationType, L2_NORMALIZATION); 55 CHECK_TEST_ENUM(OperationType, L2_POOL_2D); 56 CHECK_TEST_ENUM(OperationType, LOCAL_RESPONSE_NORMALIZATION); 57 CHECK_TEST_ENUM(OperationType, LOGISTIC); 58 CHECK_TEST_ENUM(OperationType, LSH_PROJECTION); 59 CHECK_TEST_ENUM(OperationType, LSTM); 60 CHECK_TEST_ENUM(OperationType, MAX_POOL_2D); 61 CHECK_TEST_ENUM(OperationType, MUL); 62 CHECK_TEST_ENUM(OperationType, RELU); 63 CHECK_TEST_ENUM(OperationType, RELU1); 64 CHECK_TEST_ENUM(OperationType, RELU6); 65 CHECK_TEST_ENUM(OperationType, RESHAPE); 66 CHECK_TEST_ENUM(OperationType, RESIZE_BILINEAR); 67 CHECK_TEST_ENUM(OperationType, RNN); 68 CHECK_TEST_ENUM(OperationType, SOFTMAX); 69 CHECK_TEST_ENUM(OperationType, SPACE_TO_DEPTH); 70 CHECK_TEST_ENUM(OperationType, SVDF); 71 CHECK_TEST_ENUM(OperationType, TANH); 72 CHECK_TEST_ENUM(OperationType, BATCH_TO_SPACE_ND); 73 CHECK_TEST_ENUM(OperationType, DIV); 74 CHECK_TEST_ENUM(OperationType, MEAN); 75 CHECK_TEST_ENUM(OperationType, PAD); 76 CHECK_TEST_ENUM(OperationType, SPACE_TO_BATCH_ND); 77 CHECK_TEST_ENUM(OperationType, SQUEEZE); 78 CHECK_TEST_ENUM(OperationType, STRIDED_SLICE); 79 CHECK_TEST_ENUM(OperationType, SUB); 80 CHECK_TEST_ENUM(OperationType, TRANSPOSE); 81 CHECK_TEST_ENUM(OperationType, ABS); 82 CHECK_TEST_ENUM(OperationType, ARGMAX); 83 CHECK_TEST_ENUM(OperationType, ARGMIN); 84 CHECK_TEST_ENUM(OperationType, AXIS_ALIGNED_BBOX_TRANSFORM); 85 CHECK_TEST_ENUM(OperationType, BIDIRECTIONAL_SEQUENCE_LSTM); 86 CHECK_TEST_ENUM(OperationType, BIDIRECTIONAL_SEQUENCE_RNN); 87 CHECK_TEST_ENUM(OperationType, BOX_WITH_NMS_LIMIT); 88 CHECK_TEST_ENUM(OperationType, CAST); 89 CHECK_TEST_ENUM(OperationType, CHANNEL_SHUFFLE); 90 CHECK_TEST_ENUM(OperationType, DETECTION_POSTPROCESSING); 91 CHECK_TEST_ENUM(OperationType, EQUAL); 92 CHECK_TEST_ENUM(OperationType, EXP); 93 CHECK_TEST_ENUM(OperationType, EXPAND_DIMS); 94 CHECK_TEST_ENUM(OperationType, GATHER); 95 CHECK_TEST_ENUM(OperationType, GENERATE_PROPOSALS); 96 CHECK_TEST_ENUM(OperationType, GREATER); 97 CHECK_TEST_ENUM(OperationType, GREATER_EQUAL); 98 CHECK_TEST_ENUM(OperationType, GROUPED_CONV_2D); 99 CHECK_TEST_ENUM(OperationType, HEATMAP_MAX_KEYPOINT); 100 CHECK_TEST_ENUM(OperationType, INSTANCE_NORMALIZATION); 101 CHECK_TEST_ENUM(OperationType, LESS); 102 CHECK_TEST_ENUM(OperationType, LESS_EQUAL); 103 CHECK_TEST_ENUM(OperationType, LOG); 104 CHECK_TEST_ENUM(OperationType, LOGICAL_AND); 105 CHECK_TEST_ENUM(OperationType, LOGICAL_NOT); 106 CHECK_TEST_ENUM(OperationType, LOGICAL_OR); 107 CHECK_TEST_ENUM(OperationType, LOG_SOFTMAX); 108 CHECK_TEST_ENUM(OperationType, MAXIMUM); 109 CHECK_TEST_ENUM(OperationType, MINIMUM); 110 CHECK_TEST_ENUM(OperationType, NEG); 111 CHECK_TEST_ENUM(OperationType, NOT_EQUAL); 112 CHECK_TEST_ENUM(OperationType, PAD_V2); 113 CHECK_TEST_ENUM(OperationType, POW); 114 CHECK_TEST_ENUM(OperationType, PRELU); 115 CHECK_TEST_ENUM(OperationType, QUANTIZE); 116 CHECK_TEST_ENUM(OperationType, QUANTIZED_16BIT_LSTM); 117 CHECK_TEST_ENUM(OperationType, RANDOM_MULTINOMIAL); 118 CHECK_TEST_ENUM(OperationType, REDUCE_ALL); 119 CHECK_TEST_ENUM(OperationType, REDUCE_ANY); 120 CHECK_TEST_ENUM(OperationType, REDUCE_MAX); 121 CHECK_TEST_ENUM(OperationType, REDUCE_MIN); 122 CHECK_TEST_ENUM(OperationType, REDUCE_PROD); 123 CHECK_TEST_ENUM(OperationType, REDUCE_SUM); 124 CHECK_TEST_ENUM(OperationType, ROI_ALIGN); 125 CHECK_TEST_ENUM(OperationType, ROI_POOLING); 126 CHECK_TEST_ENUM(OperationType, RSQRT); 127 CHECK_TEST_ENUM(OperationType, SELECT); 128 CHECK_TEST_ENUM(OperationType, SIN); 129 CHECK_TEST_ENUM(OperationType, SLICE); 130 CHECK_TEST_ENUM(OperationType, SPLIT); 131 CHECK_TEST_ENUM(OperationType, SQRT); 132 CHECK_TEST_ENUM(OperationType, TILE); 133 CHECK_TEST_ENUM(OperationType, TOPK_V2); 134 CHECK_TEST_ENUM(OperationType, TRANSPOSE_CONV_2D); 135 CHECK_TEST_ENUM(OperationType, UNIDIRECTIONAL_SEQUENCE_LSTM); 136 CHECK_TEST_ENUM(OperationType, UNIDIRECTIONAL_SEQUENCE_RNN); 137 CHECK_TEST_ENUM(OperationType, RESIZE_NEAREST_NEIGHBOR); 138 139 #undef CHECK_TEST_ENUM 140 141 } // namespace android::hardware::neuralnetworks::V1_2 142