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.

matrix_calculation_ops.h 34 kB

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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. /**
  2. * Copyright 2019-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 matrix_calculation_ops.h
  18. * \brief
  19. */
  20. #ifndef GE_OP_MATRIX_CALCULATION_OPS_H
  21. #define GE_OP_MATRIX_CALCULATION_OPS_H
  22. #include "graph/operator_reg.h"
  23. namespace ge {
  24. /**
  25. *@brief Multiplies matrix "a" by matrix "b", producing "a * b" . \n
  26. *@par Inputs:
  27. *Three inputs, including:
  28. * @li x1: A matrix Tensor. 2D. Must be one of the following types: float16,
  29. * float32, int32. Has format [ND, NHWC, FRACTAL_NZ].
  30. * @li x2: A matrix Tensor. 2D. Must be one of the following types: float16,
  31. * float32, int32. Has format [ND, NHWC, FRACTAL_NZ].
  32. * @li bias: A optional 1D Tensor. Must be one of the following types: float16,
  33. * float32, int32. Has format [ND, NHWC] . \n
  34. *@par Attributes:
  35. *@li transpose_a: A bool. If True, changes the shape of "x1" from [M, K] to [K, M].
  36. *@li transpose_b: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n
  37. *@par Outputs:
  38. *y: The result matrix Tensor. 2D. Must be one of the following types: float16,
  39. * float32, int32. Has format [ND, NHWC, FRACTAL_NZ] . \n
  40. *@par Third-party framework compatibility
  41. * Compatible with the TensorFlow operator BatchMatmul.
  42. */
  43. REG_OP(MatMul)
  44. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  45. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  46. .OPTIONAL_INPUT(bias, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  47. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  48. .ATTR(transpose_x1, Bool, false)
  49. .ATTR(transpose_x2, Bool, false)
  50. .OP_END_FACTORY_REG(MatMul)
  51. /**
  52. *@brief Multiplies matrix "a" by matrix "b", producing "a * b" . \n
  53. *@par Inputs:
  54. *Two inputs, including:
  55. * @li x1: A matrix Tensor. 2D. Must be one of the following types: float16,
  56. * float32, int32. Has format [ND, NHWC, FRACTAL_NZ].
  57. * @li x2: A matrix Tensor. 2D. Must be one of the following types: float16,
  58. * float32, int32. Has format [ND, NHWC, FRACTAL_NZ].
  59. * @li bias: A 1D Tensor. Must be one of the following types: float16,
  60. * float32, int32. Has format [ND, NHWC] . \n
  61. *@par Attributes:
  62. *@li transpose_a: A bool. If True, changes the shape of "x1" from [M, K] to [K, M].
  63. *@li transpose_b: A bool. If True, changes the shape of "x2" from [M, K] to [K, M] . \n
  64. *@par Outputs:
  65. *y: The result matrix Tensor. 2D. Must be one of the following types: float16,
  66. * float32, int32. Has format [ND, NHWC, FRACTAL_NZ] . \n
  67. *@par Third-party framework compatibility
  68. * Compatible with the TensorFlow operator BatchMatmul.
  69. */
  70. REG_OP(MatMulV2)
  71. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8}))
  72. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8}))
  73. .OPTIONAL_INPUT(bias, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  74. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  75. .OPTIONAL_INPUT(offset_w, TensorType({DT_INT8}))
  76. .ATTR(transpose_x1, Bool, false)
  77. .ATTR(transpose_x2, Bool, false)
  78. .ATTR(offset_x, Int, 0)
  79. .OP_END_FACTORY_REG(MatMulV2)
  80. /**
  81. *@brief Performs Matrix-to-matrix Multiply, producing c=alpha[0]*a*b+beta[0]*c . \n
  82. *@par Inputs:
  83. *Five inputs, including:
  84. *@li a: A matrix Tensor. Must be one of the following types: float16, int8.
  85. * Has format [ND, FRACTAL_NZ]. 2D(ND) or 4D(FRACTAL_NZ).
  86. *@li b: A matrix Tensor. Must be one of the following types: float16, int8.
  87. * Has format [ND, FRACTAL_NZ, FRACTAL_Z]. 2D(ND) or 4D(FRACTAL_NZ, FRACTAL_Z).
  88. *@li c: A matrix Tensor. Must be one of the following types: float16, int32,
  89. * float32. has format [ND, FRACTAL_NZ]. 2D(ND) or 4D(FRACTAL_NZ).
  90. *@li alpha: A 1D Tensor. The shape of alpha is [1].Must be one of the following
  91. * types: float16, int32, float32. Has format [ND].
  92. *@li beta: A 1D Tensor. The shape of beta is [1]. Must be one of the following
  93. * types: float16, int32, float32. Has format [ND].
  94. * The format of a, b, c has restriction:\n
  95. * When type of a is int8 and type of c is int32, the format of a, b, c should
  96. * all be ND, or a is FRACTAL_NZ and b is FRACTAL_Z and c is ND.\n
  97. * When type of a is int8 and type of c is float32, the format of a, b, c should
  98. * all be ND or a is FRACTAL_NZ and b is FRACTAL_Z and c is FRACTAL_NZ.\n
  99. * When type of a is float16 and type of c is float16, the format of a, b, c
  100. * should all be ND or FRACTAL_NZ.\n
  101. * When type of a is float16 and type of c is float32, the format of a, b, c
  102. * should all be ND or FRACTAL_NZ . \n
  103. *@par Attributes:
  104. *Two attributes, including:
  105. *@li transpose_a: Optional. A bool. If True, changes the shape of "a" from
  106. * [M, K] to [K, M].
  107. *@li transpose_b: Optional. A bool. If True, changes the shape of "b" from
  108. * [K, N] to [N, K] . \n
  109. *@par Outputs:
  110. *y: The result matrix Tensor. Must be one of the following types: float16,
  111. * float32, int32. Has format [ND, FRACTAL_NZ], the format should be equal to a.
  112. * 2D(ND) or 4D(FRACTAL_NZ).
  113. */
  114. REG_OP(GEMM)
  115. .INPUT(a, TensorType({DT_FLOAT16, DT_INT8}))
  116. .INPUT(b, TensorType({DT_FLOAT16, DT_INT8}))
  117. .INPUT(c, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  118. .INPUT(alpha, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  119. .INPUT(beta, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  120. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  121. .ATTR(transpose_a, Bool, false)
  122. .ATTR(transpose_b, Bool, false)
  123. .OP_END_FACTORY_REG(GEMM)
  124. /**
  125. *@brief Multiplies matrix "a" by matrix "b", producing "a * b" . \n
  126. *@par Inputs:
  127. *Three inputs, including:
  128. * @li x1: A matrix Tensor. Must be one of the following types: float16,
  129. * float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ].
  130. * @li x2: A matrix Tensor. Must be one of the following types: float16,
  131. * float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ] . \n
  132. *@par Attributes:
  133. *@li adj_x: A bool. If True, changes the shape of "x1" from [B, M, K] to [B, K, M].
  134. *@li adj_y: A bool. If True, changes the shape of "x2" from [B, M, K] to [B, K, M] . \n
  135. *@par Outputs:
  136. *y: The result matrix Tensor. 2D or higher. Must be one of the following types: float16,
  137. * float32, int32. 2D or higher. Has format [ND, NHWC, FRACTAL_NZ]. Has the same shape length as "x1" and "x2" . \n
  138. *@par Third-party framework compatibility
  139. * Compatible with the TensorFlow operator BatchMatmul.
  140. */
  141. REG_OP(BatchMatMul)
  142. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  143. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  144. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  145. .ATTR(adj_x1, Bool, false)
  146. .ATTR(adj_x2, Bool, false)
  147. .OP_END_FACTORY_REG(BatchMatMul)
  148. /**
  149. *@brief Computes half the L2 norm of a tensor without the sqrt . \n
  150. *@par Inputs:
  151. * x: A Tensor.
  152. * TensorType::FloatingDataType() . \n
  153. *@par Outputs:
  154. *y: A Tensor. Has the same type as "x".
  155. *@par Third-party framework compatibility
  156. *Compatible with the TensorFlow operator L2Loss.
  157. */
  158. REG_OP(L2Loss)
  159. .INPUT(x, TensorType::FloatingDataType())
  160. .OUTPUT(y, TensorType::FloatingDataType())
  161. .OP_END_FACTORY_REG(L2Loss)
  162. /**
  163. *@brief: Returns a batched diagonal tensor with a given batched diagonal values . \n
  164. *@par Inputs:
  165. *x: A Tensor. Must be one of the following types:
  166. * float16, float32, double, int32, uint8, int16, int8, complex64, int64,
  167. * qint8, quint8, qint32, uint16, complex128, uint32, uint64 . \n
  168. *@par Outputs:
  169. *y: A Tensor. Has the same type as "x" . \n
  170. *@par Third-party framework compatibility
  171. * Compatible with the TensorFlow operator MatrixDiag.
  172. */
  173. REG_OP(MatrixDiag)
  174. .INPUT(x, TensorType::BasicType())
  175. .OUTPUT(y, TensorType::BasicType())
  176. .OP_END_FACTORY_REG(MatrixDiag)
  177. /**
  178. *@brief: Returns a batched diagonal tensor with a given batched diagonal values . \n
  179. *@par Inputs:
  180. * Two inputs, including:
  181. *@li x: A Tensor. Must be one of the following types: float16, float32, int32, int8, uint8.
  182. *@li assist: A Tensor of the same type as "x" . \n
  183. *@par Outputs:
  184. *y: A Tensor. Has the same type as "x" . \n
  185. *@par Third-party framework compatibility
  186. * Compatible with the TensorFlow operator MatrixDiag.
  187. *
  188. * @par Restrictions:
  189. * Warning: THIS FUNCTION IS DEPRECATED. Please use MatrixDiag instead.
  190. */
  191. REG_OP(MatrixDiagD)
  192. .INPUT(x, TensorType::BasicType())
  193. .INPUT(assist, TensorType::BasicType())
  194. .OUTPUT(y, TensorType::BasicType())
  195. .OP_END_FACTORY_REG(MatrixDiagD)
  196. /**
  197. *@brief: Returns the batched diagonal part of a batched tensor . \n
  198. *@par Inputs:
  199. *x: A Tensor. Must be one of the following types:
  200. * float16, float32, double, int32, uint8, int16, int8, complex64, int64,
  201. * qint8, quint8, qint32, uint16, complex128, uint32, uint64 . \n
  202. *@par Outputs:
  203. *y: A Tensor. Has the same type as "x" . \n
  204. *@par Third-party framework compatibility
  205. * Compatible with the TensorFlow operator MatrixDiagPart.
  206. */
  207. REG_OP(MatrixDiagPart)
  208. .INPUT(x, TensorType::BasicType())
  209. .OUTPUT(y, TensorType::BasicType())
  210. .OP_END_FACTORY_REG(MatrixDiagPart)
  211. /**
  212. *@brief: Returns the batched diagonal part of a batched tensor . \n
  213. *@par Inputs:
  214. * Two inputs, including:
  215. *@li x: A Tensor. Must be one of the following types: float16, float32, int32, int8, uint8.
  216. *@li assist: A Tensor of the same type as "x" . \n
  217. *@par Outputs:
  218. *y: A Tensor. Has the same type as "x" . \n
  219. *@par Third-party framework compatibility
  220. * Compatible with the TensorFlow operator MatrixDiagPart.
  221. *
  222. * @par Restrictions:
  223. * Warning: THIS FUNCTION IS DEPRECATED. Please use MatrixDiagPart instead.
  224. */
  225. REG_OP(MatrixDiagPartD)
  226. .INPUT(x, TensorType::BasicType())
  227. .INPUT(assist, TensorType::BasicType())
  228. .OUTPUT(y, TensorType::BasicType())
  229. .OP_END_FACTORY_REG(MatrixDiagPartD)
  230. /**
  231. *@brief: Returns a batched matrix tensor with new batched diagonal values . \n
  232. *@par Inputs:
  233. * Two inputs, including:
  234. *@li x: A Tensor. Must be one of the following types:
  235. * float16, float32, double, int32, uint8, int16, int8, complex64, int64,
  236. * qint8, quint8, qint32, uint16, complex128, uint32, uint64.
  237. *@li diagonal: A Tensor of the same type as "x" . \n
  238. *@par Outputs:
  239. *y: A Tensor. Has the same type as "x" . \n
  240. *@par Third-party framework compatibility
  241. * Compatible with the TensorFlow operator MatrixSetDiag.
  242. */
  243. REG_OP(MatrixSetDiag)
  244. .INPUT(x, TensorType::BasicType())
  245. .INPUT(diagonal, TensorType::BasicType())
  246. .OUTPUT(y, TensorType::BasicType())
  247. .OP_END_FACTORY_REG(MatrixSetDiag)
  248. /**
  249. *@brief: Returns a batched matrix tensor with new batched diagonal values . \n
  250. *@par Inputs:
  251. * Three inputs, including:
  252. *@li x: A Tensor. Must be one of the following types: float16, float32, int32, int8, uint8.
  253. *@li diagonal: A Tensor of the same type as "x".
  254. *@li assist: A Tensor of the same type as "x" . \n
  255. *@par Outputs:
  256. *y: A Tensor. Has the same type as "x" . \n
  257. *@par Third-party framework compatibility
  258. * Compatible with the TensorFlow operator MatrixSetDiag.
  259. *
  260. * @par Restrictions:
  261. * Warning: THIS FUNCTION IS DEPRECATED. Please use MatrixSetDiag instead.
  262. */
  263. REG_OP(MatrixSetDiagD)
  264. .INPUT(x, TensorType::BasicType())
  265. .INPUT(diagonal, TensorType::BasicType())
  266. .INPUT(assist, TensorType::BasicType())
  267. .OUTPUT(y, TensorType::BasicType())
  268. .OP_END_FACTORY_REG(MatrixSetDiagD)
  269. /**
  270. *@brief Applies sparse "updates" to individual values or slices in a Variable . \n
  271. *@par Inputs:
  272. * Three inputs, including:
  273. *@li var: An ND Tensor.
  274. *Must be one of the following types: float16, float32, int8, uint8, double,
  275. * int64, complex64, qint8, quint8, qint32, uint16, complex128, half, uint32,
  276. * uint64
  277. *@li indices: An ND Tensor.
  278. *Must be one of the following types: int32, int64
  279. *@li updates: An ND Tensor.
  280. *Must be one of the following types: float16, float32, int8, uint8, double,
  281. * int64, complex64, qint8, quint8, qint32, uint16, complex128, half, uint32,
  282. * uint64
  283. *@par Attributes:
  284. *use_locking: An optional bool. Defaults to "False". If "True",
  285. * the operation will be protected by a lock . \n
  286. *@par Outputs:
  287. *var: A Tensor. Has the same type and format as input "var" . \n
  288. *@par Third-party framework compatibility
  289. * Compatible with the TensorFlow operator ScatterNdUpdate.
  290. */
  291. REG_OP(ScatterNdUpdate)
  292. .INPUT(var, TensorType::BasicType())
  293. .INPUT(indices, TensorType::IndexNumberType())
  294. .INPUT(updates, TensorType::BasicType())
  295. .OUTPUT(var, TensorType::BasicType())
  296. .ATTR(use_locking, Bool, false)
  297. .OP_END_FACTORY_REG(ScatterNdUpdate)
  298. /**
  299. *@brief Applies sparse addition to individual values or slices in a Variable . \n
  300. *@par Inputs:
  301. * Three inputs, including:
  302. *@li x: An ND Tensor. \n
  303. *Must be one of the following types: float16, float32, bool, int8, uint8
  304. *@li indices: An ND Tensor. \n
  305. *Must be one of the following types: int32
  306. *@li updates: An ND Tensor. \n
  307. *Must be one of the following types: float16, float32, bool, int8, uint8
  308. *@par Outputs:
  309. *y: A Tensor. Has the same type and format as input "x" . \n
  310. *@par Third-party framework compatibility
  311. * Compatible with the TensorFlow operator TensorScatterUpdate.
  312. */
  313. REG_OP(TensorScatterUpdate)
  314. .INPUT(x, TensorType::BasicType())
  315. .INPUT(indices, TensorType::IndexNumberType())
  316. .INPUT(updates, TensorType::BasicType())
  317. .OUTPUT(y, TensorType::BasicType())
  318. .OP_END_FACTORY_REG(TensorScatterUpdate)
  319. /**
  320. *@brief Adds sparse "updates" to a variable reference . \n
  321. *@par Inputs:
  322. * Three inputs, including:
  323. *@li var: An ND Tensor . \n
  324. *Must be one of the following types: float16, float32, int32, int8, uint8
  325. *@li indices: An ND Tensor of type int32 or int64.
  326. *@li updates: An Tensor. format:NCHW, NHWC . \n
  327. *Must be one of the following types: float16, float32, int32, int8, uint8
  328. *@par Attributes:
  329. *use_locking: An optional bool. Defaults to "False". If "True", the operation
  330. * will be protected by a lock . \n
  331. *@par Outputs:
  332. *var: A Tensor. Has the same type and format as input "var" . \n
  333. *@par Third-party framework compatibility
  334. * Compatible with the TensorFlow operator ScatterAdd.
  335. */
  336. REG_OP(ScatterAdd)
  337. .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  338. .INPUT(indices, TensorType::IndexNumberType())
  339. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  340. .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  341. .ATTR(use_locking, Bool, false)
  342. .OP_END_FACTORY_REG(ScatterAdd)
  343. /**
  344. *@brief Divides a variable reference by sparse updates . \n
  345. *@par Inputs:
  346. * Three inputs, including:
  347. *@li var: An ND Tensor.
  348. *Must be one of the following types: float16, float, int32, int8, uint8
  349. *@li indices: An ND Tensor.
  350. *Must be one of the following types: int32
  351. *@li updates: An ND Tensor.
  352. *Must be one of the following types: float16, float, int32, int8, uint8
  353. *@par Attributes:
  354. *@li use_locking: An optional bool. Defaults to "False". If "True",
  355. * the operation will be protected by a lock . \n
  356. *@par Outputs:
  357. *var: A Tensor. Has the same type and format as input "var" . \n
  358. *@par Third-party framework compatibility
  359. * Compatible with the TensorFlow operator ScatterDiv.
  360. */
  361. REG_OP(ScatterDiv)
  362. .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  363. .INPUT(indices, TensorType({DT_INT32}))
  364. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  365. .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  366. .ATTR(use_locking, Bool, false)
  367. .OP_END_FACTORY_REG(ScatterDiv)
  368. /**
  369. *@brief Applies sparse addition to individual values or slices in a Variable . \n
  370. *@par Inputs:
  371. * Three inputs, including:
  372. *@li var: An ND Tensor.
  373. *Must be one of the following types: float16, float, int32, int8, uint8
  374. *@li indices: An ND Tensor.
  375. *Must be one of the following types: int32
  376. *@li updates: An ND Tensor.
  377. *Must be one of the following types: float16, float, int32, int8, uint8
  378. *@par Attributes:
  379. *use_locking: An optional bool. Defaults to "False". If "True",
  380. * the operation will be protected by a lock . \n
  381. *@par Outputs:
  382. *var: A Tensor. Has the same type and format as input "var" . \n
  383. *@par Third-party framework compatibility
  384. * Compatible with the TensorFlow operator ScatterNdAdd.
  385. */
  386. REG_OP(ScatterNdAdd)
  387. .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  388. .INPUT(indices, TensorType::IndexNumberType())
  389. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  390. .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  391. .ATTR(use_locking, Bool, false)
  392. .OP_END_FACTORY_REG(ScatterNdAdd)
  393. /**
  394. *@brief Applies sparse addition to individual values or slices in a Variable . \n
  395. *@par Inputs:
  396. * Three inputs, including:
  397. *@li x: An ND Tensor. \n
  398. *Must be one of the following types: float16, float32, int32, int8, uint8
  399. *@li indices: An ND Tensor. \n
  400. *Must be one of the following types: int32
  401. *@li updates: An ND Tensor. \n
  402. *Must be one of the following types: float16, float32, int32, int8, uint8
  403. *@par Outputs:
  404. *y: A Tensor. Has the same type and format as input "x" . \n
  405. *@par Third-party framework compatibility
  406. * Compatible with the TensorFlow operator TensorScatterAdd.
  407. */
  408. REG_OP(TensorScatterAdd)
  409. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  410. .INPUT(indices, TensorType::IndexNumberType())
  411. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  412. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  413. .OP_END_FACTORY_REG(TensorScatterAdd)
  414. /**
  415. *@brief Applies sparse subtraction to individual values or slices in a Variable . \n
  416. *@par Inputs:
  417. * Three inputs, including:
  418. *@li var: An ND Tensor.
  419. *Must be one of the following types: float16, float, int32, int8, uint8
  420. *@li indices: An ND Tensor.
  421. *Must be one of the following types: int32, int64
  422. *@li updates: An ND Tensor.
  423. *Must be one of the following types: float16, float, int32, int8, uint8
  424. *@par Attributes:
  425. *use_locking: An optional bool. Defaults to "False". If "True",
  426. * the operation will be protected by a lock . \n
  427. *@par Outputs:
  428. *var: A Tensor. Has the same type and format as input "var" . \n
  429. *@par Third-party framework compatibility
  430. * Compatible with the TensorFlow operator ScatterNdSub.
  431. */
  432. REG_OP(ScatterNdSub)
  433. .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  434. .INPUT(indices, TensorType::IndexNumberType())
  435. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  436. .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  437. .ATTR(use_locking, Bool, false)
  438. .OP_END_FACTORY_REG(ScatterNdSub)
  439. /**
  440. *@brief Applies sparse addition to individual values or slices in a Variable . \n
  441. *@par Inputs:
  442. * Three inputs, including:
  443. *@li x: An ND Tensor. \n
  444. *Must be one of the following types: float16, float32, int32, int8, uint8
  445. *@li indices: An ND Tensor. \n
  446. *Must be one of the following types: int32
  447. *@li updates: An ND Tensor. \n
  448. *Must be one of the following types: float16, float32, int32, int8, uint8
  449. *@par Outputs:
  450. *y: A Tensor. Has the same type and format as input "x" . \n
  451. *@par Third-party framework compatibility
  452. * Compatible with the TensorFlow operator TensorScatterSub.
  453. */
  454. REG_OP(TensorScatterSub)
  455. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  456. .INPUT(indices, TensorType::IndexNumberType())
  457. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  458. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  459. .OP_END_FACTORY_REG(TensorScatterSub)
  460. /**
  461. *@brief Subtracts sparse updates to a variable reference . \n
  462. *@par Inputs:
  463. * Three inputs, including:
  464. *@li var: An ND Tensor.
  465. *Must be one of the following types: float16, float, int32, int8, uint8
  466. *@li indices: An ND Tensor.
  467. *Must be one of the following types: int32, int64
  468. *@li updates: An ND Tensor.
  469. *Must be one of the following types: float16, float, int32, int8, uint8
  470. *@par Attributes:
  471. *use_locking: An optional bool. Defaults to "False". If "True",
  472. * the operation will be protected by a lock . \n
  473. *@par Outputs:
  474. *var: A Tensor. Has the same type and format as input "var" . \n
  475. *@par Third-party framework compatibility
  476. * Compatible with the TensorFlow operator ScatterSub.
  477. */
  478. REG_OP(ScatterSub)
  479. .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  480. .INPUT(indices, TensorType::IndexNumberType())
  481. .INPUT(updates, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  482. .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  483. .ATTR(use_locking, Bool, false)
  484. .OP_END_FACTORY_REG(ScatterSub)
  485. /**
  486. *@brief: Returns the batched diagonal part of a batched tensor with "assist" . \n
  487. *@par Inputs:
  488. * Two inputs, including:
  489. * @li x: A Tensor of type float16, float32, or int32.
  490. * @li assist: A Tensor of the same type as "x" . \n
  491. *@par Outputs:
  492. *y: A Tensor. Has the same type as "x" . \n
  493. *@par Third-party framework compatibility
  494. * Compatible with the TensorFlow operator DiagPart.
  495. *
  496. * @par Restrictions:
  497. * Warning: THIS FUNCTION IS DEPRECATED. Please use DiagPart instead.
  498. */
  499. REG_OP(DiagPartD)
  500. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  501. .INPUT(assist, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  502. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  503. .OP_END_FACTORY_REG(DiagPartD)
  504. /**
  505. *@brief: Returns the batched diagonal part of a batched tensor . \n
  506. *@par Inputs:
  507. *x: A Tensor. Must be one of the following types:
  508. * float16, float32, int32, int64, double, complex64, complex128 . \n
  509. *@par Outputs:
  510. *y: A Tensor. Has the same type as "x" . \n
  511. *@par Third-party framework compatibility
  512. * Compatible with the TensorFlow operator DiagPart.
  513. */
  514. REG_OP(DiagPart)
  515. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT64, DT_DOUBLE,
  516. DT_COMPLEX64, DT_COMPLEX128}))
  517. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT64, DT_DOUBLE,
  518. DT_COMPLEX64, DT_COMPLEX128}))
  519. .OP_END_FACTORY_REG(DiagPart)
  520. /**
  521. *@brief Also known as a "fully-connected" layer, computes an inner product with a set of learned weights, and (optionally) adds biases . \n
  522. *@par Inputs:
  523. * Four inputs, including:
  524. *@li x: A Tensor of type float16, int8.
  525. *@li w: A weight matrix of type float16, int8.
  526. *@li b: A Tensor of type float16, int32, float32.
  527. *@li offset_w: A Tensor of type int8 . \n
  528. *@par Attributes:
  529. *@li num_output: Reserved.
  530. *@li transpose: A bool, specifying weight whether to transpose, either "true" or "false". Defaults to "false".
  531. *@li axis: Optional. A int, 1 or 2, specifying which dimension the input "K" starts from. Defaults to 1.
  532. * The product of the subsequent dimensions starting form first dimension or the second dimension is "K".
  533. *@li offset_x: Reserved . \n
  534. *@par Outputs:
  535. *y: The result tensor of type float16, int32, float32 . \n
  536. *@par Third-party framework compatibility
  537. * Compatible with the Caffe operator InnerProduct . \n
  538. *@par Quantization supported or not
  539. * Yes
  540. */
  541. REG_OP(FullyConnection)
  542. .INPUT(x, TensorType({DT_FLOAT16, DT_INT8}))
  543. .INPUT(w, TensorType({DT_FLOAT16, DT_INT8}))
  544. .OPTIONAL_INPUT(b, TensorType({DT_FLOAT16, DT_INT32,DT_FLOAT32}))
  545. .OPTIONAL_INPUT(offset_w, TensorType({DT_INT8}))
  546. .OUTPUT(y, TensorType({DT_FLOAT16, DT_INT32,DT_FLOAT32}))
  547. .REQUIRED_ATTR(num_output, Int)
  548. .ATTR(transpose, Bool, false)
  549. .ATTR(axis, Int, 1)
  550. .ATTR(offset_x, Int, 0)
  551. .OP_END_FACTORY_REG(FullyConnection)
  552. /**
  553. *@brief Also known as a "fully-connected-compress" layer, computes an inner product with a set of learned weights, and (optionally) adds biases . \n
  554. *@par Inputs:
  555. * Four inputs, including:
  556. *@li x: A Tensor of type uint8, int8.
  557. *@li w: A weight matrix of type int8, int8.
  558. *@li w: A compress index matrix of type int8, int8.
  559. *@li b: A Tensor of type float16, int32, int32.
  560. *@li offset_w: A Tensor of type int8.i
  561. *@par Attributes:
  562. *@li num_output: Reserved.
  563. *@li transpose: A bool, specifying whether to transpose, either "true" or "false". Defaults to "false".
  564. *@li axis: Reserved.
  565. *@li offset_x: Reserved . \n
  566. *@par Outputs:
  567. *y: The result tensor of type int32 . \n
  568. *@par Third-party framework compatibility
  569. * Compatible with the Caffe operator InnerProduct . \n
  570. *@par Quantization supported or not
  571. * Yes
  572. */
  573. REG_OP(FullyConnectionCompress)
  574. .INPUT(x, TensorType({DT_UINT8, DT_INT8}))
  575. .INPUT(w, TensorType({DT_INT8}))
  576. .INPUT(comress_index, TensorType({DT_INT8}))
  577. .OPTIONAL_INPUT(b, TensorType({DT_INT32}))
  578. .OPTIONAL_INPUT(offset_w, TensorType({DT_INT8}))
  579. .OUTPUT(y, TensorType({DT_INT32}))
  580. .REQUIRED_ATTR(num_output, Int)
  581. .ATTR(transpose, Bool, false)
  582. .ATTR(axis, Int, 1)
  583. .ATTR(offset_x, Int, 0)
  584. .OP_END_FACTORY_REG(FullyConnectionCompress)
  585. /**
  586. *@brief Computes the confusion matrix from predictions and labels . \n
  587. *@par Inputs:
  588. * Three inputs, including:
  589. *@li labels: A Tensor. Must be one of the following types: float16, float32,
  590. * int32, int8, uint8.
  591. *@li predictions: A Tensor. Must be one of the following types: float16,
  592. * float32, int32, int8, uint8.
  593. *@li weights: A Tensor. Must be one of the following types: float16, float32,
  594. * int32, int8, uint8 . \n
  595. *@par Attributes:
  596. *@li num_classes: An integer for the shape of the output matrix.
  597. * No default value.
  598. *@li dtype: Data type of the confusion matrix. No default value . \n
  599. *@par Outputs:
  600. *y: A Tensor. Has the same type and format as input "labels"
  601. *@attention Constraints:
  602. *@li "weights", "labels", and "predictions" are 1D tensors.
  603. *@li The output is with shape (num_classes, num_classes),
  604. * where, 1 <= num_classes <= 4096 . \n
  605. *@see Region()
  606. *@par Third-party framework compatibility
  607. * Compatible with the TensorFlow operator ConfusionMatrix.
  608. */
  609. REG_OP(ConfusionMatrix)
  610. .INPUT(labels, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16, DT_INT8, DT_UINT8}))
  611. .INPUT(predictions, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16, DT_INT8, DT_UINT8}))
  612. .OPTIONAL_INPUT(weights, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16, DT_INT8, DT_UINT8}))
  613. .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16, DT_INT8, DT_UINT8}))
  614. .REQUIRED_ATTR(num_classes, Int)
  615. .REQUIRED_ATTR(dtype, String)
  616. .OP_END_FACTORY_REG(ConfusionMatrix)
  617. /**
  618. *@brief Multiplies sparse updates into a variable reference . \n
  619. *@par Inputs:
  620. * Three inputs, including:
  621. *@li var: An ND Tensor.
  622. *Must be one of the following types: float16, float, int32, int8, uint8
  623. *@li indices: An ND Tensor.
  624. *Must be one of the following types: int32
  625. *@li updates: An ND Tensor . \n
  626. *Must be one of the following types: float16, float, int32, int8, uint8
  627. *@par Attributes:
  628. *use_locking: An optional bool. Defaults to "False". If "True", the operation
  629. * will be protected by a lock . \n
  630. *@par Outputs:
  631. *var: A Tensor. Has the same type and format as input "var" . \n
  632. *@par Third-party framework compatibility
  633. * Compatible with the TensorFlow operator ScatterMul.
  634. */
  635. REG_OP(ScatterMul)
  636. .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  637. .INPUT(indices, TensorType({DT_INT32}))
  638. .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  639. .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32,DT_INT8,DT_UINT8}))
  640. .ATTR(use_locking, Bool, false)
  641. .OP_END_FACTORY_REG(ScatterMul)
  642. /**
  643. *@brief Reduces sparse updates into a variable reference using
  644. * the "min" operation . \n
  645. *@par Inputs:
  646. * Three inputs, including:
  647. *@li var: An ND Tensor.
  648. *Must be one of the following types: float16, float, int32
  649. *@li indices: An ND Tensor.
  650. *Must be one of the following types: int32
  651. *@li updates: An ND Tensor.
  652. *Must be one of the following types: float16, float, int32
  653. *@par Attributes:
  654. *use_locking: An optional bool. Defaults to "False". If "True", the operation
  655. * will be protected by a lock . \n
  656. *@par Outputs:
  657. *var: A Tensor. Has the same type and format as input "var" . \n
  658. *@par Third-party framework compatibility
  659. * Compatible with the TensorFlow operator ScatterMin.
  660. */
  661. REG_OP(ScatterMin)
  662. .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  663. .INPUT(indices, TensorType({DT_INT32}))
  664. .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  665. .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  666. .ATTR(use_locking, Bool, false)
  667. .OP_END_FACTORY_REG(ScatterMin)
  668. /**
  669. *@brief Reduces sparse updates into a variable reference using the "max" operation . \n
  670. *@par Inputs:
  671. * Three inputs, including:
  672. *@li var: An ND Tensor . \n
  673. *Must be one of the following types: float16, float, int32
  674. *@li indices: An NCHW, NHWC, or ND Tensor . \n
  675. *Must be one of the following types: int32
  676. *@li updates: An NCHW, NHWC, or ND Tensor . \n
  677. *Must be one of the following types: float16, float, int32
  678. *@par Attributes:
  679. *use_locking: An optional bool. Defaults to "False".
  680. * If "True", the operation will be protected by a lock . \n
  681. *@par Outputs:
  682. *var: A Tensor. Has the same type and format as input "var" . \n
  683. *@par Third-party framework compatibility
  684. * Compatible with the TensorFlow operator ScatterMax.
  685. */
  686. REG_OP(ScatterMax)
  687. .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  688. .INPUT(indices, TensorType({DT_INT32}))
  689. .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  690. .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  691. .ATTR(use_locking, Bool, false)
  692. .OP_END_FACTORY_REG(ScatterMax)
  693. /**
  694. *@brief Applies sparse updates to a variable reference . \n
  695. *@par Inputs:
  696. * Three inputs, including:
  697. *@li var: An ND Tensor . \n
  698. *Must be one of the following types: float16, float, int32, int8, uint8
  699. *@li indices: An ND Tensor . \n
  700. *Must be one of the following types: int32
  701. *@li updates: An ND Tensor . \n
  702. *Must be one of the following types: float16, float, int32, int8, uint8
  703. *@par Attributes:
  704. *use_locking: An optional bool. Defaults to "False". If "True",
  705. * the operation will be protected by a lock . \n
  706. *@par Outputs:
  707. *var: A Tensor. Has the same type and format as input "var" . \n
  708. *@par Third-party framework compatibility
  709. * Compatible with the TensorFlow operator ScatterUpdate.
  710. */
  711. REG_OP(ScatterUpdate)
  712. .INPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8}))
  713. .INPUT(indices, TensorType({DT_INT32}))
  714. .INPUT(updates, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8}))
  715. .OUTPUT(var, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT8,DT_UINT8}))
  716. .ATTR(use_locking, Bool, false)
  717. .OP_END_FACTORY_REG(ScatterUpdate)
  718. /**
  719. *@brief Returns a tensor with the `k[0]`-th to `k[1]`-th diagonals of the batched `input` . \n
  720. *@par Inputs:
  721. * Three inputs, including:
  722. *@li input: Rank `r` tensor where `r >= 2`. \n
  723. *@li k: \n
  724. *Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main \n
  725. *diagonal, and negative value means subdiagonals. `k` can be a single integer \n
  726. *(for a single diagonal) or a pair of integers specifying the low and high ends \n
  727. *of a matrix band. `k[0]` must not be larger than `k[1]`. \n
  728. *@li padding_value: The value to fill the area outside the specified diagonal band with. \n
  729. *@par Outputs:
  730. *diagonal: The extracted diagonal(s) . \n
  731. *@par Third-party framework compatibility
  732. * Compatible with the TensorFlow operator ScatterUpdate.
  733. */
  734. REG_OP(MatrixDiagPartV2)
  735. .INPUT(input, TensorType::BasicType())
  736. .INPUT(k, TensorType({DT_INT32}))
  737. .INPUT(padding_value, TensorType::BasicType())
  738. .OUTPUT(diagonal, TensorType::BasicType())
  739. .OP_END_FACTORY_REG(MatrixDiagPartV2)
  740. /**
  741. *@brief Returns a batched matrix tensor with new batched diagonal values . \n
  742. *@par Inputs:
  743. * Three inputs, including:
  744. *@li input: "Rank `r+1`, where `r >= 1`. \n
  745. *@li diagonal: Rank `r` when `k` is an integer or `k[0] == k[1]`. Otherwise, it has rank `r+1`. \n
  746. *@li k:
  747. *Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main \n
  748. *diagonal, and negative value means subdiagonals. `k` can be a single integer \n
  749. *(for a single diagonal) or a pair of integers specifying the low and high ends \n
  750. *of a matrix band. `k[0]` must not be larger than `k[1]`. \n
  751. *@par Outputs:
  752. *output: Rank `r+1`, with `output.shape = input.shape` . \n
  753. *@par Third-party framework compatibility
  754. * Compatible with the TensorFlow operator ScatterUpdate.
  755. */
  756. REG_OP(MatrixSetDiagV2)
  757. .INPUT(input, TensorType::BasicType())
  758. .INPUT(diagonal, TensorType::BasicType())
  759. .INPUT(k, TensorType({DT_INT32}))
  760. .OUTPUT(output, TensorType::BasicType())
  761. .OP_END_FACTORY_REG(MatrixSetDiagV2)
  762. /**
  763. *@brief Returns a batched diagonal tensor with given batched diagonal values . \n
  764. *@par Inputs:
  765. * Five inputs, including:
  766. *@li diagonal: Rank `r`, where `r >= 1` \n
  767. *@li k:
  768. *Diagonal offset(s). Positive value means superdiagonal, 0 refers to the main \n
  769. *diagonal, and negative value means subdiagonals. `k` can be a single integer \n
  770. *(for a single diagonal) or a pair of integers specifying the low and high ends \n
  771. *of a matrix band. `k[0]` must not be larger than `k[1]`. \n
  772. *@li num_rows:
  773. *The number of rows of the output matrix. If it is not provided, the op assumes \n
  774. *the output matrix is a square matrix and infers the matrix size from k and the \n
  775. *innermost dimension of `diagonal`. \n
  776. *@li num_cols: An NCHW, NHWC, or ND Tensor.
  777. *The number of columns of the output matrix. If it is not provided, the op \n
  778. *assumes the output matrix is a square matrix and infers the matrix size from \n
  779. *k and the innermost dimension of `diagonal`. \n
  780. *@li padding_value: The number to fill the area outside the specified diagonal band with. \n
  781. *@par Outputs:
  782. *output: Has rank `r+1` when `k` is an integer or `k[0] == k[1]`, rank `r` otherwise . \n
  783. *@par Third-party framework compatibility
  784. * Compatible with the TensorFlow operator ScatterUpdate.
  785. */
  786. REG_OP(MatrixDiagV2)
  787. .INPUT(diagonal, TensorType::BasicType())
  788. .INPUT(k, TensorType({DT_INT32}))
  789. .INPUT(num_rows, TensorType({DT_INT32}))
  790. .INPUT(num_cols, TensorType({DT_INT32}))
  791. .INPUT(padding_value, TensorType::BasicType())
  792. .OUTPUT(output, TensorType::BasicType())
  793. .OP_END_FACTORY_REG(MatrixDiagV2)
  794. } // namespace ge
  795. #endif // GE_OP_MATRIX_CALCULATION_OPS_H

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