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