1 /** 2 * Copyright 2021 Huawei Technologies Co., Ltd 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 #ifndef MINDSPORE_NNACL_INFER_INFER_REGISTER_H_ 17 #define MINDSPORE_NNACL_INFER_INFER_REGISTER_H_ 18 19 #include "nnacl/tensor_c.h" 20 #include "nnacl/op_base.h" 21 #include "nnacl/infer/infer.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 enum PrimType { 27 PrimType_NONE = 0, 28 PrimType_Abs = 1, 29 PrimType_Activation = 2, 30 PrimType_ActivationGrad = 3, 31 PrimType_Adam = 4, 32 PrimType_AddFusion = 5, 33 PrimType_AdderFusion = 6, 34 PrimType_AddGrad = 7, 35 PrimType_AddN = 8, 36 PrimType_All = 9, 37 PrimType_ApplyMomentum = 10, 38 PrimType_ArgMaxFusion = 11, 39 PrimType_ArgMinFusion = 12, 40 PrimType_Assert = 13, 41 PrimType_Assign = 14, 42 PrimType_AssignAdd = 15, 43 PrimType_AudioSpectrogram = 16, 44 PrimType_AvgPoolFusion = 17, 45 PrimType_AvgPoolGrad = 18, 46 PrimType_BatchNorm = 19, 47 PrimType_BatchNormGrad = 20, 48 PrimType_BatchToSpace = 21, 49 PrimType_BatchToSpaceND = 22, 50 PrimType_BiasAdd = 23, 51 PrimType_BinaryCrossEntropy = 24, 52 PrimType_BinaryCrossEntropyGrad = 25, 53 PrimType_BiasAddGrad = 26, 54 PrimType_BroadcastTo = 27, 55 PrimType_Cast = 28, 56 PrimType_Ceil = 29, 57 PrimType_Clip = 30, 58 PrimType_Concat = 31, 59 PrimType_Attention = 32, 60 PrimType_Conv2DBackpropFilterFusion = 33, 61 PrimType_Conv2DBackpropInputFusion = 34, 62 PrimType_Conv2DFusion = 35, 63 PrimType_Conv2dTransposeFusion = 36, 64 PrimType_Cos = 37, 65 PrimType_ConstantOfShape = 38, 66 PrimType_Crop = 39, 67 PrimType_CustomExtractFeatures = 40, 68 PrimType_CustomNormalize = 41, 69 PrimType_CustomPredict = 42, 70 PrimType_DeConv2DGradFilter = 43, 71 PrimType_Depend = 44, 72 PrimType_DepthToSpace = 45, 73 PrimType_DetectionPostProcess = 46, 74 PrimType_DivFusion = 47, 75 PrimType_DivGrad = 48, 76 PrimType_Dropout = 49, 77 PrimType_DropoutGrad = 50, 78 PrimType_Elu = 51, 79 PrimType_Eltwise = 52, 80 PrimType_Equal = 53, 81 PrimType_EmbeddingLookupFusion = 54, 82 PrimType_ExpFusion = 55, 83 PrimType_ExpandDims = 56, 84 PrimType_FakeQuantWithMinMaxVars = 57, 85 PrimType_FakeQuantWithMinMaxVarsPerChannel = 58, 86 PrimType_FftReal = 59, 87 PrimType_FftImag = 60, 88 PrimType_Flatten = 61, 89 PrimType_FlattenGrad = 62, 90 PrimType_Floor = 63, 91 PrimType_FloorDiv = 64, 92 PrimType_FloorMod = 65, 93 PrimType_Fill = 66, 94 PrimType_FullConnection = 67, 95 PrimType_FusedBatchNorm = 68, 96 PrimType_Gather = 69, 97 PrimType_GatherNd = 70, 98 PrimType_Greater = 71, 99 PrimType_GreaterEqual = 72, 100 PrimType_HashtableLookup = 73, 101 PrimType_InstanceNorm = 74, 102 PrimType_LayerNormFusion = 75, 103 PrimType_LeakyRelu = 76, 104 PrimType_Less = 77, 105 PrimType_LessEqual = 78, 106 PrimType_Log = 79, 107 PrimType_LogGrad = 80, 108 PrimType_LogicalAnd = 81, 109 PrimType_LogicalNot = 82, 110 PrimType_LogicalOr = 83, 111 PrimType_LpNormalization = 84, 112 PrimType_LRN = 85, 113 PrimType_LshProjection = 86, 114 PrimType_LSTM = 87, 115 PrimType_L2NormalizeFusion = 88, 116 PrimType_MatMulFusion = 89, 117 PrimType_Maximum = 90, 118 PrimType_MaximumGrad = 91, 119 PrimType_MaxPoolFusion = 92, 120 PrimType_MaxPoolGrad = 93, 121 PrimType_Merge = 94, 122 PrimType_Mfcc = 95, 123 PrimType_Minimum = 96, 124 PrimType_MinimumGrad = 97, 125 PrimType_Mod = 98, 126 PrimType_MulFusion = 99, 127 PrimType_MulGrad = 100, 128 PrimType_Neg = 101, 129 PrimType_NegGrad = 102, 130 PrimType_NotEqual = 103, 131 PrimType_NonMaxSuppression = 104, 132 PrimType_OneHot = 105, 133 PrimType_OnesLike = 106, 134 PrimType_PadFusion = 107, 135 PrimType_PartialFusion = 108, 136 PrimType_PowerGrad = 109, 137 PrimType_PowFusion = 110, 138 PrimType_PriorBox = 111, 139 PrimType_PReLUFusion = 112, 140 PrimType_QuantDTypeCast = 113, 141 PrimType_Rank = 114, 142 PrimType_Range = 115, 143 PrimType_Reciprocal = 116, 144 PrimType_RealDiv = 117, 145 PrimType_ReduceFusion = 118, 146 PrimType_Reshape = 119, 147 PrimType_Resize = 120, 148 PrimType_ReverseSequence = 121, 149 PrimType_ReverseV2 = 122, 150 PrimType_Rfft = 123, 151 PrimType_ROIPooling = 124, 152 PrimType_Round = 125, 153 PrimType_Rsqrt = 126, 154 PrimType_ScaleFusion = 127, 155 PrimType_ScatterNd = 128, 156 PrimType_SGD = 129, 157 PrimType_Shape = 130, 158 PrimType_SigmoidCrossEntropyWithLogits = 131, 159 PrimType_SigmoidCrossEntropyWithLogitsGrad = 132, 160 PrimType_Sin = 133, 161 PrimType_SkipGram = 134, 162 PrimType_SliceFusion = 135, 163 PrimType_SmoothL1Loss = 136, 164 PrimType_SmoothL1LossGrad = 137, 165 PrimType_Softmax = 138, 166 PrimType_SoftmaxCrossEntropyWithLogits = 139, 167 PrimType_SpaceToBatch = 140, 168 PrimType_SpaceToBatchND = 141, 169 PrimType_SpaceToDepth = 142, 170 PrimType_SparseSoftmaxCrossEntropyWithLogits = 143, 171 PrimType_SparseToDense = 144, 172 PrimType_Split = 145, 173 PrimType_Sqrt = 146, 174 PrimType_Squeeze = 147, 175 PrimType_Square = 148, 176 PrimType_SquaredDifference = 149, 177 PrimType_Stack = 150, 178 PrimType_StridedSlice = 151, 179 PrimType_SubFusion = 152, 180 PrimType_SubGrad = 153, 181 PrimType_Switch = 154, 182 PrimType_TensorListFromTensor = 155, 183 PrimType_TensorListGetItem = 156, 184 PrimType_TensorListReserve = 157, 185 PrimType_TensorListSetItem = 158, 186 PrimType_TensorListStack = 159, 187 PrimType_TileFusion = 160, 188 PrimType_TopKFusion = 161, 189 PrimType_Transpose = 162, 190 PrimType_Unique = 163, 191 PrimType_UnsortedSegmentSum = 164, 192 PrimType_Unsqueeze = 165, 193 PrimType_Unstack = 166, 194 PrimType_LSTMGrad = 167, 195 PrimType_Where = 168, 196 PrimType_ZerosLike = 169, 197 PrimType_Select = 170, 198 PrimType_ScatterNdUpdate = 171, 199 PrimType_GRU = 172, 200 PrimType_NonZero = 173, 201 PrimType_InvertPermutation = 174, 202 PrimType_Size = 175, 203 PrimType_RandomStandardNormal = 176, 204 PrimType_CropAndResize = 177, 205 PrimType_Erf = 178, 206 PrimType_StridedSliceGrad = 179, 207 PrimType_IsFinite = 180, 208 PrimType_LinSpace = 181, 209 PrimType_UniformReal = 182, 210 PrimType_AbsGrad = 183, 211 PrimType_RsqrtGrad = 184, 212 PrimType_SqrtGrad = 185, 213 PrimType_LayerNormGrad = 186, 214 PrimType_ResizeGrad = 187, 215 PrimType_Splice = 188, 216 PrimType_LogSoftmax = 189, 217 PrimType_Call = 190, 218 PrimType_Custom = 191, 219 PrimType_CumSum = 192, 220 PrimType_SplitWithOverlap = 193, 221 PrimType_GenOP = 194, 222 PrimType_RaggedRange = 195, 223 PrimType_GLU = 196, 224 PrimType_TensorArray = 197, 225 PrimType_TensorArrayRead = 198, 226 PrimType_TensorArrayWrite = 199, 227 PrimType_Affine = 200, 228 PrimType_MIN = PrimType_NONE, 229 PrimType_MAX = PrimType_Affine + 1 230 }; 231 232 void RegInfer(int prim_type, InferShape func); 233 234 #define REG_INFER(op, type, func) \ 235 __attribute__((constructor(102))) void Reg##op##Infer() { RegInfer(type, func); } 236 237 #ifdef __cplusplus 238 } 239 #endif 240 #endif // MINDSPORE_NNACL_INFER_INFER_REGISTER_H_ 241