You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 12 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """
  16. Primitive operator classes.
  17. A collection of operators to build neural networks or to compute functions.
  18. """
  19. from .image_ops import (CropAndResize)
  20. from .array_ops import (Argmax, Argmin, Cast, Concat, Pack, Unpack,
  21. Diag, DiagPart, DType, ExpandDims, Eye,
  22. Fill, GatherNd, GatherV2, SparseGatherV2, InvertPermutation,
  23. IsInstance, IsSubClass, ArgMaxWithValue, OnesLike, ZerosLike,
  24. Rank, Reshape, ResizeNearestNeighbor, ArgMinWithValue, Meshgrid,
  25. SameTypeShape, ScatterAdd, ScatterSub, ScatterMul, ScatterDiv, ScatterMax, ScatterMin,
  26. ScatterUpdate, ScalarToArray, ScalarToTensor, ScatterNd, ScatterNdUpdate, Select,
  27. Shape, DynamicShape, Size, Slice, Split, TransShape, ParallelConcat, Padding,
  28. ScatterNdAdd, ScatterNdSub, ScatterNonAliasingAdd, ReverseV2, Rint,
  29. Squeeze, StridedSlice, Tile, TensorScatterUpdate, EditDistance, Sort,
  30. Transpose, TruncatedNormal, TupleToArray, UnsortedSegmentMin, UnsortedSegmentProd,
  31. UnsortedSegmentSum, SpaceToDepth, DepthToSpace, SpaceToBatch, BatchToSpace,
  32. SpaceToBatchND, BatchToSpaceND, BroadcastTo, InplaceUpdate, ReverseSequence, EmbeddingLookup,
  33. Unique, GatherD, Identity, RepeatElements)
  34. from .comm_ops import (AllGather, AllReduce, _AlltoAll, ReduceScatter, Broadcast,
  35. _MirrorOperator, ReduceOp, _VirtualDataset,
  36. _VirtualDiv, _GetTensorSlice,
  37. _HostAllGather, _HostReduceScatter)
  38. from .debug_ops import (ImageSummary, InsertGradientOf, HookBackward, ScalarSummary,
  39. TensorSummary, HistogramSummary, Print, Assert)
  40. from .control_ops import ControlDepend, GeSwitch, Merge
  41. from .inner_ops import ScalarCast
  42. from .math_ops import (Abs, ACos, Asin, Asinh, AddN, AccumulateNV2, AssignAdd, AssignSub, Atan2, BatchMatMul, BitwiseAnd, BitwiseOr,
  43. BitwiseXor, Inv, Invert, ApproximateEqual, InplaceAdd, InplaceSub,
  44. ReduceMax, ReduceMin, ReduceMean, ReduceSum, ReduceAll, ReduceProd, CumProd, ReduceAny,
  45. Cos, Div, DivNoNan, Equal, EqualCount, Exp, Expm1, Erf, Erfc, Floor, FloorDiv, FloorMod, Ceil,
  46. Acosh, Greater, GreaterEqual, Less, LessEqual, Log, Log1p, LogicalAnd, Mod,
  47. LogicalNot, LogicalOr, MatMul, Maximum,
  48. Minimum, Mul, Neg, NMSWithMask, NotEqual,
  49. NPUAllocFloatStatus, NPUClearFloatStatus,
  50. NPUGetFloatStatus, Pow, RealDiv, IsNan, IsInf, IsFinite, FloatStatus,
  51. Reciprocal, CumSum, HistogramFixedWidth, SquaredDifference, Xdivy, Xlogy,
  52. Sin, Sqrt, Rsqrt, BesselI0e, BesselI1e, TruncateDiv, TruncateMod, IFMR,
  53. Square, Sub, TensorAdd, Sign, Round, SquareSumAll, Atan, Atanh, Cosh, Sinh, Eps, Tan)
  54. from .random_ops import (RandomChoiceWithMask, StandardNormal, Gamma, Poisson, UniformInt, UniformReal,
  55. RandomCategorical, StandardLaplace, Multinomial)
  56. from .nn_ops import (LSTM, SGD, Adam, FusedSparseAdam, FusedSparseLazyAdam, ApplyMomentum, BatchNorm,
  57. BiasAdd, Conv2D,
  58. DepthwiseConv2dNative,
  59. DropoutDoMask, Dropout,
  60. DropoutGenMask, Flatten, FusedBatchNorm, FusedBatchNormEx, BNTrainingReduce, BNTrainingUpdate,
  61. Gelu, Elu,
  62. GetNext, L2Normalize, LayerNorm, L2Loss, CTCLoss, CTCGreedyDecoder,
  63. LogSoftmax,
  64. MaxPool, DataFormatDimMap,
  65. AvgPool, Conv2DBackpropInput,
  66. MaxPoolWithArgmax, OneHot, Pad, MirrorPad, PReLU, ReLU, ReLU6, ReLUV2, HSwish, HSigmoid,
  67. ResizeBilinear, Sigmoid,
  68. SigmoidCrossEntropyWithLogits,
  69. SmoothL1Loss, Softmax, Softsign, Softplus, LRN, RNNTLoss, DynamicRNN,
  70. SoftmaxCrossEntropyWithLogits, ROIAlign,
  71. SparseSoftmaxCrossEntropyWithLogits, Tanh,
  72. TopK, BinaryCrossEntropy, KLDivLoss, SparseApplyAdagrad, LARSUpdate, ApplyFtrl, SparseApplyFtrl,
  73. ApplyProximalAdagrad, SparseApplyProximalAdagrad, SparseApplyAdagradV2, SparseApplyFtrlV2,
  74. FusedSparseFtrl, FusedSparseProximalAdagrad,
  75. ApplyAdaMax, ApplyAdadelta, ApplyAdagrad, ApplyAdagradV2,
  76. ApplyAddSign, ApplyPowerSign, ApplyGradientDescent, ApplyProximalGradientDescent,
  77. ApplyRMSProp, ApplyCenteredRMSProp, BasicLSTMCell, InTopK, UniformSampler)
  78. from . import _quant_ops
  79. from ._quant_ops import *
  80. from .other_ops import (Assign, IOU, BoundingBoxDecode, BoundingBoxEncode, PopulationCount,
  81. CheckValid, MakeRefKey, Partial, Depend, identity, CheckBprop, Push, Pull)
  82. from ._thor_ops import (CusBatchMatMul, CusCholeskyTrsm, CusFusedAbsMax1, CusImg2Col, CusMatMulCubeDenseLeft,
  83. CusMatMulCubeFraczRightMul, CusMatMulCube, CusMatrixCombine, CusTranspose02314,
  84. CusMatMulCubeDenseRight,
  85. CusMatMulCubeFraczLeftCast, Im2Col, UpdateThorGradient, Cholesky)
  86. from .sparse_ops import SparseToDense
  87. from ._cache_ops import CacheSwapHashmap, SearchCacheIdx, CacheSwapTable, UpdateCache, MapCacheIdx
  88. __all__ = [
  89. 'Unique',
  90. 'ReverseSequence',
  91. 'Sort',
  92. 'EditDistance',
  93. 'CropAndResize',
  94. 'TensorAdd',
  95. 'IFMR',
  96. 'Argmax',
  97. 'Argmin',
  98. 'ArgMaxWithValue',
  99. 'ArgMinWithValue',
  100. 'AddN',
  101. 'AccumulateNV2',
  102. 'Sub',
  103. 'CumSum',
  104. 'MatMul',
  105. 'BatchMatMul',
  106. 'Mul',
  107. 'Meshgrid',
  108. 'Pow',
  109. 'Exp',
  110. 'Expm1',
  111. 'Rsqrt',
  112. 'Sqrt',
  113. 'Square',
  114. 'SquaredDifference',
  115. 'Xdivy',
  116. 'Xlogy',
  117. 'Conv2D',
  118. 'Flatten',
  119. 'MaxPoolWithArgmax',
  120. 'FusedBatchNorm',
  121. 'FusedBatchNormEx',
  122. 'BNTrainingReduce',
  123. 'BNTrainingUpdate',
  124. 'BatchNorm',
  125. 'MaxPool',
  126. 'TopK',
  127. 'Adam',
  128. 'FusedSparseAdam',
  129. 'FusedSparseLazyAdam',
  130. 'Softplus',
  131. 'Softmax',
  132. 'Softsign',
  133. 'LogSoftmax',
  134. 'SoftmaxCrossEntropyWithLogits',
  135. 'ROIAlign',
  136. 'SparseSoftmaxCrossEntropyWithLogits',
  137. 'SGD',
  138. 'ApplyMomentum',
  139. 'ExpandDims',
  140. 'Cast',
  141. 'IsSubClass',
  142. 'IsInstance',
  143. 'Reshape',
  144. 'Squeeze',
  145. 'Transpose',
  146. 'OneHot',
  147. 'GatherV2',
  148. 'SparseGatherV2',
  149. 'EmbeddingLookup',
  150. 'Padding',
  151. 'GatherD',
  152. 'Identity',
  153. 'Concat',
  154. 'Pack',
  155. 'Unpack',
  156. 'Tile',
  157. 'BiasAdd',
  158. 'Gelu',
  159. 'Minimum',
  160. 'Maximum',
  161. 'StridedSlice',
  162. 'ReduceSum',
  163. 'ReduceMean',
  164. 'LayerNorm',
  165. 'Rank',
  166. 'Less',
  167. 'LessEqual',
  168. 'RealDiv',
  169. 'Div',
  170. 'DivNoNan',
  171. 'Inv',
  172. 'Invert',
  173. 'TruncatedNormal',
  174. 'Fill',
  175. 'OnesLike',
  176. 'ZerosLike',
  177. 'Select',
  178. 'Split',
  179. 'ReLU',
  180. 'ReLU6',
  181. 'Elu',
  182. 'Erf',
  183. 'Erfc',
  184. 'Sigmoid',
  185. 'HSwish',
  186. 'HSigmoid',
  187. 'Tanh',
  188. 'RandomChoiceWithMask',
  189. 'StandardNormal',
  190. 'Multinomial',
  191. 'Gamma',
  192. 'Poisson',
  193. 'UniformInt',
  194. 'UniformReal',
  195. 'StandardLaplace',
  196. 'RandomCategorical',
  197. 'ResizeBilinear',
  198. 'ScalarSummary',
  199. 'ImageSummary',
  200. 'TensorSummary',
  201. 'HistogramSummary',
  202. "Print",
  203. "Assert",
  204. 'InsertGradientOf',
  205. 'HookBackward',
  206. 'InvertPermutation',
  207. 'Shape',
  208. 'DynamicShape',
  209. 'DropoutDoMask',
  210. 'DropoutGenMask',
  211. 'Dropout',
  212. 'Neg',
  213. 'InplaceAdd',
  214. 'InplaceSub',
  215. 'Slice',
  216. 'DType',
  217. 'NPUAllocFloatStatus',
  218. 'NPUGetFloatStatus',
  219. 'NPUClearFloatStatus',
  220. 'IsNan',
  221. 'IsFinite',
  222. 'IsInf',
  223. 'FloatStatus',
  224. 'Reciprocal',
  225. 'SmoothL1Loss',
  226. 'L2Loss',
  227. 'CTCLoss',
  228. 'CTCGreedyDecoder',
  229. 'RNNTLoss',
  230. 'DynamicRNN',
  231. 'ReduceAll',
  232. 'ReduceAny',
  233. 'ScalarToArray',
  234. 'ScalarToTensor',
  235. 'TupleToArray',
  236. 'ControlDepend',
  237. 'GeSwitch',
  238. 'Merge',
  239. 'SameTypeShape',
  240. 'CheckBprop',
  241. 'CheckValid',
  242. 'BoundingBoxEncode',
  243. 'BoundingBoxDecode',
  244. 'L2Normalize',
  245. 'ScatterAdd',
  246. 'ScatterSub',
  247. 'ScatterMul',
  248. 'ScatterDiv',
  249. 'ScatterNd',
  250. 'ScatterMax',
  251. 'ScatterMin',
  252. 'ScatterNdAdd',
  253. 'ScatterNdSub',
  254. 'ScatterNonAliasingAdd',
  255. 'ReverseV2',
  256. 'Rint',
  257. 'ResizeNearestNeighbor',
  258. 'HistogramFixedWidth',
  259. 'Pad',
  260. 'MirrorPad',
  261. 'GatherNd',
  262. 'TensorScatterUpdate',
  263. 'ScatterUpdate',
  264. 'ScatterNdUpdate',
  265. 'Floor',
  266. 'NMSWithMask',
  267. 'IOU',
  268. 'MakeRefKey',
  269. 'Partial',
  270. 'Depend',
  271. 'identity',
  272. 'AvgPool',
  273. # Back Primitive
  274. 'Equal',
  275. 'EqualCount',
  276. 'NotEqual',
  277. 'Greater',
  278. 'GreaterEqual',
  279. 'LogicalNot',
  280. 'LogicalAnd',
  281. 'LogicalOr',
  282. 'Size',
  283. 'DepthwiseConv2dNative',
  284. 'UnsortedSegmentSum',
  285. 'UnsortedSegmentMin',
  286. 'UnsortedSegmentProd',
  287. "AllGather",
  288. "AllReduce",
  289. "ReduceScatter",
  290. "Broadcast",
  291. "ReduceOp",
  292. 'ScalarCast',
  293. 'GetNext',
  294. 'ReduceMax',
  295. 'ReduceMin',
  296. 'ReduceProd',
  297. 'CumProd',
  298. 'Log',
  299. 'Log1p',
  300. 'SigmoidCrossEntropyWithLogits',
  301. 'FloorDiv',
  302. 'FloorMod',
  303. 'TruncateDiv',
  304. 'TruncateMod',
  305. 'Ceil',
  306. 'Acosh',
  307. 'Asinh',
  308. "PReLU",
  309. "Cos",
  310. "Cosh",
  311. "ACos",
  312. "Diag",
  313. "DiagPart",
  314. 'Eye',
  315. 'Assign',
  316. 'AssignAdd',
  317. 'AssignSub',
  318. "Sin",
  319. "Sinh",
  320. "Asin",
  321. "LSTM",
  322. "Abs",
  323. "BinaryCrossEntropy",
  324. "KLDivLoss",
  325. "SparseApplyAdagrad",
  326. "SparseApplyAdagradV2",
  327. "SpaceToDepth",
  328. "DepthToSpace",
  329. "Conv2DBackpropInput",
  330. "Sign",
  331. "LARSUpdate",
  332. "Round",
  333. "Eps",
  334. "ApplyFtrl",
  335. "SpaceToBatch",
  336. "SparseApplyFtrl",
  337. "SparseApplyFtrlV2",
  338. "FusedSparseFtrl",
  339. "ApplyProximalAdagrad",
  340. "SparseApplyProximalAdagrad",
  341. "FusedSparseProximalAdagrad",
  342. "ApplyAdaMax",
  343. "ApplyAdadelta",
  344. "ApplyAdagrad",
  345. "ApplyAdagradV2",
  346. "ApplyAddSign",
  347. "ApplyPowerSign",
  348. "ApplyGradientDescent",
  349. "ApplyProximalGradientDescent",
  350. "BatchToSpace",
  351. "Atan2",
  352. "ApplyRMSProp",
  353. "ApplyCenteredRMSProp",
  354. "SpaceToBatchND",
  355. "BatchToSpaceND",
  356. "SquareSumAll",
  357. "BitwiseAnd",
  358. "BitwiseOr",
  359. "BitwiseXor",
  360. "BesselI0e",
  361. "BesselI1e",
  362. "Atan",
  363. "Atanh",
  364. "Tan",
  365. "BasicLSTMCell",
  366. "BroadcastTo",
  367. "DataFormatDimMap",
  368. "ApproximateEqual",
  369. "InplaceUpdate",
  370. "InTopK",
  371. "UniformSampler",
  372. "LRN",
  373. "Mod",
  374. "PopulationCount",
  375. "ParallelConcat",
  376. "Push",
  377. "Pull",
  378. "ReLUV2",
  379. "SparseToDense",
  380. "RepeatElements",
  381. ]
  382. __all__.sort()