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.

list_ops.h 17 kB

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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /**
  2. * Copyright 2019 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 list_ops.h
  18. * \brief
  19. */
  20. #ifndef OPS_BUILT_IN_OP_PROTO_INC_LIST_OPS_H_
  21. #define OPS_BUILT_IN_OP_PROTO_INC_LIST_OPS_H_
  22. #include <algorithm>
  23. #include "graph/operator_reg.h"
  24. #include "graph/operator.h"
  25. namespace ge {
  26. /**
  27. *@brief Creates and returns an empty tensor list. \n
  28. *@par Inputs:
  29. *@li element_shape: A shape compatible with that of elements in the list.
  30. *@li max_num_elements: The maximum number of elements. \n
  31. *@par Attributes:
  32. *@li element_dtype: The type of elements in the list. \n
  33. *@par Outputs:
  34. *@li handle: An empty tensor list . \n
  35. *@par Third-party framework compatibility.
  36. *Compatible with tensorflow EmptyTensorList operator.
  37. */
  38. REG_OP(EmptyTensorList)
  39. .INPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  40. .INPUT(max_num_elements, TensorType({DT_INT32}))
  41. .OUTPUT(handle, TensorType({DT_VARIANT}))
  42. .ATTR(element_dtype, Type, DT_INT32)
  43. .OP_END_FACTORY_REG(EmptyTensorList)
  44. /**
  45. *@brief Returns a list which has the passed-in `Tensor` as last element
  46. and the other elements of the given list in `input_handle`. \n
  47. *@par Inputs:
  48. *@li input_handle: The old list.
  49. *@li tensor: The tensor to put on the list. \n
  50. *@par Attributes:
  51. *@li element_dtype: The type of elements in the list. \n
  52. *@par Outputs:
  53. *@li output_handle:A list with the elements of old list followed by tensor. \n
  54. *@par Third-party framework compatibility.
  55. *Compatible with tensorflow TensorListPushBack operator.
  56. */
  57. REG_OP(TensorListPushBack)
  58. .INPUT(input_handle, TensorType({DT_VARIANT}))
  59. .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  60. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  61. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,DT_RESOURCE,
  62. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  63. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  64. .ATTR(element_dtype, Type, DT_INT32)
  65. .OP_END_FACTORY_REG(TensorListPushBack)
  66. /**
  67. *@brief The last element of the input list as well as a
  68. list with all but that element. \n
  69. *@par Inputs:
  70. *@li input_handle: The input list.
  71. *@li element_shape: A shape compatible with that of elements in the list. \n
  72. *@par Attributes:
  73. *@li element_dtype: The type of elements in the list. \n
  74. *@par Outputs:
  75. *@li output_handle:A list with the elements of the old list followed by tensor.
  76. *@li tensor:The withdrawn last element of the list. \n
  77. *@par Third-party framework compatibility.
  78. *Compatible with tensorflow TensorListPopBack operator.
  79. */
  80. REG_OP(TensorListPopBack)
  81. .INPUT(input_handle, TensorType({DT_VARIANT}))
  82. .INPUT(element_shape, TensorType({DT_INT32}))
  83. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  84. .OUTPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  85. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  86. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,DT_RESOURCE,
  87. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  88. .ATTR(element_dtype, Type, DT_INT32)
  89. .OP_END_FACTORY_REG(TensorListPopBack)
  90. /**
  91. *@brief The number of tensors in the input tensor list. \n
  92. *@par Inputs:
  93. *@li input_handle: The input list. \n
  94. *@par Outputs:
  95. *@li length:The number of tensors in the list. \n
  96. *@par Third-party framework compatibility.
  97. *Compatible with tensorflow TensorListLength operator.
  98. */
  99. REG_OP(TensorListLength)
  100. .INPUT(input_handle, TensorType({DT_VARIANT}))
  101. .OUTPUT(length, TensorType({DT_INT32}))
  102. .OP_END_FACTORY_REG(TensorListLength)
  103. /**
  104. *@brief The shape of elements in the input tensor list. \n
  105. *@par Inputs:
  106. *@li input_handle: The input list. \n
  107. *@par Attributes:
  108. *@li shape_type: The type of shape in the list. \n
  109. *@par Outputs:
  110. *@li element_shape:A shape compatible with that of elements in the list. \n
  111. *@par Third-party framework compatibility.
  112. *Compatible with tensorflow TensorListElementShape operator.
  113. */
  114. REG_OP(TensorListElementShape)
  115. .INPUT(input_handle, TensorType({DT_VARIANT}))
  116. .OUTPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  117. .ATTR(shape_type, Type, DT_INT32)
  118. .OP_END_FACTORY_REG(TensorListElementShape)
  119. /**
  120. *@brief List of the given size with empty elements. \n
  121. *@par Inputs:
  122. *@li element_shape: A shape compatible with that of elements in the list.
  123. *@li num_elements: The number of elements to reserve. \n
  124. *@par Attributes:
  125. *@li element_dtype: The type of elements in the list.
  126. *@li shape_type: The type of shape in the list. \n
  127. *@par Outputs:
  128. *@li handle: An output tensor list . \n
  129. *@par Third-party framework compatibility.
  130. *Compatible with tensorflow TensorListReserve operator.
  131. */
  132. REG_OP(TensorListReserve)
  133. .INPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  134. .INPUT(num_elements, TensorType({DT_INT32}))
  135. .OUTPUT(handle, TensorType({DT_VARIANT}))
  136. .ATTR(element_dtype, Type, DT_INT32)
  137. .ATTR(shape_type, Type, DT_INT32)
  138. .OP_END_FACTORY_REG(TensorListReserve)
  139. /**
  140. *@brief Get input tensor list elements of index position. \n
  141. *@par Inputs:
  142. *@li input_handle: The input list.
  143. *@li index: A tensor of position.
  144. *@li element_shape: A shape compatible with that of elements in the list. \n
  145. *@par Attributes:
  146. *@li element_dtype: The type of elements in the list. \n
  147. *@par Outputs:
  148. *@li item: An output tensor value of index position . \n
  149. *@par Third-party framework compatibility.
  150. *Compatible with tensorflow TensorListGetItem operator.
  151. */
  152. REG_OP(TensorListGetItem)
  153. .INPUT(input_handle, TensorType({DT_VARIANT}))
  154. .INPUT(index, TensorType({DT_INT32}))
  155. .INPUT(element_shape, TensorType({DT_INT32}))
  156. .OUTPUT(item, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  157. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  158. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  159. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  160. .ATTR(element_dtype, Type, DT_INT32)
  161. .OP_END_FACTORY_REG(TensorListGetItem)
  162. /**
  163. *@brief Sets the index-th position of the list to contain the given tensor. \n
  164. *@par Inputs:
  165. *@li input_handle: The input list.
  166. *@li index: The position in the list to which the tensor will be assigned.
  167. *@li item: The element to be assigned to that position. \n
  168. *@par Attributes:
  169. *@li element_dtype: The type of elements in the list. \n
  170. *@par Outputs:
  171. *@li output_handle: An output tensor list . \n
  172. *@par Third-party framework compatibility.
  173. *Compatible with tensorflow TensorListSetItem operator.
  174. */
  175. REG_OP(TensorListSetItem)
  176. .INPUT(input_handle, TensorType({DT_VARIANT}))
  177. .INPUT(index, TensorType({DT_INT32}))
  178. .INPUT(item, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  179. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  180. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,DT_RESOURCE,
  181. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  182. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  183. .ATTR(element_dtype, Type, DT_INT32)
  184. .OP_END_FACTORY_REG(TensorListSetItem)
  185. /**
  186. *@brief Push tensor to list. \n
  187. *@par Inputs:
  188. *@li input_handles: The input tensor lists.
  189. *@li tensor: The tensor push into tensor list. \n
  190. *@par Attributes:
  191. *@li element_dtype: The type of elements in the list. \n
  192. *@par Outputs:
  193. *@li output_handles: The output tensor lists. \n
  194. *@par Third-party framework compatibility.
  195. *Compatible with tensorflow TensorListPushBackBatch operator.
  196. */
  197. REG_OP(TensorListPushBackBatch)
  198. .INPUT(input_handles, TensorType({DT_VARIANT}))
  199. .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  200. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  201. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  202. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  203. .OUTPUT(output_handles, TensorType({DT_VARIANT}))
  204. .ATTR(element_dtype, Type, DT_INT32)
  205. .OP_END_FACTORY_REG(TensorListPushBackBatch)
  206. /**
  207. *@brief Stacks all tensors in the list. \n
  208. *@par Inputs:
  209. *@li input_handle: The input tensor list.
  210. *@li element_shape: A shape compatible with that of elements in the tensor. \n
  211. *@par Attributes:
  212. *@li element_dtype: The type of elements in the list.
  213. *@li num_elements: The number of elements in the list. \n
  214. *@par Outputs:
  215. *@li tensor: The tensor of list. \n
  216. *@par Third-party framework compatibility.
  217. *Compatible with tensorflow TensorListStack operator.
  218. */
  219. REG_OP(TensorListStack)
  220. .INPUT(input_handle, TensorType({DT_VARIANT}))
  221. .INPUT(element_shape, TensorType({DT_INT32}))
  222. .OUTPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  223. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  224. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  225. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  226. .ATTR(element_dtype, Type, DT_INT32)
  227. .ATTR(num_elements, Int, -1)
  228. .OP_END_FACTORY_REG(TensorListStack)
  229. /**
  230. *@brief Concats all tensors in the list along the 0th dimension.
  231. Requires that all tensors have the same shape except the first dimension. \n
  232. *@par Inputs:
  233. *@li input_handle: The input list.
  234. *@li element_shape: The shape of the uninitialized elements in the list.
  235. If the first dimension is not -1, it is assumed that all list elements have
  236. the same leading dim.
  237. *@li leading_dims: The list of leading dims of uninitialized list elements. Used if
  238. the leading dim of input_handle.element_shape or the element_shape input arg
  239. is not already set. \n
  240. *@par Attributes:
  241. *@li element_dtype: The type of elements in the list. \n
  242. *@par Outputs:
  243. *@li tensor: The concated result.
  244. *@li lengths: Output tensor containing sizes of the 0th dimension of tensors
  245. in the list, used for computing the gradient. \n
  246. *@par Third-party framework compatibility.
  247. *Compatible with tensorflow TensorListConcatV2 operator.
  248. */
  249. REG_OP(TensorListConcatV2)
  250. .INPUT(input_handle, TensorType({DT_VARIANT}))
  251. .INPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  252. .INPUT(leading_dims, TensorType({DT_INT64}))
  253. .OUTPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  254. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  255. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  256. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  257. .OUTPUT(lengths, TensorType({DT_INT64}))
  258. .ATTR(element_dtype, Type, DT_INT32)
  259. .OP_END_FACTORY_REG(TensorListConcatV2)
  260. /**
  261. *@brief Splits a tensor into a list. \n
  262. *@par Inputs:
  263. *@li tensor: The input tensor.
  264. *@li element_shape: A shape compatible with that of elements in the tensor.
  265. *@li lengths: Vector of sizes of the 0th dimension of tensors in the list. \n
  266. *@par Attributes:
  267. *@li element_dtype: The type of elements in the list. \n
  268. *@par Outputs:
  269. *@li output_handle: The list. \n
  270. *@par Third-party framework compatibility.
  271. *Compatible with tensorflow TensorListSplit operator.
  272. */
  273. REG_OP(TensorListSplit)
  274. .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  275. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  276. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  277. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  278. .INPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  279. .INPUT(lengths, TensorType({DT_INT64}))
  280. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  281. .ATTR(element_dtype, Type, DT_INT32)
  282. .OP_END_FACTORY_REG(TensorListSplit)
  283. /**
  284. *@brief Creates a TensorList which, when stacked, has the value of `tensor`. \n
  285. *@par Inputs:
  286. *@li tensor: The input tensor.
  287. *@li element_shape: The shape of elements in the list. \n
  288. *@par Attributes:
  289. *@li element_dtype: The type of elements in the list. \n
  290. *@par Outputs:
  291. *@li output_handle: An output tensor list . \n
  292. *@par Third-party framework compatibility.
  293. *Compatible with tensorflow TensorListFromTensor operator.
  294. */
  295. REG_OP(TensorListFromTensor)
  296. .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  297. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  298. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  299. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  300. .INPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  301. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  302. .ATTR(element_dtype, Type, DT_INT32)
  303. .OP_END_FACTORY_REG(TensorListFromTensor)
  304. /**
  305. *@brief Resizes the list. \n
  306. *@par Inputs:
  307. *@li input_handle: The input tensor list.
  308. *@li size: size of the output list. \n
  309. *@par Outputs:
  310. *@li output_handle: The output tensor list. \n
  311. *@par Third-party framework compatibility.
  312. *Compatible with tensorflow TensorListResize operator.
  313. */
  314. REG_OP(TensorListResize)
  315. .INPUT(input_handle, TensorType({DT_VARIANT}))
  316. .INPUT(size, TensorType({DT_INT32}))
  317. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  318. .OP_END_FACTORY_REG(TensorListResize)
  319. /**
  320. *@brief Creates a Tensor by indexing into the TensorList. \n
  321. *@par Inputs:
  322. *@li input_handle: The input tensor list.
  323. *@li indices: The indices used to index into the list.
  324. *@li element_shape: The shape of elements in the list. \n
  325. *@par Attributes:
  326. *@li element_dtype: The type of elements in the list. \n
  327. *@par Outputs:
  328. *@li values: The tensor. \n
  329. *@par Third-party framework compatibility.
  330. *Compatible with tensorflow TensorListGather operator.
  331. */
  332. REG_OP(TensorListGather)
  333. .INPUT(input_handle, TensorType({DT_VARIANT}))
  334. .INPUT(indices, TensorType({DT_INT32}))
  335. .INPUT(element_shape, TensorType({DT_INT32}))
  336. .OUTPUT(values, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  337. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  338. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  339. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  340. .ATTR(element_dtype, Type, DT_INT32)
  341. .OP_END_FACTORY_REG(TensorListGather)
  342. /**
  343. *@brief Creates a TensorList by indexing into a Tensor. \n
  344. *@par Inputs:
  345. *@li tensor: The input tensor.
  346. *@li indices: The indices used to index into the list.
  347. *@li element_shape: The shape of the elements in the list (can be less specified than
  348. the shape of the tensor).
  349. *@li num_elements: The size of the output list. Must be large enough to accommodate
  350. the largest index in indices. If -1, the list is just large enough to include
  351. the largest index in indices. \n
  352. *@par Attributes:
  353. *@li element_dtype: The type of elements in the list. \n
  354. *@par Outputs:
  355. *@li output_handle: The TensorList. \n
  356. *@par Third-party framework compatibility.
  357. *Compatible with tensorflow TensorListScatterV2 operator.
  358. */
  359. REG_OP(TensorListScatterV2)
  360. .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  361. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  362. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  363. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  364. .INPUT(indices, TensorType({DT_INT32}))
  365. .INPUT(element_shape, TensorType({DT_INT32,DT_INT64}))
  366. .INPUT(num_elements, TensorType({DT_INT32}))
  367. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  368. .ATTR(element_dtype, Type, DT_INT32)
  369. .OP_END_FACTORY_REG(TensorListScatterV2)
  370. /**
  371. *@brief Scatters tensor at indices in an input list. \n
  372. *@par Inputs:
  373. *@li input_handle: The input tensor list.
  374. *@li tensor: The input tensor.
  375. *@li indices: The indices used to index into the list. \n
  376. *@par Attributes:
  377. *@li element_dtype: The type of elements in the list. \n
  378. *@par Outputs:
  379. *@li output_handle: The TensorList. \n
  380. *@par Third-party framework compatibility.
  381. *Compatible with tensorflow TensorListScatterIntoExistingList operator.
  382. */
  383. REG_OP(TensorListScatterIntoExistingList)
  384. .INPUT(input_handle, TensorType({DT_VARIANT}))
  385. .INPUT(tensor, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT8,
  386. DT_INT16,DT_INT32,DT_INT64,DT_UINT8,DT_UINT16,DT_QINT8,DT_QUINT8,
  387. DT_QINT16,DT_QUINT16,DT_QINT32,DT_BOOL,
  388. DT_STRING,DT_COMPLEX64,DT_COMPLEX128}))
  389. .INPUT(indices, TensorType({DT_INT32}))
  390. .OUTPUT(output_handle, TensorType({DT_VARIANT}))
  391. .ATTR(element_dtype, Type, DT_INT32)
  392. .OP_END_FACTORY_REG(TensorListScatterIntoExistingList)
  393. /**
  394. *@brief Concat two tensor lists to a new tensor list. \n
  395. *@par Inputs:
  396. *@li input_a: The input tensor list A.
  397. *@li input_b: The input tensor list B. \n
  398. *@par Attributes:
  399. *@li element_dtype: The type of elements in the list. \n
  400. *@par Outputs:
  401. *@li output: The output list. \n
  402. *@par Third-party framework compatibility.
  403. *Compatible with tensorflow TensorListConcatLists operator.
  404. */
  405. REG_OP(TensorListConcatLists)
  406. .INPUT(input_a, TensorType({DT_VARIANT}))
  407. .INPUT(input_b, TensorType({DT_VARIANT}))
  408. .OUTPUT(output, TensorType({DT_VARIANT}))
  409. .ATTR(element_dtype, Type, DT_INT32)
  410. .OP_END_FACTORY_REG(TensorListConcatLists)
  411. } // namespace ge
  412. #endif // OPS_BUILT_IN_OP_PROTO_INC_LIST_OPS_H_

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