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.

selection_ops.h 87 kB

5 years ago
4 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
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
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
4 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
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
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
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
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312
  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 selection_ops.h
  18. * \brief
  19. */
  20. #ifndef OPS_BUILT_IN_OP_PROTO_INC_SELECTION_OPS_H_
  21. #define OPS_BUILT_IN_OP_PROTO_INC_SELECTION_OPS_H_
  22. #include "graph/operator_reg.h"
  23. namespace ge {
  24. /**
  25. *@brief Creates a sequence of numbers . \n
  26. *@par Inputs:
  27. *Three inputs, including:
  28. * @li start: A 0D Tensor (scalar). Acts as first entry in the range if "limit"
  29. * is not "None"; otherwise, acts as range limit and first entry defaults to "0".
  30. * The supported types are: float32, int32, double, int64.
  31. * @li limit: A 0D Tensor (scalar). Upper limit of sequence, exclusive. If "None",
  32. * defaults to the value of "start" while the first entry of the range
  33. * defaults to "0". The supported types are: float32, int32, double, int64.
  34. * @li delta: A 0D Tensor (scalar). Number that increments "start".
  35. * Defaults to "1". The supported types are: float32, int32, double, int64 . \n
  36. *@par Outputs:
  37. *y: A 1D Tensor . \n
  38. *@par Third-party framework compatibility
  39. *Compatible with the TensorFlow operator Range.
  40. */
  41. REG_OP(Range)
  42. .INPUT(start, TensorType({DT_FLOAT,DT_INT32,DT_DOUBLE,DT_INT64}))
  43. .INPUT(limit, TensorType({DT_FLOAT,DT_INT32,DT_DOUBLE,DT_INT64}))
  44. .INPUT(delta, TensorType({DT_FLOAT,DT_INT32,DT_DOUBLE,DT_INT64}))
  45. .OUTPUT(y, TensorType({DT_FLOAT,DT_INT32,DT_DOUBLE,DT_INT64}))
  46. .OP_END_FACTORY_REG(Range)
  47. /**
  48. *@brief: Creates a sequence of numbers . \n
  49. *@par Inputs:
  50. *Four inputs, including:
  51. * @li x: A 1D Tensor of type float32 or int32. The assistant data.
  52. * @li start: A 0D Tensor (scalar) of type float32 or int32. Acts as first entry in the range if "limit"
  53. * is not "None"; otherwise, acts as range limit and first entry defaults to "0".
  54. * @li limit: A 0D Tensor (scalar) of type float32 or int32.
  55. * Upper limit of sequence, exclusive. If "None",
  56. * defaults to the value of "start" while the first entry of the range
  57. * defaults to "0".
  58. * @li delta: A 0D Tensor (scalar) of type float32 or int32.
  59. * Number that increments "start". Defaults to "1" . \n
  60. *@par Outputs:
  61. *y: A 1D Tensor . \n
  62. *@par Quantization supported or not
  63. *Not supported
  64. *@par Quantized inference supported or not
  65. *Not supported
  66. *@par Multiple batches supported or not
  67. *Supported
  68. *@see Range()
  69. *@since V100R001C33
  70. *
  71. * @par Restrictions:
  72. * Warning: THIS FUNCTION IS DEPRECATED. Please use Range instead.
  73. */
  74. REG_OP(RangeD)
  75. .INPUT(x, TensorType({DT_FLOAT,DT_INT32}))
  76. .OUTPUT(y, TensorType({DT_FLOAT,DT_INT32}))
  77. .REQUIRED_ATTR(start, Float)
  78. .REQUIRED_ATTR(limit, Float)
  79. .REQUIRED_ATTR(delta, Float)
  80. .OP_END_FACTORY_REG(RangeD)
  81. /**
  82. *@brief Constructs a tensor by tiling a given tensor . \n
  83. *@par Inputs:
  84. *Two inputs, including:
  85. * @li x: A Tensor.
  86. * Must be one of the following types: float16, float32, double, int64, int32, uint8, uint16,
  87. uint32, uint64, int8, int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32.
  88. * @li multiples: A 1D Tensor of type int32 or int64.
  89. * The length must be the same as the number of dimensions in "input"
  90. *@par Outputs:
  91. *y: A Tensor. Has the same type as "x" . \n
  92. *@see TileD()
  93. *@par Third-party framework compatibility
  94. *Compatible with the TensorFlow operator Tile.
  95. */
  96. REG_OP(Tile)
  97. .INPUT(x, TensorType::BasicType())
  98. .INPUT(multiples, TensorType::IndexNumberType())
  99. .OUTPUT(y, TensorType::BasicType())
  100. .OP_END_FACTORY_REG(Tile)
  101. /**
  102. *@brief Constructs a tensor by tiling a given tensor . \n
  103. *@par Inputs:
  104. *x: A Tensor. Must be one of the following types: float32, float16, int32 . \n
  105. *@par Attributes:
  106. *multiples: A required Tensor of type int32 or int64.
  107. * Number of replication times . \n
  108. *@par Outputs:
  109. *y: A Tensor. Has the same type as "x" . \n
  110. *@see Tile()
  111. *@par Third-party framework compatibility
  112. *Compatible with the TensorFlow operator Tile.
  113. *@par Restrictions:
  114. *Warning: THIS FUNCTION IS DEPRECATED. Please use Tile instead.
  115. */
  116. REG_OP(TileD)
  117. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  118. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  119. .REQUIRED_ATTR(multiples, ListInt)
  120. .OP_END_FACTORY_REG(TileD)
  121. /**
  122. * @brief Gather slices from "x" into a tensor with shape specified by
  123. * "indices". "indices" is an K-dimensional integer tensor, best thought of as a
  124. * (K-1)-dimensional tensor of "indices" into "params", where each element
  125. * defines a slice of "params":
  126. * output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]]
  127. * "indices" defines slices into the first N dimensions of
  128. * "params", where
  129. * N = indices.shape[-1]
  130. * indices = [[0, 0], [1, 1]]
  131. * x = [['a', 'b'], ['c', 'd']]
  132. * output = ['a', 'd']
  133. * @par Inputs:
  134. * @li x: A Tensor of type BasicType.
  135. * @li indices: A Tensor of type IndexNumberType . \n
  136. * @par Outputs:
  137. * y: A Tensor of type BasicType.
  138. * @see GatherNd()
  139. * @attention Constraints:
  140. * @li "x" is one of the following types: float16, float32, double, int32,
  141. * uint8, int16, int8, complex64, int64, qint8, quint8, qint32, uint16,
  142. * complex128, uint32, uint64 . \n
  143. * @par Third-party framework compatibility
  144. * Compatible with the TensorFlow operator GatherNd.
  145. */
  146. REG_OP(GatherNd)
  147. .INPUT(x, TensorType::BasicType())
  148. .INPUT(indices, TensorType::IndexNumberType())
  149. .OUTPUT(y, TensorType::BasicType())
  150. .OP_END_FACTORY_REG(GatherNd)
  151. /**
  152. *@brief Gather slices from "x" according to "indices" by corresponding axis . \n
  153. *@par Inputs:
  154. *Three inputs, including:
  155. * @li x: A Tensor. Must be one of the following types: float32, float64, int32,
  156. * uint8, int16, int8, int64, qint8, quint8, qint32, qint16, quint16,
  157. * uint16, complex128, float16, uint32, uint64, complex64, complex128.
  158. * @li indices: A Tensor of type int32 or int64.
  159. * @li axis: A Tensor of type as int32 or int64,
  160. * Must be in the range [-rank(input_tensor), rank(input_tensor)) . \n
  161. *@par Outputs:
  162. *y: A Tensor. Has the same type as "x" . \n
  163. *@attention Constraints:
  164. *Value in indices must be in range [0, x.shape[axis])
  165. *@par Third-party framework compatibility
  166. * Compatible with the TensorFlow operator GatherV2 . \n
  167. */
  168. REG_OP(GatherV2)
  169. .INPUT(x, TensorType::BasicType())
  170. .INPUT(indices, TensorType::IndexNumberType())
  171. .INPUT(axis, TensorType::IndexNumberType())
  172. .OUTPUT(y, TensorType::BasicType())
  173. .OP_END_FACTORY_REG(GatherV2)
  174. /**
  175. *@brief Gather slices from "x" according to "indices" by corresponding axis . \n
  176. *@par Inputs:
  177. *Two inputs, including:
  178. * @li x: A Tensor. Must be one of the following types: float32, float16, int32, uint32, int8, uint8,
  179. * int16, uint16, int64, uint64.
  180. * @li indices: A Tensor of type int32 or int64 . \n
  181. *@par Attributes:
  182. *axis: A int32 specifying the axis to gather from . \n
  183. *@par Outputs:
  184. *y: A Tensor. Has the same type as "x" . \n
  185. *@attention Constraints:
  186. *@par Third-party framework compatibility
  187. * Compatible with the TensorFlow operator GatherV2.
  188. *
  189. * @par Restrictions:
  190. * Warning: THIS FUNCTION IS DEPRECATED. Please use GatherV2 instead.
  191. */
  192. REG_OP(GatherV2D)
  193. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_UINT32, DT_INT8, DT_UINT8,
  194. DT_INT16, DT_UINT16, DT_INT64, DT_UINT64}))
  195. .INPUT(indices, TensorType::IndexNumberType())
  196. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_UINT32, DT_INT8, DT_UINT8,
  197. DT_INT16, DT_UINT16, DT_INT64, DT_UINT64}))
  198. .REQUIRED_ATTR(axis, Int)
  199. .OP_END_FACTORY_REG(GatherV2D)
  200. /**
  201. *@Gathers values along an axis specified by dim . \n
  202. *@par Inputs:
  203. *@li x: A Tensor. Must be one of the following types: float16, float32, int32, int64.
  204. *@li index: A Tensor. Must be one of the following types: int64 . \n
  205. *@par Attributes:
  206. * dim: the axis along which to index . \n
  207. *@par Outputs:
  208. * y: A Tensor. Has the same type as "x" . \n
  209. *@par Third-party framework compatibility
  210. *Compatible with the PyTorch operator Gather.
  211. */
  212. REG_OP(GatherElements)
  213. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64}))
  214. .INPUT(index, TensorType({DT_INT64}))
  215. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64}))
  216. .ATTR(dim, Int, 0)
  217. .OP_END_FACTORY_REG(GatherElements)
  218. /**
  219. *@brief Extracts a strided slice of a tensor. Roughly speaking, this op
  220. extracts a slice of size (end-begin)/stride from the given input tensor.
  221. Starting at the location specified by begin the slice continues by
  222. adding stride to the index until all dimensions are not less than end.
  223. *@par Inputs:
  224. *Four inputs, including:
  225. * @li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  226. * complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16,
  227. * complex128, float16, uint32, uint64, complex64, complex128.
  228. * @li begin: A Tensor of type int32 or int64, for the index of the first value to select . \n
  229. * @li end: A Tensor of type int32 or int64, for the index of the last value to select . \n
  230. * @li strides: A Tensor of type int32 or int64, for the increment . \n
  231. *@par Attributes:
  232. * @li begin_mask: A Tensor of type int32.
  233. A bitmask where a bit "i" being "1" means to ignore the begin
  234. value and instead use the largest interval possible.
  235. * @li end_mask: A Tensor of type int32.
  236. Analogous to "begin_mask".
  237. * @li ellipsis_mask: A Tensor of type int32.
  238. A bitmask where bit "i" being "1" means the "i"th position
  239. is actually an ellipsis.
  240. * @li new_axis_mask: A Tensor of type int32.
  241. A bitmask where bit "i" being "1" means the "i"th
  242. specification creates a new shape 1 dimension.
  243. * @li shrink_axis_mask: A Tensor of type int32.
  244. A bitmask where bit "i" implies that the "i"th
  245. specification should shrink the dimensionality . \n
  246. *@par Outputs:
  247. *y: A Tensor. Has the same type as "x" . \n
  248. *@par Third-party framework compatibility
  249. * Compatible with the TensorFlow operator StridedSlice.
  250. */
  251. REG_OP(StridedSlice)
  252. .INPUT(x, TensorType::BasicType())
  253. .INPUT(begin, TensorType::IndexNumberType())
  254. .INPUT(end, TensorType::IndexNumberType())
  255. .INPUT(strides, TensorType::IndexNumberType())
  256. .ATTR(begin_mask, Int, 0)
  257. .ATTR(end_mask, Int, 0)
  258. .ATTR(ellipsis_mask, Int, 0)
  259. .ATTR(new_axis_mask, Int, 0)
  260. .ATTR(shrink_axis_mask, Int, 0)
  261. .OUTPUT(y, TensorType::BasicType())
  262. .OP_END_FACTORY_REG(StridedSlice)
  263. /**
  264. *@brief Extracts a strided slice of a tensor. Roughly speaking, this op
  265. extracts a slice of size "(end-begin)/stride" from the given input tensor.
  266. Starting at the location specified by "begin" the slice continues by
  267. adding "stride" to the index until all dimensions are not less than "end" . \n
  268. *@par Inputs:
  269. *x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  270. * complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16,
  271. * complex128, float16, uint32, uint64, complex64, complex128 . \n
  272. *@par Attributes:
  273. * @li begin: A Tensor of type int32 or int64.
  274. The index of the first value to select.
  275. * @li end: A Tensor of type int32 or int64.
  276. The index of the last value to select.
  277. * @li strides: A Tensor of type int32 or int64, for the increment.
  278. * @li begin_mask: A Tensor of type int32.
  279. A bitmask where a bit "i" being "1" means to ignore the begin
  280. value and instead use the largest interval possible.
  281. * @li end_mask: Analogous to "begin_mask". A Tensor of type as int32.
  282. * @li ellipsis_mask: A Tensor of type int32.
  283. A bitmask where bit "i" being "1" means the "i"th position
  284. is actually an ellipsis.
  285. * @li new_axis_mask: A Tensor of type int32.
  286. A bitmask where bit "i" being "1" means the "i"th
  287. specification creates a new shape 1 dimension.
  288. * @li shrink_axis_mask: A Tensor of type int32.
  289. A bitmask where bit "i" implies that the "i"th
  290. specification should shrink the dimensionality . \n
  291. *@par Outputs:
  292. *y: A Tensor. Has the same type as "x" . \n
  293. *@par Third-party framework compatibility
  294. * Compatible with the TensorFlow operator StridedSlice.
  295. * @par Restrictions:
  296. * Warning: THIS FUNCTION IS DEPRECATED. Please use StridedSlice instead.
  297. */
  298. REG_OP(StridedSliceD)
  299. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_UINT8, DT_INT8,
  300. DT_BOOL}))
  301. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_UINT8, DT_INT8,
  302. DT_BOOL}))
  303. .REQUIRED_ATTR(begin, ListInt)
  304. .REQUIRED_ATTR(end, ListInt)
  305. .REQUIRED_ATTR(strides, ListInt)
  306. .ATTR(begin_mask, Int, 0)
  307. .ATTR(end_mask, Int, 0)
  308. .ATTR(ellipsis_mask, Int, 0)
  309. .ATTR(new_axis_mask, Int, 0)
  310. .ATTR(shrink_axis_mask, Int, 0)
  311. .OP_END_FACTORY_REG(StridedSliceD)
  312. /**
  313. *@brief Since StridedSlice cuts out pieces of its "input" which is size "dy",
  314. its gradient will have the same shape (which is passed here as "shape").
  315. The gradient will be zero in any element that the slice does not select . \n
  316. *@par Inputs:
  317. *dy: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  318. * complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16,
  319. * complex128, float16, uint32, uint64, complex64, complex128 . \n
  320. *@par Attributes:
  321. * @li shape: A Tensor of type int32 or int64.
  322. * @li begin: A Tensor of type int32 or int64.
  323. The index of the first value to select.
  324. * @li end: A Tensor of type int32 or int64.
  325. The index of the last value to select.
  326. * @li strides: A Tensor of type int32 or int64, for the increment.
  327. * @li begin_mask: A Tensor of type int32.
  328. A bitmask where a bit "i" being "1" means to ignore the begin
  329. value and instead use the largest interval possible.
  330. * @li end_mask: A Tensor of type int32.
  331. Analogous to "begin_mask".
  332. * @li ellipsis_mask: A Tensor of type int32.
  333. A bitmask where bit "i" being "1" means the "i"th position
  334. is actually an ellipsis.
  335. * @li new_axis_mask: A Tensor of type int32.
  336. A bitmask where bit "i" being "1" means the "i"th
  337. specification creates a new shape 1 dimension.
  338. * @li shrink_axis_mask: A Tensor of type int32.
  339. A bitmask where bit "i" implies that the "i"th
  340. specification should shrink the dimensionality . \n
  341. *@par Outputs:
  342. *output: A Tensor. Has the same type as "dy" . \n
  343. *@par Third-party framework compatibility
  344. * Compatible with the TensorFlow operator StridedSliceGradD.
  345. * @par Restrictions:
  346. * Warning: THIS FUNCTION IS DEPRECATED. Please use StridedSliceGrad instead.
  347. */
  348. REG_OP(StridedSliceGradD)
  349. .INPUT(dy, TensorType::BasicType())
  350. .OUTPUT(output, TensorType::BasicType())
  351. .REQUIRED_ATTR(shape, ListInt)
  352. .REQUIRED_ATTR(begin, ListInt)
  353. .REQUIRED_ATTR(end, ListInt)
  354. .REQUIRED_ATTR(strides, ListInt)
  355. .ATTR(begin_mask, Int, 0)
  356. .ATTR(end_mask, Int, 0)
  357. .ATTR(ellipsis_mask, Int, 0)
  358. .ATTR(new_axis_mask, Int, 0)
  359. .ATTR(shrink_axis_mask, Int, 0)
  360. .OP_END_FACTORY_REG(StridedSliceGradD)
  361. /**
  362. *@brief Since StridedSlice cuts out pieces of its "input" which is size "dy",
  363. its gradient will have the same shape (which is passed here as "shape").
  364. The gradient will be zero in any element that the slice does not select . \n
  365. *@par Inputs:
  366. *Five inputs, including:
  367. * @li shape: A Tensor of type int32 or int64.
  368. * @li begin: A Tensor of type int32 or int64.
  369. The index of the first value to select.
  370. * @li end: A Tensor of type int32 or int64.
  371. The index of the last value to select.
  372. * @li strides: A Tensor of type int32 or int64, for the increment.
  373. * @li dy: A Tensor. Must be one of the following types:
  374. * float32, float64, int32, uint8, int16, int8,
  375. * complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16,
  376. * complex128, float16, uint32, uint64, complex64, complex128 . \n
  377. *@par Attributes:
  378. * @li begin_mask: A Tensor of type int32.
  379. A bitmask where a bit "i" being "1" means to ignore the begin
  380. value and instead use the largest interval possible.
  381. * @li end_mask: A Tensor of type int32.
  382. Analogous to "begin_mask".
  383. * @li ellipsis_mask: A Tensor of type int32.
  384. A bitmask where bit "i" being "1" means the "i"th position
  385. is actually an ellipsis.
  386. * @li new_axis_mask: A Tensor of type int32.
  387. A bitmask where bit "i" being "1" means the "i"th
  388. specification creates a new shape 1 dimension.
  389. * @li shrink_axis_mask: A Tensor of type int32.
  390. A bitmask where bit "i" implies that the "i"th
  391. specification should shrink the dimensionality . \n
  392. *@par Outputs:
  393. *output: A Tensor has the same type as "dy" . \n
  394. *@par Third-party framework compatibility
  395. * Compatible with the TensorFlow operator StridedSliceGrad.
  396. */
  397. REG_OP(StridedSliceGrad)
  398. .INPUT(shape, TensorType::IndexNumberType())
  399. .INPUT(begin, TensorType::IndexNumberType())
  400. .INPUT(end, TensorType::IndexNumberType())
  401. .INPUT(strides, TensorType::IndexNumberType())
  402. .INPUT(dy, TensorType::BasicType())
  403. .OUTPUT(output, TensorType::BasicType())
  404. .ATTR(begin_mask, Int, 0)
  405. .ATTR(end_mask, Int, 0)
  406. .ATTR(ellipsis_mask, Int, 0)
  407. .ATTR(new_axis_mask, Int, 0)
  408. .ATTR(shrink_axis_mask, Int, 0)
  409. .OP_END_FACTORY_REG(StridedSliceGrad)
  410. /**
  411. *@brief Computes the sum along segments of a tensor . \n
  412. *@par Inputs:
  413. *Three inputs, including:
  414. * @li x: A Tensor of type NumberType.
  415. * @li segment_ids: A Tensor of type IndexNumberType, whose shape is a prefix
  416. * of "x.shape".
  417. * @li num_segments: A Tensor of type IndexNumberType . \n
  418. *@par Outputs:
  419. *y: A Tensor of type NumberType . \n
  420. *@par Third-party framework compatibility
  421. * Compatible with the TensorFlow operator UnsortedSegmentSum.
  422. */
  423. REG_OP(UnsortedSegmentSum)
  424. .INPUT(x, TensorType::NumberType())
  425. .INPUT(segment_ids, TensorType::IndexNumberType())
  426. .INPUT(num_segments, TensorType::IndexNumberType())
  427. .OUTPUT(y, TensorType::NumberType())
  428. .OP_END_FACTORY_REG(UnsortedSegmentSum)
  429. /**
  430. *@brief Creates a one-dimensional tensor of size steps whose values are evenly spaced from start to
  431. * end, inclusive, on a logarithmic scale with base base. \n
  432. *@par Inputs:
  433. *One inputs, including:
  434. * @li assist: A tensor. Must be one of the following types:
  435. * float16, float32. \n
  436. * @par Attributes:
  437. * @li start: An required float. Used to select the start. \n
  438. * @li end: An required float. Used to select the end. \n
  439. * @li steps: An optional int.Defaults to 100. \n
  440. * @li base: An optional float.Defaults to 10.0. \n
  441. * @li dtype: An optional int.Defaults to 1. \n
  442. *@par Outputs:
  443. *y: A Tensor with the same type and shape of input_x's. \n
  444. *@par Third-party framework compatibility
  445. *Compatible with the Pytorch operator logspaced. \n
  446. */
  447. REG_OP(LogSpaceD)
  448. .INPUT(assist, TensorType({DT_FLOAT, DT_FLOAT16}))
  449. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  450. .REQUIRED_ATTR (start, Float)
  451. .REQUIRED_ATTR (end, Float)
  452. .ATTR(steps, Int, 100)
  453. .ATTR(base, Float, 10.0)
  454. .ATTR(dtype, Int, 1)
  455. .OP_END_FACTORY_REG(LogSpaceD)
  456. /**
  457. *@brief Computes the sum along segments of a tensor . \n
  458. *@par Inputs:
  459. *Two inputs, including:
  460. * @li x: A Tensor of type float16, float32, int32, int8, uint8.
  461. * @li segment_ids: A Tensor of type int32, whose shape is a prefix
  462. * of "x.shape" . \n
  463. *@par Attributes:
  464. *num_segments: An int32, specifying the number of distinct segment IDs . \n
  465. *@par Outputs:
  466. *y: A Tensor with same type as "x" . \n
  467. *@par Third-party framework compatibility
  468. * Compatible with the TensorFlow operator UnsortedSegmentSum.
  469. * @par Restrictions:
  470. * Warning: THIS FUNCTION IS DEPRECATED. Please use UnsortedSegmentSum instead.
  471. */
  472. REG_OP(UnsortedSegmentSumD)
  473. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8, DT_UINT8}))
  474. .INPUT(segment_ids, TensorType({DT_INT32}))
  475. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8, DT_UINT8}))
  476. .REQUIRED_ATTR(num_segments, Int)
  477. .OP_END_FACTORY_REG(UnsortedSegmentSumD)
  478. /**
  479. *@brief Reverses specific dimensions of a tensor . \n
  480. *@par Inputs:
  481. * Two inputs, including:
  482. *@li x: An ND Tensor (up to 8D).
  483. *Must be one of the following types: int8, uint8, int16, uint16, int32, int64, bool, float16, float32, double, complex64, complex128, string.
  484. *@li axis: A 1D Tensor.
  485. *Must be one of the following types: int32, int64
  486. *@par Outputs:
  487. *y: A Tensor. Has the same type and format as "x"
  488. *@attention Constraints:
  489. "axis" must be within the rank of "x" . \n
  490. *@par Third-party framework compatibility
  491. * Compatible with the TensorFlow operator ReverseV2.
  492. */
  493. REG_OP(ReverseV2)
  494. .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  495. DT_INT64, DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  496. DT_COMPLEX64, DT_COMPLEX128, DT_STRING}))
  497. .INPUT(axis, TensorType({DT_INT32,DT_INT64}))
  498. .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  499. DT_INT64, DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  500. DT_COMPLEX64, DT_COMPLEX128, DT_STRING}))
  501. .OP_END_FACTORY_REG(ReverseV2)
  502. /**
  503. *@brief Reverses specific dimensions of a tensor . \n
  504. *@par Inputs:
  505. * One input:
  506. *@li x: An ND Tensor (up to 8D).
  507. * Must be one of the following types: int8, uint8, int16, uint16, int32,
  508. * int64, bool, float16, float, double, complex64, complex128, string . \n
  509. *@par Attributes:
  510. *axis: The indices of the dimensions to reverse. Support type: listInt . \n
  511. *@par Outputs:
  512. *y: A Tensor. Has the same type and format as "x"
  513. *@attention Constraints:
  514. "axis" must be within the rank of "x" . \n
  515. *@par Third-party framework compatibility
  516. * Compatible with the TensorFlow operator ReverseV2.
  517. *@par Restrictions:
  518. *Warning: THIS FUNCTION IS DEPRECATED. Please use ReverseV2 instead.
  519. */
  520. REG_OP(ReverseV2D)
  521. .INPUT(x, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  522. DT_INT64, DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  523. DT_COMPLEX64, DT_COMPLEX128, DT_STRING}))
  524. .OUTPUT(y, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32,
  525. DT_INT64, DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  526. DT_COMPLEX64, DT_COMPLEX128, DT_STRING}))
  527. .REQUIRED_ATTR(axis, ListInt)
  528. .OP_END_FACTORY_REG(ReverseV2D)
  529. /**
  530. *@brief: Selects elements from "x1" or "x2", depending on "condition" . \n
  531. *@par Inputs:
  532. * Three inputs, including:
  533. * @li condition: A Tensor of type bool.
  534. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  535. * int32, int8, uint8, int16, uint16, double, complex64, int64, complex128
  536. * half, qint8, quint8, qint16, quint16, qint32, quint32, uint32, uint64.
  537. * format:ND
  538. * @li x2: A Tensor of the same type as "x1".format:ND
  539. *@par Outputs:
  540. *y: A Tensor. Has the same type as "x1". format:ND
  541. *@par Third-party framework compatibility
  542. * Compatible with the TensorFlow operator Select.
  543. */
  544. REG_OP(Select)
  545. .INPUT(condition, TensorType({DT_BOOL}))
  546. .INPUT(x1,TensorType::BasicType())
  547. .INPUT(x2,TensorType::BasicType())
  548. .OUTPUT(y,TensorType::BasicType())
  549. .OP_END_FACTORY_REG(Select)
  550. /**
  551. *@brief: SelectV2s elements from "then" or "else", depending on "condition" . \n
  552. *@par Inputs:
  553. * Three inputs, including:
  554. * @li condition: A Tensor of type bool.
  555. * @li then: A Tensor. Must be one of the following types: float16, float32, int32, int8, uint8.
  556. * @li else: A Tensor of the same type as "then" . \n
  557. *@par Outputs:
  558. *result: A Tensor. Has the same type as "then" . \n
  559. *@par Third-party framework compatibility
  560. * Compatible with the TensorFlow operator SelectV2.
  561. */
  562. REG_OP(SelectV2)
  563. .INPUT(condition, TensorType({DT_BOOL}))
  564. .INPUT(then,TensorType::BasicType())
  565. .INPUT(else,TensorType::BasicType())
  566. .OUTPUT(result,TensorType::BasicType())
  567. .OP_END_FACTORY_REG(SelectV2)
  568. /**
  569. *@brief: Computes the maximum along segments of a tensor.
  570. *Computes a tensor such that output[i]=(data[i]) where max is over j such that segment_ids[j] == i.
  571. *If the max is empty for a given segment ID i, output[i] = 0
  572. *@par Inputs:
  573. *Two inputs, include:
  574. * @li x:A Tensor of type float16, float32, int32,int8,uint8.
  575. * @li segment_ids:should be the size of the first dimension
  576. must sorted and need not cover all values in the full range of valid values
  577. must be positive intege
  578. *@par Outputs:
  579. *y:A Tensor with same type as "x" . \n
  580. *@par Third-party framework compatibility
  581. *Compatible with the TensorFlow operator SegmentMax.
  582. */
  583. REG_OP(SegmentMax)
  584. .INPUT(x, TensorType::RealNumberType())
  585. .INPUT(segment_ids, TensorType::IndexNumberType())
  586. .OUTPUT(y, TensorType::RealNumberType())
  587. .OP_END_FACTORY_REG(SegmentMax)
  588. /**
  589. *@brief: Computes the maximum along segments of a tensor.
  590. *Computes a tensor such that output[i]=(data[i]) where max is over j
  591. * such that segment_ids[j] == i.
  592. *If the max is empty for a given segment ID i, output[i] = 0
  593. *@par Inputs:
  594. *One inputs, include:
  595. * @li x:A Tensor of type float16, float, int32. format:ND
  596. *@par Attributes:
  597. * @li segment_ids:should be the size of the first dimension
  598. must sorted and need not cover all values in
  599. the full range of valid values must be positive intege
  600. *@par Outputs:
  601. *y:A Tensor with same type as "x". format:ND
  602. *@par Third-party framework compatibility
  603. *Compatible with the TensorFlow operator SegmentMax.
  604. *@par Restrictions:
  605. *Warning: THIS FUNCTION IS DEPRECATED. Please use SegmentMax instead.
  606. */
  607. REG_OP(SegmentMaxD)
  608. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32}))
  609. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32}))
  610. .REQUIRED_ATTR(segment_ids, ListInt)
  611. .OP_END_FACTORY_REG(SegmentMaxD)
  612. /**
  613. *@brief Returns a one-hot tensor. The locations represented by index in "x" take value "on_value",
  614. * while all other locations take value "off_value" . \n
  615. *@par Inputs:
  616. *Four inputs, including:
  617. * @li x: A Tensor of indices. Must be one of the following types: int32, uint8, int64.
  618. * @li depth: A scalar of type int32. The depth of the one hot dimension.
  619. * @li on_value: A scalar. The value to fill in output when indices[j] = i,
  620. * Must be one of the following types: float16, float32, int32, int8, uint8.
  621. * @li off_value: A scalar. The value to fill in output when indices[j] != i,
  622. * Has the same type as "on_value" . \n
  623. *@par Attributes:
  624. *axis: An int. The axis to fill. Defaults to "-1" . \n
  625. *@par Outputs:
  626. *y: A Tensor. Has the same type as "on_value" . \n
  627. *@par Third-party framework compatibility:
  628. * Compatible with the TensorFlow operator OneHot.
  629. */
  630. REG_OP(OneHot)
  631. .INPUT(x, TensorType({DT_UINT8, DT_INT32, DT_INT64}))
  632. .INPUT(depth, TensorType({DT_INT32}))
  633. .INPUT(on_value, TensorType::BasicType())
  634. .INPUT(off_value, TensorType::BasicType())
  635. .OUTPUT(y, TensorType::BasicType())
  636. .ATTR(axis, Int, -1)
  637. .OP_END_FACTORY_REG(OneHot)
  638. /**
  639. *@brief Returns a one-hot tensor. The locations represented by index in "x" take value "on_value",
  640. * while all other locations take value "off_value" . \n
  641. *@par Inputs:
  642. *Three inputs, including:
  643. *@li x: A Tensor of indices. Must be one of the following types: int32, uint8, int64.
  644. *@li on_value: A scalar. The value to fill in output when indices[j] = i,
  645. * Must be one of the following types: float16, float32, int32, int8, uint8.
  646. *@li off_value: A scalar. The value to fill in output when indices[j] != i,
  647. * Has the same type as "on_value" . \n
  648. *@par Attributes:
  649. *@li depth: A scalar of type int32. The depth of the one hot dimension.
  650. *@li axis: An int. The axis to fill. Defaults to "-1" . \n
  651. *@par Outputs:
  652. *y: A Tensor. Has the same type as "on_value" . \n
  653. *@par Third-party framework compatibility:
  654. * Compatible with the TensorFlow operator OneHot.
  655. *
  656. * @par Restrictions:
  657. * Warning: THIS FUNCTION IS DEPRECATED. Please use OneHot instead.
  658. */
  659. REG_OP(OneHotD)
  660. .INPUT(x, TensorType({DT_UINT8, DT_INT32}))
  661. .INPUT(on_value, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_UINT8,
  662. DT_INT8}))
  663. .INPUT(off_value, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_UINT8,
  664. DT_INT8}))
  665. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_UINT8, DT_INT8}))
  666. .REQUIRED_ATTR(depth, Int)
  667. .ATTR(axis, Int, -1)
  668. .OP_END_FACTORY_REG(OneHotD)
  669. /**
  670. *@brief Extracts a slice from a tensor.
  671. * This operation extracts a slice of size "size" from a tensor "x"
  672. * starting at the location specified by "begin" . \n
  673. *@par Inputs:
  674. *@li x: A Tensor. Must be one of the following types:
  675. * float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8,
  676. * int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32.
  677. *@li offsets: A Tensor of type int32 or int64. The starting location for the slice.
  678. *@li size: A Tensor of type int32 or int64. The tensor shape . \n
  679. *@par Outputs:
  680. *y: A Tensor. Has the same type as "x". The slice extracted from the tensor . \n
  681. *@par Third-party framework compatibility
  682. *Compatible with the TensorFlow operator Slice.
  683. */
  684. REG_OP(Slice)
  685. .INPUT(x, TensorType::BasicType())
  686. .INPUT(offsets, TensorType::IndexNumberType())
  687. .INPUT(size, TensorType::IndexNumberType())
  688. .OUTPUT(y, TensorType::BasicType())
  689. .OP_END_FACTORY_REG(Slice)
  690. /**
  691. *@brief Extracts a slice from a tensor.
  692. * This operation extracts a slice of size "size" from a tensor "x"
  693. * starting at the location specified by "begin" . \n
  694. *@par Inputs:
  695. *@li x: A Tensor. Must be one of the following types:
  696. * float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8,
  697. * int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32 . \n
  698. *@par Attributes:
  699. *@li offsets: The starting location for the slice.
  700. *@li size: The tensor shape . \n
  701. *@par Outputs:
  702. *y: A Tensor. Has the same type as "x". The slice extracted from the tensor.
  703. *@par Restrictions:
  704. *Warning: THIS FUNCTION IS DEPRECATED. Please use Slice instead.
  705. */
  706. REG_OP(SliceD)
  707. .INPUT(x, TensorType::BasicType())
  708. .OUTPUT(y, TensorType::BasicType())
  709. .REQUIRED_ATTR(offsets, ListInt)
  710. .REQUIRED_ATTR(size, ListInt)
  711. .OP_END_FACTORY_REG(SliceD)
  712. /**
  713. *@brief Extracts a slice from a tensor.
  714. * This operation extracts a slice of size "size" from a tensor "x"
  715. * starting at the location specified by "begin" . \n
  716. *@par Inputs:
  717. *@li x: A Tensor. Must be one of the following types:
  718. * float16, float32, double, int64, int32, uint8, uint16, uint32, uint64, int8,
  719. * int16, complex64, complex128, qint8, quint8, qint16, quint16, qint32 . \n
  720. *@par Inputs:
  721. *@li offsets: The starting location for the slice.
  722. *@par Attributes:
  723. *@li size: The tensor shape . \n
  724. *@par Outputs:
  725. *y: A Tensor. Has the same type as "x". The slice extracted from the tensor.
  726. *@par Restrictions:
  727. *Warning: THIS FUNCTION IS DEPRECATED. Please use Slice instead.
  728. */
  729. REG_OP(SliceDV2)
  730. .INPUT(x, TensorType::BasicType())
  731. .INPUT(offsets, TensorType::IndexNumberType())
  732. .OUTPUT(y, TensorType::BasicType())
  733. .REQUIRED_ATTR(size, ListInt)
  734. .OP_END_FACTORY_REG(SliceDV2)
  735. /**
  736. * @brief Finds values and indices of the "k" largest elements for the last
  737. * dimension . \n
  738. * @par Inputs:
  739. * Two inputs, including:
  740. * @li x: A 1D or higher tensor of type float16, with the last dimension at
  741. * least "k".
  742. * Specifies the data to sort.
  743. * @li assist_seq: A 1D tensor of type float16.
  744. * with size of 2N, which "N" is the last dimension.
  745. * The first N numbers is indices, and the next N numbers is deviation of casting
  746. * int32 to float16. \n
  747. * @par Attributes:
  748. * @li k: A required int that is at least 0, specifying the number of top elements
  749. * to look for along the last dimension (along each row for matrices).
  750. * @li sorted: An optional bool. Defaults to true.
  751. * If true, the resulting "k" elements will be sorted by the values in descending
  752. * order.
  753. * @li dim: An optional int. Defaults to -1. For reserved use.
  754. * @li largest: An optional bool. Defaults to true. For reserved use. \n
  755. * @par Outputs:
  756. * @li values: A Tensor, specifying the sorted data. Has the same type as "input".
  757. * @li indices: A Tensor of type int32, specifying the indices of sorted data . \n
  758. * @attention Constraints:
  759. * @li k =< 5120
  760. * @li Size of the last dimension =< 1458176
  761. * @li sorted = true
  762. * @li It's unstable sorted indices on the platform of Ascend310
  763. * @par Restrictions:
  764. * Warning: THIS FUNCTION IS DEPRECATED. Please use TopKV2 instead.
  765. */
  766. REG_OP(TopKD)
  767. .INPUT(x, TensorType::RealNumberType())
  768. .INPUT(assist_seq, TensorType({DT_FLOAT16}))
  769. .OUTPUT(values, TensorType::RealNumberType())
  770. .OUTPUT(indices, TensorType({DT_INT32}))
  771. .REQUIRED_ATTR(k, Int)
  772. .ATTR(sorted, Bool, true)
  773. .ATTR(dim, Int, -1)
  774. .ATTR(largest, Bool, true)
  775. .OP_END_FACTORY_REG(TopKD)
  776. /**
  777. * @brief Finds values and indices of the "k" largest elements for the last
  778. * dimension . \n
  779. * @par Inputs:
  780. * Two inputs, including:
  781. * @li x: A 1D or higher tensor of type BasicType, with the last dimension
  782. * at least "k".
  783. * @li k: A 0D Tensor of type int32.
  784. * Number of top elements to look for along the last dimension (along each row
  785. * for matrices) . \n
  786. * @par Attributes:
  787. * @li sorted: An optional bool. Defaults to true.
  788. * If true, the resulting "k" elements will be sorted by the values in descending
  789. * order.
  790. * @li dim: An optional int. Defaults to -1. For reserved use.
  791. * @li largest: An optional bool. Defaults to true. For reserved use. \n
  792. * @par Outputs:
  793. * @li values: A Tensor, specifying the sorted data. Has the same type as
  794. * "input".
  795. * @li indices: A Tensor of type int32, specifying the indices of sorted data . \n
  796. * @see TopK()
  797. * @par Third-party framework compatibility
  798. * @li Compatible with the TensorFlow operator TopKV2.
  799. */
  800. REG_OP(TopKV2)
  801. .INPUT(x, TensorType::RealNumberType())
  802. .INPUT(k, TensorType({DT_INT32}))
  803. .OUTPUT(values, TensorType::RealNumberType())
  804. .OUTPUT(indices, TensorType({DT_INT32}))
  805. .ATTR(sorted, Bool, true)
  806. .ATTR(dim, Int, -1)
  807. .ATTR(largest, Bool, true)
  808. .OP_END_FACTORY_REG(TopKV2)
  809. /**
  810. * @brief Finds values and indices of the "k" largest elements for the last
  811. * dimension . \n
  812. * @par Inputs:
  813. * Two inputs, including:
  814. * @li x: A 1D or higher tensor of type BasicType, with the last dimension
  815. * at least "k".
  816. * @li k: A 0D Tensor of type int32.
  817. * Number of top elements to look for along the last dimension (along each row
  818. * for matrices) . \n
  819. * @par Attributes:
  820. * @li sorted: An optional bool. Defaults to true.
  821. * If true, the resulting "k" elements will be sorted by the values in descending
  822. * order.
  823. * @li T: Indicator of indices type . \n
  824. * @par Outputs:
  825. * @li values: A Tensor, specifying the sorted data. Has the same type as
  826. * "input".
  827. * @li indices: A Tensor of type int32, specifying the indices of sorted data . \n
  828. * @see TopK()
  829. * @par Third-party framework compatibility
  830. * @li Compatible with the TensorFlow operator TopKV2.
  831. */
  832. REG_OP(TopK)
  833. .INPUT(x, TensorType::RealNumberType())
  834. .INPUT(k, TensorType({DT_INT32}))
  835. .OUTPUT(values, TensorType::RealNumberType())
  836. .OUTPUT(indices, TensorType({DT_INT32}))
  837. .ATTR(sorted, Bool, true)
  838. .ATTR(largest, Bool, true)
  839. .ATTR(dim, Int, -1)
  840. .OP_END_FACTORY_REG(TopK)
  841. /**
  842. *@brief Creates a new tensor by applying sparse "updates" to individual values or slices within a tensor (initially zero for numeric, empty for string) of the given "shape" according to "indices" . \n
  843. *@par Inputs:
  844. *Inputs including:
  845. * @li indices: A required index tensor. Must be one of the following types: int32 or int64.
  846. * @li x: A required slice tensor. Must be one of the following types: float32, float16, int32, int8, uint8...
  847. * @li shape: A required list of int32 or int64, specifying the output shape.
  848. *@par Outputs:
  849. *y:A output Tensor with same datatype as "updates" . \n
  850. *@attention Constraints:
  851. *@li "y" has the same shape as "shape".
  852. *@li "y" has the same type as "x".
  853. *@par Third-party framework compatibility
  854. * Compatible with the TensorFlow operator ScatterNd.
  855. */
  856. REG_OP(ScatterNd)
  857. .INPUT(indices, TensorType::IndexNumberType())
  858. .INPUT(x, TensorType::BasicType())
  859. .INPUT(shape, TensorType::IndexNumberType())
  860. .OUTPUT(y, TensorType::BasicType())
  861. .OP_END_FACTORY_REG(ScatterNd)
  862. /**
  863. *@brief Creates a new tensor by applying sparse "updates" to individual values
  864. * or slices within a tensor (initially zero for numeric, empty for string) of
  865. * the given "shape" according to "indices" . \n
  866. *@par Inputs:
  867. *Inputs including:
  868. * @li indices: A required index tensor. Must be one of the following types:
  869. * int32 or int64. format:ND.
  870. * @li x: A required slice tensor. Must be one of the following types:
  871. * float16, float, int32, int8, uint8. format:ND.
  872. *@par Attributes:
  873. * @li shape: A required list of int32 or int64, specifying the output shape.
  874. *@par Outputs:
  875. *y: A Tensor. Has the same type as "x". format:ND . \n
  876. *@attention Constraints:
  877. *@li "y" has the same shape as "shape".
  878. *@li "y" has the same type as "x".
  879. *@par Third-party framework compatibility
  880. * Compatible with the TensorFlow operator ScatterNd.
  881. * @par Restrictions:
  882. * Warning: THIS FUNCTION IS DEPRECATED. Please use ScatterNd instead.
  883. */
  884. REG_OP(ScatterNdD)
  885. .INPUT(indices, TensorType::IndexNumberType())
  886. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8}))
  887. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8}))
  888. .REQUIRED_ATTR(shape, ListInt)
  889. .OP_END_FACTORY_REG(ScatterNdD)
  890. /**
  891. * @brief Says whether the targets are in the top "k" predictions . \n
  892. * @par Inputs:
  893. * Three inputs, including:
  894. * @li x1: A 2D Tensor of type float32. A "batch_size * classes" tensor.
  895. * @li x2: A 1D Tensor of type int32. A batch_size tensor of class ids . \n
  896. * @par Attributes:
  897. * @li k: A required IndexNumberType, specifying the number of top elements to
  898. * look at for computing precision . \n
  899. * @par Outputs:
  900. * y: A Tensor of type bool . \n
  901. * @attention Constraints:
  902. * @li x2 must be non-negative tensor.
  903. * @see InTopK()
  904. * @par Third-party framework compatibility
  905. * Compatible with the TensorFlow operator InTopK.
  906. *
  907. *@par Restrictions:
  908. *Warning: THIS FUNCTION IS DEPRECATED. Please use InTopK instead.
  909. */
  910. REG_OP(InTopKD)
  911. .INPUT(x1, TensorType({DT_FLOAT}))
  912. .INPUT(x2, TensorType({IndexNumberType}))
  913. .OUTPUT(y, TensorType({DT_BOOL}))
  914. .REQUIRED_ATTR(k, Int)
  915. .OP_END_FACTORY_REG(InTopKD)
  916. /**
  917. * @brief Says whether the targets are in the top "k" predictions . \n
  918. * @par Inputs:
  919. * Two inputs, including:
  920. * @li x1: A 2D Tensor of type float32. A "batch_size * classes" tensor.
  921. * @li x2: A 1D Tensor of type IndexNumberType. A batch_size tensor of class ids.
  922. * @li k: A 1D Tensor of the same type as "x2".
  923. * Specifies the number of top elements to look at for computing precision . \n
  924. * @par Outputs:
  925. * y: A Tensor of type bool . \n
  926. * @attention Constraints:
  927. * @li x2 must be non-negative tensor.
  928. * @par Third-party framework compatibility
  929. * @li Compatible with the TensorFlow operator InTopKV2.
  930. */
  931. REG_OP(InTopK)
  932. .INPUT(x1, TensorType({DT_FLOAT}))
  933. .INPUT(x2, TensorType(IndexNumberType))
  934. .INPUT(k, TensorType({IndexNumberType}))
  935. .OUTPUT(y, TensorType({DT_BOOL}))
  936. .OP_END_FACTORY_REG(InTopK)
  937. /**
  938. * @brief Assigns "value" to the sliced l-value reference of "var".
  939. * The values of "value" are assigned to the positions in the variable. "var"
  940. * that are selected by the slice parameters. The slice parameters "begin, "end",
  941. * "strides", etc. work exactly as in "StridedSlice" . \n
  942. * @par Inputs:
  943. * Five inputs, including:
  944. * @li var: A mutable ND Tensor of type BasicType.
  945. * @li begin: A mutable ND Tensor of type IndexNumberType.
  946. * Specifies the index of the first value to select.
  947. * @li end: A mutable ND Tensor of type IndexNumberType.
  948. * Specifies the index of the last value to select.
  949. * @li strides: A mutable ND Tensor of type IndexNumberType.
  950. * Specifies the stride to select.
  951. * @li input_value: A mutable ND Tensor of type BasicType . \n
  952. * @par Attributes:
  953. * @li begin_mask: An optional int. Defaults to "0".
  954. * @li end_mask: An optional int. Defaults to "0".
  955. * @li ellipsis_mask: An optional int. Defaults to "0".
  956. * @li new_axis_mask: An optional int. Defaults to "0".
  957. * @li shrink_axis_mask: An optional int. Defaults to "0" . \n
  958. * @par Outputs:
  959. * var: A mutable Tensor. Has the same type as "var" . \n
  960. * @attention Constraints:
  961. * This operator currently does not support broadcasting. Therefore, the shape
  962. * of "value" must be exactly the shape produced by the slice of "var" . \n
  963. * @see StridedSlice()
  964. * @par Third-party framework compatibility
  965. * @li Compatible with the TensorFlow operator StridedSlice.
  966. */
  967. REG_OP(StridedSliceAssign)
  968. .INPUT(var, TensorType(BasicType))
  969. .INPUT(begin, TensorType(IndexNumberType))
  970. .INPUT(end, TensorType(IndexNumberType))
  971. .INPUT(strides, TensorType(IndexNumberType))
  972. .INPUT(input_value, TensorType(BasicType))
  973. .OUTPUT(var, TensorType(BasicType))
  974. .ATTR(begin_mask, Int, 0)
  975. .ATTR(end_mask, Int, 0)
  976. .ATTR(ellipsis_mask, Int, 0)
  977. .ATTR(new_axis_mask, Int, 0)
  978. .ATTR(shrink_axis_mask, Int, 0)
  979. .OP_END_FACTORY_REG(StridedSliceAssign)
  980. /**
  981. * @brief Assigns "value" to the sliced l-value reference of "var".
  982. * The values of "value" are assigned to the positions in the variable. "var"
  983. * that are selected by the slice parameters. The slice parameters "begin, "end",
  984. * "strides", etc. work exactly as in "StridedSlice" . \n
  985. * @par Inputs:
  986. * Two inputs, including:
  987. * @li var: A mutable ND Tensor of the following types:int32, int16, float16, float32.
  988. * @li input_value: A mutable ND "Tensor" of the following types:int32, int16, float16, float32 . \n
  989. * @par Attributes:
  990. * @li begin: A required list of ints.
  991. * Specifies the index of the first value to select.
  992. * @li end: A required list of ints.
  993. * Specifies the index of the last value to select.
  994. * @li strides: A required list of ints. Specifies the stride to select.
  995. * @li begin_mask: An optional int. Defaults to "0".
  996. * @li end_mask: An optional int. Defaults to "0".
  997. * @li ellipsis_mask: An optional int. Defaults to "0".
  998. * @li new_axis_mask: An optional int. Defaults to "0".
  999. * @li shrink_axis_mask: An optional int. Defaults to "0" . \n
  1000. * @par Outputs:
  1001. * var: A mutable Tensor. Has the same type as input "var" . \n
  1002. * @attention Constraints:
  1003. * This operator currently does not support broadcasting. Therefore, the shape of
  1004. * "value" shape must be exactly the shape produced by the slice of "var" . \n
  1005. * @see StridedSlice()
  1006. *
  1007. * @par Restrictions:
  1008. * Warning: THIS FUNCTION IS DEPRECATED. Please use StridedSliceAssign instead.
  1009. */
  1010. REG_OP(StridedSliceAssignD)
  1011. .INPUT(var, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT16}))
  1012. .INPUT(input_value, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT16}))
  1013. .OUTPUT(var, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT16}))
  1014. .REQUIRED_ATTR(begin, ListInt)
  1015. .REQUIRED_ATTR(end, ListInt)
  1016. .REQUIRED_ATTR(strides, ListInt)
  1017. .ATTR(begin_mask, Int, 0)
  1018. .ATTR(end_mask, Int, 0)
  1019. .ATTR(ellipsis_mask, Int, 0)
  1020. .ATTR(new_axis_mask, Int, 0)
  1021. .ATTR(shrink_axis_mask, Int, 0)
  1022. .OP_END_FACTORY_REG(StridedSliceAssignD)
  1023. /**
  1024. *@brief Gather slices from "params" according to "indices"."indices" must be
  1025. an integer tensor of any dimension(usually 0-D or 1-D).
  1026. Produces an output tensor with shape "indices.shape + params.shape[1:]" . \n
  1027. *@par Inputs:
  1028. *Two inputs, including:
  1029. * @li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  1030. * int64, qint8, quint8, qint32, qint16, quint16, uint16,
  1031. * float16, uint32, uint64, complex64, complex128.
  1032. * @li indices: A Tensor of type int32 or int64 . \n
  1033. *@par Attributes:
  1034. *validate_indices: A bool specifying whether to verify the argument of "indice" . \n
  1035. *@par Outputs:
  1036. *y: A Tensor. Has the same type as "x" . \n
  1037. *@attention Constraints:
  1038. * "indices" is in the range [0, x.shape[0]) . \n
  1039. *@par Third-party framework compatibility
  1040. * Compatible with the TensorFlow operator Gather . \n
  1041. */
  1042. REG_OP(Gather)
  1043. .INPUT(x, TensorType::BasicType())
  1044. .INPUT(indices, TensorType::IndexNumberType())
  1045. .OUTPUT(y, TensorType::BasicType())
  1046. .ATTR(validate_indices, Bool, true)
  1047. .OP_END_FACTORY_REG(Gather)
  1048. /**
  1049. *@brief Computes the cumulative product of the tensor "x" along "axis" . \n
  1050. *@par Inputs:
  1051. * Two inputs, including:
  1052. *@li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  1053. * complex64, int64, qint8, quint8, qint32, uint16, complex128, float16, uint32, uint64
  1054. *@li axis A Tensor of type int32 or int64. Range is [-rank(x),rank(x)). Defaults to "0".
  1055. *
  1056. *@par Attributes:
  1057. *@li exclusive: If "False", performs inclusive cumprod, which means that the first element of the input
  1058. * is identical to the first element of the output. If "True", performs exclusive cumprod.
  1059. *@li reverse: A bool. Defaults to "False".
  1060. *
  1061. *@par Outputs:
  1062. *y: A Tensor. Has the same type as "x".
  1063. *@par Third-party framework compatibility
  1064. * Compatible with the TensorFlow operator Cumprod.
  1065. */
  1066. REG_OP(Cumprod)
  1067. .INPUT(x, TensorType::NumberType())
  1068. .INPUT(axis, TensorType::IndexNumberType())
  1069. .OUTPUT(y, TensorType::NumberType())
  1070. .ATTR(exclusive, Bool, false)
  1071. .ATTR(reverse, Bool, false)
  1072. .OP_END_FACTORY_REG(Cumprod)
  1073. /**
  1074. *@brief Computes the cumulative product of the tensor "x" along "axis" . \n
  1075. *@par Inputs:
  1076. * One input:
  1077. *x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  1078. * complex64, int64, qint8, quint8, qint32, uint16, complex128, float16, uint32, uint64
  1079. *
  1080. *@par Attributes:
  1081. *@li axis A Tensor of type int32 or int64. Range is [-rank(x),rank(x)). Defaults to "0".
  1082. *@li exclusive: If "False", performs inclusive cumprod, which means that the first element of the input
  1083. * is identical to the first element of the output. If "True", performs exclusive cumprod.
  1084. *@li reverse: A bool. Defaults to "False".
  1085. *
  1086. *@par Outputs:
  1087. *y: A Tensor. Has the same type as "x".
  1088. *@par Third-party framework compatibility
  1089. * Compatible with the TensorFlow operator Cumprod.
  1090. * @par Restrictions:
  1091. * Warning: THIS FUNCTION IS DEPRECATED. Please use Cumprod instead.
  1092. */
  1093. REG_OP(CumprodD)
  1094. .INPUT(x, TensorType::NumberType())
  1095. .OUTPUT(y, TensorType::NumberType())
  1096. .REQUIRED_ATTR(axis, Int)
  1097. .ATTR(exclusive, Bool, false)
  1098. .ATTR(reverse, Bool, false)
  1099. .OP_END_FACTORY_REG(CumprodD)
  1100. /**
  1101. *@brief Computes the cumulative sum of the tensor "x" along "axis" . \n
  1102. *@par Inputs:
  1103. * Two inputs, including:
  1104. *@li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  1105. * complex64, int64, qint8, quint8, qint32, uint16, complex128, float16, uint32, uint64.
  1106. *@li axis A Tensor of type int32 or int64. Range is [-rank(x),rank(x)). Defaults to "0".
  1107. *
  1108. *@par Attributes:
  1109. *@li exclusive: If "False", performs inclusive cumsum, which means that the first element of the input is
  1110. * identical to the first element of the output. If "True", performs exclusive cumsum.
  1111. *@li reverse: A bool. Defaults to "False".
  1112. *
  1113. *@par Outputs:
  1114. *@li y: A Tensor. Has the same type as "x".
  1115. *@par Third-party framework compatibility
  1116. * Compatible with the TensorFlow operator Cumsum.
  1117. */
  1118. REG_OP(Cumsum)
  1119. .INPUT(x, TensorType::NumberType())
  1120. .INPUT(axis, TensorType::IndexNumberType())
  1121. .OUTPUT(y, TensorType::NumberType())
  1122. .ATTR(exclusive, Bool, false)
  1123. .ATTR(reverse, Bool, false)
  1124. .OP_END_FACTORY_REG(Cumsum)
  1125. /**
  1126. *@brief Computes the cumulative sum of the tensor "x" along "axis".
  1127. *
  1128. *@par Inputs:
  1129. * One input:
  1130. *x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8,
  1131. * complex64, int64, qint8, quint8, qint32, uint16, complex128, float16, uint32, uint64.
  1132. *
  1133. *@par Attributes:
  1134. *@li axis A Tensor of type int32 or int64. Range is [-rank(x),rank(x)). Defaults to "0".
  1135. *@li exclusive: If "False", performs inclusive cumsum, which means that the first element of the input is
  1136. * identical to the first element of the output. If "True", performs exclusive cumsum.
  1137. *@li reverse: A bool. Defaults to "False".
  1138. *
  1139. *@par Outputs:
  1140. *y: A Tensor. Has the same type as "x".
  1141. *@par Third-party framework compatibility
  1142. * Compatible with the TensorFlow operator Cumsum.
  1143. * @par Restrictions:
  1144. * Warning: THIS FUNCTION IS DEPRECATED. Please use Cumsum instead.
  1145. */
  1146. REG_OP(CumsumD)
  1147. .INPUT(x, TensorType::NumberType())
  1148. .OUTPUT(y, TensorType::NumberType())
  1149. .REQUIRED_ATTR(axis, Int)
  1150. .ATTR(exclusive, Bool, false)
  1151. .ATTR(reverse, Bool, false)
  1152. .OP_END_FACTORY_REG(CumsumD)
  1153. /**
  1154. *@brief Updates specified rows with values in v.
  1155. *Computes x[i, :] = v; return x.
  1156. *@par Inputs:
  1157. *Three inputs, including:
  1158. * @li x: A Tensor.
  1159. * TensorType::NumberType().
  1160. * @li indices: A vector of type int32.
  1161. * Indices into the left-most dimension of "x".
  1162. * @li v: A Tensor of the same type as "x".
  1163. * Same dimension sizes as x except the first dimension,
  1164. * which must be the same as the size of "indices" . \n
  1165. *@par Outputs:
  1166. *y: A Tensor of the same type as "x".
  1167. * An alias of "x". The content of "y" is undefined if there are duplicates in indices.
  1168. *@par Third-party framework compatibility
  1169. *Compatible with the TensorFlow operator InplaceUpdate.
  1170. */
  1171. REG_OP(InplaceUpdate)
  1172. .INPUT(x, TensorType::BasicType())
  1173. .INPUT(indices, TensorType({DT_INT32}))
  1174. .INPUT(v, TensorType::BasicType())
  1175. .OUTPUT(y, TensorType::BasicType())
  1176. .OP_END_FACTORY_REG(InplaceUpdate)
  1177. /**
  1178. *@brief Updates specified rows with values in v.
  1179. *Computes x[i, :] = v; return x.
  1180. *@par Inputs:
  1181. *Two inputs, including:
  1182. * @li x: A Tensor of type int32, float16, floay32.
  1183. * @li v: A Tensor of the same type as "x".
  1184. * Same dimension sizes as "x" except the first dimension, which must be the same as the size of "indices" . \n
  1185. *@par Attributes:
  1186. *indices: A required list of ints. Indices into the left-most dimension of "x" . \n
  1187. *@par Outputs:
  1188. *y: A Tensor of the same type as "x".
  1189. * An alias of "x". The content of "y" is undefined if there are duplicates in indices . \n
  1190. *@par Third-party framework compatibility
  1191. *Compatible with the TensorFlow operator InplaceUpdate.
  1192. *
  1193. * @par Restrictions:
  1194. * Warning: THIS FUNCTION IS DEPRECATED. Please use InplaceUpdate instead.
  1195. */
  1196. REG_OP(InplaceUpdateD)
  1197. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1198. .INPUT(v, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1199. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1200. .REQUIRED_ATTR(indices, ListInt)
  1201. .OP_END_FACTORY_REG(InplaceUpdateD)
  1202. /**
  1203. *@brief Adds "v" into specified rows of "x".
  1204. *Computes y = x; y[i, :] += v.
  1205. *@par Inputs:
  1206. *Three inputs, including:
  1207. * @li x: A Tensor.
  1208. * TensorType::NumberType().
  1209. * @li indices: A vector of type int32.
  1210. * Indices into the left-most dimension of "x".
  1211. * @li v: A Tensor of the same type as "x".
  1212. * Same dimension sizes as x except the first dimension,
  1213. * which must be the same as the size of "indices" . \n
  1214. *@par Outputs:
  1215. *y: A Tensor of the same type as "x".
  1216. * An alias of "x". The content of "y" is undefined if there are duplicates in indices.
  1217. *@par Third-party framework compatibility
  1218. *Compatible with the TensorFlow operator InplaceAdd.
  1219. */
  1220. REG_OP(InplaceAdd)
  1221. .INPUT(x, TensorType::BasicType())
  1222. .INPUT(indices, TensorType({DT_INT32}))
  1223. .INPUT(v, TensorType::BasicType())
  1224. .OUTPUT(y, TensorType::BasicType())
  1225. .OP_END_FACTORY_REG(InplaceAdd)
  1226. /**
  1227. *@brief Adds "v" into specified rows of "x".
  1228. *Computes y = x; y[i, :] += v.
  1229. *@par Inputs:
  1230. *Two inputs, including:
  1231. * @li x: A Tensor of type is int32, float16, float32.
  1232. * @li v: A Tensor of the same type as "x".
  1233. * Same dimension sizes as "x" except the first dimension, which must be the same as the size of "indices" . \n
  1234. *@par Attributes:
  1235. *indices: A required list of ints. Indices into the left-most dimension of "x" . \n
  1236. *@par Outputs:
  1237. *y: A Tensor of the same type as "x".
  1238. * An alias of "x". The content of "y" is undefined if there are duplicates in indices . \n
  1239. *@par Third-party framework compatibility
  1240. *Compatible with the TensorFlow operator InplaceAdd.
  1241. *
  1242. * @par Restrictions:
  1243. * Warning: THIS FUNCTION IS DEPRECATED. Please use InplaceAdd instead.
  1244. */
  1245. REG_OP(InplaceAddD)
  1246. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1247. .INPUT(v, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1248. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1249. .REQUIRED_ATTR(indices, ListInt)
  1250. .OP_END_FACTORY_REG(InplaceAddD)
  1251. /**
  1252. *@brief Subtracts "v" into specified rows of "x".
  1253. *Computes y = x; y[i, :] -= v; return y.
  1254. *@par Inputs:
  1255. **Three inputs, including:
  1256. * @li x: A Tensor. TensorType::NumberType().
  1257. * @li indices: A vector of type int32. Indices into the left-most dimension of x.
  1258. * @li v: A Tensor of the same type as "x".
  1259. * Same dimension sizes as "x" except the first dimension, which must be the same as the size of "indices" . \n
  1260. *@par Outputs:
  1261. *y: A Tensor. Has the same type as "x".
  1262. * An alias of "x". The content of "y" is undefined if there are duplicates in indices . \n
  1263. *@par Third-party framework compatibility
  1264. *Compatible with the TensorFlow operator InplaceSub.
  1265. */
  1266. REG_OP(InplaceSub)
  1267. .INPUT(x, TensorType::BasicType())
  1268. .INPUT(indices, TensorType({DT_INT32}))
  1269. .INPUT(v, TensorType::BasicType())
  1270. .OUTPUT(y, TensorType::BasicType())
  1271. .OP_END_FACTORY_REG(InplaceSub)
  1272. /**
  1273. *@brief Subtracts "v" into specified rows of "x".
  1274. *Computes y = x; y[i, :] -= v . \n
  1275. *@par Inputs:
  1276. **Two inputs, including:
  1277. * @li x: A Tensor of type is int32, float16, float32.
  1278. * @li v: A Tensor of the same type as "x".
  1279. * Same dimension sizes as "x" except the first dimension, which must be the same as the size of "indices" . \n
  1280. *@par Attributes:
  1281. *indices: A required list of ints. Indices into the left-most dimension of "x" . \n
  1282. *@par Outputs:
  1283. *y: A Tensor. Has the same type as "x".
  1284. * An alias of x. The content of y is undefined if there are duplicates in indices . \n
  1285. *@par Third-party framework compatibility
  1286. *Compatible with the TensorFlow operator InplaceSub.
  1287. *
  1288. * @par Restrictions:
  1289. * Warning: THIS FUNCTION IS DEPRECATED. Please use InplaceSub instead.
  1290. */
  1291. REG_OP(InplaceSubD)
  1292. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1293. .INPUT(v, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1294. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  1295. .REQUIRED_ATTR(indices, ListInt)
  1296. .OP_END_FACTORY_REG(InplaceSubD)
  1297. /**
  1298. * @brief Applies sparse addition to input "x" using individual values or slices
  1299. * from "updates" according to "indices". The updates are non-aliasing: "x" is
  1300. * only modified in-place if no other operations will use it. Otherwise, a copy
  1301. * of "x" is made. This operation has a gradient with respect to both "x" and
  1302. * "updates" . \n
  1303. * @par Inputs:
  1304. * Three inputs, including:
  1305. * @li x: A Tensor of type NumberType. A batch_size x classes tensor.
  1306. * @li indices: A Tensor of type IndexNumberType. Specifies the indices into "x".
  1307. * @li updates: A Tensor. Must have the same type as "x".
  1308. * Specifies the updated values to add to "x" . \n
  1309. * @par Outputs:
  1310. * y: A Tensor with the same shape as "x", containing values of "x" updated with
  1311. * "updates" . \n
  1312. * @see ScatterNd(),ScatterNdAdd()
  1313. * @par Third-party framework compatibility
  1314. * @li Compatible with the TensorFlow operator ScatterNDNonAliasingAdd.
  1315. */
  1316. REG_OP(ScatterNonAliasingAdd)
  1317. .INPUT(x, TensorType::NumberType())
  1318. .INPUT(indices, TensorType::IndexNumberType())
  1319. .INPUT(updates, TensorType::NumberType())
  1320. .OUTPUT(y, TensorType::NumberType())
  1321. .OP_END_FACTORY_REG(ScatterNonAliasingAdd)
  1322. /**
  1323. * @brief Computes the minimum along segments of a tensor . \n
  1324. * @par Inputs:
  1325. * Three inputs, including:
  1326. * @li x: A Tensor of type RealNumberType.
  1327. * @li segment_ids: A 1D Tensor of type IndexNumberType, whose shape is a prefix
  1328. * of "x.shape".
  1329. * @li num_segments: A Tensor of type IndexNumberType . \n
  1330. * @par Outputs:
  1331. * y: A Tensor of type RealNumberType . \n
  1332. * @attention Constraints:
  1333. * @li segment_ids must be non-negative tensor.
  1334. * @see UnsortedSegmentSum(), UnsortedSegmentProd(),
  1335. * @par Third-party framework compatibility
  1336. * @li Compatible with the TensorFlow operator UnsortedSegmentMin.
  1337. */
  1338. REG_OP(UnsortedSegmentMin)
  1339. .INPUT(x, TensorType::RealNumberType())
  1340. .INPUT(segment_ids, TensorType::IndexNumberType())
  1341. .INPUT(num_segments, TensorType::IndexNumberType())
  1342. .OUTPUT(y, TensorType::RealNumberType())
  1343. .OP_END_FACTORY_REG(UnsortedSegmentMin)
  1344. /**
  1345. * @brief Computes the minimum along segments of a tensor . \n
  1346. * @par Inputs:
  1347. * Two inputs, including:
  1348. * @li x: A Tensor of the following types:int32, int16, float16, float32.
  1349. * @li segment_ids: A 1D Tensor of type int32, whose shape is a prefix
  1350. * of "x.shape" . \n
  1351. * @par Attributes:
  1352. * num_segments: A required int32, specifying the number of distinct segment IDs . \n
  1353. * @par Outputs:
  1354. * y: A Tensor.Must have the same type as input "x" . \n
  1355. * @attention Constraints:
  1356. * @li segment_ids must be non-negative tensor.
  1357. * @see UnsortedSegmentProdD(), UnsortedSegmentSumD(),
  1358. *
  1359. * @par Restrictions:
  1360. * Warning: THIS FUNCTION IS DEPRECATED. Please use UnsortedSegmentMin instead.
  1361. */
  1362. REG_OP(UnsortedSegmentMinD)
  1363. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  1364. .INPUT(segment_ids, TensorType({DT_INT32}))
  1365. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  1366. .REQUIRED_ATTR(num_segments, Int)
  1367. .OP_END_FACTORY_REG(UnsortedSegmentMinD)
  1368. /**
  1369. * @brief Computes the maximum along segments of a tensor . \n
  1370. * @par Inputs:
  1371. * Three inputs, including:
  1372. * @li x: A Tensor of type RealNumberType.
  1373. * @li segment_ids: A 1D Tensor of type IndexNumberType, whose shape is a prefix
  1374. * of "x.shape".
  1375. * @li num_segments: A Tensor of type IndexNumberType . \n
  1376. * @par Outputs:
  1377. * y: A Tensor of type RealNumberType . \n
  1378. * @attention Constraints:
  1379. * @li segment_ids must be non-negative tensor.
  1380. * @see UnsortedSegmentSum(), UnsortedSegmentProd(),
  1381. * @par Third-party framework compatibility
  1382. * @li Compatible with the TensorFlow operator UnsortedSegmentMax.
  1383. */
  1384. REG_OP(UnsortedSegmentMax)
  1385. .INPUT(x, TensorType::RealNumberType())
  1386. .INPUT(segment_ids, TensorType::IndexNumberType())
  1387. .INPUT(num_segments, TensorType::IndexNumberType())
  1388. .OUTPUT(y, TensorType::RealNumberType())
  1389. .OP_END_FACTORY_REG(UnsortedSegmentMax)
  1390. /**
  1391. * @brief Computes the maximum along segments of a tensor . \n
  1392. * @par Inputs:
  1393. * Two inputs, including:
  1394. * @li x: A Tensor of the following types:int32, int16, float16, float32.
  1395. * @li segment_ids: A 1D Tensor of type int32, whose shape is a prefix
  1396. * of "x.shape" . \n
  1397. * @par Attributes:
  1398. * num_segments: A required int32, specifying the number of distinct segment IDs . \n
  1399. * @par Outputs:
  1400. * y: A Tensor.Must have the same type as input "x" . \n
  1401. * @attention Constraints:
  1402. * @li segment_ids must be non-negative tensor.
  1403. * @see UnsortedSegmentProdD(),
  1404. *
  1405. * @par Restrictions:
  1406. * Warning: THIS FUNCTION IS DEPRECATED. Please use UnsortedSegmentMax instead.
  1407. */
  1408. REG_OP(UnsortedSegmentMaxD)
  1409. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  1410. .INPUT(segment_ids, TensorType({DT_INT32}))
  1411. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  1412. .REQUIRED_ATTR(num_segments, Int)
  1413. .OP_END_FACTORY_REG(UnsortedSegmentMaxD)
  1414. /**
  1415. * @brief Computes the product along segments of a tensor . \n
  1416. * @par Inputs:
  1417. * Three inputs, including:
  1418. * @li x: A Tensor of type NumberType.
  1419. * @li segment_ids: A 1D Tensor of type IndexNumberType, whose shape is a prefix
  1420. * of "x.shape".
  1421. * @li num_segments: A Tensor of type IndexNumberType . \n
  1422. * @par Outputs:
  1423. * y: A Tensor of type NumberType . \n
  1424. * @attention Constraints:
  1425. * @li segment_ids must be non-negative tensor.
  1426. * @see UnsortedSegmentSum(), UnsortedSegmentMin(),
  1427. * @par Third-party framework compatibility
  1428. * @li Compatible with the TensorFlow operator UnsortedSegmentProd.
  1429. */
  1430. REG_OP(UnsortedSegmentProd)
  1431. .INPUT(x, TensorType::NumberType())
  1432. .INPUT(segment_ids, TensorType::IndexNumberType())
  1433. .INPUT(num_segments, TensorType::IndexNumberType())
  1434. .OUTPUT(y, TensorType::NumberType())
  1435. .OP_END_FACTORY_REG(UnsortedSegmentProd)
  1436. /**
  1437. * @brief Computes the product along segments of a tensor . \n
  1438. * @par Inputs:
  1439. * Two inputs, including:
  1440. * @li x: A Tensor of the following types:int32, int16, float16, float32.
  1441. * @li segment_ids: A 1D Tensor of type int32, whose shape is a prefix
  1442. * of "x.shape" . \n
  1443. * @par Attributes:
  1444. * num_segments: An int32, specifying the number of distinct segment IDs . \n
  1445. * @par Outputs:
  1446. * y: A Tensor.Must have the same type as input "x" . \n
  1447. * @attention Constraints:
  1448. * @li segment_ids must be non-negative tensor.
  1449. * @see UnsortedSegmentMinD()
  1450. *
  1451. * @par Restrictions:
  1452. * Warning: THIS FUNCTION IS DEPRECATED. Please use UnsortedSegmentProd instead.
  1453. */
  1454. REG_OP(UnsortedSegmentProdD)
  1455. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  1456. .INPUT(segment_ids, TensorType({DT_INT32}))
  1457. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  1458. .REQUIRED_ATTR(num_segments, Int)
  1459. .OP_END_FACTORY_REG(UnsortedSegmentProdD)
  1460. /**
  1461. *@brief Performs object detection . \n
  1462. *@par Inputs:
  1463. *@li cls_prob: An NCHW tensor of type float16 or float32, specifying the probability of the proposal is the background class.
  1464. *@li bbox_delta: An NCHW tensor of type float16 or float32, specifying the coordinates of the proposals bounding boxes.
  1465. *@li im_info: An ND tensor of type float16 or float32, specifying the Image information . \n
  1466. *@par Attributes:
  1467. *@li feat_stride: A optional float32, specifying the stride of the sliding window. Must be greater than "0".Defaults to "16".
  1468. *@li base_size: A optional float32, specifying the size of the generated base box. Must be greater than "0". Defaults to "16".
  1469. *@li min_size: A optional float32, specifying the minimum edge length of a proposal. A box with any edge less than this value is removed. Must be greater than "0". Defaults to "16".
  1470. *@li ratio: A optional list of floats, specifying the aspect ratio of the generated base box. Defaults to [0.5, 1, 2].
  1471. *@li scale: A optional list of floats, specifying the ratio of the size of the generated base box to "base_size". Defaults to [8, 16, 32].
  1472. *@li pre_nms_topn: A required int, specifying top K boxes before NMS. For float16 input, pre_nms_topn <= 6000. For float32 input, pre_nms_topn <= 3000. Defaults to "3000".
  1473. *@li post_nms_topn: A required int, specifying the number of boxes to be output after NMS. The value is a multiple of 16. For float16 input, post_nms_topn <= 6000. For float32 input, post_nms_topn <= 3000 (the maximum multiple of 16 is 2992 within the range). Defaults to "304".
  1474. *@li iou_threshold: A required float32, specifying the NMS threshold. The value range is (0,1]. Defaults to "0.7".
  1475. *@li output_actual_rois_num: An optional bool. Defaults to "false" . \n
  1476. *@par Outputs:
  1477. *@li rois: A Tensor with shape [batch, 5, post_nms_topn], of type float16 or float32, specifying the output box information. "post_nms_topn" must be a multiple of 16. The dimension "5" indicates (batchID, x1, y1, x2, y2). The number of BBoxes output per batch is determined by "actual_rois_num".
  1478. *@li actual_rois_num: A Tensor with shape [batch, 8], of type int32, specifying the number of BBoxes output per batch.
  1479. *@par Third-party framework compatibility
  1480. * It is a custom operator. It has no corresponding operator in Caffe.
  1481. */
  1482. REG_OP(Proposal)
  1483. .INPUT(cls_prob, TensorType({DT_FLOAT16, DT_FLOAT}))
  1484. .INPUT(bbox_delta, TensorType({DT_FLOAT16, DT_FLOAT}))
  1485. .INPUT(im_info, TensorType({DT_FLOAT16, DT_FLOAT}))
  1486. .OUTPUT(rois, TensorType({DT_FLOAT16, DT_FLOAT}))
  1487. .OUTPUT(actual_rois_num, TensorType({DT_INT32}))
  1488. .ATTR(feat_stride, Float, 16)
  1489. .ATTR(base_size, Float, 16)
  1490. .ATTR(min_size, Float, 16)
  1491. .ATTR(ratio, ListFloat, {0.5, 1, 2})
  1492. .ATTR(scale, ListFloat, {8, 16, 32})
  1493. .ATTR(pre_nms_topn, Int, 3000)
  1494. .ATTR(post_nms_topn, Int, 304)
  1495. .ATTR(iou_threshold, Float, 0.7)
  1496. .ATTR(output_actual_rois_num, Bool, false)
  1497. .OP_END_FACTORY_REG(Proposal)
  1498. /**
  1499. *@brief Performs object detection. Different from Proposal, this is an internal API called after FE fusion and has an additional "rpn_bbox" attribute. The suffix "D" in the API name will be removed from the generated model . \n
  1500. *@par Inputs:
  1501. *@li cls_prob: An NCHW tensor of type float16, specifying the probability of the proposal is the background class.
  1502. *@li bbox_delta: An NCHW tensor of type float16, specifying the coordinates of the proposals bounding boxes.
  1503. *@li im_info: An ND tensor of type float16 or float32, specifying the Image information.
  1504. *@li rpn_bbox: An NCHW tensor of type float16, specifying the coordinates of the proposals bounding boxes . \n
  1505. *@par Attributes:
  1506. *@li feat_stride: A required float32, specifying the stride of the sliding window. Must be greater than "0".Defaults to "16".
  1507. *@li base_size: A required float32, specifying the size of the generated base box. Must be greater than "0". Defaults to "16".
  1508. *@li min_size: A required float32, specifying the minimum edge length of a proposal. A box with any edge less than this value is removed. Must be greater than "0". Defaults to "16".
  1509. *@li ratio: A required list of floats, specifying the aspect ratio of the generated base box. Defaults to [0.5, 1, 2].
  1510. *@li scale: A required list of floats, specifying the ratio of the size of the generated base box to "base_size". Defaults to [8, 16, 32].
  1511. *@li pre_nms_topn: A required int, specifying top K boxes before NMS. For float16 input, pre_nms_topn <= 6000. For float32 input, pre_nms_topn <= 3000. Defaults to "3000".
  1512. *@li post_nms_topn: A required int, specifying the number of boxes to be output after NMS. The value is a multiple of 16. For float16 input, post_nms_topn <= 6000. For float32 input, post_nms_topn <= 3000 (the maximum multiple of 16 is 2992 within the range). Defaults to "304".
  1513. *@li iou_threshold: A required float32, specifying the NMS threshold. The value range is (0,1]. Defaults to 0.7.
  1514. *@li output_actual_rois_num: An optional bool. Defaults to "false" . \n
  1515. *@par Outputs:
  1516. *@li rois: A Tensor with shape [batch, 5, post_nms_topn], of type float16 or float32, specifying the output box information. "post_nms_topn" must be a multiple of 16. The dimension "5" indicates (batchID, x1, y1, x2, y2). The number of BBoxes output per batch is determined by "actual_rois_num".
  1517. *@li actual_rois_num: A Tensor with shape [batch, 8], of type int32, specifying the number of BBoxes output per batch.
  1518. *@par Third-party framework compatibility
  1519. * It is a custom operator. It has no corresponding operator in Caffe.
  1520. *@par Restrictions:
  1521. *Warning: THIS FUNCTION IS DEPRECATED. Please use Proposal instead.
  1522. */
  1523. REG_OP(ProposalD)
  1524. .INPUT(cls_prob, TensorType({DT_FLOAT16, DT_FLOAT}))
  1525. .INPUT(bbox_delta, TensorType({DT_FLOAT16, DT_FLOAT}))
  1526. .INPUT(im_info, TensorType({DT_FLOAT16, DT_FLOAT}))
  1527. .INPUT(rpn_bbox, TensorType({DT_FLOAT16, DT_FLOAT}))
  1528. .OUTPUT(rois, TensorType({DT_FLOAT16, DT_FLOAT}))
  1529. .OUTPUT(actual_rois_num, TensorType({DT_INT32}))
  1530. .ATTR(feat_stride, Float, 16)
  1531. .ATTR(base_size, Float, 16)
  1532. .ATTR(min_size, Float, 16)
  1533. .ATTR(ratio, ListFloat, {0.5, 1, 2})
  1534. .ATTR(scale, ListFloat, {8, 16, 32})
  1535. .ATTR(pre_nms_topn, Int, 3000)
  1536. .ATTR(post_nms_topn, Int, 304)
  1537. .ATTR(iou_threshold, Float, 0.7)
  1538. .ATTR(output_actual_rois_num, Bool, false)
  1539. .OP_END_FACTORY_REG(ProposalD)
  1540. /**
  1541. *@brief Performs plane or channel conversion on YoloV2.
  1542. * If reverse=true: (N, H, W, C)->(N, H*stride, W*stride, C/(stride*stride))
  1543. * If reverse=false: (N, H, W, C)->(N, H/stride, W/stride, C*(stride*stride))
  1544. *@par Inputs:
  1545. *x: An (N, H, W, C) tensor. Type is float16, float32, int8, uint8, int16, uint16, int32, uint32, int64 or uint64. . \n
  1546. *@par Attributes:
  1547. *@li stride: An optional int32, specifying the plane or channel scaling factor. Defaults to "2".
  1548. *@li reverse: An optional bool, specifying the conversion mode. If "true", depth to space conversion is performed. If "false", space to depth conversion is performed. Defaults to "false" . \n
  1549. *@par Outputs:
  1550. *y: An (N, H, W, C) tensor. Has same type as "x" . \n
  1551. *@attention Constraints:
  1552. *@li If reverse=true: C/(stride*stride) yields an integer result. If reverse=false: W/stride and H/stride yield integer results.
  1553. *@par Third-party framework compatibility
  1554. * It is a custom operator. It has no corresponding operator in Caffe.
  1555. */
  1556. REG_OP(PassThrough)
  1557. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64}))
  1558. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32, DT_INT64, DT_UINT64}))
  1559. .ATTR(stride, Int, 2)
  1560. .ATTR(reverse, Bool, false)
  1561. .OP_END_FACTORY_REG(PassThrough)
  1562. /**
  1563. *@brief Crops the input tensor x to the shape of size. For example:
  1564. *(1) x: bottom to be cropped, with shape (20, 50, 512, 512);
  1565. *(2) size: reference input for cropping, with shape (20, 10, 256, 256);
  1566. *(3) axis = 1;
  1567. *(4) offset = (25, 128, 128);
  1568. *(5) y = x[:, 25:25 + size.shape[1], 128:128 + size.shape[2], 128:128 + size.shape[3]] . \n
  1569. *@par Inputs:
  1570. *Inputs include:
  1571. * @li x: A required Tensor. Must be one of the following types: float16, float32, int8, uint8, int16, uint16, int32, uint32,int64, uint64.
  1572. * @li size: A required Tensor. Must be one of the following types: float16, float32, int8, uint8, int16, uint16, int32, uint32, int64, uint64.
  1573. *@par Attributes:
  1574. *@li axis: A required int32, specifying the first dimension to crop. Defaults to "2".
  1575. *@li offset: A required array, specifying the shift for all/each dimension to align the cropped bottom with the reference bottom. Must be one of the following types: float16, float32, int8, uint8, int16, uint16, int32, uint32, int64, uint64.
  1576. *@par Outputs:
  1577. *y: A required Tensor. Has the same type and shape as "size" . \n
  1578. *@attention Constraints:
  1579. *@li "y" must have the same type and shape as "size". "x" must have the same type as "size".
  1580. *@li "axis" must be less than the rank of "x".
  1581. *@li The "offset" for each dimension must not exceed the maximum value of the corresponding dimension of "x".
  1582. *@li The array length of "offset" plus the value of "axis" equals to the rank of "y".
  1583. *@par Third-party framework compatibility
  1584. * Compatible with the Caffe operator Crop.
  1585. */
  1586. REG_OP(Crop)
  1587. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32,DT_INT64,DT_UINT64}))
  1588. .INPUT(size, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32,DT_INT64,DT_UINT64}))
  1589. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT,DT_INT8, DT_UINT8, DT_INT16, DT_UINT16, DT_INT32, DT_UINT32,DT_INT64,DT_UINT64}))
  1590. .ATTR(axis, Int, 2)
  1591. .REQUIRED_ATTR(offsets, ListInt)
  1592. .OP_END_FACTORY_REG(Crop)
  1593. /**
  1594. *@brief Returns a namedtuple (values, indices) where values is the cumulative
  1595. * the cumulative minimum of elements of input in the dimension dim.
  1596. * And indices is the index location of each maximum value found in the dimension dim. \n
  1597. *@par Inputs:
  1598. *One inputs, including:
  1599. * @li x: A tensor . Must be one of the following types:
  1600. * float16, float32, int32, uint32, int8, uint8. \n
  1601. *@par Attributes:
  1602. * @li axis: Axis along which to cummin. \n
  1603. *@par Outputs:
  1604. * y: A Tensor with the same type and shape of x's. \n
  1605. * indices: A Tensor with the int32 type and the same shape of x's. \n
  1606. *@par Third-party framework compatibility
  1607. *Compatible with the Pytorch operator Cummin. \n
  1608. */
  1609. REG_OP(Cummin)
  1610. .INPUT(x, TensorType::BasicType())
  1611. .OUTPUT(y, TensorType::BasicType())
  1612. .OUTPUT(indices, TensorType::BasicType())
  1613. .REQUIRED_ATTR(axis, Int)
  1614. .OP_END_FACTORY_REG(Cummin)
  1615. /**
  1616. *@brief Extends the input with copies of data along a specified dimension. For example:
  1617. *(1) If x = [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12]]], with shape (2, 3, 2);
  1618. *(2) axis = 1;
  1619. *(3) tiles = 2;
  1620. *(4) Then, y = [[[1, 2], [3, 4], [5, 6], [1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10], [11, 12], [7, 8], [9, 10], [11, 12]]], with shape (2, 6, 2) . \n
  1621. *@par Inputs:
  1622. * One input:
  1623. *input_x: A Tensor with any format. Must be one of the following types: float16, float32, int8, int16, int32, int64, uint8, uint16, uint32, uint64 . \n
  1624. *@par Attributes:
  1625. *@li axis: An optional int32, specifying the axis to tile. Defaults to 1.
  1626. *@li tiles: A required int32, specifying the number of copies (tiles) to output . \n
  1627. *@par Outputs:
  1628. *output_y: A Tensor of any format. Must be one of the following types: float16, float32, int8, int16, int32, int64, uint8, uint16, uint32, uint64 . \n
  1629. *@attention Constraints:
  1630. *@li "axis" must be within the rank of the input tensor.
  1631. *@li "tiles" must be greater than 1.
  1632. *@par Third-party framework compatibility
  1633. * Compatible with the Caffe operator Tile.
  1634. */
  1635. REG_OP(TileWithAxis)
  1636. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT64, DT_INT32,
  1637. DT_INT16, DT_INT8, DT_UINT64, DT_UINT32, DT_UINT16, DT_UINT8}))
  1638. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT64, DT_INT32,
  1639. DT_INT16, DT_INT8, DT_UINT64, DT_UINT32, DT_UINT16, DT_UINT8}))
  1640. .ATTR(axis, Int, 1)
  1641. .REQUIRED_ATTR(tiles, Int)
  1642. .OP_END_FACTORY_REG(TileWithAxis)
  1643. /**
  1644. *@brief Read data with offset and stride . \n
  1645. *@par Inputs:
  1646. *One input:
  1647. *x: A Tensor. Must be one of the following types: float16, int8 . \n
  1648. *@par Attributes:
  1649. *@li stride_list: An optional 5D list of type int32. Defaults to "[1,1,1,1,1]" . \n
  1650. *@par Outputs:
  1651. *y: A Tensor of the same type as "x".
  1652. *@par Restrictions:
  1653. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  1654. */
  1655. REG_OP(ReadSelect)
  1656. .INPUT(x, TensorType::ALL())
  1657. .OUTPUT(y, TensorType::ALL())
  1658. .ATTR(stride_list, ListInt, {1,1,1,1,1})
  1659. .OP_END_FACTORY_REG(ReadSelect)
  1660. /**
  1661. *@brief: Write data with offset . \n
  1662. *@par Inputs:
  1663. *x: A Tensor. Must be one of the following types: int32, float32, float16, int8 . \n
  1664. *@par Outputs:
  1665. *y: A Tensor. Has the same type as "x".
  1666. *@par Restrictions:
  1667. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  1668. */
  1669. REG_OP(WriteSelect)
  1670. .INPUT(x, TensorType::ALL())
  1671. .OUTPUT(y, TensorType::ALL())
  1672. .OP_END_FACTORY_REG(WriteSelect)
  1673. /**
  1674. *@brief Read data by stride . \n
  1675. *@par Inputs:
  1676. *One input:
  1677. *x: A Tensor. Must be one of the following types: float16, int8 . \n
  1678. *@par Attributes:
  1679. *@li axis: A required int32, specifying the index of axis to read by stride . \n
  1680. *@par Attributes:
  1681. *@li stride: A required int32, specifying the value of reading stride . \n
  1682. *@par Outputs:
  1683. *y: A Tensor of the same type as "x".
  1684. */
  1685. REG_OP(StridedRead)
  1686. .INPUT(x, TensorType::ALL())
  1687. .OUTPUT(y, TensorType::ALL())
  1688. .ATTR(axis, Int, 1)
  1689. .ATTR(stride, Int, 1)
  1690. .OP_END_FACTORY_REG(StridedRead)
  1691. /**
  1692. *@brief: Write data by stride . \n
  1693. *@par Inputs:
  1694. *x: A Tensor. Must be one of the following types: float16, int8 . \n
  1695. *@par Attributes:
  1696. *@li axis: A required int32, specifying the index of axis to write by stride . \n
  1697. *@par Attributes:
  1698. *@li stride: A required int32, specifying the value of writing stride . \n
  1699. *@par Outputs:
  1700. *y: A Tensor. Has the same type as "x".
  1701. */
  1702. REG_OP(StridedWrite)
  1703. .INPUT(x, TensorType::ALL())
  1704. .OUTPUT(y, TensorType::ALL())
  1705. .ATTR(axis, Int, 1)
  1706. .ATTR(stride, Int, 1)
  1707. .OP_END_FACTORY_REG(StridedWrite)
  1708. /**
  1709. *@brief Computes the cumulative log sum exp of the tensor "x" along "axis" . \n
  1710. *@par Inputs:
  1711. * Two inputs, including:
  1712. *@li x: A Tensor. Must be one of the following types: float32, float16.
  1713. *@li axis A Tensor of type int32 or int16. Defaults to "0".
  1714. *
  1715. *@par Attributes:
  1716. *@li exclusive: If "False", performs inclusive CumulativeLogsumexp, which means that the first element of the input is identical to the first element of the output. If "True", performs exclusive CumulativeLogsumexp.
  1717. *@li reverse: A bool. Defaults to "False".
  1718. *
  1719. *@par Outputs:
  1720. *@li y: A Tensor. Has the same type as "x".
  1721. *@par Third-party framework compatibility
  1722. * Compatible with the TensorFlow operator Cumsum.
  1723. */
  1724. REG_OP(CumulativeLogsumexp)
  1725. .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16}))
  1726. .INPUT(axis, TensorType({DT_INT32, DT_INT16}))
  1727. .OUTPUT(y, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16}))
  1728. .ATTR(exclusive, Bool, false)
  1729. .ATTR(reverse, Bool, false)
  1730. .OP_END_FACTORY_REG(CumulativeLogsumexp)
  1731. /**
  1732. *@brief Computes the cumulative log sum exp of the tensor "x" along "axis".
  1733. *
  1734. *@par Inputs:
  1735. * One input:
  1736. *x: A Tensor. Must be one of the following types: float32, float16.
  1737. *
  1738. *@par Attributes:
  1739. *@li axis A Tensor of type int32 or int16. Defaults to "0".
  1740. *@li exclusive: If "False", performs inclusive cumulativeLogsumexp, which means that the first element of the input is identical to the first element of the output. If "True", performs exclusive CumulativeLogsumexp.
  1741. *@li reverse: A bool. Defaults to "False".
  1742. *
  1743. *@par Outputs:
  1744. *y: A Tensor. Has the same type as "x".
  1745. *@par Third-party framework compatibility
  1746. * Compatible with the TensorFlow operator Cumsum.
  1747. *
  1748. * @par Restrictions:
  1749. * Warning: THIS FUNCTION IS DEPRECATED. Please use CumulativeLogsumexp instead.
  1750. */
  1751. REG_OP(CumulativeLogsumexpD)
  1752. .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16}))
  1753. .OUTPUT(y, TensorType({DT_DOUBLE, DT_FLOAT, DT_FLOAT16}))
  1754. .REQUIRED_ATTR(axis, Int)
  1755. .ATTR(exclusive, Bool, false)
  1756. .ATTR(reverse, Bool, false)
  1757. .OP_END_FACTORY_REG(CumulativeLogsumexpD)
  1758. /**
  1759. * @brief Add updates to var according to axis and indices.
  1760. * @par Inputs:
  1761. * Three inputs, including:
  1762. * @li var: A Tensor. Must be one of the following types:
  1763. * float16, float32, int16, int32, int8, uint8.
  1764. * @li indices: A Tensor of the indices, type should be int32.
  1765. * @li updates: A Tensor of the same type as "var". \n
  1766. * @par Attributes:
  1767. * @li axis: An required int to specify the axis to perform indices add. \n
  1768. * @par Outputs:
  1769. * @li var: A Tensor. Same as input "var".
  1770. * @par Third-party framework compatibility
  1771. * Compatible with the Pytorch operator index_add_.
  1772. */
  1773. REG_OP(InplaceIndexAdd)
  1774. .INPUT(var, TensorType({DT_INT16, DT_INT32, DT_INT8,
  1775. DT_UINT8, DT_FLOAT32, DT_FLOAT16}))
  1776. .INPUT(indices, TensorType({DT_INT32}))
  1777. .INPUT(updates, TensorType({DT_INT16, DT_INT32, DT_INT8,
  1778. DT_UINT8, DT_FLOAT32, DT_FLOAT16}))
  1779. .OUTPUT(var, TensorType({DT_INT16, DT_INT32, DT_INT8,
  1780. DT_UINT8, DT_FLOAT32, DT_FLOAT16}))
  1781. .REQUIRED_ATTR(axis, Int)
  1782. .OP_END_FACTORY_REG(InplaceIndexAdd)
  1783. /**
  1784. * @brief Replace the value of X with value according to mask.
  1785. * @par Inputs:
  1786. * three inputs, including:
  1787. * @li x: A Tensor of dtype is float16 or float32 or int64 or int32 or int8.
  1788. * @li mask: A Tensor of dtype bool.
  1789. * @li value: A Tensor of dtype float16 or float32 or int64 or int32 or int8.
  1790. * @par Outputs:
  1791. * @li y: A tensor. Must be one of the following dtypes:
  1792. * float16, float32, int64, int32, int8.
  1793. */
  1794. REG_OP(MaskedFill)
  1795. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT32, DT_INT64}))
  1796. .INPUT(mask, TensorType({DT_BOOL}))
  1797. .INPUT(value, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT32, DT_INT64}))
  1798. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_INT32, DT_INT64}))
  1799. .OP_END_FACTORY_REG(MaskedFill)
  1800. /**
  1801. * @brief Choose the value of X with value according to mask.
  1802. * @par Inputs:
  1803. * two inputs, including:
  1804. * @li x: A Tensor of dtype is float16 or float32.
  1805. * @li mask: A Tensor of dtype is bool. \n
  1806. * @par Outputs:
  1807. * @li y: A tensor with the same type as x. \n
  1808. * @par Third-party framework compatibility
  1809. * Compatible with the Numpy operator select.
  1810. * Replaces the pytorch operator masked_select in some scenarios.\n
  1811. */
  1812. REG_OP(MaskedSelectV2)
  1813. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  1814. .INPUT(mask, TensorType({DT_BOOL}))
  1815. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1816. .OP_END_FACTORY_REG(MaskedSelectV2)
  1817. /**
  1818. * @brief Slice a tensor at its last dim, e.x. a[..., begin:end:stride]. \n
  1819. * @par Inputs:
  1820. * One inputs, including:
  1821. * @li x: A Tensor. Must be one of the following types: float16, float32, int16, int32.
  1822. * @par Attributes:
  1823. * @li start: An attribute of type Int, start index of last dim. \n
  1824. * @li end: An attribute of type Int, end index of last dim. \n
  1825. * @li stride: An attribute of type Int, stride of slice. \n
  1826. * @par Outputs:
  1827. * @li y: A Tensor. Has the same type as "x". \n
  1828. * @par Third-party framework compatibility
  1829. * No compatibility
  1830. */
  1831. REG_OP(SliceLastDim)
  1832. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64}))
  1833. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8, DT_INT16, DT_INT32, DT_INT64}))
  1834. .REQUIRED_ATTR(start, Int)
  1835. .REQUIRED_ATTR(end, Int)
  1836. .ATTR(stride, Int, 1)
  1837. .OP_END_FACTORY_REG(SliceLastDim)
  1838. /**
  1839. * @brief Extracts a strided slice of a tensor. Roughly speaking, this op \n
  1840. * extracts a slice of size (end-begin)/stride from the given input tensor. \n
  1841. * Starting at the location specified by begin the slice continues by \n
  1842. * adding stride to the index until all dimensions are not less than end. \n
  1843. *
  1844. * @par Inputs:
  1845. * Four inputs, including:
  1846. * @li x: A Tensor. Must be one of the following types: float32, float64, int32, uint8, int16, int8, \n
  1847. * complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16, \n
  1848. * complex128, float16, uint32, uint64, complex64, complex128. \n
  1849. * @li begin: A Tensor of type int32 or int64, for the index of the first value to select.
  1850. *
  1851. * @li end: A Tensor of type int32 or int64, for the index of the last value to select.
  1852. *
  1853. * @li axes: A Tensor of type int32 or int64, indicate axis to be select.
  1854. *
  1855. * @li strides: A Tensor of type int32 or int64, for the increment.
  1856. *
  1857. * @par Attributes:
  1858. * @li begin_mask: A Tensor of type int32. \n
  1859. * A bitmask where a bit "i" being "1" means to ignore the begin \n
  1860. * value and instead use the largest interval possible.
  1861. * @li end_mask: A Tensor of type int32. \n
  1862. * Analogous to "begin_mask".
  1863. * @li ellipsis_mask: A Tensor of type int32. \n
  1864. * A bitmask where bit "i" being "1" means the "i"th position \n
  1865. * is actually an ellipsis.
  1866. * @li new_axis_mask: A Tensor of type int32. \n
  1867. * A bitmask where bit "i" being "1" means the "i"th \n
  1868. * specification creates a new shape 1 dimension.
  1869. * @li shrink_axis_mask: A Tensor of type int32. \n
  1870. * A bitmask where bit "i" implies that the "i"th \n
  1871. * specification should shrink the dimensionality.
  1872. *
  1873. * @par Outputs:
  1874. * y: A Tensor. Has the same type as "x".
  1875. *
  1876. * @attention Constraints:
  1877. *
  1878. * @par Third-party framework compatibility
  1879. * Compatible with the TensorFlow operator StridedSliceV2.
  1880. */
  1881. REG_OP(StridedSliceV2)
  1882. .INPUT(x, TensorType::BasicType())
  1883. .INPUT(begin, TensorType::IndexNumberType())
  1884. .INPUT(end, TensorType::IndexNumberType())
  1885. .OPTIONAL_INPUT(axes, TensorType::IndexNumberType())
  1886. .OPTIONAL_INPUT(strides, TensorType::IndexNumberType())
  1887. .ATTR(begin_mask, Int, 0)
  1888. .ATTR(end_mask, Int, 0)
  1889. .ATTR(ellipsis_mask, Int, 0)
  1890. .ATTR(new_axis_mask, Int, 0)
  1891. .ATTR(shrink_axis_mask, Int, 0)
  1892. .OUTPUT(y, TensorType::BasicType())
  1893. .OP_END_FACTORY_REG(StridedSliceV2)
  1894. /**
  1895. *@brief Fills the elements of the input tensor with value val by selecting the indices in the order given in index. \n
  1896. *@par Inputs:
  1897. *Three inputs, including:
  1898. * @li x: A tensor. Must be one of the following types:
  1899. * float16, float32, int32. \n
  1900. *@li assist1: A tensor. Must be one of the following types:
  1901. * float16, float32, int32. \n
  1902. *@li assist2: A tensor. Must be one of the following types:
  1903. * float16, float32, int32. \n
  1904. * @par Attributes:
  1905. * @li dim: A required int. Used to select the dimension of this tensor. \n
  1906. *@par Outputs:
  1907. *y: A Tensor with the same type and shape of input_x's. \n
  1908. *@par Third-party framework compatibility
  1909. *Compatible with the Pytorch operator IndexFill. \n
  1910. */
  1911. REG_OP(IndexFillD)
  1912. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32}))
  1913. .INPUT(assist1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32}))
  1914. .INPUT(assist2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32}))
  1915. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32}))
  1916. .REQUIRED_ATTR(dim, Int)
  1917. .OP_END_FACTORY_REG(IndexFillD)
  1918. /**
  1919. * @brief For each row r of this and for each column c, do (*this)(r, c) += src(j, c), \n
  1920. * where j ranges from indexes[r].first through indexes[r].second - 1. \n
  1921. * In general indexes must be >= 0 and < src.NumRows(); \n
  1922. * but to represent an empty range you may use the pair (-1, -1) or any pair of numbers (i, j) such that i >= j. \n
  1923. * @par Inputs:
  1924. * Three inputs, including:
  1925. * @li x: A Tensor. Must be one of the following types:
  1926. * float16, float32.
  1927. * @li indices: A Tensor of the indices, type should be int32.
  1928. * @li src: A Tensor of the same type as "x". \n
  1929. * @par Outputs:
  1930. * @li x: A Tensor. Same as input "x".
  1931. * @par Third-party framework compatibility
  1932. * Compatible with the kaldi operator AddRowRanges.
  1933. */
  1934. REG_OP(AddRowRanges)
  1935. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
  1936. .INPUT(src, TensorType({DT_FLOAT16,DT_FLOAT}))
  1937. .INPUT(indices, TensorType({DT_INT32}))
  1938. .OUTPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
  1939. .OP_END_FACTORY_REG(AddRowRanges)
  1940. /**
  1941. *@brief masked fill tensor along with one axis by range.
  1942. * boxes. It is a customized masked fill range operator . \n
  1943. *@par Inputs:
  1944. * Four inputs, including:
  1945. *@li x: input tensor. A ND Tensor of float32/float16/int32/int8 with shapes
  1946. * 1-D (D,), 2-D(N, D), 3-D(N, C, D)
  1947. *@li start: masked fill start pos. A 3D Tensor of int32 with
  1948. * shape (num, N). "num" indicates the number of loop masked fill, and the value N
  1949. * indicates the batch of ND Tensor, if input x shape is 1-D, N = 1. \n
  1950. *@li end: masked fill end pos. A 3D Tensor of int32 with
  1951. * shape (num, N). "num" indicates the number of loop masked fill, and the value N
  1952. * indicates the batch of ND Tensor. \n
  1953. *@li value: masked fill value. A 2D Tensor of float32/float16/int32/int8 with
  1954. * shape (num,). "num" indicates the number of loop masked fill
  1955. *@par Attributes:
  1956. *@li axis: axis with masked fill of int32. Defaults to -1.
  1957. *@par Outputs:
  1958. *y: A ND Tensor of float32/float16/int32/int8 with shapes 1-D (D,), 2-D(N, D), 3-D(N, C, D)
  1959. * @par Restrictions:
  1960. * Warning: input shape's length must not be bigger than 1024 * 1024 * 1024.
  1961. */
  1962. REG_OP(MaskedFillRange)
  1963. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32}))
  1964. .INPUT(start, TensorType({DT_INT32}))
  1965. .INPUT(end, TensorType({DT_INT32}))
  1966. .INPUT(value, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32}))
  1967. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32}))
  1968. .REQUIRED_ATTR(axis, Int)
  1969. .OP_END_FACTORY_REG(MaskedFillRange)
  1970. } // namespace ge
  1971. #endif // OPS_BUILT_IN_OP_PROTO_INC_SELECTION_OPS_H_

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