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.

nonlinear_fuc_ops.h 33 kB

5 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
5 years ago
5 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
3 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  1. /**
  2. * Copyright 2020 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. /*!
  17. * \file nonlinear_fuc_ops.h
  18. * \brief
  19. */
  20. #ifndef OPS_BUILT_IN_OP_PROTO_INC_NONLINEAR_FUC_OPS_H_
  21. #define OPS_BUILT_IN_OP_PROTO_INC_NONLINEAR_FUC_OPS_H_
  22. #include "graph/operator_reg.h"
  23. namespace ge {
  24. /**
  25. *@brief Computes the for the gelu of "x" . \n
  26. *@par Inputs:
  27. *One input, including:
  28. *x: A Tensor. Must be one of the following types: float16, float32
  29. *@par Outputs:
  30. *y: A Tensor. Has the same type as "x".
  31. *@par Third-party framework compatibility
  32. *Compatible with the TensorFlow operator Gelu
  33. */
  34. REG_OP(Gelu)
  35. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  36. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  37. .OP_END_FACTORY_REG(Gelu)
  38. /**
  39. *@brief Computes the gradient for the gelu of "x" . \n
  40. *@par Inputs:
  41. *Three inputs, including:
  42. * @li dy: A Tensor. Must be one of the following types: float16, float32
  43. * @li x: A Tensor of the same type as "dy".
  44. * @li y: A Tensor of the same type as "dy" . \n
  45. *@par Outputs:
  46. *z: A Tensor. Has the same type as "dy".
  47. *@par Third-party framework compatibility
  48. *Compatible with the TensorFlow operator GeluGrad
  49. */
  50. REG_OP(GeluGrad)
  51. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  52. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  53. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  54. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  55. .OP_END_FACTORY_REG(GeluGrad)
  56. /**
  57. *@brief Computes the for the fast_gelu of "x" . \n
  58. *@par Inputs:
  59. *One input, including:
  60. *x: A Tensor. Must be one of the following types: float16, float32
  61. *@par Outputs:
  62. *y: A Tensor. Has the same type as "x".
  63. *@par Third-party framework compatibility
  64. *Compatible with the TensorFlow operator FastGelu
  65. */
  66. REG_OP(FastGelu)
  67. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  68. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  69. .OP_END_FACTORY_REG(FastGelu)
  70. /**
  71. *@brief Computes the gradient for the fast_gelu of "x" . \n
  72. *@par Inputs:
  73. *Two inputs, including:
  74. * @li dy: A Tensor. Must be one of the following types: float16, float32
  75. * @li x: A Tensor of the same type as "dy" . \n
  76. *@par Outputs:
  77. *z: A Tensor. Has the same type as "dy".
  78. *@par Third-party framework compatibility
  79. *Compatible with the TensorFlow operator FastGeluGrad
  80. */
  81. REG_OP(FastGeluGrad)
  82. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  83. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  84. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  85. .OP_END_FACTORY_REG(FastGeluGrad)
  86. /**
  87. *@brief Computes the gradient for the tanh of "x" . \n
  88. *@par Inputs:
  89. *Two inputs, including:
  90. * @li y: A Tensor. Must be one of the following types: float16, float32,
  91. * double, complex64, complex128.
  92. * @li dy: A Tensor of the same type as "y" . \n
  93. *@par Outputs:
  94. *z: A Tensor. Has the same type as "y".
  95. *@par Third-party framework compatibility
  96. *Compatible with the TensorFlow operator TanhGrad.
  97. */
  98. REG_OP(TanhGrad)
  99. .INPUT(y, TensorType::UnaryDataType())
  100. .INPUT(dy, TensorType::UnaryDataType())
  101. .OUTPUT(z, TensorType::UnaryDataType())
  102. .OP_END_FACTORY_REG(TanhGrad)
  103. /**
  104. *@brief: Computes hyperbolic tangent of "x" element-wise . \n
  105. *@par Inputs:
  106. *One input:
  107. *x: A Tensor. Must be one of the following types: float16, float32, complex64, complex128, double . \n
  108. *@par Outputs:
  109. *y: A Tensor. Has the same type as "x" . \n
  110. *@par Third-party framework compatibility
  111. * Compatible with TensorFlow operator Tanh.
  112. */
  113. REG_OP(Tanh)
  114. .INPUT(x, TensorType::UnaryDataType())
  115. .OUTPUT(y, TensorType::UnaryDataType())
  116. .OP_END_FACTORY_REG(Tanh)
  117. /**
  118. * @brief Computes rectified linear: "max(x, 0)".
  119. *
  120. * @par Inputs:
  121. * x: A tensor. Must be one of the following types: float32, float64, int32, uint8,
  122. * int16, int8, int64, uint16, float16, qint8.
  123. *
  124. * @par Outputs:
  125. * y: A tensor. Has the same type as "x".
  126. *
  127. * @par Third-party framework compatibility
  128. * @li Compatible with the TensorFlow operator Relu.
  129. * @li Compatible with the Caffe operator ReLULayer.
  130. *
  131. */
  132. REG_OP(Relu)
  133. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE,
  134. DT_INT8, DT_INT32, DT_INT16, DT_INT64,
  135. DT_UINT8, DT_UINT16, DT_QINT8}))
  136. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE,
  137. DT_INT8, DT_INT32, DT_INT16, DT_INT64,
  138. DT_UINT8, DT_UINT16, DT_QINT8}))
  139. .OP_END_FACTORY_REG(Relu)
  140. /**
  141. * @brief Computes rectified linear 6.
  142. * activations = min(max(x, 0), 6) . \n
  143. * @par Inputs:
  144. * x: A Tensor of type RealNumberType . \n
  145. * @par Outputs:
  146. * y: A Tensor with the same type as x . \n
  147. * @par Third-party framework compatibility
  148. * Compatible with the TensorFlow operator Relu6.
  149. */
  150. REG_OP(Relu6)
  151. .INPUT(x, TensorType::RealNumberType())
  152. .OUTPUT(y, TensorType::RealNumberType())
  153. .OP_END_FACTORY_REG(Relu6)
  154. /**
  155. * @brief Computes rectified linear 6*scale.
  156. * activations = min(max(x, 0), 6*scale) . \n
  157. * @par Inputs:
  158. * x: A Tensor of type RealNumberType . \n
  159. * @par Attributes:
  160. * epsilon: A required scalar. The data type is float32 . \n
  161. * @par Outputs:
  162. * y: A Tensor of type RealNumberType . \n
  163. * @par Third-party framework compatibility
  164. * Compatible with the TensorFlow operator Relu6.
  165. *
  166. *@par Restrictions:
  167. *Warning: THIS FUNCTION IS DEPRECATED. Please use Relu6 instead.
  168. */
  169. REG_OP(Relu6D)
  170. .INPUT(x, TensorType::RealNumberType())
  171. .OUTPUT(y, TensorType::RealNumberType())
  172. .ATTR(scale, Float, 1.0)
  173. .OP_END_FACTORY_REG(Relu6D)
  174. /**
  175. * @brief Computes rectified linear 6 gradients for a Relu6 operation.
  176. * backprops = gradients * (features > 0) * (features < 6) . \n
  177. * @par Inputs:
  178. * @li gradients: A Tensor of type RealNumberType. The backpropagated
  179. gradients to the corresponding Relu6 operation.
  180. * @li features: A Tensor with the same type as gradients.he features passed
  181. as input to the corresponding Relu6 operation, or its output;
  182. using either one produces the same result. \n
  183. * @par Outputs:
  184. * backprops: A Tensor of type RealNumberType . \n
  185. * @par Third-party framework compatibility
  186. * Compatible with the TensorFlow operator Relu6Grad.
  187. */
  188. REG_OP(Relu6Grad)
  189. .INPUT(gradients, TensorType::RealNumberType())
  190. .INPUT(features, TensorType::RealNumberType())
  191. .OUTPUT(backprops, TensorType::RealNumberType())
  192. .OP_END_FACTORY_REG(Relu6Grad)
  193. /**
  194. *@brief Calculate the elu_grad_v2 function.
  195. *Applies the element-wise function:
  196. * Computes the backward for the elu: if x>0, 1; otherwise elu() + alpha .
  197. *@par Inputs:
  198. *Two inputs, including:
  199. * @li grads: A tensor. Must be one of the following types:
  200. * float16, float32.
  201. * @li activations: A tensor. Must be one of the following types:
  202. * float16, float32.
  203. *
  204. *@par Outputs:
  205. *y: A Tensor with the same type and shape of grads's.
  206. *
  207. *@par Attributes:
  208. *alpha: scalar parameter, default value = 1.0
  209. */
  210. REG_OP(EluGradV2)
  211. .INPUT(grads, TensorType({DT_FLOAT, DT_FLOAT16}))
  212. .INPUT(activations, TensorType({DT_FLOAT, DT_FLOAT16}))
  213. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  214. .ATTR(alpha, Float, 1.0)
  215. .OP_END_FACTORY_REG(EluGradV2)
  216. /**
  217. * @brief Compute sigmoid of "x" element-wise . \n
  218. * @par Inputs:
  219. * A Tensor of type complex64, complex128, float16, float32 or double . \n
  220. * @par Outputs:
  221. * A Tensor. Has the same type as "x" . \n
  222. * @see Relu()
  223. * @par Third-party framework compatibility
  224. * Compatible with the TensorFlow operator Sigmoid.
  225. */
  226. REG_OP(Sigmoid)
  227. .INPUT(x, TensorType::UnaryDataType())
  228. .OUTPUT(y, TensorType::UnaryDataType())
  229. .OP_END_FACTORY_REG(Sigmoid)
  230. /**
  231. * @brief Computes z = (y - y*y)*dy . \n
  232. * @par Inputs:
  233. * @li y: The input is Tensor, dtype is UnaryDataType.
  234. * @li dy: The input is Tensor, dtype is UnaryDataType . \n
  235. * @par Outputs:
  236. * z: The shape of output, dtype is UnaryDataType.
  237. */
  238. REG_OP(SigmoidGrad)
  239. .INPUT(y, TensorType(UnaryDataType))
  240. .INPUT(dy, TensorType(UnaryDataType))
  241. .OUTPUT(z, TensorType(UnaryDataType))
  242. .OP_END_FACTORY_REG(SigmoidGrad)
  243. /**
  244. *@brief Computes the binomial normal log likelihood (BNLL) output:
  245. *if x>0, x+log(1+exp(-x)); otherwise log(1+exp(x)) . \n
  246. *@par Inputs:
  247. *x: A Tensor of type double, float16 or float32 . \n
  248. *@par Outputs:
  249. *y: A tensor. Has the same type and format as input "x" . \n
  250. *@par Third-party framework compatibility
  251. * Compatible with the Caffe operator BNLL.
  252. */
  253. REG_OP(BNLL)
  254. .INPUT(x, TensorType::FloatingDataType())
  255. .OUTPUT(y, TensorType::FloatingDataType())
  256. .OP_END_FACTORY_REG(BNLL)
  257. /**
  258. *@brief Computes softplus: log(exp(x) + 1) . \n
  259. *@par Inputs:
  260. * One input:
  261. *x: A Tensor of type float16 or float32. Up to 8D . \n
  262. *@par Outputs:
  263. *y: The activations tensor. Has the same type and format as input "x"
  264. *@par Third-party framework compatibility
  265. * Compatible with the TensorFlow operator Softplus.
  266. */
  267. REG_OP(Softplus)
  268. .INPUT(x, TensorType::FloatingDataType())
  269. .OUTPUT(y, TensorType::FloatingDataType())
  270. .OP_END_FACTORY_REG(Softplus)
  271. /**
  272. *@brief Computes softplus gradients for a softplus operation . \n
  273. *@par Inputs:
  274. *Two inputs:
  275. * @li gradients: An NC1HWC0 or ND Tensor of type float16 or float32.
  276. * @li features: An NC1HWC0 or ND Tensor of type float16 or float32.
  277. *@par Outputs:
  278. *backprops: A Tensor. Has the same type and format as input "gradients" . \n
  279. *@par Third-party framework compatibility
  280. * Compatible with the TensorFlow operator SoftplusGrad.
  281. */
  282. REG_OP(SoftplusGrad)
  283. .INPUT(gradients, TensorType::FloatingDataType())
  284. .INPUT(features, TensorType::FloatingDataType())
  285. .OUTPUT(backprops, TensorType::FloatingDataType())
  286. .OP_END_FACTORY_REG(SoftplusGrad)
  287. /**
  288. *@brief Computes softsign: x/(abs(x) + 1) . \n
  289. *@par Inputs:
  290. * One input:
  291. *x: A Tensor of type float16 or float32. Up to 8D . \n
  292. *@par Outputs:
  293. *y: The activations tensor. Has the same type and format as "x"
  294. *@par Third-party framework compatibility
  295. * Compatible with the TensorFlow operator Softsign.
  296. */
  297. REG_OP(Softsign)
  298. .INPUT(x, TensorType::FloatingDataType())
  299. .OUTPUT(y, TensorType::FloatingDataType())
  300. .OP_END_FACTORY_REG(Softsign)
  301. /**
  302. *@brief Computes scaled exponential linear: scale * alpha * (exp(x) - 1) . \n
  303. *@par Inputs:
  304. * One input:
  305. *x: A Tensor. Must be one of the following types: float16, float, double
  306. * int32, int8. format:ND, NC1HWC0 . \n
  307. *@par Outputs:
  308. *y: A Tensor. Has the same type and format as input "x". format:ND, NC1HWC0 . \n
  309. *@see Region()
  310. *@par Third-party framework compatibility
  311. * Compatible with the TensorFlow operator Selu.
  312. */
  313. REG_OP(Selu)
  314. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,
  315. DT_INT8,DT_INT32}))
  316. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,
  317. DT_INT8,DT_INT32}))
  318. .OP_END_FACTORY_REG(Selu)
  319. /**
  320. *@brief Computes rectified linear gradients for a ReLU operation . \n
  321. *@par Inputs:
  322. * Two inputs, including:
  323. *@li gradients: A Tensor. Must be one of the following types: float32, double,
  324. * int32, int8, int16, int64, uint16, float16, uint32, uint64
  325. *@li features: A Tensor. Must be one of the following types: float32, double,
  326. * int32, int8, int16, int64, uint16, float16, uint32, uint64
  327. *@par Outputs:
  328. *backprops: A Tensor. Must have the same type as"gradients" . \n
  329. *@attention Constraints:
  330. * The corresponding Relu operator needs to be called before using this operator on the network . \n
  331. *@see Relu
  332. *@par Third-party framework compatibility
  333. * Compatible with TensorFlow operator ReluGrad.
  334. */
  335. REG_OP(ReluGrad)
  336. .INPUT(gradients, TensorType::RealNumberType())
  337. .INPUT(features, TensorType::RealNumberType())
  338. .OUTPUT(backprops, TensorType::RealNumberType())
  339. .OP_END_FACTORY_REG(ReluGrad)
  340. /**
  341. *@brief Computes rectified linear gradients for a ReLU operation . \n
  342. *@par Inputs:
  343. * Two inputs, including:
  344. *@li gradients: A Tensor. Must be one of the following types: float32, double, int32, int8, int16, int8, int64, uint16, float16, uint32, uint64
  345. *@li mask: A Tensor. Must be the following types: uint8
  346. *@par Outputs:
  347. *backprops: A Tensor. Must have the same type as"gradients" . \n
  348. *@attention Constraints:
  349. * The corresponding Relu operator needs to be called before using this operator on the network . \n
  350. *@see Relu
  351. *@par Third-party framework compatibility
  352. * Compatible with TensorFlow operator ReluGradV2.
  353. */
  354. REG_OP(ReluGradV2)
  355. .INPUT(gradients, TensorType::RealNumberType())
  356. .INPUT(mask, TensorType({DT_UINT8}))
  357. .OUTPUT(backprops, TensorType::RealNumberType())
  358. .OP_END_FACTORY_REG(ReluGradV2)
  359. /**
  360. *@brief Computes rectified linear: "max(x, 0)".
  361. *
  362. *@attention Constraints:
  363. * The last dimension must be divisible by 8.
  364. * The second output "mask" is "1" (for y >= 0) or "0" ( for y < 0).
  365. *
  366. *@par Inputs:
  367. * x: A tensor. Must be one of the following types: float32, float64, int32, uint8,
  368. * int16, int8, int64, uint16, float16, qint8.
  369. *
  370. *@par Outputs:
  371. *@li y: A tensor. Has the same type as "x".
  372. *@li mask: A tensor of type uint8.
  373. *
  374. *@par Third-party framework compatibility
  375. * Incompatible with TensorFlow or Caffe.
  376. *
  377. */
  378. REG_OP(ReluV2)
  379. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_INT8, DT_INT32, DT_INT16, DT_INT64, DT_UINT8, DT_UINT16, DT_QINT8}))
  380. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_INT8, DT_INT32, DT_INT16, DT_INT64, DT_UINT8, DT_UINT16, DT_QINT8}))
  381. .OUTPUT(mask, TensorType({DT_UINT8}))
  382. .OP_END_FACTORY_REG(ReluV2)
  383. /**
  384. *@brief Performs parametric ReLU . \n
  385. *@par Inputs:
  386. * Two inputs, including:
  387. *@li x: A multi-dimensional Tensor of type float16 or float32.
  388. *@li weight: A Scalar or 1D Tensor of type float16 or float32, specifying the weight, the initial value of "a". The number of dimensions must be the same as the number of channels . \n
  389. *@par Outputs:
  390. *y: An activated Tensor. Has the same dimensions with "x" . \n
  391. *@par Third-party framework compatibility
  392. * Compatible with PyTorch and Caffe operator PReLU.
  393. */
  394. REG_OP(PRelu)
  395. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
  396. .INPUT(weight, TensorType({DT_FLOAT, DT_FLOAT16}))
  397. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  398. .OP_END_FACTORY_REG(PRelu)
  399. /**
  400. *@brief Performs the backpropagation of PRelu for training scenarios . \n
  401. *@par Inputs:
  402. * Three inputs, including:
  403. *@li grads: Input gradient. Multi-dimensional Tensors are supported. The data type can be float16 or float32.
  404. *@li features: A multi-dimensional Tensor of type float16 or float32.
  405. *@li weights: A Scalar or 1D Tensor of type float16 or float32, specifying the weight. The number of dimensions must be the same as the number of channels . \n
  406. *@par Outputs:
  407. *@li dx: Reverse gradient of "features". Has the same dimensions and type as "features".
  408. *@li da: Reverse gradient of "weight". Has the same dimensions and type as "features" . \n
  409. *@par Third-party framework compatibility
  410. * Compatible with PyTorch operator PReluGrad.
  411. */
  412. REG_OP(PReluGrad)
  413. .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT}))
  414. .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT}))
  415. .INPUT(weights, TensorType({DT_FLOAT16, DT_FLOAT}))
  416. .OUTPUT(dx, TensorType({DT_FLOAT16, DT_FLOAT}))
  417. .OUTPUT(da, TensorType({DT_FLOAT16, DT_FLOAT}))
  418. .OP_END_FACTORY_REG(PReluGrad)
  419. /**
  420. *@brief Activation function fused from sigmoid and ReLU, with soft saturation
  421. * on the left and no saturation on the right . \n
  422. *@par Inputs:
  423. *x: A float16, float32 or double, for the input data type . \n
  424. *@par Attributes:
  425. *alpha: A float32. Defines at which negative value the ELU saturates. Defaults to "1.0" . \n
  426. *@par Outputs:
  427. *y: A float16, float32 or double, for the normalized result . \n
  428. *@attention Constraints:
  429. *@li The input is of type float16 or float32 . \n
  430. *@par Multiple batches supported or not
  431. *Supported
  432. *@par Third-party framework compatibility
  433. *@li Compatible with Tensorflow's Elu operator
  434. *@li Compatible with Caffe's ELULayer operator
  435. *
  436. *@since V100R001C33
  437. */
  438. REG_OP(Elu)
  439. .INPUT(x, TensorType::FloatingDataType())
  440. .OUTPUT(y, TensorType::FloatingDataType())
  441. .ATTR(alpha, Float, 1.0)
  442. .OP_END_FACTORY_REG(Elu)
  443. /**
  444. *@brief Continuously Differentiable Exponential Linear Uints:
  445. * Perform the linear uint element-wise on the input tensor X using formula:
  446. * max(0, x) + min(0, alpha * (exp(x/alpha) - 1)). \n
  447. *@par Inputs:
  448. *x: A float16, float32, for the input data type . \n
  449. *@par Attributes:
  450. *@li alpha1: A float32. Defines at which negative value the ELU saturates. Defaults to "1.0" .
  451. *@li alpha2: A float32. Defines at which negative value the ELU saturates. Defaults to "1.0" .
  452. *@li alpha3: A float32. Defines at which positive value the ELU saturates. Defaults to "1.0" . \n
  453. *@par Outputs:
  454. *y: A float16, float32, for the normalized result . \n
  455. *@attention Constraints:
  456. *@li The input is of type float16 or float32 . \n
  457. *@par Multiple batches supported or not
  458. *Supported
  459. *@par Third-party framework compatibility
  460. *@li Compatible with ONNX's Celu operator
  461. */
  462. REG_OP(Celu)
  463. .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16}))
  464. .OUTPUT(y, TensorType({DT_FLOAT,DT_FLOAT16}))
  465. .ATTR(alpha1, Float, 1.0)
  466. .ATTR(alpha2, Float, 1.0)
  467. .ATTR(alpha3, Float, 1.0)
  468. .OP_END_FACTORY_REG(Celu)
  469. /**
  470. *@brief Computes gradients for the exponential linear (Elu) operation.
  471. *
  472. *@par Inputs:
  473. *@li grads: A tensor. Must be one of the following types: float16, float32, float64.
  474. * The backpropagated gradients to the corresponding Elu operation.
  475. *@li activations: A tensor. Has the same type as "grads".
  476. * The outputs of the corresponding Elu operation.
  477. *
  478. *@par Outputs:
  479. * y: A tensor. Has the same type as "grads".
  480. *
  481. *@par Third-party framework compatibility
  482. *Compatible with the TensorFlow operator EluGrad.
  483. *
  484. */
  485. REG_OP(EluGrad)
  486. .INPUT(grads, TensorType::FloatingDataType())
  487. .INPUT(activations, TensorType::FloatingDataType())
  488. .OUTPUT(y, TensorType::FloatingDataType())
  489. .OP_END_FACTORY_REG(EluGrad)
  490. /**
  491. *@brief Computes the output as x if x > 0 and negative_slope * x if x <= 0 . \n
  492. *@par Inputs:
  493. * One input:
  494. * x: A Tensor. Must be one of the following types: float32, float16, double.
  495. *
  496. *@par Attributes:
  497. *negative_slope: A float32. Defaults to "0.0".
  498. *
  499. *@par Outputs:
  500. *y: A Tensor. Has the same type as "x".
  501. *@par Third-party framework compatibility
  502. * Compatible with the Caffe operator ReLU.
  503. */
  504. REG_OP(LeakyRelu)
  505. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE}))
  506. .ATTR(negative_slope, Float, 0.0)
  507. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE}))
  508. .OP_END_FACTORY_REG(LeakyRelu)
  509. /**
  510. *@brief Computes the output as gradients if features > 0 and negative_slope * gradients if features <= 0 . \n
  511. *@par Inputs:
  512. * Two inputs, including:
  513. * @li gradients: A Tensor. Must be one of the following types: float16, float32, double.
  514. * @li features: A Tensor. Has the same type as "gradients" . \n
  515. *@par Attributes:
  516. *negative_slope: A float32. Defaults to "0.0" . \n
  517. *@par Outputs:
  518. *backprops: A Tensor. Has the same type as "gradients" . \n
  519. *@par Third-party framework compatibility
  520. * Compatible with the TensorFlow operator LeakyReluGrad.
  521. */
  522. REG_OP(LeakyReluGrad)
  523. .INPUT(gradients, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  524. .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  525. .ATTR(negative_slope, Float, 0.0)
  526. .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  527. .OP_END_FACTORY_REG(LeakyReluGrad)
  528. /**
  529. *@brief Thresholds grad each element of the input Tensor . \n
  530. *@par Inputs:
  531. * @li gradients: A Tensor shape and dtype of input gradients. Support float16, int32.
  532. * @li features: A Tensor shape and dtype of input features. Support float16, int32 . \n
  533. *@par Attributes:
  534. *threshold: A float32 scale value to threshold at . \n
  535. *@par Outputs:
  536. *backprops: A Tensor of shape and dtype of output backprops, should be same shape and type as inputs . \n
  537. *@par Restrictions:
  538. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  539. */
  540. REG_OP(ThresholdGradV2D)
  541. .INPUT(gradients, TensorType({DT_INT32, DT_FLOAT16}))
  542. .INPUT(features, TensorType({DT_INT32, DT_FLOAT16}))
  543. .OUTPUT(backprops, TensorType({DT_INT32, DT_FLOAT16}))
  544. .REQUIRED_ATTR(threshold, Float)
  545. .OP_END_FACTORY_REG(ThresholdGradV2D)
  546. /**
  547. *@brief Thresholds each element of the input Tensor y = (x > threshold) ? x : value . \n
  548. *@par Inputs:
  549. *x: A Tensor dtype of real number . \n
  550. *@par Attributes:
  551. *@li threshold: A float32 scale value to threshold at.
  552. *@li value: A float32 scale value to replace with . \n
  553. *@par Outputs:
  554. *y: A Tensor of shape and dtype of output, should be same shape and type as input . \n
  555. *@par Restrictions:
  556. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  557. */
  558. REG_OP(ThresholdV2D)
  559. .INPUT(x, TensorType::RealNumberType())
  560. .OUTPUT(y, TensorType::RealNumberType())
  561. .REQUIRED_ATTR(threshold, Float)
  562. .REQUIRED_ATTR(value, Float)
  563. .OP_END_FACTORY_REG(ThresholdV2D)
  564. /**
  565. *@brief: Computes hyperbolic tangent of "x" element-wise . \n
  566. *@par Inputs:
  567. *One input:
  568. *x: A Tensor. Must be one of the following types: float16, float32 . \n
  569. *@par Outputs:
  570. *y: A Tensor. Has the same type as "x" . \n
  571. *@par Third-party framework compatibility
  572. * Compatible with TensorFlow operator Mish.
  573. */
  574. REG_OP(Mish)
  575. .INPUT(x, TensorType({ DT_FLOAT,DT_FLOAT16 }))
  576. .OUTPUT(y, TensorType({ DT_FLOAT,DT_FLOAT16 }))
  577. .OP_END_FACTORY_REG(Mish)
  578. /**
  579. * @brief: pytorch mish_grad operator.
  580. * @par Inputs:
  581. * three input, including:
  582. * @li grad: A Tensor. shape, datatype and format is same as x
  583. * @li x: A Tensor. Must be one of the following types: float16, float32
  584. * @li tanhx: A Tensor. shape, datatype and format is same as x
  585. * @par Outputs:
  586. * One output, including:
  587. * x_grad: A Tensor. shape, datatype and format is same as x
  588. */
  589. REG_OP(MishGrad)
  590. .INPUT(grad, TensorType({ DT_FLOAT,DT_FLOAT16 }))
  591. .INPUT(x, TensorType({ DT_FLOAT,DT_FLOAT16 }))
  592. .OPTIONAL_INPUT(tanhx, TensorType({ DT_FLOAT,DT_FLOAT16 }))
  593. .OUTPUT(x_grad, TensorType({ DT_FLOAT,DT_FLOAT16 }))
  594. .OP_END_FACTORY_REG(MishGrad)
  595. /**
  596. * @brief pytorch hardtanh_backward operator.
  597. *
  598. * @par Inputs:
  599. * Two inputs, including:
  600. * @li result, minimum tensor of the linear region range,
  601. * datatype: float16/float32, format:ND/5HD.
  602. * @li grad, maximum tensor of the linear region range,
  603. * datatype:float16/float32, format:ND/5HD. \n
  604. * @par Attributes:
  605. * Two attributes, including:
  606. * @li min_val, minimum value of the linear region range, datatype:float.
  607. * @li max_val, maximum value of the linear region range, datatype:float. \n
  608. * @par Outputs:
  609. * One output, including:
  610. * y, hardtanh_backward output tensor, datatype and format is same as
  611. * input result. \n
  612. * @attention Constraints:
  613. * This operator only supports dataType: float16/float32, format: ND/5HD. \n
  614. * @par Third-party framework compatibility
  615. * Compatible with the Pytorch operator HardtanhGrad.
  616. */
  617. REG_OP(HardtanhGrad)
  618. .INPUT(result, TensorType({ DT_FLOAT16, DT_FLOAT })) /* "First operand." */
  619. .INPUT(grad, TensorType({ DT_FLOAT16, DT_FLOAT })) /* "Second operand." */
  620. .OUTPUT(y, TensorType({ DT_FLOAT16, DT_FLOAT })) /* "Result, has same element type as two inputs" */
  621. .ATTR(min_val, Float, -1.0)
  622. .ATTR(max_val, Float, 1.0)
  623. .OP_END_FACTORY_REG(HardtanhGrad)
  624. /**
  625. * @brief Calculates the softplus loss function with attributes of beta and threshold. \n
  626. * @par Inputs:
  627. * One inputs, including:
  628. * x: A mutable Tensor. Must be one of the following types:
  629. * float16, float32. \n
  630. * @par Attributes:
  631. * @li beta: An optional float. Defaults to "1.0" \n
  632. * @li threshold: An optional float. Defaults to "20.0" \n
  633. * @par Outputs:
  634. * y: A mutable Tensor. Has the same type as "x" \n
  635. * @par Third-party framework compatibility
  636. * Compatible with the Pytorch operator Softplus.
  637. */
  638. REG_OP(SoftplusV2)
  639. .INPUT(x, TensorType({ DT_FLOAT, DT_FLOAT16 }))
  640. .OUTPUT(y, TensorType({ DT_FLOAT, DT_FLOAT16 }))
  641. .ATTR(beta, Float, 1.0)
  642. .ATTR(threshold, Float, 20.0)
  643. .OP_END_FACTORY_REG(SoftplusV2)
  644. /**
  645. * @brief Calculates the reversed outputs of the function "softplus_v2". \n
  646. * @par Inputs:
  647. * Two inputs, including:
  648. * @li input_gradients: A mutable Tensor. Must be one of the following types:
  649. * float16, float32.
  650. * @li input_features: A mutable Tensor of the same type as "input_gradients" \n
  651. * @par Attributes:
  652. * @li beta: An optional float. Defaults to "1.0" \n
  653. * @li threshold: An optional float. Defaults to "20.0" \n
  654. * @par Outputs:
  655. * output_backprops: A mutable Tensor. Has the same type as "input_gradients" \n
  656. * @par Third-party framework compatibility
  657. * Compatible with the Pytorch operator SoftplusGrad.
  658. */
  659. REG_OP(SoftplusV2Grad)
  660. .INPUT(input_gradients, TensorType({ DT_FLOAT, DT_FLOAT16 }))
  661. .INPUT(input_features, TensorType({ DT_FLOAT, DT_FLOAT16 }))
  662. .OUTPUT(output_backprops, TensorType({ DT_FLOAT, DT_FLOAT16 }))
  663. .ATTR(beta, Float, 1.0)
  664. .ATTR(threshold, Float, 20.0)
  665. .OP_END_FACTORY_REG(SoftplusV2Grad)
  666. /**
  667. * @brief ThresholdedRelu takes one input data (Tensor) and produces one output data (Tensor)
  668. * where the rectified linear function, y = x for x > alpha, y = 0 otherwise, is applied to the tensor elementwise.
  669. *
  670. * @par Inputs:
  671. * one input including:
  672. * x: input A Tensor. Must be one of the following types: float32, float16
  673. *
  674. * @par Attributes:
  675. * alpha: An optional float. Defaults to 1.0. \n
  676. * @par Outputs:
  677. * one output including:
  678. * y:A Tensor of the same type as x
  679. *
  680. */
  681. REG_OP(ThresholdedRelu)
  682. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  683. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  684. .ATTR(alpha, Float, 1.0)
  685. .OP_END_FACTORY_REG(ThresholdedRelu)
  686. /**
  687. * @brief Calculate the hard shrinkage function. \n
  688. * @par Inputs:
  689. * One inputs, including:
  690. * input_x: A tensor. Must be one of the following types:
  691. * float16, float32. \n
  692. * @par Attributes:
  693. * lambd: An optional float. Defaults to 0.5. \n
  694. * @par Outputs:
  695. * output_y: A Tensor with the same dtype and shape of input_x's. \n
  696. * @par Third-party framework compatibility
  697. * Compatible with the Pytorch operator Hardshrink. \n
  698. */
  699. REG_OP(HardShrink)
  700. .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))
  701. .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT}))
  702. .ATTR(lambd, Float, 0.5)
  703. .OP_END_FACTORY_REG(HardShrink)
  704. /**
  705. *@brief Calculate the hard shrink grad function. \n
  706. *
  707. * Computes the gradient for the HardShrink: if x > lambda or x < -lambda, x,otherwise 0
  708. *
  709. *@par Inputs:
  710. *Two inputs, including:
  711. * @li gradients: A tensor. Must be one of the following types:
  712. * float16, float32. \n
  713. * @li features: A tensor. Must be one of the following types:
  714. * float16, float32. \n
  715. *
  716. *@par Outputs:
  717. *backprops: A Tensor with the same type and shape of features's. \n
  718. *
  719. *@par Attributes:
  720. *lambd: An optional float.Defaults to 0.5. \n
  721. *
  722. *@par Third-party framework compatibility
  723. *Compatible with the Pytorch operator Hardshrink_backward. \n
  724. */
  725. REG_OP(HardShrinkGrad)
  726. .INPUT(gradients, TensorType({DT_FLOAT16, DT_FLOAT}))
  727. .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT}))
  728. .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT}))
  729. .ATTR(lambd, Float, 0.5)
  730. .OP_END_FACTORY_REG(HardShrinkGrad)
  731. /**
  732. * @brief Calculate the hard sigmoid function. \n
  733. * @par Inputs:
  734. * One inputs, including:
  735. * input_x: A tensor. Must be one of the following types:
  736. * float16, float32, int32. \n
  737. * @par Attributes:
  738. * @li alpha: An optional float. Defaults to 0.16666666. \n
  739. * @li beta: An optional float. Defaults to 0.5. \n
  740. * @par Outputs:
  741. * y: A Tensor with the same dtype and shape of input_x's. \n
  742. * @par Third-party framework compatibility
  743. * Compatible with the Pytorch operator Hardsigmoid. \n
  744. */
  745. REG_OP(HardSigmoid)
  746. .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  747. .OUTPUT(output_y, TensorType({DT_FLOAT, DT_FLOAT16}))
  748. .ATTR(alpha, Float, 0.16666666)
  749. .ATTR(beta, Float, 0.5)
  750. .OP_END_FACTORY_REG(HardSigmoid)
  751. /**
  752. * @brief Calculate the soft shrinkage function. \n
  753. * @par Inputs:
  754. * One inputs, including:
  755. * input_x: A tensor. Must be one of the following types:
  756. * float16, float32. \n
  757. * @par Attributes:
  758. * lambd: An optional float. Defaults to 0.5. \n
  759. * @par Outputs:
  760. * y: A Tensor with the same dtype and shape of input_x's. \n
  761. * @par Third-party framework compatibility
  762. * Compatible with the Pytorch operator Softshrink. \n
  763. */
  764. REG_OP(SoftShrink)
  765. .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))
  766. .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT}))
  767. .ATTR(lambd, Float, 0.5)
  768. .OP_END_FACTORY_REG(SoftShrink)
  769. /**
  770. * @brief Calculate the reversed outputs of the function "soft_shrink". \n
  771. * @par Inputs:
  772. * Two inputs, including:
  773. * @li input_grad: A tensor. Must be one of the following types:
  774. * float16, float32. \n
  775. * @li input_x: A tensor of the same dtype as "input_grad". \n
  776. * @par Attributes:
  777. * lambd: An optional float. Defaults to 0.5. \n
  778. * @par Outputs:
  779. * y: A Tensor of the same dtype and shape as "input_graxd". \n
  780. * @par Third-party framework compatibility
  781. * Compatible with the Pytorch operator SoftShrinkGrad. \n
  782. */
  783. REG_OP(SoftShrinkGrad)
  784. .INPUT(input_grad, TensorType({DT_FLOAT16, DT_FLOAT}))
  785. .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))
  786. .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT}))
  787. .ATTR(lambd, Float, 0.5)
  788. .OP_END_FACTORY_REG(SoftShrinkGrad)
  789. /**
  790. *@brief Calculate the gradient of log simoid. \n
  791. *@par Inputs:
  792. *Two inputs, including:
  793. * @li grads: A tensor, gradient of previous layer. Must be one of the following types:
  794. * float16, float32. \n
  795. * @li features: A tensor, input of log sigmoid. Must be one of the following types:
  796. * float16, float32. \n
  797. *@par Outputs:
  798. *One outputs, including:
  799. * @li backprops: A tensor with the same type of and shape of grads. \n
  800. *@par Third-party framework compatibility
  801. *Compatible with the Pytorch operator LogSigmoidBackward. \n
  802. */
  803. REG_OP(LogSigmoidGrad)
  804. .INPUT(grads, TensorType({DT_FLOAT16, DT_FLOAT}))
  805. .INPUT(features, TensorType({DT_FLOAT16, DT_FLOAT}))
  806. .OUTPUT(backprops, TensorType({DT_FLOAT16, DT_FLOAT}))
  807. .OP_END_FACTORY_REG(LogSigmoidGrad)
  808. /**
  809. *@brief Calculate -ln(1+e^(-x)). \n
  810. *@par Inputs:
  811. *One inputs, including:
  812. * x: A tensor. Must be one of the following types:
  813. * float16, float32. \n
  814. *@par Outputs:
  815. *One outputs, including:
  816. * y: A tensor with the same type and shape of x's. \n
  817. *@par Third-party framework compatibility
  818. *Compatible with the Pytorch operator LogSigmoid. \n
  819. */
  820. REG_OP(LogSigmoid)
  821. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT})) /* "input:x" */
  822. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT})) /* "output:y" */
  823. .OP_END_FACTORY_REG(LogSigmoid)
  824. /**
  825. *@brief Calculate the backward outputs of the function "hard_sigmoid" \n
  826. *@par Inputs:
  827. *One inputs, including:
  828. * @li grads: A tensor. Must be one of the following types:
  829. * float16, float32. \n
  830. * @li input_x: A tensor. Must be one of the following types:
  831. * float16, float32. \n
  832. *@par Outputs:
  833. *One outputs, including:
  834. * y: A tensor with the same type and shape of x's. \n
  835. * @par Attributes:
  836. * @li alpha: An optional float. Defaults to 0.16666666. \n
  837. * @li beta: An optional float. Defaults to 0.5. \n
  838. *@par Third-party framework compatibility
  839. *Compatible with the Pytorch operator LogSigmoidGrad. \n
  840. */
  841. REG_OP(HardSigmoidGrad)
  842. .INPUT(grads, TensorType({DT_FLOAT, DT_FLOAT16}))
  843. .INPUT(input_x, TensorType({DT_FLOAT, DT_FLOAT16}))
  844. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  845. .ATTR(alpha, Float, 0.16666666)
  846. .ATTR(beta, Float, 0.5)
  847. .OP_END_FACTORY_REG(HardSigmoidGrad)
  848. /**
  849. * @brief Calculate the shrink function. \n
  850. * @par Inputs:
  851. * One inputs, including:
  852. * @li input_x: A tensor. Must be one of the following types:
  853. * float16, float32. \n
  854. * @par Attributes:
  855. * @li lambd: An optional float. Defaults to 0.5. \n
  856. * @li bias: An optional float. Defaults to 0.0. \n
  857. * @par Outputs:
  858. * y: A Tensor with the same dtype and shape of input_x's. \n
  859. * @par Third-party framework compatibility
  860. * Compatible with the ONNX operator Shrink. \n
  861. */
  862. REG_OP(Shrink)
  863. .INPUT(input_x, TensorType({DT_FLOAT16, DT_FLOAT}))
  864. .OUTPUT(output_y, TensorType({DT_FLOAT16, DT_FLOAT}))
  865. .ATTR(lambd, Float, 0.5)
  866. .ATTR(bias, Float, 0.0)
  867. .OP_END_FACTORY_REG(Shrink)
  868. } // namespace ge
  869. #endif // OPS_BUILT_IN_OP_PROTO_INC_NONLINEAR_FUC_OPS_H_

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示