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.

elewise_calculation_ops.h 116 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317
  1. /**
  2. * Copyright 2019-2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*!
  17. * \file elewise_calculation_ops.h
  18. * \brief
  19. */
  20. #ifndef GE_OP_ELEWISE_CALCULATION_OPS_H
  21. #define GE_OP_ELEWISE_CALCULATION_OPS_H
  22. #include "graph/operator_reg.h"
  23. namespace ge {
  24. /**
  25. *@brief Adds all input tensors element-wise. \n
  26. *@par Inputs:
  27. *Dynamic inputs, including:
  28. * @li x: A list of Tensor objects, each with same shape and type. The supported
  29. types are:
  30. * float16, float32, double, int32, uint8, int16, int8, complex64, int64,
  31. * qint8, quint8, qint32, uint16, complex128, uint32, uint64. \n
  32. *@par Outputs:
  33. *y: A Tensor. Has the same shape and type as the elements of "x". \n
  34. *@par Third-party framework compatibility
  35. *Compatible with the TensorFlow operator AddN.
  36. */
  37. REG_OP(AddN)
  38. .DYNAMIC_INPUT(x, TensorType::NumberType())
  39. .OUTPUT(y, TensorType::NumberType())
  40. .REQUIRED_ATTR(N, Int)
  41. .OP_END_FACTORY_REG(AddN)
  42. /**
  43. *@brief Calculates the reversed outputs of the function "maximum"
  44. *@par Inputs:
  45. *Three inputs, including:
  46. * @li grads: A mutable Tensor. Must be one of the following types:
  47. * float16, float32, int32.
  48. * @li x1: A mutable Tensor of the same type as "grads".
  49. * @li x2: A mutable Tensor of the same type as "grads". \n
  50. *@par Attributes:
  51. *@li grad_x: An optional bool. Defaults to "True".
  52. * If "True", "y1" will be output.
  53. * If "False", "y1" will not be output. \n
  54. *@li grad_y: An optional bool. Defaults to "True".
  55. * If "True", "y2" will be output.
  56. * If "False", "y2" will not be output. \n
  57. *@par Outputs:
  58. * @li y1: A mutable Tensor. Has the same type as "grads".
  59. * @li y2: A mutable Tensor. Has the same type as "grads". \n
  60. *@par Third-party framework compatibility
  61. * Compatible with the TensorFlow operator MaximumGrad.
  62. */
  63. REG_OP(MaximumGrad)
  64. .INPUT(grads, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  65. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  66. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  67. .OUTPUT(y1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  68. .OUTPUT(y2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  69. .ATTR(grad_x, Bool, true)
  70. .ATTR(grad_y, Bool, true)
  71. .OP_END_FACTORY_REG(MaximumGrad)
  72. /**
  73. *@brief Calculates the reversed outputs of the function "minimum"
  74. *@par Inputs:
  75. *Three inputs, including:
  76. * @li grads: A mutable Tensor. Must be one of the following types:
  77. * float16, float32, int32.
  78. * @li x1: A mutable Tensor of the same type as "grads".
  79. * @li x2: A mutable Tensor of the same type as "grads". \n
  80. *@par Attributes:
  81. *@li grad_x: An optional bool. Defaults to "True".
  82. * If "True", "y1" will be output.
  83. * If "False", "y1" will not be output. \n
  84. *@li grad_y: An optional bool. Defaults to "True".
  85. * If "True", "y2" will be output.
  86. * If "False", "y2" will not be output. \n
  87. *@par Outputs:
  88. * @li y1: A mutable Tensor. Has the same type as "grads".
  89. * @li y2: A mutable Tensor. Has the same type as "grads". \n
  90. *@par Third-party framework compatibility
  91. * Compatible with the TensorFlow operator MinimumGrad.
  92. */
  93. REG_OP(MinimumGrad)
  94. .INPUT(grads, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  95. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  96. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  97. .OUTPUT(y1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  98. .OUTPUT(y2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  99. .ATTR(grad_x, Bool, true)
  100. .ATTR(grad_y, Bool, true)
  101. .OP_END_FACTORY_REG(MinimumGrad)
  102. /**
  103. *@brief Cast a tensor form src data type to dst data type. \n
  104. *@par Inputs:
  105. *One input:
  106. *x:A Tensor. Must be one of the following types: bool, float16, float, int8,
  107. int32, uint32, uint8,
  108. int64, uint64, int16, uint16, double, complex64, complex128, qint8, quint8, qint16, quint16, qint32. \n
  109. *@par Attributes:
  110. *dst_type: An required attribute of type int32, specifying the dst data type. \n
  111. *@par Outputs:
  112. *y:A Tensor. Has the same type as x.
  113. */
  114. REG_OP(Cast)
  115. .INPUT(x, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8,
  116. DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64,
  117. DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32}))
  118. .OUTPUT(y, TensorType({DT_BOOL, DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT32, DT_UINT8,
  119. DT_INT64, DT_UINT64, DT_INT16, DT_UINT16, DT_DOUBLE, DT_COMPLEX64,
  120. DT_COMPLEX128, DT_QINT8, DT_QUINT8, DT_QINT16, DT_QUINT16, DT_QINT32}))
  121. .REQUIRED_ATTR(dst_type, Int)
  122. .OP_END_FACTORY_REG(Cast)
  123. /**
  124. *@brief Returns the truth value of (x1 >= x2) element-wise. \n
  125. *@par Inputs:
  126. *Two inputs, including:
  127. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  128. * double, int32, int8, uint8, int64, uint16, uint32, uint64.
  129. * @li x2: A Tensor of the same type as "x1". \n
  130. *@par Outputs:
  131. *y: A Tensor. Has the same type as "x1". \n
  132. *@par Third-party framework compatibility:
  133. * Compatible with the TensorFlow operator GreaterEqual.
  134. */
  135. REG_OP(GreaterEqual)
  136. .INPUT(x1, TensorType::RealNumberType())
  137. .INPUT(x2, TensorType::RealNumberType())
  138. .OUTPUT(y, TensorType({DT_BOOL}))
  139. .OP_END_FACTORY_REG(GreaterEqual)
  140. /**
  141. *@brief Returns the truth value of (x1 < x2) element-wise. \n
  142. *@par Inputs:
  143. *Two inputs, including:
  144. * @li x1: A Tensor. Must be one of the following types: float16, float32, double, int32,
  145. * uint8, int16, int8, int64, uint16, uint32, uint64.
  146. * @li x2: A Tensor with the same type as "x1". \n
  147. *@par Outputs:
  148. *y: A Tensor of type bool. \n
  149. *@par Third-party framework compatibility:
  150. * Compatible with TensorFlow operator Less.
  151. */
  152. REG_OP(Less)
  153. .INPUT(x1, TensorType::RealNumberType())
  154. .INPUT(x2, TensorType::RealNumberType())
  155. .OUTPUT(y, TensorType({DT_BOOL}))
  156. .OP_END_FACTORY_REG(Less)
  157. /**
  158. *@brief Returns x1/x2 element-wise for real types. \n
  159. *@par Inputs:
  160. * Two inputs, including:
  161. *@li x1: A Tensor. Must be one of the following types: float16, float32, double, uint16,
  162. int8, uint8, int16, int32, int64, complex64, DT_COMPLEX128.
  163. *@li x2: A Tensor. Must be one of the following types: float16, float32, double, uint16,
  164. int8, uint8, int16, int32, int64, complex64, DT_COMPLEX128. \n
  165. *@par Outputs:
  166. * y: A Tensor. Has the same type and format as input "x1". \n
  167. *@par Third-party framework compatibility
  168. * Compatible with the TensorFlow operator RealDiv.
  169. */
  170. REG_OP(RealDiv)
  171. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_UINT8, DT_INT8,
  172. DT_UINT16, DT_INT16, DT_INT32, DT_INT64,
  173. DT_COMPLEX64, DT_COMPLEX128}))
  174. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8,
  175. DT_UINT16, DT_INT16, DT_INT32, DT_INT64,
  176. DT_COMPLEX64, DT_COMPLEX128}))
  177. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8,
  178. DT_UINT16, DT_INT16, DT_INT32, DT_INT64,
  179. DT_COMPLEX64, DT_COMPLEX128}))
  180. .OP_END_FACTORY_REG(RealDiv)
  181. /**
  182. *@brief Computes square root of x element-wise. \n
  183. *@par Inputs:
  184. * x: A Tensor. Must be one of the following types: float16, float32, complex128, complex64, float64. \n
  185. *@par Outputs:
  186. *y: A Tensor. Has the same type as "x".
  187. *@par Third-party framework compatibility
  188. *Compatible with the TensorFlow operator Sqrt.
  189. */
  190. REG_OP(Sqrt)
  191. .INPUT(x, TensorType{(DT_FLOAT. DT_FLOAT16, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128)})
  192. .OUTPUT(y, TensorType{(DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128)})
  193. .OP_END_FACTORY_REG(Sqrt)
  194. /**
  195. *@brief Returns the max of "x" and "y" (i.e. x > y ? x: y) element-wise. \n
  196. *@par Inputs:
  197. *Two inputs, including:
  198. * @li x1: A Tensor. Must be one of the following types: float16, float32, double, int32, int64.
  199. * @li x2: A Tensor of the same type as "x1". \n
  200. *@par Outputs:
  201. *y: A Tensor. Has the same type as "x1". \n
  202. *@par Third-party framework compatibility
  203. *Compatible with the TensorFlow operator Maximum.
  204. */
  205. REG_OP(Maximum)
  206. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  207. DT_INT64}))
  208. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  209. DT_INT64}))
  210. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  211. DT_INT64}))
  212. .OP_END_FACTORY_REG(Maximum)
  213. /**
  214. *@brief Returns the min of x and y (i.e. x1 < x2 ? x1 : x2) element-wise. \n
  215. *@par Inputs:
  216. *Two inputs, include:
  217. * @li x1: A Tensor. Must be one of the following types: float32, float16, double, int32, int64.
  218. * @li x2: A Tensor of the same type as "x1". \n
  219. *@par Outputs:
  220. *y: A Tensor of the same type as "x1". \n
  221. *@par Third-party framework compatibility:
  222. * Compatible with the TensorFlow operator Minimum.
  223. */
  224. REG_OP(Minimum)
  225. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_INT32,
  226. DT_INT64}))
  227. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_INT32,
  228. DT_INT64}))
  229. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_INT32,
  230. DT_INT64}))
  231. .OP_END_FACTORY_REG(Minimum)
  232. /**
  233. *@brief: Computes the reciprocal of "x". \n
  234. *@par Inputs:
  235. *One inputs, include:
  236. *x:A Tensor of type float16, float32, int32, int64, double,
  237. * complex64, complex128.the format can be [NCHW,NC1HWC0,NHWC,ND,NCHW,NC1HWC0,NHWC,ND]
  238. *@par Outputs:
  239. *y:A Tensor with same type as "x". \n
  240. *@par Third-party framework compatibility
  241. *Compatible with the TensorFlow operator Reciprocal.
  242. */
  243. REG_OP(Reciprocal)
  244. .INPUT(x, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_FLOAT16,
  245. DT_COMPLEX64, DT_COMPLEX128}))
  246. .OUTPUT(y, TensorType({DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_FLOAT16
  247. DT_COMPLEX64, DT_COMPLEX128}))
  248. .OP_END_FACTORY_REG(Reciprocal)
  249. /**
  250. *@brief Returns x - y element-wise.
  251. *@par Inputs:
  252. *Two inputs, including:
  253. * @li x1: A Tensor. Must be one of the following types: int8, int16, int32, int64, uint8, float64,
  254. * float16, float32, complex128, complex64, uint16.
  255. * @li x2: A Tensor of the same type as "x1". \n
  256. *@par Outputs:
  257. *y: A Tensor. Has the same type as "x".
  258. *@par Third-party framework compatibility
  259. *Compatible with the TensorFlow operator Subtract.
  260. */
  261. REG_OP(Sub)
  262. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_UINT8, DT_INT8,
  263. DT_UINT16, DT_INT16, DT_INT32, DT_INT64,
  264. DT_COMPLEX64, DT_COMPLEX128}))
  265. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_UINT8, DT_INT8,
  266. DT_UINT16, DT_INT16, DT_INT32, DT_INT64,
  267. DT_COMPLEX64, DT_COMPLEX128}))
  268. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_UINT8, DT_INT8,
  269. DT_UINT16, DT_INT16, DT_INT32, DT_INT64,
  270. DT_COMPLEX64, DT_COMPLEX128}))
  271. .OP_END_FACTORY_REG(Sub)
  272. /**
  273. *@brief computes the absolute value of a tensor. \n
  274. *@par Inputs:
  275. *One inputs, including:
  276. * @li x: A Tensor. Must be one of the following types: float16, float32, double, int32, int64. \n
  277. *@par Outputs:
  278. *y: A Tensor. Has the same type as "x". \n
  279. *@par Third-party framework compatibility
  280. *Compatible with the TensorFlow operator Abs.
  281. */
  282. REG_OP(Abs)
  283. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64}))
  284. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64}))
  285. .OP_END_FACTORY_REG(Abs)
  286. /**
  287. *@brief Computes gradients for absolute operation. \n
  288. *
  289. *@par Inputs:
  290. *@li y: A tensor of type float16 or float32.
  291. *@li dy: A tensor of the same type as "y".
  292. *
  293. *@attention Constraints:
  294. * "dy" has the same type as "y".
  295. *
  296. *@par Outputs:
  297. * z: A tensor. Has the same type as "y".
  298. *
  299. *@par Third-party framework compatibility
  300. *Compatible with the TensorFlow operator AbsGrad.
  301. *
  302. */
  303. REG_OP(AbsGrad)
  304. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  305. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  306. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  307. .OP_END_FACTORY_REG(AbsGrad)
  308. /**
  309. *@brief: Computes the sign of "x". \n
  310. *@par Inputs:
  311. *x:An ND Tensor of type float16, float32, int32, int64, double,
  312. * complex64, complex128. \n
  313. *@par Outputs:
  314. *y:An ND Tensor with same type as "x". \n
  315. *@par Third-party framework compatibility
  316. *Compatible with the TensorFlow operator Sign.
  317. */
  318. REG_OP(Sign)
  319. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT, DT_DOUBLE, DT_INT32,
  320. DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  321. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  322. DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  323. .OP_END_FACTORY_REG(Sign)
  324. /**
  325. *@brief Returns (x1 - x2)(x1 - x2) element-wise. \n
  326. *@par Inputs:
  327. *Two inputs, including: \n
  328. *@li x1: A Tensor. Must be one of the following types: float16, float32,
  329. float64, int32, int64, complex64,complex128
  330. *@li x2: A Tensor. Has the same type as "x1". \n
  331. *@par Outputs:
  332. *y: A Tensor. Has the same type as "x1". \n
  333. *@par Third-party framework compatibility
  334. * Compatible with TensorFlow operator SquaredDifference.
  335. */
  336. REG_OP(SquaredDifference)
  337. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  338. DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  339. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  340. DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  341. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32,
  342. DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  343. .OP_END_FACTORY_REG(SquaredDifference)
  344. /**
  345. *@brief Computes cosine of "x" element-wise. \n
  346. *@par Inputs:
  347. *x: A Tensor of type float16, float32, double, complex64, complex128.
  348. * the format can be [NCHW,NC1HWC0,NHWC,ND]
  349. *@par Outputs:
  350. *y: A Tensor of the same type as "x". \n
  351. *@par Third-party framework compatibility
  352. * Compatible with the TensorFlow operator Cos. \n
  353. */
  354. REG_OP(Cos)
  355. .INPUT(x, TensorType::UnaryDataType())
  356. .OUTPUT(y, TensorType::UnaryDataType())
  357. .OP_END_FACTORY_REG(Cos)
  358. /**
  359. *@brief Returns x1/x2 element-wise. \n
  360. *@par Inputs:
  361. * Two inputs, including:
  362. *@li x1: A Tensor. Must be one of the following types:
  363. * float16, float32, int32, int8, uint8, float64, int64, uint16, int16,
  364. * complex64, complex128, the format can be [NCHW,NC1HWC0,NHWC,ND].
  365. *@li x2: A Tensor. Has the same type and format as input "x1". \n
  366. *@par Outputs:
  367. * y: A Tensor. Has the same type and format as input "x1". \n
  368. *@par Third-party framework compatibility
  369. * Compatible with the TensorFlow operator Div.
  370. */
  371. REG_OP(Div)
  372. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT32,
  373. DT_DOUBLE, DT_INT64, DT_UINT16, DT_INT16,
  374. DT_COMPLEX64, DT_COMPLEX128}))
  375. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT32,
  376. DT_DOUBLE, DT_INT64, DT_UINT16, DT_INT16,
  377. DT_COMPLEX64, DT_COMPLEX128}))
  378. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT32,
  379. DT_DOUBLE, DT_INT64, DT_UINT16, DT_INT16,
  380. DT_COMPLEX64, DT_COMPLEX128}))
  381. .OP_END_FACTORY_REG(Div)
  382. /**
  383. *@brief: Returns the truth value of (x = y) element-wise. \n
  384. *@par Inputs:
  385. * Two inputs, including:
  386. *@li x1: A Tensor. Must be one of the following types:
  387. * float16, float32, int32, int8, uint8, double, int16, int64, complex64,
  388. * complex128, quint8, qint8, qint32, string, bool. the format can be
  389. * [NCHW, NC1HWC0, NHWC, ND]
  390. *@li x2: A Tensor of the same type and format as "x1". \n
  391. *@par Outputs:
  392. *y: A Tensor of type bool. \n
  393. *@par Third-party framework compatibility
  394. * Compatible with the TensorFlow operator Equal.
  395. */
  396. REG_OP(Equal)
  397. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8, DT_UINT8,
  398. DT_DOUBLE, DT_INT16, DT_INT64, DT_COMPLEX64,
  399. DT_COMPLEX128, DT_QUINT8, DT_QINT8, DT_QINT32,
  400. DT_STRING, DT_BOOL}))
  401. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8, DT_UINT8,
  402. DT_DOUBLE, DT_INT16, DT_INT64, DT_COMPLEX64,
  403. DT_COMPLEX128, DT_QUINT8, DT_QINT8, DT_QINT32,
  404. DT_STRING, DT_BOOL}))
  405. .OUTPUT(y, TensorType({DT_BOOL}))
  406. .OP_END_FACTORY_REG(Equal)
  407. /**
  408. *@brief Computes the exponential of "x" element-wise. \n
  409. *@par Inputs:
  410. *One input:\n
  411. *x: A Tensor. Must be one of the following types: float16, float32, double,
  412. complex64, complex128. \n
  413. *@par Attributes:
  414. *@li base: An optional attribute of type float32, specifying the base gamma.
  415. Defaults to "-1.0".
  416. *@li scale: An optional attribute of type float32, specifying the scale alpha.
  417. Defaults to "1.0".
  418. *@li shift: An optional attribute of type float32, specifying the shift beta.
  419. Defaults to "0.0". \n
  420. *@par Outputs:
  421. *y: A Tensor of the same type as "x". \n
  422. *@par Third-party framework compatibility
  423. * Compatible with TensorFlow operator Exp.
  424. */
  425. REG_OP(Exp)
  426. .INPUT(x, TensorType::UnaryDataType())
  427. .OUTPUT(y, TensorType::UnaryDataType())
  428. .ATTR(base, Float, -1.0)
  429. .ATTR(scale, Float, 1.0)
  430. .ATTR(shift, Float, 0.0)
  431. .OP_END_FACTORY_REG(Exp)
  432. /**
  433. *@brief Computes the exp(x) - 1 element-wise, y = e^x - 1. \n
  434. *@par Inputs:
  435. *One input:
  436. *x: A Tensor. Must be one of the following types: float16, float32, double,
  437. complex64, complex128. \n
  438. *@par Outputs:
  439. *y: A Tensor of the same type as "x". \n
  440. *@par Third-party framework compatibility
  441. * Compatible with TensorFlow operator Expm1.
  442. */
  443. REG_OP(Expm1)
  444. .INPUT(x, TensorType::UnaryDataType())
  445. .OUTPUT(y, TensorType::UnaryDataType())
  446. .OP_END_FACTORY_REG(Expm1)
  447. /**
  448. *@brief: Computes the reciprocal of "x". \n
  449. *@par Inputs:\n
  450. *x: A Tensor. Must be one of the following types: float16, float32,
  451. int32, int64, double,
  452. complex64, complex128. \n
  453. *@par Outputs:
  454. *y: A Tensor. Has the same type as "x". \n
  455. *@par Third-party framework compatibility
  456. * Compatible with the TensorFlow operator Inv.
  457. */
  458. REG_OP(Inv)
  459. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT,DT_DOUBLE,DT_INT32,DT_INT64,DT_COMPLEX64,DT_COMPLEX128}))
  460. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT,DT_INT32}))
  461. .OP_END_FACTORY_REG(Inv)
  462. /**
  463. *@brief: Computes "x" reciprocal grad, dx = -1*dy*y*y, where, "y = 1/x", and "dy"
  464. is the corresponding input gradient. \n
  465. *@par Inputs:
  466. * Two inputs, including:
  467. * @li x: A Tensor. Must be one of the following types: float16, float32, int32, int8.
  468. * @li grad: A Tensor. Has the same type as "x". \n
  469. *@par Outputs:
  470. *y: A Tensor, Has the same type as "x". \n
  471. *@par Third-party framework compatibility
  472. * Compatible with the TensorFlow operator InvGrad.
  473. */
  474. REG_OP(InvGrad)
  475. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8}))
  476. .INPUT(grad, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8}))
  477. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT8}))
  478. .OP_END_FACTORY_REG(InvGrad)
  479. /**
  480. *@brief: Returns the truth value of (x <= y) element-wise. \n
  481. *@par Inputs:
  482. * Two inputs, including:
  483. *@li x1: A Tensor. Must be one of the following types: float32, float64,
  484. * int32, uint8, int16, int8, int64, qint8, quint8, qint32, uint16,
  485. * float16, uint32, uint64.
  486. *@li x2: A Tensor of the same type as "x1". \n
  487. *@par Outputs:
  488. *y: A Tensor of type bool. \n
  489. *@par Third-party framework compatibility
  490. * Compatible with the TensorFlow operator LessEqual.
  491. */
  492. REG_OP(LessEqual)
  493. .INPUT(x1, TensorType::RealNumberType())
  494. .INPUT(x2, TensorType::RealNumberType())
  495. .OUTPUT(y, TensorType({DT_BOOL}))
  496. .OP_END_FACTORY_REG(LessEqual)
  497. /**
  498. *@brief Computes the logarithm of (x + 1) element-wise, y = ln(x + 1). \n
  499. *@par Inputs:
  500. *One input:\n
  501. *x: A Tensor. Must be one of the following types: float16, float32, double, complex64, complex128. \n
  502. *@par Outputs:
  503. *y: A Tensor of the same type as "x". \n
  504. *@par Third-party framework compatibility
  505. * Compatible with TensorFlow operator Log1p.
  506. */
  507. REG_OP(Log1p)
  508. .INPUT(x, TensorType::UnaryDataType())
  509. .OUTPUT(y, TensorType::UnaryDataType())
  510. .OP_END_FACTORY_REG(Log1p)
  511. /**
  512. *@brief Returns element-wise remainder of division.
  513. *@par Inputs:
  514. *Two inputs, including:
  515. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  516. * int32, int64, int8, uint8, double.
  517. * @li x2: A Tensor of the same type as "x1". \n
  518. *@par Outputs:
  519. *y: A Tensor. Has the same type as "x1".
  520. *@par Third-party framework compatibility
  521. *Compatible with the TensorFlow operator Mod.
  522. */
  523. REG_OP(Mod)
  524. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8,
  525. DT_INT64, DT_DOUBLE}))
  526. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8,
  527. DT_INT64, DT_DOUBLE}))
  528. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8,
  529. DT_INT64, DT_DOUBLE}))
  530. .OP_END_FACTORY_REG(Mod)
  531. /**
  532. *@brief: Returns the truth value of (x != y) element-wise. \n
  533. *@par Inputs:
  534. * Two inputs, including:
  535. *@li x1: A Tensor. Must be one of the following types: float16, float32, int32,
  536. * int8, uint8, double, int16, int64, uint16, half, uint32, uint64
  537. *@li x2: A Tensor of the same type as "x1". \n
  538. *@par Outputs:
  539. *y: A Tensor of type bool. \n
  540. *@par Third-party framework compatibility
  541. * Compatible with the TensorFlow operator NotEqual.
  542. */
  543. REG_OP(NotEqual)
  544. .INPUT(x1, TensorType::RealNumberType())
  545. .INPUT(x2, TensorType::RealNumberType())
  546. .OUTPUT(y, TensorType({DT_BOOL}))
  547. .OP_END_FACTORY_REG(NotEqual)
  548. /**
  549. *@brief Computes numerical negative value element-wise (y = -x)
  550. *@par Inputs:
  551. * One input:
  552. *x: A Tensor. Must be one of the following types: float16, float32, int32,
  553. * int64, complex64, complex128. \n
  554. *@par Outputs:
  555. *y: A Tensor. Has the same type and format as input "x". \n
  556. *@par Third-party framework compatibility
  557. * Compatible with the TensorFlow operator Neg.
  558. */
  559. REG_OP(Neg)
  560. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  561. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  562. .OP_END_FACTORY_REG(Neg)
  563. /**
  564. *@brief Returns x1/x2 element-wise for integer types. \n
  565. *@par Inputs:
  566. *@li x1: A Tensor. Must be one of the following types:
  567. * float32, float64, int32, uint8, int16, int8,
  568. * complex64, int64, qint8, quint8, qint32, uint16,
  569. * complex128, float16, uint32, uint64, complex64, complex128.
  570. *@li x2: A Tensor of the same data type as "x1". \n
  571. *@par Outputs:
  572. *y: A Tensor. Has the same type as "x1".
  573. *@attention Constraints:
  574. * Broadcasting is supported. \n
  575. *@par Third-party framework compatibility
  576. * Compatible with the TensorFlow operator TruncateDiv. \n
  577. */
  578. REG_OP(TruncateDiv)
  579. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT32,
  580. DT_DOUBLE, DT_UINT16, DT_INT16, DT_INT64,
  581. DT_COMPLEX64, DT_COMPLEX128}))
  582. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT32,
  583. DT_DOUBLE, DT_UINT16, DT_INT16, DT_INT64,
  584. DT_COMPLEX64, DT_COMPLEX128}))
  585. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT8, DT_UINT8, DT_INT32,
  586. DT_DOUBLE, DT_UINT16, DT_INT16, DT_INT64,
  587. DT_COMPLEX64, DT_COMPLEX128}))
  588. .OP_END_FACTORY_REG(TruncateDiv)
  589. /**
  590. *@brief Computes x1/x2 element-wise, if x1 == 0, return 0.
  591. *@par Inputs:
  592. * Two inputs, including:
  593. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  594. * double, complex64, complex128.
  595. * @li x2: A Tensor. Has the same type as "x1". \n
  596. *@par Outputs:
  597. *y: A Tensor. Has the same type as "x1". \n
  598. *@par Third-party framework compatibility
  599. * Compatible with TensorFlow operator Xdivy.
  600. */
  601. REG_OP(Xdivy)
  602. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64,
  603. DT_COMPLEX128}))
  604. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64,
  605. DT_COMPLEX128}))
  606. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64,
  607. DT_COMPLEX128}))
  608. .OP_END_FACTORY_REG(Xdivy)
  609. /**
  610. *@brief Computes "x" multiplied by the logarithm of y element-wise,
  611. * if "x" == 0, return "0". \n
  612. *@par Inputs:
  613. * Two inputs, including:
  614. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  615. * double, complex64, complex128.
  616. * @li x2: A Tensor. Has the same type as "x1". \n
  617. *@par Outputs:
  618. *y: A Tensor. Has the same type as "x1". \n
  619. *@par Third-party framework compatibility
  620. * Compatible with TensorFlow operator Xlogy.
  621. */
  622. REG_OP(Xlogy)
  623. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64,
  624. DT_COMPLEX128}))
  625. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64,
  626. DT_COMPLEX128}))
  627. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64,
  628. DT_COMPLEX128}))
  629. .OP_END_FACTORY_REG(Xlogy)
  630. /**
  631. *@brief Computes square of "x" element-wise. \n
  632. *@par Inputs:
  633. *One input: \n
  634. *x: A Tensor. Must be one of the following types: float16, float32, float64,
  635. int32, int64, complex64, complex128
  636. *@par Outputs:
  637. *y: A Tensor. Has the same type as "x". \n
  638. *@par Third-party framework compatibility
  639. * Compatible with TensorFlow operator Square.
  640. */
  641. REG_OP(Square)
  642. .INPUT(x, TensorType({DT_DOUBLE, DT_FLOAT16, DT_FLOAT,
  643. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  644. .OUTPUT(y, TensorType({DT_DOUBLE, DT_FLOAT16, DT_FLOAT,
  645. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  646. .OP_END_FACTORY_REG(Square)
  647. /**
  648. *@brief Computes reciprocal of square root of "x" element-wise: y = 1/sqrt{x}. \n
  649. *
  650. *@par Inputs:
  651. * x: An ND or 5HD tensor. Must be one of the following types: float, double, half,
  652. * complex64, complex128.
  653. *
  654. *@par Outputs:
  655. * y: An ND or 5HD tensor. Has the same type as "x".
  656. *
  657. *@par Third-party framework compatibility
  658. *Compatible with the TensorFlow operator Rsqrt.
  659. *
  660. */
  661. REG_OP(Rsqrt)
  662. .INPUT(x, TensorType::UnaryDataType())
  663. .OUTPUT(y, TensorType::UnaryDataType())
  664. .OP_END_FACTORY_REG(Rsqrt)
  665. /**
  666. *@brief Computes the trignometric inverse sine of "x" element-wise. \n
  667. *
  668. *@par Inputs:
  669. * x: A tensor. Must be one of the following types: float16, float32, float64,
  670. int32, int64, complex64, complex128.
  671. *
  672. *@par Outputs:
  673. * y: A tensor. Has the same type as "x".
  674. *
  675. *@par Third-party framework compatibility
  676. *Compatible with the TensorFlow operator Asin.
  677. *
  678. */
  679. REG_OP(Asin)
  680. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  681. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  682. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  683. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  684. .OP_END_FACTORY_REG(Asin)
  685. /**
  686. *@brief Computes gradients for Asin operation. \n
  687. *
  688. *@par Inputs:
  689. *@li y: A tensor of type float16, float32, float64,
  690. int32, int64, complex64, complex128.
  691. *@li dy: A tensor of the same type as "y".
  692. *
  693. *@attention Constraints:
  694. * "dy" has the same type as "y".
  695. *
  696. *@par Outputs:
  697. * z: A tensor. Has the same type as "y".
  698. *
  699. *@par Third-party framework compatibility
  700. *Compatible with the TensorFlow operator AsinGrad.
  701. *
  702. */
  703. REG_OP(AsinGrad)
  704. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  705. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  706. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  707. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  708. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  709. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  710. .OP_END_FACTORY_REG(AsinGrad)
  711. /**
  712. *@brief Computes acos of x element-wise. \n
  713. *
  714. *@par Inputs:
  715. * x: A tensor. Must be one of the following types: float16, float32, float64,
  716. int32, int64, complex64, complex128.
  717. *
  718. *@par Outputs:
  719. * y: A tensor. Has the same type as "x".
  720. *
  721. *@par Third-party framework compatibility
  722. *Compatible with the TensorFlow operator Acos.
  723. *
  724. */
  725. REG_OP(Acos)
  726. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  727. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  728. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE,
  729. DT_INT32, DT_INT64, DT_COMPLEX64, DT_COMPLEX128}))
  730. .OP_END_FACTORY_REG(Acos)
  731. /**
  732. *@brief Computes gradients for Acos operation. \n
  733. *
  734. *@par Inputs:
  735. *@li y: A tensor of type float16 or float32.
  736. *@li dy: A tensor of the same type as "y".
  737. *
  738. *@attention Constraints:
  739. * "dy" has the same shape as "y".
  740. *
  741. *@par Outputs:
  742. * z: A tensor. Has the same type as "y".
  743. *
  744. *@par Third-party framework compatibility
  745. *Compatible with the TensorFlow operator AcosGrad.
  746. *
  747. */
  748. REG_OP(AcosGrad)
  749. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  750. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  751. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  752. .OP_END_FACTORY_REG(AcosGrad)
  753. /**
  754. *@brief Computes inverse hyperbolic cosine of x element-wise. \n
  755. *
  756. *@par Inputs:
  757. * x: A tensor. Must be one of the following types: float16, float32, float64,
  758. complex64, complex128.
  759. *
  760. *@attention Constraints:
  761. * x Given an input tensor, the function computes inverse hyperbolic cosine of every element.\n
  762. * Input range is [1, inf].
  763. *
  764. *@par Outputs:
  765. * y: A tensor. Has the same type as "x".
  766. *
  767. *@par Third-party framework compatibility
  768. *Compatible with the TensorFlow operator Acosh.
  769. *
  770. */
  771. REG_OP(Acosh)
  772. .INPUT(x, TensorType::UnaryDataType())
  773. .OUTPUT(y, TensorType::UnaryDataType())
  774. .OP_END_FACTORY_REG(Acosh)
  775. /**
  776. *@brief Computes gradients for Acosh operation. \n
  777. *
  778. *@par Inputs:
  779. *@li y: A tensor of type float16 or float32.
  780. *@li dy: A tensor of the same type as "y".
  781. *
  782. *@attention Constraints:
  783. * "dy" has the same type as "y".
  784. *
  785. *@par Outputs:
  786. * z: A tensor. Has the same type as "y".
  787. *
  788. *@par Third-party framework compatibility
  789. *Compatible with the TensorFlow operator AcoshGrad.
  790. *
  791. */
  792. REG_OP(AcoshGrad)
  793. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  794. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  795. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  796. .OP_END_FACTORY_REG(AcoshGrad)
  797. /**
  798. *@brief Returns the truth value of x1 OR x2 element-wise. \n
  799. *
  800. *@par Inputs:
  801. *@li x1: A tensor of type bool.
  802. *@li x2: A tensor of the same type as "x1".
  803. *
  804. *@attention Constraints:
  805. * LogicalOr supports broadcasting.
  806. *
  807. *@par Outputs:
  808. * y: A tensor of the same type as "x1".
  809. *
  810. *@par Third-party framework compatibility
  811. *Compatible with the TensorFlow operator LogicalOr.
  812. *
  813. */
  814. REG_OP(LogicalOr)
  815. .INPUT(x1, TensorType({DT_BOOL}))
  816. .INPUT(x2, TensorType({DT_BOOL}))
  817. .OUTPUT(y, TensorType({DT_BOOL}))
  818. .OP_END_FACTORY_REG(LogicalOr)
  819. /**
  820. *@brief Returns the truth value of x1 AND x2 element-wise. \n
  821. *
  822. *@par Inputs:
  823. *@li x1: A tensor of type bool.
  824. *@li x2: A tensor of the same type as "x1".
  825. *
  826. *@attention Constraints:
  827. * LogicalAnd supports broadcasting.
  828. *
  829. *@par Outputs:
  830. * y: A tensor of the same type as "x1".
  831. *
  832. *@par Third-party framework compatibility
  833. *Compatible with the TensorFlow operator LogicalAnd.
  834. *
  835. */
  836. REG_OP(LogicalAnd)
  837. .INPUT(x1, TensorType({DT_BOOL}))
  838. .INPUT(x2, TensorType({DT_BOOL}))
  839. .OUTPUT(y, TensorType({DT_BOOL}))
  840. .OP_END_FACTORY_REG(LogicalAnd)
  841. /**
  842. *@brief Computes the Bessel i0e function of "x" element-wise.
  843. * Exponentially scaled modified Bessel function of order 0
  844. * defined as: bessel_i0e(x) = exp(-abs(x)) bessel_i0(x).
  845. * This function is faster and numerically stabler than "bessel_i0(x)".
  846. *
  847. *@par Inputs:
  848. * x: A tensor of type float16, float32, or float64.
  849. *
  850. *@par Outputs:
  851. * y: A tensor. Has the same type as "x".
  852. *
  853. *@par Third-party framework compatibility
  854. *Compatible with the TensorFlow operator BesselI0e.
  855. *
  856. */
  857. REG_OP(BesselI0e)
  858. .INPUT(x, TensorType::FloatingDataType())
  859. .OUTPUT(y, TensorType::FloatingDataType())
  860. .OP_END_FACTORY_REG(BesselI0e)
  861. /**
  862. *@brief Computes the Bessel i1e function of "x" element-wise.
  863. * Exponentially scaled modified Bessel function of order 0
  864. * defined as: bessel_i1e(x) = exp(-abs(x)) bessel_i1(x).
  865. * This function is faster and numerically stabler than "bessel_i1(x)".
  866. *
  867. *@par Inputs:
  868. * x: A tensor of type float16, float32, or float64.
  869. *
  870. *@par Outputs:
  871. * y: A tensor. Has the same type as "x".
  872. *
  873. *@par Third-party framework compatibility
  874. *Compatible with the TensorFlow operator BesselI1e.
  875. *
  876. */
  877. REG_OP(BesselI1e)
  878. .INPUT(x, TensorType::FloatingDataType())
  879. .OUTPUT(y, TensorType::FloatingDataType())
  880. .OP_END_FACTORY_REG(BesselI1e)
  881. /**
  882. * @brief Computes logarithm of x element-wise.
  883. * y = log_base(shift + scale * x), with "base" > 0. \n
  884. * @par Inputs:
  885. * @li x: A Tensor of type complex64, complex128, float16, float32 or double. \n
  886. * @par Attributes:
  887. * @li base: An optional float32, specifying the base "e". Defaults to "-1.0"
  888. * @li scale: An optional float32, specifying the scale of input "x". Defaults
  889. * to "1.0"
  890. * @li shift: An optional float32, specifying the shift. Defaults to "0.0"
  891. * @par Outputs:
  892. * y: A Tensor has same type as "x". \n
  893. * @attention Constraints:
  894. * @li "base" is supposed to be greater than 0. Retaining the default
  895. * value "-1" sets "base" to "e".
  896. * @li If the input value of operator Log is within the range (0, 0.01] or
  897. * [0.95, 1.05], the output accuracy is subject to change. \n
  898. * @par Third-party framework compatibility
  899. * @li Compatible with the TensorFlow operator Log.
  900. * @li Compatible with the Caffe operator Log.
  901. */
  902. REG_OP(Log)
  903. .INPUT(x, TensorType::UnaryDataType())
  904. .OUTPUT(y, TensorType::UnaryDataType())
  905. .ATTR(base, Float, -1.0)
  906. .ATTR(scale, Float, 1.0)
  907. .ATTR(shift, Float, 0.0)
  908. .OP_END_FACTORY_REG(Log)
  909. /**
  910. * @brief Returns x1 * x2 element-wise.
  911. * y = x1 * x2
  912. * @par Inputs:
  913. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  914. * float64, uint8, int8, uint16, int16, int32, int64, complex64, complex128.
  915. * @li x2: A Tensor. Must be one of the following types: float16, float32,
  916. * float64, uint8, int8, uint16, int16, int32, int64, complex64, complex128. \n
  917. * @par Outputs:
  918. * y: A Tensor. Must be one of the following types: float16, float32, float64,
  919. * uint8, int8, uint16, int16, int32, int64, complex64, complex128. \n
  920. * @attention Constraints:
  921. * @li "x1" and "x2" have incompatible shapes or types. \n
  922. * @par Third-party framework compatibility
  923. * Compatible with the TensorFlow operator Multiply.
  924. */
  925. REG_OP(Mul)
  926. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8,
  927. DI_UINT16, DT_INT16, DT_INT32, DT_INT64,
  928. DT_COMPLEX64, DT_COMPLEX128}))
  929. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8,
  930. DI_UINT16, DT_INT16, DT_INT32, DT_INT64,
  931. DT_COMPLEX64, DT_COMPLEX128}))
  932. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_UINT8, DT_INT8,
  933. DI_UINT16, DT_INT16, DT_INT32, DT_INT64,
  934. DT_COMPLEX64, DT_COMPLEX128}))
  935. .OP_END_FACTORY_REG(Mul)
  936. /**
  937. * @brief Computes the gradient of the square root of "x" with regard to its
  938. * input. grad = dy * 0.5/y, where y = sqrt(x), and "dy" is the corresponding
  939. * input gradient. \n
  940. * @par Inputs:
  941. * Two inputs, including:
  942. * @li y: A Tensor of type float32 or float16.
  943. * @li dy: A Tensor. Has the same type as "y". \n
  944. * @par Outputs:
  945. * z: A Tensor. Has the same type as "y". \n
  946. * @attention Constraints:
  947. * "dy" has the same shape and type as "y".
  948. */
  949. REG_OP(SqrtGrad)
  950. .INPUT(y, TensorType(UnaryDataType))
  951. .INPUT(dy, TensorType(UnaryDataType))
  952. .OUTPUT(z, TensorType(UnaryDataType))
  953. .OP_END_FACTORY_REG(SqrtGrad)
  954. /**
  955. *@brief Returns x + y element-wise.
  956. *@par Inputs:
  957. *Two inputs, including:
  958. * @li x1: A Tensor. Must be one of the following types: int8, int16, int32, int64, uint8, float64,
  959. * float16, float32, complex128, complex64, string.
  960. * @li x2: A Tensor of the same type as "x1". \n
  961. *@par Outputs:
  962. *y: A Tensor. Has the same type as "x".
  963. *@par Third-party framework compatibility
  964. *Compatible with the TensorFlow operator Add.
  965. */
  966. REG_OP(Add)
  967. .INPUT(x1, TensorType({DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_INT16,
  968. DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX128,
  969. DT_COMPLEX64, DT_STRING}))
  970. .INPUT(x2, TensorType({DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_INT16,
  971. DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX128,
  972. DT_COMPLEX64, DT_STRING}))
  973. .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_INT16,
  974. DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX128,
  975. DT_COMPLEX64, DT_STRING}))
  976. .OP_END_FACTORY_REG(Add)
  977. /**
  978. *@brief Confuse broadcast, add and mul. \n
  979. *@par Inputs:
  980. *Five inputs, including:
  981. * @li x1: A Tensor. Must be one of the following types:int32 float16, float32.
  982. * @li x2: A Tensor of the same type as "x1".
  983. * @li x3: A Tensor of the same type as "x1". \n
  984. *@par Outputs:
  985. *@li y: A Tensor. Has the same type as "x1". \n
  986. *@par Third-party framework compatibility:
  987. * Compatible with the TensorFlow operator LRN.
  988. *@par Restrictions:
  989. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  990. */
  991. REG_OP(FusedMulAdd)
  992. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  993. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  994. .INPUT(x3, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  995. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32}))
  996. .OP_END_FACTORY_REG(FusedMulAdd)
  997. /**
  998. *@brief Returns x1 + x2 element-wise. \n
  999. *
  1000. *@par Inputs:
  1001. *@li x1: A tensor. Must be one of the following types: float16, float32, float64,
  1002. uint8, int8, int16, int32, int64, complex64, complex128.
  1003. *@li x2: A tensor of the same type as "x1".
  1004. *
  1005. *@attention Constraints:
  1006. * AddV2 supports broadcasting.
  1007. *
  1008. *@par Outputs:
  1009. * y: A tensor. Has the same type as "x1".
  1010. *
  1011. *@par Third-party framework compatibility
  1012. *Compatible with the TensorFlow operator AddV2.
  1013. *
  1014. */
  1015. REG_OP(AddV2)
  1016. .INPUT(x1, TensorType({DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_INT16,
  1017. DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX64,
  1018. DT_COMPLEX128}))
  1019. .INPUT(x2, TensorType({DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_INT16,
  1020. DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX64,
  1021. DT_COMPLEX128}))
  1022. .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_INT64, DT_FLOAT16, DT_INT16,
  1023. DT_INT8, DT_UINT8, DT_DOUBLE, DT_COMPLEX64,
  1024. DT_COMPLEX128}))
  1025. .OP_END_FACTORY_REG(AddV2)
  1026. /**
  1027. *@brief Updates "ref" by adding "value" to it. \n
  1028. *@par Inputs:
  1029. *@li ref: A Tensor. Must be one of the following types: float16, float32, int8,
  1030. int16, int32, int64, uint8, uint16, uint32, uint64.
  1031. *@li value: A Tensor of the same type as "ref". \n
  1032. *@par Attributes:
  1033. *use_locking: An optional bool. Defaults to "False".
  1034. If "True", the addition will be protected by a lock;
  1035. otherwise the behavior is undefined, but may exhibit less contention.
  1036. * This attribute is reserved. \n
  1037. *@par Outputs:
  1038. *ref: A Tensor that holds the new value of ref after the value has been added. \n
  1039. *@attention Constraints:
  1040. *An input tensor of type int64 must have a shape with size 1. \n
  1041. *@par Third-party framework compatibility
  1042. *Compatible with the TensorFlow operator AssignAdd.
  1043. */
  1044. REG_OP(AssignAdd)
  1045. .INPUT(ref, TensorType::BasicType())
  1046. .INPUT(value,TensorType::BasicType())
  1047. .OUTPUT(ref, TensorType::BasicType())
  1048. .ATTR(use_locking, Bool, false)
  1049. .OP_END_FACTORY_REG(AssignAdd)
  1050. /**
  1051. *@brief Updates "ref" by assigning "value" to it. \n
  1052. *@par Inputs:
  1053. *@li ref: A Tensor. Must be one of the following types: float16, float32, int8, int16,
  1054. int32, int64, uint8, uint16, uint32, uint64.
  1055. *@li value: A Tensor of the same type as "ref". \n
  1056. *@par Attributes:
  1057. *@li validate_shape: An optional bool. Defaults to "true".
  1058. If "true", the operation will validate that the shape of "value"
  1059. matches the shape of the Tensor being assigned to.
  1060. * If "false", "ref" will take on the shape of "value".
  1061. * This attribute is reserved.
  1062. *@li use_locking: An optional bool. Defaults to True.
  1063. If True, the assignment will be protected by a lock;
  1064. otherwise the behavior is undefined, but may exhibit less contention.
  1065. * This attribute is reserved. \n
  1066. *@par Outputs:
  1067. *ref: A Tensor that holds the new value of ref after the value has been assigned. \n
  1068. *@par Third-party framework compatibility
  1069. *Compatible with the TensorFlow operator Assign.
  1070. */
  1071. REG_OP(Assign)
  1072. .INPUT(ref, TensorType::BasicType())
  1073. .INPUT(value,TensorType::BasicType())
  1074. .OUTPUT(ref, TensorType::BasicType())
  1075. .ATTR(validate_shape, Bool, true)
  1076. .ATTR(use_locking, Bool, false)
  1077. .OP_END_FACTORY_REG(Assign)
  1078. /**
  1079. *@brief Updates "var" by subtracting "value" from it.\n
  1080. * This operation outputs "var" after the update is done. \n
  1081. * This makes it easier to chain operations that need to use the reset value. \n
  1082. *
  1083. *@par Inputs:
  1084. *@li var: A tensor. Must be one of the following types: float32, float64,
  1085. int32, uint8, int16, int8, complex64, int64, qint8, quint8, qint32, uint16, complex128, uint32, uint64
  1086. *@li value: A tensor of the same type as "var".
  1087. *
  1088. *@par Attributes:
  1089. * use_locking: An optional bool. Defaults to "False". If "True", the subtraction will be protected \n
  1090. * by a lock; otherwise the behavior is undefined, but may exhibit less contention.
  1091. *
  1092. *@par Outputs:
  1093. * y: A tensor. Has the same type as "var".
  1094. *
  1095. *@par Third-party framework compatibility
  1096. *Compatible with the TensorFlow operator AssignSub.
  1097. *
  1098. */
  1099. REG_OP(AssignSub)
  1100. .INPUT(var, TensorType::NumberType())
  1101. .INPUT(value,TensorType::NumberType())
  1102. .OUTPUT(var, TensorType::NumberType())
  1103. .ATTR(use_locking, Bool, false)
  1104. .OP_END_FACTORY_REG(AssignSub)
  1105. /**
  1106. *@brief: Computes the backpropagation of the square root operation. \n
  1107. *@par Inputs:
  1108. * Two inputs, including:
  1109. *@li y: An NCHW, NC1HWC0, NHWC, ND Tensor. Must be one of the following types: \
  1110. * float, int32, int8, double, complex64, complex128, half.
  1111. *@li dy: A Tensor of the same type and format as "y". \n
  1112. *@par Outputs:
  1113. *z: A Tensor of the same type and format as "y". \n
  1114. *@see Matmul() | Rsqrt ()
  1115. *@par Third-party framework compatibility
  1116. * Compatible with the TensorFlow operator RsqrtGrad.
  1117. */
  1118. REG_OP(RsqrtGrad)
  1119. .INPUT(y, TensorType({UnaryDataType,int32,int8}))
  1120. .INPUT(dy, TensorType({UnaryDataType,int32,int8}))
  1121. .OUTPUT(z, TensorType({UnaryDataType,int32,int8}))
  1122. .OP_END_FACTORY_REG(RsqrtGrad)
  1123. /**
  1124. *@brief Computes hyperbolic sine of "x" element-wise. \n
  1125. *@par Inputs:
  1126. *x: An NCHW, NC1HWC0, NHWC,or ND Tensor of type float, double, complex64,
  1127. * complex128, half. \n
  1128. *@par Outputs:
  1129. *y: A NCHW, NC1HWC0, NHWC,or ND Tensor of type float, double, complex64,
  1130. * complex128, half. \n
  1131. *@par Third-party framework compatibility
  1132. * Compatible with the TensorFlow operator Sinh. \n
  1133. */
  1134. REG_OP(Sinh)
  1135. .INPUT(x, TensorType::UnaryDataType())
  1136. .OUTPUT(y, TensorType::UnaryDataType())
  1137. .OP_END_FACTORY_REG(Sinh)
  1138. /**
  1139. *@brief: Clips tensor values to a specified min and max. \n
  1140. *@par Inputs:
  1141. * Three inputs, including:
  1142. *@li x: A Tensor of type float32, float64, int32, uint8, int16, int8, complex64, int64,
  1143. *qint8, quint8, qint32, uint16, complex128, float16, uint32, uint64.
  1144. *@li clip_value_min: A Tensor of the same type as "x".
  1145. *@li clip_value_max: A Tensor of the same type as "x". \n
  1146. *@par Outputs:
  1147. *y: A Tensor. Has the same type as "x". \n
  1148. *@par Third-party framework compatibility
  1149. * Compatible with the TensorFlow operator ClipByValue.
  1150. */
  1151. REG_OP(ClipByValue)
  1152. .INPUT(x, TensorType::NumberType())
  1153. .INPUT(clip_value_min, TensorType::NumberType())
  1154. .INPUT(clip_value_max, TensorType::NumberType())
  1155. .OUTPUT(y, TensorType::NumberType())
  1156. .OP_END_FACTORY_REG(ClipByValue)
  1157. /**
  1158. *@brief Computes cosine of "x" element-wise. \n
  1159. *@par Inputs:
  1160. *x: A Tensor of type float16, float32, double, complex64, complex128.
  1161. * the format can be [NCHW,NC1HWC0,NHWC,ND]. \n
  1162. *@par Outputs:
  1163. *y: A Tensor. Has the same type as "x". \n
  1164. *@par Third-party framework compatibility
  1165. * Compatible with the TensorFlow operator Cosh. \n
  1166. */
  1167. REG_OP(Cosh)
  1168. .INPUT(x, TensorType::UnaryDataType())
  1169. .OUTPUT(y, TensorType::UnaryDataType())
  1170. .OP_END_FACTORY_REG(Cosh)
  1171. /**
  1172. *@brief: Returns 0 if the denominator is zero, else, like Div. \n
  1173. *@par Inputs:
  1174. * Two inputs, including:
  1175. *@li x1: A Tensor. Must be one of the following types:float16, float32, int32,
  1176. * int8, uint8, double, the format can be [NCHW,NC1HWC0,NHWC,ND].
  1177. *@li x2: A Tensor of the same type as "x1". \n
  1178. *@par Outputs:
  1179. *y: A Tensor. Has the same type as "x1". \n
  1180. *@par Third-party framework compatibility
  1181. * Compatible with the TensorFlow operator DivNoNan.
  1182. */
  1183. REG_OP(DivNoNan)
  1184. .INPUT(x1, TensorType({DT_FLOAT, DT_UINT8, DT_INT8, DT_INT32, DT_FLOAT16,
  1185. DT_DOUBLE}))
  1186. .INPUT(x2, TensorType({DT_FLOAT, DT_UINT8, DT_INT8, DT_INT32, DT_FLOAT16,
  1187. DT_DOUBLE}))
  1188. .OUTPUT(y, TensorType({DT_FLOAT, DT_UINT8, DT_INT8, DT_INT32, DT_FLOAT16,
  1189. DT_DOUBLE}))
  1190. .OP_END_FACTORY_REG(DivNoNan)
  1191. /**
  1192. *@brief Reverses specific dimensions of a tensor. \n
  1193. *@par Inputs:
  1194. * One input: \n
  1195. *x: A Tensor, Must be one of the following types:
  1196. * int32, uint8, int16, int8, int64, int64, uint16, uint32, uint64,
  1197. * and format can be [NCHW,NC1HWC0,NHWC,ND]
  1198. *@par Outputs:
  1199. *y: A Tensor. Has the same type and format as "x"
  1200. *@par Third-party framework compatibility
  1201. * Compatible with the TensorFlow operator Invert.
  1202. */
  1203. REG_OP(Invert)
  1204. .INPUT(x, TensorType::IntegerDataType())
  1205. .OUTPUT(y, TensorType::IntegerDataType())
  1206. .OP_END_FACTORY_REG(Invert)
  1207. /**
  1208. *@brief Returns a tensor of the same shape and type with all elements set to one.
  1209. *@par Inputs:
  1210. *One input: \n
  1211. *x: A Tensor. Must be one of the following types: float16, float32, int8, uint8,
  1212. * int16, uint16, int32, int64, complex128, bool. \n
  1213. *@par Outputs:
  1214. *y: A Tensor of the same type as "x". \n
  1215. *@par Third-party framework compatibility
  1216. * Compatible with TensorFlow operator OnesLike.
  1217. */
  1218. REG_OP(OnesLike)
  1219. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8,
  1220. DT_UINT8, DT_INT16, DI_UINT16, DT_INT32,
  1221. DT_INT64, DT_COMPLEX128, DT_BOOL}))
  1222. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT8,
  1223. DT_UINT8, DT_INT16, DI_UINT16, DT_INT32,
  1224. DT_INT64, DT_COMPLEX128, DT_BOOL}))
  1225. .OP_END_FACTORY_REG(OnesLike)
  1226. /**
  1227. *@brief Computes the gradient for the inverse of "x" with regard its input. \n
  1228. *@par Inputs:
  1229. *@li input_y: A Tensor. Must be one of the following types: float, double,
  1230. * complex64, complex128, half.
  1231. *@li input_dy: A Tensor. Must be one of the following types: float, double,
  1232. * complex64, complex128, half. \n
  1233. *@par Outputs:
  1234. *output_data: A Tensor. Must be one of the following types: float, double,
  1235. * complex64, complex128, half. \n
  1236. *@attention Constraints:
  1237. * "input_dy" has the same shape and type as "input_y". \n
  1238. *@par Third-party framework compatibility
  1239. * Compatible with the TensorFlow operator reciprocal_grad.
  1240. */
  1241. REG_OP(ReciprocalGrad)
  1242. .INPUT(y, TensorType::UnaryDataType())
  1243. .INPUT(dy, TensorType::UnaryDataType())
  1244. .OUTPUT(z, TensorType::UnaryDataType())
  1245. .OP_END_FACTORY_REG(ReciprocalGrad)
  1246. /**
  1247. *@brief Returns the truth value of (x1 > x2) element-wise. \n
  1248. *@par Inputs:
  1249. *@li x1: A Tensor of type float16, float32, double, int64, int32, int16, int8,
  1250. * uint8, uint16, uint32, uint64.
  1251. *@li x2: A Tensor of the same data type as "x1". \n
  1252. *@par Outputs:
  1253. *y: A Tensor of type bool.
  1254. *@attention Constraints:
  1255. * Broadcasting is supported. \n
  1256. *@par Third-party framework compatibility
  1257. * Compatible with the TensorFlow operator Greater. \n
  1258. */
  1259. REG_OP(Greater)
  1260. .INPUT(x1, TensorType::RealNumberType())
  1261. .INPUT(x2, TensorType::RealNumberType())
  1262. .OUTPUT(y, TensorType({DT_BOOL}))
  1263. .OP_END_FACTORY_REG(Greater)
  1264. /**
  1265. *@brief Returns a tensor of the same type and shape as the input tensor with all elements set to zero. \n
  1266. *@par Inputs:
  1267. *x: A Tensor. Must be one of the following types:
  1268. * float32, float64, int32, uint8, int16, int8,
  1269. * complex64, int64, qint8, quint8, qint32, qint16, quint16, uint16,
  1270. * complex128, float16, uint32, uint64, complex64, complex128. \n
  1271. *@par Outputs:
  1272. *y: A Tensor of the same data type as "x". \n
  1273. *@attention Constraints:
  1274. * The output has the same shape and type as the input. \n
  1275. *@par Third-party framework compatibility
  1276. * Compatible with the TensorFlow operator zeros_like.
  1277. */
  1278. REG_OP(ZerosLike)
  1279. .INPUT(x, TensorType::BasicType())
  1280. .OUTPUT(y, TensorType::BasicType())
  1281. .OP_END_FACTORY_REG(ZerosLike)
  1282. /**
  1283. *@brief Returns the truth value of NOT "x" element-wise. \n
  1284. *@par Inputs:
  1285. *x: A Tensor of type bool. \n
  1286. *@par Outputs:
  1287. *y: A Tensor of type bool. \n
  1288. *@attention Constraints:
  1289. * The input and output values are "1" or "0", corresponding to bool values "true" and "false". \n
  1290. *@par Third-party framework compatibility
  1291. * Compatible with the TensorFlow operator logical_not.
  1292. */
  1293. REG_OP(LogicalNot)
  1294. .INPUT(x, TensorType({DT_BOOL}))
  1295. .OUTPUT(y, TensorType({DT_BOOL}))
  1296. .OP_END_FACTORY_REG(LogicalNot)
  1297. /**
  1298. *@brief Computes inverse hyperbolic sine of x element-wise.
  1299. * Given an input tensor, this function computes inverse hyperbolic sine for every element in the tensor. \n
  1300. *
  1301. *@par Inputs:
  1302. * x: A tensor. Must be one of the following types: float16, float32, float64, complex64, complex128.
  1303. *
  1304. *@par Outputs:
  1305. * y: A tensor. Has the same type as "x".
  1306. *
  1307. *@par Third-party framework compatibility
  1308. *Compatible with the TensorFlow operator Asinh.
  1309. *
  1310. */
  1311. REG_OP(Asinh)
  1312. .INPUT(x, TensorType::UnaryDataType())
  1313. .OUTPUT(y, TensorType::UnaryDataType())
  1314. .OP_END_FACTORY_REG(Asinh)
  1315. /**
  1316. *@brief Computes gradients for Asinh operation. \n
  1317. *
  1318. *@par Inputs:
  1319. *@li y: A tensor. Must be one of the following types: float16, float32.
  1320. *@li dy: A tensor of the same type as "y"
  1321. *
  1322. *@par Outputs:
  1323. * z: A tensor. Has the same type as "y".
  1324. *
  1325. *@par Third-party framework compatibility
  1326. *Compatible with the TensorFlow operator AsinhGrad.
  1327. *
  1328. */
  1329. REG_OP(AsinhGrad)
  1330. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1331. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  1332. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  1333. .OP_END_FACTORY_REG(AsinhGrad)
  1334. /**
  1335. *@brief Computes inverse hyperbolic tangent of x element-wise.\n
  1336. * Given an input tensor, this function computes inverse hyperbolic tangent for every element in the tensor. \n Input range is [-1,1] and output range is [-inf, inf]. If input is -1, \n output will be -inf and if the input is 1, output will be inf.\n Values outside the range will have nan as output. \n
  1337. *
  1338. *@par Inputs:
  1339. * x: A tensor. Must be one of the following types: float16, float32, float64, complex64, complex128.
  1340. *
  1341. *@par Outputs:
  1342. * y: A tensor. Has the same type as "x".
  1343. *
  1344. *@par Third-party framework compatibility
  1345. *Compatible with the TensorFlow operator Atanh.
  1346. *
  1347. */
  1348. REG_OP(Atanh)
  1349. .INPUT(x, TensorType::UnaryDataType())
  1350. .OUTPUT(y, TensorType::UnaryDataType())
  1351. .OP_END_FACTORY_REG(Atanh)
  1352. /**
  1353. *@brief Computes the trignometric inverse tangent of x element-wise.
  1354. * The atan operation returns the inverse of tan, such that if y = tan(x) then, x = atan(y). \n
  1355. *
  1356. *@par Inputs:
  1357. * x: A tensor. Must be one of the following types: float16, float32, float64, complex64, complex128.
  1358. *
  1359. *@par Outputs:
  1360. * y: A tensor. Has the same type as "x". The output of atan will lie within the invertible range of tan, i.e (-pi/2, pi/2).
  1361. *
  1362. *@par Third-party framework compatibility
  1363. *Compatible with the TensorFlow operator Atan.
  1364. *
  1365. */
  1366. REG_OP(Atan)
  1367. .INPUT(x, TensorType::UnaryDataType())
  1368. .OUTPUT(y, TensorType::UnaryDataType())
  1369. .OP_END_FACTORY_REG(Atan)
  1370. /**
  1371. *@brief Computes gradients for Atan operation. \n
  1372. *
  1373. *@par Inputs:
  1374. *@li y: A tensor of type float16 or float32.
  1375. *@li dy: A tensor of the same type as "y"
  1376. *
  1377. *@par Outputs:
  1378. * z: A tensor. Has the same type as "y".
  1379. *
  1380. *@par Third-party framework compatibility
  1381. *Compatible with the TensorFlow operator AtanGrad.
  1382. *
  1383. */
  1384. REG_OP(AtanGrad)
  1385. .INPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  1386. .INPUT(dy, TensorType({DT_FLOAT16, DT_FLOAT}))
  1387. .OUTPUT(z, TensorType({DT_FLOAT16, DT_FLOAT}))
  1388. .OP_END_FACTORY_REG(AtanGrad)
  1389. /**
  1390. *@brief Computes arctangent of x1/x2 element-wise, respecting signs of the arguments. \n
  1391. *
  1392. *@par Inputs:
  1393. *@li x1: A tensor. Must be one of the following types: float16, float32, float64
  1394. *@li x2: A tensor of the same type as "x1".
  1395. *
  1396. *@par Outputs:
  1397. * y: A tensor. Has the same type as "x1".
  1398. *
  1399. *@par Third-party framework compatibility
  1400. *Compatible with the TensorFlow operator Atan2.
  1401. *
  1402. */
  1403. REG_OP(Atan2)
  1404. .INPUT(x1, TensorType::FloatingDataType())
  1405. .INPUT(x2, TensorType::FloatingDataType())
  1406. .OUTPUT(y, TensorType::FloatingDataType())
  1407. .OP_END_FACTORY_REG(Atan2)
  1408. /**
  1409. *@brief Returns the truth value of abs(x1-x2) < tolerance element-wise. \n
  1410. *
  1411. *@par Inputs:
  1412. *@li x1: A tensor. Must be one of the following types: float32, float64, int32,
  1413. uint8, int16, int8, complex64, int64, qint8, quint8, qint32, uint16, complex128,
  1414. float16, uint32, uint64
  1415. *@li x2: A tensor of the same type as "x1".
  1416. *
  1417. *@par Attributes:
  1418. * tolerance: Defaults to "1e-05".
  1419. *
  1420. *@par Outputs:
  1421. * y: A tensor of type bool.
  1422. *
  1423. *@par Third-party framework compatibility
  1424. *Compatible with the TensorFlow operator ApproximateEqual.
  1425. *
  1426. */
  1427. REG_OP(ApproximateEqual)
  1428. .INPUT(x1, TensorType::NumberType())
  1429. .INPUT(x2, TensorType::NumberType())
  1430. .OUTPUT(y, TensorType({DT_BOOL}))
  1431. .ATTR(tolerance, Float, 1e-5)
  1432. .OP_END_FACTORY_REG(ApproximateEqual)
  1433. /**
  1434. *@brief Returns the element-wise sum of a list of tensors.\n
  1435. * AccumulateNV2 performs the same operation as AddN, but does not wait for all
  1436. of its inputs to be ready before beginning to sum.\n This can save memory if
  1437. inputs are ready at different times, \n since minimum temporary storage is
  1438. proportional to the output size rather than the inputs size.\n Returns a Tensor
  1439. of same shape and type as the elements of inputs. \n
  1440. *
  1441. *@par Inputs:
  1442. *Dynamic inputs, including:
  1443. * x: A tensor. Must be one of the following types: float32, float64, int32,
  1444. uint8, int16, int8, complex64, int64, \n qint8, quint8, qint32, uint16,
  1445. complex128, float16, uint32, uint64.
  1446. *
  1447. *@par Outputs:
  1448. * y: A tensor. Has the same type as "x".
  1449. *
  1450. *@par Attributes:
  1451. * N: the size of x.
  1452. *@par Third-party framework compatibility
  1453. *Compatible with the TensorFlow operator AccumulateNV2.
  1454. *
  1455. */
  1456. REG_OP(AccumulateNV2)
  1457. .DYNAMIC_INPUT(x, TensorType::NumberType())
  1458. .OUTPUT(y, TensorType::NumberType())
  1459. .REQUIRED_ATTR(N, Int)
  1460. .OP_END_FACTORY_REG(AccumulateNV2)
  1461. /**
  1462. *@brief Fake-quantizes the input Tensor, type float to output a Tensor of same type.
  1463. * [min, max] define the clamping range for the "inputs" data.\n
  1464. * the values of "x" are quantized into the quantization range ([0, 2^num_bits - 1] \n
  1465. * when "narrow_range" is "false" or [1, 2^num_bits - 1] when it is "true") and \n
  1466. * then de-quantized and output as float32 in [min; max] interval.\n
  1467. * num_bits is the bit width of the quantization, between 2 and 16, inclusive. \n
  1468. * Quantization is called fake since the output is still in floating point. \n
  1469. *@par Inputs:
  1470. *One input:
  1471. *x: A Tensor of type float32. \n
  1472. *@par Attributes:
  1473. *@li min: An optional attribute. Defaults to "-6.0".
  1474. *@li max: An optional attribute. Defaults to "6.0".
  1475. *@li num_bits: An optional attribute. Defaults to "8".
  1476. *@li narrow_range: An optional bool. Defaults to "false". \n
  1477. *@par Outputs:
  1478. *y: A Tensor. Has the same shape and type of "x". \n
  1479. *@par Third-party framework compatibility
  1480. * Compatible with TensorFlow operator FakeQuantWithMinMaxArgs.
  1481. */
  1482. REG_OP(FakeQuantWithMinMaxArgs)
  1483. .INPUT(x, TensorType({DT_FLOAT}))
  1484. .OUTPUT(y, TensorType({DT_FLOAT}))
  1485. .ATTR(min, Float, -6.0)
  1486. .ATTR(max, Float, 6.0)
  1487. .ATTR(num_bits, Int, 8)
  1488. .ATTR(narrow_range, Bool, false)
  1489. .OP_END_FACTORY_REG(FakeQuantWithMinMaxArgs)
  1490. /**
  1491. *@brief Computes gradients for a FakeQuantWithMinMaxArgs operation. \n
  1492. *@par Inputs:
  1493. *Two inputs, including: \n
  1494. *@li gradients: A Tensor of type float32. Backpropagated gradients
  1495. above the FakeQuantWithMinMaxArgs operation.
  1496. *@li x: A Tensor of type float32. Has the same type and format as "gradients".\n
  1497. * This is the input Tensor of the FakeQuantWithMinMaxArgs operator.\n
  1498. *@par Attributes:
  1499. *@li min: An optional attribute. Defaults to "-6.0".
  1500. *@li max: An optional attribute. Defaults to "6.0".
  1501. *@li num_bits: An optional attribute. Defaults to "8".
  1502. *@li narrow_range: An optional bool. Defaults to "False". \n
  1503. *@par Outputs:
  1504. *y: A Tensor of type float32. \n
  1505. *@par Third-party framework compatibility
  1506. * Compatible with TensorFlow operator FakeQuantWithMinMaxArgsGradient.
  1507. */
  1508. REG_OP(FakeQuantWithMinMaxArgsGradient)
  1509. .INPUT(gradients, TensorType({DT_FLOAT}))
  1510. .INPUT(x, TensorType({DT_FLOAT}))
  1511. .OUTPUT(y, TensorType({DT_FLOAT}))
  1512. .ATTR(min, Float, -6.0)
  1513. .ATTR(max, Float, 6.0)
  1514. .ATTR(num_bits, Int, 8)
  1515. .ATTR(narrow_range, Bool, false)
  1516. .OP_END_FACTORY_REG(FakeQuantWithMinMaxArgsGradient)
  1517. /**
  1518. *@brief Fake-quantize the 'inputs' tensor of type float via global float scalars. \n
  1519. *@par Inputs:
  1520. *Three inputs, including:
  1521. *@li x: A Tensor of type float32.
  1522. *@li min: A Tensor of type float32. Has the same type and format as "x".
  1523. *@li max: A Tensor of type float32. Has the same type and format as "x".\n
  1524. *[min; max] define the clamping range for the inputs data
  1525. *@par Attributes:
  1526. *@li num_bits: An optional attribute. Defaults to "8".
  1527. *@li narrow_range: An optional bool. Defaults to "False". \n
  1528. *@par Outputs:
  1529. *y: A Tensor of type float32. \n
  1530. *@par Third-party framework compatibility
  1531. * Compatible with TensorFlow operator FakeQuantWithMinMaxVars.
  1532. */
  1533. REG_OP(FakeQuantWithMinMaxVars)
  1534. .INPUT(x, TensorType({DT_FLOAT}))
  1535. .INPUT(min, TensorType({DT_FLOAT}))
  1536. .INPUT(max, TensorType({DT_FLOAT}))
  1537. .OUTPUT(y, TensorType({DT_FLOAT}))
  1538. .ATTR(num_bits, Int, 8)
  1539. .ATTR(narrow_range, Bool, false)
  1540. .OP_END_FACTORY_REG(FakeQuantWithMinMaxVars)
  1541. /**
  1542. *@brief Computes gradients for a FakeQuantWithMinMaxVars operation. \n
  1543. *@par Inputs:
  1544. *Four inputs, including:
  1545. *@li gradients: A Tensor of type float32.
  1546. *@li x: A Tensor of type float32.
  1547. *@li min: A Tensor of type float32.
  1548. *@li max: A Tensor of type float32. \n
  1549. *@par Attributes:
  1550. *@li num_bits: An integer specifying the quantization bit width. Defaults to "8".
  1551. *@li narrow_range: A Boolean specifying whether to use a narrow range for quantization. Defaults to "False". \n
  1552. *@par Outputs:
  1553. *@li backprops_wrt_x: A Tensor. Has the same type as input "x".
  1554. *@li backprops_wrt_min: A Tensor. Has the same type as input "min".
  1555. *@li backprops_wrt_max: A Tensor. Has the same type as input "max". \n
  1556. *@attention Constraints:
  1557. *@li "gradients" has the same shape as "x".
  1558. *@li "min" and "max" are scalars.
  1559. *@li "num_bits" is between 2 and 16
  1560. *@see Region()
  1561. *@par Third-party framework compatibility
  1562. * Compatible with the operator FakeQuantWithMinMaxVarsGradient.
  1563. */
  1564. REG_OP(FakeQuantWithMinMaxVarsGradient)
  1565. .INPUT(gradients, TensorType({DT_FLOAT}))
  1566. .INPUT(x, TensorType({DT_FLOAT}))
  1567. .INPUT(min, TensorType({DT_FLOAT}))
  1568. .INPUT(max, TensorType({DT_FLOAT}))
  1569. .OUTPUT(backprops_wrt_x, TensorType({DT_FLOAT}))
  1570. .OUTPUT(backprops_wrt_min, TensorType({DT_FLOAT}))
  1571. .OUTPUT(backprops_wrt_max, TensorType({DT_FLOAT}))
  1572. .ATTR(num_bits, Int, 8)
  1573. .ATTR(narrow_range, Bool, false)
  1574. .OP_END_FACTORY_REG(FakeQuantWithMinMaxVarsGradient)
  1575. /**
  1576. *@brief Fake-quantizes the "inputs" tensor of type float
  1577. via per-channel floats min and max of shape [d] to "outputs" \n
  1578. tensor of same shape as inputs
  1579. *@par Inputs:
  1580. *Three inputs, including:
  1581. *@li x: A Tensor of type float32.
  1582. *@li min: A Tensor of type float32.
  1583. *@li max: A Tensor of type float32. \n
  1584. *@par Attributes:
  1585. *@li num_bits: An integer specifying the quantization bit width. Defaults to "8".
  1586. *@li narrow_range: A Boolean specifying whether to use a narrow range for quantization. Defaults to "False". \n
  1587. *@par Outputs:
  1588. *y: A Tensor. Has the same type as input "x".
  1589. *@attention Constraints:
  1590. *@li "min" and "max" have one-dimensional shapes.
  1591. *@li "min" has the same last dimension size as "x". "max" has the same last dimension size as "x".
  1592. *@li "num_bits" is between 2 and 16
  1593. *@see Region()
  1594. *@par Third-party framework compatibility
  1595. * Compatible with the TensorFlow operator FakeQuantWithMinMaxVarsPerChannel.
  1596. */
  1597. REG_OP(FakeQuantWithMinMaxVarsPerChannel)
  1598. .INPUT(x, TensorType({DT_FLOAT}))
  1599. .INPUT(min, TensorType({DT_FLOAT}))
  1600. .INPUT(max, TensorType({DT_FLOAT}))
  1601. .OUTPUT(y, TensorType({DT_FLOAT}))
  1602. .ATTR(num_bits, Int, 8)
  1603. .ATTR(narrow_range, Bool, false)
  1604. .OP_END_FACTORY_REG(FakeQuantWithMinMaxVarsPerChannel)
  1605. /**
  1606. *@brief Computes gradients for a FakeQuantWithMinMaxVarsPerChannel operation. \n
  1607. *@par Inputs:
  1608. *Four inputs, including:
  1609. *@li gradients: A Tensor of type float32.
  1610. *@li x: A Tensor of type float32.
  1611. *@li min: A Tensor of type float32.
  1612. *@li max: A Tensor of type float32. \n
  1613. *@par Attributes:
  1614. *@li num_bits: An integer specifying the quantization bit width. Defaults to "8".
  1615. *@li narrow_range: A Boolean specifying whether to use a narrow range for quantization. Defaults to "False". \n
  1616. *@par Outputs:
  1617. *@li backprops_wrt_x: A Tensor. Has the same type as input "x".
  1618. *@li backprops_wrt_min: A Tensor. Has the same type as input "min".
  1619. *@li backprops_wrt_max: A Tensor. Has the same type as input "max". \n
  1620. *@attention Constraints:
  1621. *@li "gradients" has the same shape as "x".
  1622. *@li "min" and "max" have one-dimensional shapes.
  1623. *@li "min" has the same last dimension size as "x". "max" has the same last dimension size as "x". "gradients" has the same last dimension size as "x".
  1624. *@li "num_bits" is between 2 and 16
  1625. *@see Region()
  1626. *@par Third-party framework compatibility
  1627. * Compatible with the TensorFlow operator FakeQuantWithMinMaxVarsPerChannelGradient.
  1628. */
  1629. REG_OP(FakeQuantWithMinMaxVarsPerChannelGradient)
  1630. .INPUT(gradients, TensorType({DT_FLOAT}))
  1631. .INPUT(x, TensorType({DT_FLOAT}))
  1632. .INPUT(min, TensorType({DT_FLOAT}))
  1633. .INPUT(max, TensorType({DT_FLOAT}))
  1634. .OUTPUT(backprops_wrt_x, TensorType({DT_FLOAT}))
  1635. .OUTPUT(backprops_wrt_min, TensorType({DT_FLOAT}))
  1636. .OUTPUT(backprops_wrt_max, TensorType({DT_FLOAT}))
  1637. .ATTR(num_bits, Int, 8)
  1638. .ATTR(narrow_range, Bool, false)
  1639. .OP_END_FACTORY_REG(FakeQuantWithMinMaxVarsPerChannelGradient)
  1640. /**
  1641. *@brief Element-wise computes the bitwise AND of "x1" and "x2". \n
  1642. *@par Inputs:
  1643. *Two inputs, including:
  1644. * @li x1: A Tensor. Must be one of the following types: int8, int16,
  1645. * int32, int64, uint8, uint16, uint32, uint64. Broadcasting is supported.
  1646. * @li x2: A Tensor of the same type as "x1". \n
  1647. *@par Outputs:
  1648. *y: A Tensor. Has the same type as "x1". \n
  1649. *@par Third-party framework compatibility
  1650. *Compatible with the TensorFlow operator BitwiseAnd.
  1651. */
  1652. REG_OP(BitwiseAnd)
  1653. .INPUT(x1, TensorType::IntegerDataType())
  1654. .INPUT(x2, TensorType::IntegerDataType())
  1655. .OUTPUT(y, TensorType::IntegerDataType())
  1656. .OP_END_FACTORY_REG(BitwiseAnd)
  1657. /**
  1658. *@brief Element-wise computes the bitwise OR of "x1" and "x2". \n
  1659. *@par Inputs:
  1660. *Two inputs, including:
  1661. * @li x1: A Tensor. Must be one of the following types: int8, int16,
  1662. * int32, int64, uint8, uint16, uint32, uint64. Broadcasting is supported.
  1663. * @li x2: A Tensor of the same type as "x1". \n
  1664. *@par Outputs:
  1665. *y: A Tensor. Has the same type as "x1". \n
  1666. *@par Third-party framework compatibility
  1667. *Compatible with the TensorFlow operator BitwiseOr.
  1668. */
  1669. REG_OP(BitwiseOr)
  1670. .INPUT(x1, TensorType::IntegerDataType())
  1671. .INPUT(x2, TensorType::IntegerDataType())
  1672. .OUTPUT(y, TensorType::IntegerDataType())
  1673. .OP_END_FACTORY_REG(BitwiseOr)
  1674. /**
  1675. *@brief Elementwise computes the bitwise XOR of "x1" and "x2". \n
  1676. *@par Inputs:
  1677. *Two inputs, including:
  1678. *@li x1: A Tensor. Must be one of the following types: int8, int16, int32, int64, uint8, uint16, uint32, uint64.
  1679. * The format is NC1HWC0 or ND. Broadcasting is supported.
  1680. *@li x2: A Tensor. Has the same type and format as "x1". \n
  1681. *@par Outputs:
  1682. *y: Output result. Has the same type as "x1". \n
  1683. *@par Third-party framework compatibility
  1684. * Compatible with TensorFlow operator BitwiseXor.
  1685. */
  1686. REG_OP(BitwiseXor)
  1687. .INPUT(x1, TensorType::IntegerDataType())
  1688. .INPUT(x2, TensorType::IntegerDataType())
  1689. .OUTPUT(y, TensorType::IntegerDataType())
  1690. .OP_END_FACTORY_REG(BitwiseXor)
  1691. /**
  1692. *@brief Returns element-wise smallest integer not less than "x". \n
  1693. *@par Inputs:
  1694. * x: A Tensor of type float16 or float32 or float64. \n
  1695. *@par Outputs:
  1696. *y: A Tensor. Has the same type as "x".
  1697. *@par Third-party framework compatibility
  1698. *Compatible with the TensorFlow operator Ceil.
  1699. */
  1700. REG_OP(Ceil)
  1701. .INPUT(x, TensorType::FloatingDataType())
  1702. .OUTPUT(y, TensorType::FloatingDataType())
  1703. .OP_END_FACTORY_REG(Ceil)
  1704. /**
  1705. *@brief Returns element-wise largest integer not greater than "x". \n
  1706. *@par Inputs:
  1707. *x: A Tensor of type float16, float32 or double. \n
  1708. *@par Outputs:
  1709. *y: A Tensor of the same type as "x". \n
  1710. *@par Third-party framework compatibility:
  1711. * Compatible with TensorFlow operator Floor.
  1712. */
  1713. REG_OP(Floor)
  1714. .INPUT(x, TensorType::FloatingDataType())
  1715. .OUTPUT(y, TensorType::FloatingDataType())
  1716. .OP_END_FACTORY_REG(Floor)
  1717. /**
  1718. *@brief Divides "x1/x2" element-wise, rounding toward the
  1719. * most negative integer. \n
  1720. *@par Inputs:
  1721. *Two inputs, including:
  1722. * @li x1: A Tensor. Must be one of the following types: float16, float32, int32, int64, int8,
  1723. * uint8, int16, uint16, double, complex64, complex128.
  1724. * @li x2: A Tensor of the same type as "x1". \n
  1725. *@par Outputs:
  1726. *y: A Tensor. Has the same type as "x1". \n
  1727. *@par Third-party framework compatibility
  1728. * Compatible with the TensorFlow operator FloorDiv.
  1729. */
  1730. REG_OP(FloorDiv)
  1731. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8,
  1732. DT_INT64, DT_INT16, DT_UINT16, DT_DOUBLE,
  1733. DT_COMPLEX64, DT_COMPLEX128}))
  1734. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8,
  1735. DT_INT64, DT_INT16,DT_UINT16, DT_DOUBLE,
  1736. DT_COMPLEX64, DT_COMPLEX128}))
  1737. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8,
  1738. DT_INT64, DT_INT16,DT_UINT16, DT_DOUBLE,
  1739. DT_COMPLEX64, DT_COMPLEX128}))
  1740. .OP_END_FACTORY_REG(FloorDiv)
  1741. /**
  1742. *@brief Returns element-wise remainder of division. Consistent with: floor(x1/x2) * x2 + mod(x1, x2) = x1. \n
  1743. *@par Inputs:
  1744. * Two inputs, including:
  1745. *@li x1: A Tensor. Must be one of the following types:
  1746. * int32, int64, float, float16, double
  1747. *@li x2: A Tensor. Must have the same type as "x1".
  1748. *
  1749. *@par Outputs:
  1750. *y: Result remainder.
  1751. *@par Third-party framework compatibility
  1752. * Compatible with the TensorFlow operator FloorMod.
  1753. */
  1754. REG_OP(FloorMod)
  1755. .INPUT(x1, TensorType({DT_INT32, DT_INT64, DT_FLOAT, DT_FLOAT16,
  1756. DT_DOUBLE}))
  1757. .INPUT(x2, TensorType({DT_INT32, DT_INT64, DT_FLOAT, DT_FLOAT16,
  1758. DT_DOUBLE}))
  1759. .OUTPUT(y, TensorType({DT_INT32, DT_INT64, DT_FLOAT, DT_FLOAT16,
  1760. DT_DOUBLE}))
  1761. .OP_END_FACTORY_REG(FloorMod)
  1762. /**
  1763. *@brief Computes the power of "x1" to "x2". \n
  1764. *@par Inputs:
  1765. *Two inputs, including:
  1766. * @li x1: A Tensor. Must be one of the following types:
  1767. * float16, float32, int32, int64, int8, uint8, double, complex64, complex128.
  1768. * @li x2: A Tensor of the same type as "x1". \n
  1769. *@par Outputs:
  1770. *y: A Tensor. Has the same type as "x1". \n
  1771. *@par Third-party framework compatibility
  1772. *Compatible with the TensorFlow operator Pow.
  1773. */
  1774. REG_OP(Pow)
  1775. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64, DT_INT8,
  1776. DT_UINT8, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128}))
  1777. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64, DT_INT8,
  1778. DT_UINT8, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128}))
  1779. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64, DT_INT8,
  1780. DT_UINT8, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128}))
  1781. .OP_END_FACTORY_REG(Pow)
  1782. /**
  1783. *@brief Return element-wise integer closest to x. \n
  1784. *@par Inputs:
  1785. *One input, include:
  1786. *x: A mutable Tensor. Must be one of the following types:
  1787. * float16, float32, double. \n
  1788. *@par Outputs:
  1789. *y: A mutable Tensor. Has the same type as "x". \n
  1790. *@par Third-party framework compatibility
  1791. * Compatible with the TensorFlow operator Rint.
  1792. */
  1793. REG_OP(Rint)
  1794. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1795. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  1796. .OP_END_FACTORY_REG(Rint)
  1797. /**
  1798. *@brief Rounds the values of a tensor to the nearest integer, element-wise.
  1799. * Rounds half to even. \n
  1800. *@par Inputs:
  1801. *Inputs including:
  1802. *x: A required ND Tensor of type float16, float, int64, double, complex64,
  1803. * complex128 or int32.
  1804. *@par Outputs:
  1805. *y: A required ND Tensor. Has the same data type and shape as "x".
  1806. *@par Third-party framework compatibility
  1807. * Compatible with the TensorFlow operator Round.
  1808. */
  1809. REG_OP(Round)
  1810. .INPUT(x, TensorType(DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64,
  1811. DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128))
  1812. .OUTPUT(y, TensorType(DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT64,
  1813. DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128))
  1814. .OP_END_FACTORY_REG(Round)
  1815. /**
  1816. *@brief: Computes sine of "x" element-wise. \n
  1817. *@par Inputs:
  1818. *One input:
  1819. *x: An ND Tensor. Must be one of the following types: float16, float32, double,
  1820. * complex64, complex128, int32, int64
  1821. *@par Outputs:
  1822. *y: An ND Tensor. Has the same type as "x". \n
  1823. *@par Third-party framework compatibility
  1824. * Compatible with TensorFlow operator Sin.
  1825. */
  1826. REG_OP(Sin)
  1827. .INPUT(x, TensorType::UnaryDataType())
  1828. .OUTPUT(y, TensorType::UnaryDataType())
  1829. .OP_END_FACTORY_REG(Sin)
  1830. /**
  1831. *@brief: Computes tan of "x" element-wise. \n
  1832. *@par Inputs:
  1833. *One input:
  1834. *x: A Tensor. Must be one of the following types: float16, float32, double, complex64, complex128, int32, int64
  1835. *@par Outputs:
  1836. *y: A Tensor. Has the same type as "x". \n
  1837. *@par Third-party framework compatibility
  1838. * Compatible with TensorFlow operator Tan.
  1839. */
  1840. REG_OP(Tan)
  1841. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_COMPLEX64,
  1842. DT_COMPLEX128, DT_INT32, DT_INT64}))
  1843. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_DOUBLE, DT_COMPLEX64,
  1844. DT_COMPLEX128, DT_INT32, DT_INT64}))
  1845. .OP_END_FACTORY_REG(Tan)
  1846. /**
  1847. *@brief Returns element-wise remainder of division. \n
  1848. *@par Inputs:
  1849. *Two inputs, including:
  1850. * @li x1: A Tensor. Must be one of the following types: float16, float32,
  1851. * double, int32, int64.
  1852. * @li x2: A Tensor of the same type as "x1". \n
  1853. *@par Outputs:
  1854. *y: A Tensor. Has the same type as "x1". \n
  1855. *@par Third-party framework compatibility
  1856. *@li Compatible with the TensorFlow operator TruncateMod.
  1857. */
  1858. REG_OP(TruncateMod)
  1859. .INPUT(x1, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT64,
  1860. DT_INT32}))
  1861. .INPUT(x2, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT64,
  1862. DT_INT32}))
  1863. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT64,
  1864. DT_INT32}))
  1865. .OP_END_FACTORY_REG(TruncateMod)
  1866. /**
  1867. *@brief Adds 'bias' to 'x'. \n
  1868. *@par Inputs:
  1869. *Two inputs, including:
  1870. * @li x: A Tensor of type NumberType. Must be one of the following types: float32, float64, int32, uint8, int16,
  1871. *int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16, complex128, float16, uint32, uint64.
  1872. * @li bias: A 1D Tensor with size the C dimension of value. \n
  1873. *@par Attributes:
  1874. *data_format: An optional string. Defaults to "NHWC". \n
  1875. *@par Outputs:
  1876. *y: A Tensor with same type as "x". \n
  1877. *@par Third-party framework compatibility
  1878. *Compatible with the TensorFlow operator BiasAdd.
  1879. */
  1880. REG_OP(BiasAdd)
  1881. .INPUT(x, TensorType::NumberType())
  1882. .INPUT(bias, TensorType::NumberType())
  1883. .OUTPUT(y, TensorType::NumberType())
  1884. .ATTR(data_format, String, "NHWC")
  1885. .OP_END_FACTORY_REG(BiasAdd)
  1886. /**
  1887. *@brief Returns the index with the smallest value across dimensions of a tensor. \n
  1888. *@par Inputs:
  1889. *Two inputs, including:
  1890. *@li x: A Tensor. Must be one of the following types: float32, float64, int32,
  1891. uint8, int16, int8, complex64, int64, qint8, quint8, qint32, bfloat16, uint16,
  1892. complex128, float16, uint32, uint64.
  1893. *format is ND.
  1894. *@li dimension: A Tensor. Must be one of the following types: int32, int64.
  1895. Must be in the range [-rank(input x), rank(input x)]. Describes which dimension
  1896. of the input Tensor to reduce across.
  1897. * The format is ND.
  1898. *@par Attributes:
  1899. *dtype: The output type, either "int32" or "int64". Defaults to "int64". \n
  1900. *@par Outputs:
  1901. *y: A Tensor of type "dtype". \n
  1902. *@par Third-party framework compatibility
  1903. * Compatible with TensorFlow operator ArgMin.
  1904. */
  1905. REG_OP(ArgMin)
  1906. .INPUT(x, TensorType::NumberType())
  1907. .INPUT(dimension, TensorType::IndexNumberType())
  1908. .OUTPUT(y, TensorType({DT_INT32, DT_INT64}))
  1909. .ATTR(dtype, Type, DT_INT64)
  1910. .OP_END_FACTORY_REG(ArgMin)
  1911. /**
  1912. *@brief Returns the index with the smallest value across dimensions of a tensor. \n
  1913. *@par Inputs:
  1914. *One input:
  1915. *x: A Tensor of type float16 or float32 in ND format. \n
  1916. *@par Attributes:
  1917. *@li dimension: The dimension of the input Tensor to reduce across.
  1918. *@li dtype: An optional attribute, specifying the output data type. Must be "int32". Defaults to "int64". \n
  1919. *@par Outputs:
  1920. *y: A Tensor of type dtype. \n
  1921. *@par Third-party framework compatibility
  1922. * Compatible with TensorFlow operator ArgMin.
  1923. *
  1924. * @par Restrictions:
  1925. * Warning: THIS FUNCTION IS DEPRECATED. Please use ArgMin instead.
  1926. */
  1927. REG_OP(ArgMinD)
  1928. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
  1929. .OUTPUT(y, TensorType({DT_INT32}))
  1930. .REQUIRED_ATTR(dimension, Int)
  1931. .ATTR(dtype, Type, DT_INT64)
  1932. .OP_END_FACTORY_REG(ArgMinD)
  1933. /**
  1934. *@brief Returns the index with the largest value across axes of a tensor. \n
  1935. *@par Inputs:
  1936. * Two inputs, including:
  1937. *@li x: A multi-dimensional Tensor of type float16, float32, or int16.
  1938. *@li dimension: A Scalar of type int32, specifying the index with the largest value. \n
  1939. *@par Attributes:
  1940. *dtype: The output type, either "int32" or "int64". Defaults to "int64". \n
  1941. *@par Outputs:
  1942. *y: A multi-dimensional Tensor of type int32 or int64, specifying the index with the largest value. The dimension is one less than that of "x". \n
  1943. *@attention Constraints:
  1944. *@li x: If there are multiple maximum values, the index of the first maximum value is used.
  1945. *@li The value range of "dimension" is [-dims, dims - 1]. "dims" is the dimension length of "x". \n
  1946. *@par Third-party framework compatibility
  1947. * Compatible with TensorFlow operator ArgMax.
  1948. */
  1949. REG_OP(ArgMaxV2)
  1950. .INPUT(x, TensorType::NumberType())
  1951. .INPUT(dimension, TensorType::IndexNumberType())
  1952. .OUTPUT(y, TensorType({DT_INT32, DT_INT64}))
  1953. .ATTR(dtype, Type, DT_INT64)
  1954. .OP_END_FACTORY_REG(ArgMaxV2)
  1955. /**
  1956. *@brief Returns the index with the largest value across axes of a tensor. \n
  1957. *@par Inputs:
  1958. * One input, including:
  1959. *x: A multi-dimensional Tensor of type float16, float32. \n
  1960. *@par Attributes:
  1961. *@li dimension: An integer of type int32, specifying the axis information of the index with the maximum value.
  1962. *@li dtype: The output type, either "int32" or "int64". Defaults to "int64". \n
  1963. *@par Outputs:
  1964. *y: A multi-dimensional Tensor of type int32, specifying the index with the
  1965. largest value. The dimension is one less than that of "x". \n
  1966. *@attention Constraints:
  1967. *@li x: If there are multiple maximum values, the index of the first maximum value is used.
  1968. *@li The value range of "dimension" is [-dims, dims - 1]. "dims" is the
  1969. dimension length of "x". \n
  1970. *@par Third-party framework compatibility
  1971. * Compatible with TensorFlow operator ArgMax.
  1972. * @par Restrictions:
  1973. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  1974. */
  1975. REG_OP(ArgMaxD)
  1976. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
  1977. .OUTPUT(y, TensorType({DT_INT32}))
  1978. .REQUIRED_ATTR(dimension, Int)
  1979. .ATTR(dtype, Type, DT_INT64)
  1980. .OP_END_FACTORY_REG(ArgMaxD)
  1981. /**
  1982. *@brief Returns the maximum value of all elements in the input in the given
  1983. * dimension. \n
  1984. *@par Inputs:
  1985. *One input: \n
  1986. *x: A multi-dimensional Tensor of type float16 or float32. \n
  1987. *@par Attributes:
  1988. *@li dimension: An integer of type int32, specifying the axis information of
  1989. * the index with the maximum value.
  1990. *@li keep_dims: A bool, specifying whether to keep dimensions for the output
  1991. * Tensor. Defaults to "false". \n
  1992. *@par Outputs:
  1993. *@li indice: A multi-dimensional Tensor of type int32, specifying the index.
  1994. * (If "keep_dims" is set to "false", the output dimensions are reduced by
  1995. * "dimension" compared with that of "x". Otherwise, the output has one fewer
  1996. * dimension than "x".)
  1997. *@li values: A Tensor, specifying the maximum value. Has the same dimensions
  1998. * as "indice" and the same type as "x". \n
  1999. *@attention Constraints:
  2000. *@li If there are multiple maximum values, the index of the first maximum
  2001. * value is used.
  2002. *@li The value range of "dimension" is [-dims, dims - 1]. "dims" is the
  2003. * dimension length of "x". \n
  2004. *@par Third-party framework compatibility
  2005. * Compatible with the two output scenarios of PyTorch operator Max (the output
  2006. * sequence is opposite to that of PyTorch).
  2007. */
  2008. REG_OP(ArgMaxWithValue)
  2009. .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16}))
  2010. .OUTPUT(indice,TensorType({DT_INT32}))
  2011. .OUTPUT(values, TensorType({DT_FLOAT,DT_FLOAT16}))
  2012. .REQUIRED_ATTR(dimension, Int)
  2013. .ATTR(keep_dims, Bool, false)
  2014. .OP_END_FACTORY_REG(ArgMaxWithValue)
  2015. /**
  2016. *@par Inputs:
  2017. *One input: \n
  2018. *x: A multi-dimensional Tensor of type float16 or float32. \n
  2019. *@par Attributes:
  2020. *@li dimension: An integer of type int32, specifying the axis information of
  2021. * the index with the maximum value.
  2022. *@li keep_dims: A bool, specifying whether to keep dimensions for the output
  2023. * Tensor. Defaults to "false". \n
  2024. *@par Outputs:
  2025. *@li indice: A multi-dimensional Tensor of type int32, specifying the index.
  2026. * (If "keep_dims" is set to "false", the output dimensions are reduced by
  2027. * "dimension" compared with that of "x". Otherwise, the output has one fewer
  2028. * dimension than "x".)
  2029. *@li values: A Tensor, specifying the minimum value. Has the same dimensions
  2030. * as "indice" and the same type as "x". \n
  2031. *@attention Constraints:
  2032. *@li If there are multiple minimum values, the index of the first minimum
  2033. * value is used.
  2034. *@li The value range of "dimension" is [-dims, dims - 1]. "dims" is the
  2035. * dimension length of "x".
  2036. *@li Performing the ArgMinWithValue operation on the last axis of float32 data
  2037. * is not supported on a mini platform. \n
  2038. *@par Third-party framework compatibility
  2039. * Compatible with the two output scenarios of PyTorch operator Min (the output
  2040. * sequence is opposite to that of PyTorch).
  2041. */
  2042. REG_OP(ArgMinWithValue)
  2043. .INPUT(x, TensorType({DT_FLOAT,DT_FLOAT16}))
  2044. .OUTPUT(indice,TensorType({DT_INT32}))
  2045. .OUTPUT(values, TensorType({DT_FLOAT,DT_FLOAT16}))
  2046. .REQUIRED_ATTR(dimension, Int)
  2047. .ATTR(keep_dims, Bool, false)
  2048. .OP_END_FACTORY_REG(ArgMinWithValue)
  2049. /**
  2050. *@brief Compute elementwise modes, such as 0: PRODUCT, 1: SUM, 2: MAX
  2051. *@par Inputs:
  2052. *One input: \n
  2053. *x: the list of input data, the type of element in Tensor should be same.
  2054. * the max size of x is 32.
  2055. * should met one of the following types: float16, float32. It's a dynamic input. \n
  2056. *@par Outputs:
  2057. *y: A Tensor. Has the same type and format as "x". \n
  2058. *@par Attributes:
  2059. *@li N: A required attribute. the number of input x, max size is 32. Type is int.
  2060. *@li model: An optional attribute. Type is int. Defaults to "1".
  2061. * "0": product, "1": sum, "2": max.
  2062. *@li coeff: A required attribute. Must met all of following rules:
  2063. * size of "coeff" must be equal to len("x") or is null.
  2064. * the absolute value of "coeff" must less than or equal to 1.
  2065. */
  2066. REG_OP(Eltwise)
  2067. .DYNAMIC_INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT}))
  2068. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT}))
  2069. .REQUIRED_ATTR(N, Int)
  2070. .ATTR(mode, Int, 1)
  2071. .ATTR(coeff, ListFloat, {})
  2072. .OP_END_FACTORY_REG(Eltwise)
  2073. /**
  2074. *@brief Computes element-wise population count. \n
  2075. *@par Inputs:
  2076. *x: A Tensor of type TensorType::IntegerDataType(). \n
  2077. *@par Outputs:
  2078. *y: A Tensor of type uint8. \n
  2079. *@par Third-party framework compatibility
  2080. * Compatible with the TensorFlow operator PopulationCount.
  2081. */
  2082. REG_OP(PopulationCount)
  2083. .INPUT(x, TensorType::IntegerDataType())
  2084. .OUTPUT(y, TensorType({DT_UINT8}))
  2085. .OP_END_FACTORY_REG(PopulationCount)
  2086. /**
  2087. *@brief A fusion operator for bert lamb. \n
  2088. *@par Inputs:
  2089. *Thirteen inputs, including:
  2090. * @li input_mul3: A Tensor. Must be one of the following types: float16, float32.
  2091. * @li input_mul2: A Tensor. Must be one of the following types: float16, float32.
  2092. * @li input_realdiv1: A Tensor. Must be one of the following types: float16, float32.
  2093. * @li input_mul1: A Tensor. Must be one of the following types: float16, float32.
  2094. * @li input_mul0: A Tensor. Must be one of the following types: float16, float32.
  2095. * @li input_realdiv0: A Tensor. Must be one of the following types: float16, float32.
  2096. * @li input_mul4: A Tensor. Must be one of the following types: float16, float32.
  2097. * @li mul0_x: A Tensor. Must be one of the following types: float16, float32.
  2098. * @li mul1_sub: A Tensor. Must be one of the following types: float16, float32.
  2099. * @li mul2_x: A Tensor. Must be one of the following types: float16, float32.
  2100. * @li mul3_sub1: A Tensor. Must be one of the following types: float16, float32.
  2101. * @li mul4_x: A Tensor. Must be one of the following types: float16, float32.
  2102. * @li add2_y: A Tensor. Must be one of the following types: float16, float32. \n
  2103. *@par Outputs:
  2104. *Four outputs, including:
  2105. * @li y1: A Tensor. Must be one of the following types: float16, float32.
  2106. * @li y2: A Tensor. Must be one of the following types: float16, float32.
  2107. * @li y3: A Tensor. Must be one of the following types: float16, float32.
  2108. * @li y4: A Tensor. Must be one of the following types: float16, float32. \n
  2109. *@par Restrictions:
  2110. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2111. */
  2112. REG_OP(LambNextMVWithDecay)
  2113. .INPUT(input_mul3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2114. .INPUT(input_mul2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2115. .INPUT(input_realdiv1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2116. .INPUT(input_mul1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2117. .INPUT(input_mul0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2118. .INPUT(input_realdiv0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2119. .INPUT(input_mul4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2120. .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2121. .INPUT(mul1_sub, TensorType({DT_FLOAT16,DT_FLOAT}))
  2122. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2123. .INPUT(mul3_sub1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2124. .INPUT(mul4_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2125. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2126. .OUTPUT(y1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2127. .OUTPUT(y2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2128. .OUTPUT(y3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2129. .OUTPUT(y4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2130. .OP_END_FACTORY_REG(LambNextMVWithDecay)
  2131. /**
  2132. *@brief Confuse real_div, rsqrt, sqrt, maximum, minimum, sub and add. \n
  2133. *@par Inputs:
  2134. *Thirteen inputs, including:
  2135. * @li input_mul3: A Tensor. Must be one of the following types: float16, float32.
  2136. * @li input_mul2: A Tensor of the same type as "input1".
  2137. * @li input_realdiv1: A Tensor of the same type as "input1".
  2138. * @li input_mul1: A Tensor of the same type as "input1".
  2139. * @li input_mul0: A Tensor of the same type as "input1".
  2140. * @li input_realdiv0: A Tensor. Must be one of the following types: float16, float32.
  2141. * @li input_mul4: A Tensor of the same type as "input1".
  2142. * @li mul0_x: A Tensor of the same type as "input1".
  2143. * @li mul1_sub: A Tensor of the same type as "input1".
  2144. * @li mul2_x: A Tensor of the same type as "input1".
  2145. * @li mul3_sub1: A Tensor. Must be one of the following types: float16, float32.
  2146. * @li mul4_x: A Tensor of the same type as "input1".
  2147. * @li add2_y: A Tensor of the same type as "input1". \n
  2148. *@par Outputs:
  2149. *Four outputs, including:
  2150. *@li y1: A Tensor. Has the same type as "input_mul3".
  2151. *@li y2: A Tensor. Has the same type as "input_mul3".
  2152. *@li y3: A Tensor. Has the same type as "input_mul3".
  2153. *@li y4: A Tensor. Has the same type as "input_mul3".
  2154. *@par Restrictions:
  2155. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2156. */
  2157. REG_OP(LambNextMV)
  2158. .INPUT(input_mul3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2159. .INPUT(input_mul2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2160. .INPUT(input_realdiv1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2161. .INPUT(input_mul1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2162. .INPUT(input_mul0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2163. .INPUT(input_realdiv0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2164. .INPUT(input_mul4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2165. .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2166. .INPUT(mul1_sub, TensorType({DT_FLOAT16,DT_FLOAT}))
  2167. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2168. .INPUT(mul3_sub1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2169. .INPUT(mul4_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2170. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2171. .OUTPUT(y1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2172. .OUTPUT(y2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2173. .OUTPUT(y3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2174. .OUTPUT(y4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2175. .OP_END_FACTORY_REG(LambNextMV)
  2176. /**
  2177. *@brief A fusion operator for bert lamb. \n
  2178. *@par Inputs:
  2179. *Six inputs, including:
  2180. * @li input_square: A Tensor. Must be one of the following types: float16, float32.
  2181. * @li input_mul2: A Tensor. Must be one of the following types: float16, float32.
  2182. * @li mul2_x: A Tensor. Must be one of the following types: float16, float32.
  2183. * @li mul3_x: A Tensor. Must be one of the following types: float16, float32.
  2184. * @li truediv1_recip: A Tensor. Must be one of the following types: float16, float32.
  2185. * @li add2_y: A Tensor. Must be one of the following types: float16, float32. \n
  2186. *@par Outputs:
  2187. *Two outputs, including:
  2188. * @li y1: A Tensor of the same type as "input_square".
  2189. * @li y2: A Tensor of the same type as "input_square". \n
  2190. *@par Restrictions:
  2191. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2192. */
  2193. REG_OP(LambNextRight)
  2194. .INPUT(input_square, TensorType({DT_FLOAT16,DT_FLOAT}))
  2195. .INPUT(input_mul2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2196. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2197. .INPUT(mul3_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2198. .INPUT(truediv1_recip, TensorType({DT_FLOAT16,DT_FLOAT}))
  2199. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2200. .OUTPUT(y1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2201. .OUTPUT(y2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2202. .OP_END_FACTORY_REG(LambNextRight)
  2203. /**
  2204. *@brief A fusion operator for bert lamb. \n
  2205. *@par Inputs:
  2206. *Six inputs, including:
  2207. * @li input_greater1: A Tensor. Must be one of the following types: float16, float32.
  2208. * @li input_greater_realdiv: A Tensor. Must be one of the following types: float16, float32.
  2209. * @li input_realdiv: A Tensor. Must be one of the following types: float16, float32.
  2210. * @li input_mul0: A Tensor. Must be one of the following types: float16, float32.
  2211. * @li input_mul1: A Tensor. Must be one of the following types: float16, float32.
  2212. * @li input_sub: A Tensor. Must be one of the following types: float16, float32.
  2213. * @li greater_y: A Tensor. Must be one of the following types: float16, float32.
  2214. * @li select_e: A Tensor. Must be one of the following types: float16, float32.
  2215. * @li minimum_y: A Tensor. Must be one of the following types: float16, float32. \n
  2216. *@par Outputs:
  2217. *y: A Tensor of the same type as "input_greater1". \n
  2218. *@par Restrictions:
  2219. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2220. */
  2221. REG_OP(LambUpdateWithLr)
  2222. .INPUT(input_greater1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2223. .INPUT(input_greater_realdiv, TensorType({DT_FLOAT16,DT_FLOAT}))
  2224. .INPUT(input_realdiv, TensorType({DT_FLOAT16,DT_FLOAT}))
  2225. .INPUT(input_mul0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2226. .INPUT(input_mul1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2227. .INPUT(input_sub, TensorType({DT_FLOAT16,DT_FLOAT}))
  2228. .INPUT(greater_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2229. .INPUT(select_e, TensorType({DT_FLOAT16,DT_FLOAT}))
  2230. .INPUT(minimum_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2231. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2232. .OP_END_FACTORY_REG(LambUpdateWithLr)
  2233. /**
  2234. *@brief A fusion operator for bert lamb. \n
  2235. *@par Inputs:
  2236. *Seven inputs, including:
  2237. * @li x1: A Tensor. Must be one of the following types: float16, float32.
  2238. * @li x2: A Tensor. Must be one of the following types: float16, float32.
  2239. * @li x3: A Tensor. Must be one of the following types: float16, float32.
  2240. * @li x4: A Tensor. Must be one of the following types: float16, float32.
  2241. * @li x5: A Tensor. Must be one of the following types: float16, float32.
  2242. * @li greater_y: A Tensor. Must be one of the following types: float16, float32.
  2243. * @li select_e: A Tensor. Must be one of the following types: float16, float32. \n
  2244. *@par Outputs:
  2245. *y: A Tensor of the same type as input. \n
  2246. *@par Restrictions:
  2247. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2248. */
  2249. REG_OP(LambUpdateWithLrV2)
  2250. .INPUT(x1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2251. .INPUT(x2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2252. .INPUT(x3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2253. .INPUT(x4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2254. .INPUT(x5, TensorType({DT_FLOAT16,DT_FLOAT}))
  2255. .INPUT(greater_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2256. .INPUT(select_e, TensorType({DT_FLOAT16,DT_FLOAT}))
  2257. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2258. .OP_END_FACTORY_REG(LambUpdateWithLrV2)
  2259. /**
  2260. *@brief A fusion operator for bert lamb. \n
  2261. *@par Inputs:
  2262. *Eleven inputs, including:
  2263. * @li input0: A Tensor. Must be one of the following types: float16, float32.
  2264. * @li input1: A Tensor. Must be one of the following types: float16, float32.
  2265. * @li input2: A Tensor. Must be one of the following types: float16, float32.
  2266. * @li input3: A Tensor. Must be one of the following types: float16, float32.
  2267. * @li input4: A Tensor. Must be one of the following types: float16, float32.
  2268. * @li mul0_x: A Tensor. Must be one of the following types: float16, float32.
  2269. * @li mul1_x: A Tensor. Must be one of the following types: float16, float32.
  2270. * @li mul2_x: A Tensor. Must be one of the following types: float16, float32.
  2271. * @li mul3_x: A Tensor. Must be one of the following types: float16, float32.
  2272. * @li mul4_x: A Tensor. Must be one of the following types: float16, float32.
  2273. * @li add2_y: A Tensor. Must be one of the following types: float16, float32. \n
  2274. *@par Outputs:
  2275. *Three outputs, including:
  2276. * @li output0: A Tensor. Must be one of the following types: float16, float32.
  2277. * @li output1: A Tensor. Must be one of the following types: float16, float32.
  2278. * @li output2: A Tensor. Must be one of the following types: float16, float32. \n
  2279. *@par Restrictions:
  2280. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2281. */
  2282. REG_OP(AdamApplyOneWithDecay)
  2283. .INPUT(input0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2284. .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2285. .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2286. .INPUT(input3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2287. .INPUT(input4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2288. .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2289. .INPUT(mul1_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2290. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2291. .INPUT(mul3_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2292. .INPUT(mul4_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2293. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2294. .OUTPUT(output0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2295. .OUTPUT(output1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2296. .OUTPUT(output2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2297. .OP_END_FACTORY_REG(AdamApplyOneWithDecay)
  2298. /**
  2299. *@brief A fusion operator for bert lamb. \n
  2300. *@par Inputs:
  2301. *Ten inputs, including:
  2302. * @li input0: A Tensor. Must be one of the following types: float16, float32.
  2303. * @li input1: A Tensor. Must be one of the following types: float16, float32.
  2304. * @li input2: A Tensor. Must be one of the following types: float16, float32.
  2305. * @li input3: A Tensor. Must be one of the following types: float16, float32.
  2306. * @li input4: A Tensor. Must be one of the following types: float16, float32.
  2307. * @li mul0_x: A Tensor. Must be one of the following types: float16, float32.
  2308. * @li mul1_x: A Tensor. Must be one of the following types: float16, float32.
  2309. * @li mul2_x: A Tensor. Must be one of the following types: float16, float32.
  2310. * @li mul3_x: A Tensor. Must be one of the following types: float16, float32.
  2311. * @li add2_y: A Tensor. Must be one of the following types: float16, float32. \n
  2312. *@par Outputs:
  2313. *Three outputs, including:
  2314. * @li output0: A Tensor. Must be one of the following types: float16, float32.
  2315. * @li output1: A Tensor. Must be one of the following types: float16, float32.
  2316. * @li output2: A Tensor. Must be one of the following types: float16, float32. \n
  2317. *@par Restrictions:
  2318. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2319. */
  2320. REG_OP(AdamApplyOne)
  2321. .INPUT(input0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2322. .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2323. .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2324. .INPUT(input3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2325. .INPUT(input4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2326. .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2327. .INPUT(mul1_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2328. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2329. .INPUT(mul3_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2330. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2331. .OUTPUT(output0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2332. .OUTPUT(output1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2333. .OUTPUT(output2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2334. .OP_END_FACTORY_REG(AdamApplyOne)
  2335. /**
  2336. *@brief A fusion operator for bert lamb. \n
  2337. *@par Inputs:
  2338. *Eleven inputs, including:
  2339. * @li input0: A Tensor. Must be one of the following types: float16, float32.
  2340. * @li input1: A Tensor. Must be one of the following types: float16, float32.
  2341. * @li input2: A Tensor. Must be one of the following types: float16, float32.
  2342. * @li input3: A Tensor. Must be one of the following types: float16, float32.
  2343. * @li input4: A Tensor. Must be one of the following types: float16, float32.
  2344. * @li mul0_x: A Tensor. Must be one of the following types: float16, float32.
  2345. * @li mul1_x: A Tensor. Must be one of the following types: float16, float32.
  2346. * @li mul2_x: A Tensor. Must be one of the following types: float16, float32.
  2347. * @li mul3_x: A Tensor. Must be one of the following types: float16, float32.
  2348. * @li mul4_x: A Tensor. Must be one of the following types: float16, float32.
  2349. * @li add2_y: A Tensor. Must be one of the following types: float16, float32. \n
  2350. *@par Outputs:
  2351. *Three outputs, including:
  2352. * @li output0: A Tensor. Must be one of the following types: float16, float32.
  2353. * @li output1: A Tensor. Must be one of the following types: float16, float32.
  2354. * @li output2: A Tensor. Must be one of the following types: float16, float32. \n
  2355. *@par Restrictions:
  2356. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2357. */
  2358. REG_OP(AdamApplyOneWithDecayAssign)
  2359. .INPUT(input0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2360. .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2361. .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2362. .INPUT(input3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2363. .INPUT(input4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2364. .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2365. .INPUT(mul1_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2366. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2367. .INPUT(mul3_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2368. .INPUT(mul4_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2369. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2370. .OUTPUT(output0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2371. .OUTPUT(output1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2372. .OUTPUT(output2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2373. .OP_END_FACTORY_REG(AdamApplyOneWithDecayAssign)
  2374. /**
  2375. *@brief A fusion operator for bert lamb. \n
  2376. *@par Inputs:
  2377. *Ten inputs, including:
  2378. * @li input0: A Tensor. Must be one of the following types: float16, float32.
  2379. * @li input1: A Tensor. Must be one of the following types: float16, float32.
  2380. * @li input2: A Tensor. Must be one of the following types: float16, float32.
  2381. * @li input3: A Tensor. Must be one of the following types: float16, float32.
  2382. * @li input4: A Tensor. Must be one of the following types: float16, float32.
  2383. * @li mul0_x: A Tensor. Must be one of the following types: float16, float32.
  2384. * @li mul1_x: A Tensor. Must be one of the following types: float16, float32.
  2385. * @li mul2_x: A Tensor. Must be one of the following types: float16, float32.
  2386. * @li mul3_x: A Tensor. Must be one of the following types: float16, float32.
  2387. * @li add2_y: A Tensor. Must be one of the following types: float16, float32. \n
  2388. *@par Outputs:
  2389. *Three outputs, including:
  2390. * @li output0: A Tensor. Must be one of the following types: float16, float32.
  2391. * @li output1: A Tensor. Must be one of the following types: float16, float32.
  2392. * @li output2: A Tensor. Must be one of the following types: float16, float32. \n
  2393. *@par Restrictions:
  2394. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2395. */
  2396. REG_OP(AdamApplyOneAssign)
  2397. .INPUT(input0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2398. .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2399. .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2400. .INPUT(input3, TensorType({DT_FLOAT16,DT_FLOAT}))
  2401. .INPUT(input4, TensorType({DT_FLOAT16,DT_FLOAT}))
  2402. .INPUT(mul0_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2403. .INPUT(mul1_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2404. .INPUT(mul2_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2405. .INPUT(mul3_x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2406. .INPUT(add2_y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2407. .OUTPUT(output0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2408. .OUTPUT(output1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2409. .OUTPUT(output2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2410. .OP_END_FACTORY_REG(AdamApplyOneAssign)
  2411. /**
  2412. *@brief Confuse select, maximum, greater and sqrt. \n
  2413. *@par Inputs:
  2414. *Four inputs, including:
  2415. * @li x: A Tensor. Must be one of the following types: float16, float32.
  2416. * @li greater_zeros: A Tensor. Must be one of the following types: float16, float32.
  2417. * @li select_ones: A Tensor. Must be one of the following types: float16, float32.
  2418. * @li maximum_ones: A Tensor. Must be one of the following types: float16, float32. \n
  2419. *@par Outputs:
  2420. *y: A Tensor of the same type as "x". \n
  2421. *@par Restrictions:
  2422. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2423. */
  2424. REG_OP(ClipByNormNoDivSum)
  2425. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2426. .INPUT(greater_zeros, TensorType({DT_FLOAT16,DT_FLOAT}))
  2427. .INPUT(select_ones, TensorType({DT_FLOAT16,DT_FLOAT}))
  2428. .INPUT(maximum_ones, TensorType({DT_FLOAT16,DT_FLOAT}))
  2429. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2430. .OP_END_FACTORY_REG(ClipByNormNoDivSum)
  2431. /**
  2432. *@brief Confuse reducesumd and square. \n
  2433. *@par Inputs:
  2434. *x: A Tensor of type float16, float32. \n
  2435. *@par Attributes:
  2436. * Two attributes, including: \n
  2437. *@li axis: A optional listint, specifies the dimensions to reduce.
  2438. *@li keep_dims: A bool, specifying whether to keep dimensions for the output Tensor. Defaults to "false". \n
  2439. *@par Outputs:
  2440. *Two outputs, including: \n
  2441. *@li y1: A Tensor. Has the same type as "x".
  2442. *@li y2: A Tensor. Has the same type as "x".
  2443. *@par Restrictions:
  2444. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2445. */
  2446. REG_OP(SquareSumV2)
  2447. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2448. .OUTPUT(y1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2449. .OUTPUT(y2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2450. .REQUIRED_ATTR(axis, ListInt)
  2451. .ATTR(keep_dims, Bool, false)
  2452. .OP_END_FACTORY_REG(SquareSumV2)
  2453. /**
  2454. *@brief Confuse reducesumd and square. \n
  2455. *@par Inputs:
  2456. *x: A Tensor of type float16, float32. \n
  2457. *@par Attributes:
  2458. * Two attributes, including: \n
  2459. *@li axis: A optional listint, specifies the dimensions to reduce.
  2460. *@li keep_dims: A bool, specifying whether to keep dimensions for the output Tensor. Defaults to "false". \n
  2461. *@par Outputs:
  2462. y: A Tensor. Has the same type as "x".
  2463. *@par Restrictions:
  2464. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2465. */
  2466. REG_OP(SquareSumV1)
  2467. .INPUT(x, TensorType({DT_FLOAT16,DT_FLOAT}))
  2468. .OUTPUT(y, TensorType({DT_FLOAT16,DT_FLOAT}))
  2469. .REQUIRED_ATTR(axis, ListInt)
  2470. .ATTR(keep_dims, Bool, false)
  2471. .OP_END_FACTORY_REG(SquareSumV1)
  2472. /**
  2473. *@brief Calculate square of Tensor and then reducesum
  2474. *@par Inputs:
  2475. *x1: A Tensor of type float32.
  2476. *x2: A Tensor of type float32. \n
  2477. *@par Outputs:
  2478. y1: A Tensor. Has the same type as "x1".The result of "x1".
  2479. y2: A Tensor. Has the same type as "x2".The result of "x2".
  2480. *@par Restrictions:
  2481. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2482. */
  2483. REG_OP(SquareSumAll)
  2484. .INPUT(x1, TensorType({DT_FLOAT}))
  2485. .INPUT(x2, TensorType({DT_FLOAT}))
  2486. .OUTPUT(y1, TensorType({DT_FLOAT}))
  2487. .OUTPUT(y2, TensorType({DT_FLOAT}))
  2488. .OP_END_FACTORY_REG(SquareSumAll)
  2489. /**
  2490. *@brief Confuse broadcast, addn and mul. \n
  2491. *@par Inputs:
  2492. *Three inputs, including:
  2493. * @li x1: A Tensor. Must be one of the following types:int32, int16, float16, float32.
  2494. * @li x2: A Tensor of the same type as "x1".
  2495. * @li x3: A Tensor of the same type as "x1". \n
  2496. *@par Outputs:
  2497. * y: A Tensor. Has the same type as "x1".
  2498. *@par Restrictions:
  2499. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2500. */
  2501. REG_OP(FusedMulAddN)
  2502. .INPUT(x1, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  2503. .INPUT(x2, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  2504. .INPUT(x3, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  2505. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16, DT_INT32, DT_INT16}))
  2506. .OP_END_FACTORY_REG(FusedMulAddN)
  2507. /**
  2508. *@brief Add 'bias' to 'x'. \n
  2509. *@par Inputs:
  2510. * Two inputs, including:
  2511. *@li x: An ND tensor of type float16 or float32.
  2512. *@li bias: An ND tensor of type float16 or float32. \n
  2513. *@par Attributes:
  2514. *@li axis: An optional int32 used to compute the shape of bias input from the
  2515. online bottoms. Defaults to "1".
  2516. *@li num_axes: An optional int32 used to compute the shape of bias input from a
  2517. Caffe model trained offline. Defaults to "1".
  2518. *@li bias_from_blob: An optional bool. If "true", bias is input from a Caffe
  2519. model trained offline. If "false", bias is input from online bottoms. Defaults
  2520. to "true". \n
  2521. *@par Outputs:
  2522. *y: An ND tensor of type float16 or float32. \n
  2523. *@attention Constraints:\n
  2524. * Assume that the shape length of "x" is "n" and that of "bias" is "m".
  2525. *@li "axis" is within the range [-n, n-1]. num_axes >= -1.
  2526. *@li If "bias_from_blob = true", "num_axes = -1", and "axis >= 0", the ith axis
  2527. of "bias" and the (i+"axis")th axis of "x" must have the same size (0 <= i <
  2528. n-axis).\n
  2529. * If "axis < 0", the ith axis of "bias" and the (i+n+"axis")th axis of "x" must
  2530. have the same size (0 <= i < -axis).
  2531. *@li If "bias_from_blob = true" and "num_axes = 0", "bias" is a scalar with
  2532. shape length 1 and dimension size 1.
  2533. *@li If "bias_from_blob = true", "num_axes > 0, and "axis >= 0", "axis +
  2534. num_axes" must be less than or equal to "n" and the ith axis of "bias" and the
  2535. (i+"axis")th axis of "x" must have the same size (0 <= i < num_axes).\n
  2536. * If "axis < 0", "n + axis + num_axes" must be less than or equal to "n" and
  2537. the ith axis of "bias" and the (i+n+"axis")th axis of "x" must have the same
  2538. size (0 <= i < num_axes).
  2539. *@li If "bias_from_blob = false", "bias" is not a scalar, and "axis >= 0","axis
  2540. + m" must be less than or equal to "n" and the ith axis of "bias" and the (i
  2541. +"axis")th axis of "x" must have the same size (0 <= i < m).\n
  2542. * If "axis < 0", "n + axis + m" must be less than or equal to "n" and the ith
  2543. axis of "bias" and the (i+n+"axis")th axis of "x" must have the same size (0 <=
  2544. i < m).
  2545. *@par Third-party framework compatibility
  2546. * Compatible with the Caffe operator Bias.
  2547. */
  2548. REG_OP(Bias)
  2549. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16})) /* "First operand." */
  2550. .INPUT(bias, TensorType({DT_FLOAT, DT_FLOAT16})) /* "Second operand." */
  2551. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16})) /* "Result, has same element type as x" */
  2552. .ATTR(axis, Int, 1)
  2553. .ATTR(num_axes, Int, 1)
  2554. .ATTR(bias_from_blob, Bool, true)
  2555. .OP_END_FACTORY_REG(Bias)
  2556. /**
  2557. *@brief Function multiply gradients calculation.
  2558. output0 is the result of which input0 dot multily input1.
  2559. output1 is the result of which input0 dot multily input1, then reducesum it. \n
  2560. *@par Inputs:
  2561. *@li input0: A Tensor of input of mul, and dtype supports float16, float32.
  2562. *@li input1: A Tensor of input of mul and mul_1, and dtype supports float16, float32.
  2563. *@li input2: A Tensor of input of mul_1, and dtype supports float16, float32. \n
  2564. *@par Attributes:
  2565. *@li axes: The dimensions to reduce. Default:(), reduce all dimensions. \n
  2566. Only constant value is allowed.
  2567. *@li keep_dims: If true, keep these reduced dimensions and the length is 1. \n
  2568. If false, don’t keep these dimensions. Default:False. \n
  2569. *@par Outputs:
  2570. *@li output0: A Tensor result of which input0 dot multily input1.
  2571. *@li output1: A Tensor result of which input0 dot multily input1, then reducesum it.
  2572. *@par Restrictions:
  2573. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2574. */
  2575. REG_OP(ConfusionMulGrad)
  2576. .INPUT(input0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2577. .INPUT(input1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2578. .INPUT(input2, TensorType({DT_FLOAT16,DT_FLOAT}))
  2579. .OUTPUT(output0, TensorType({DT_FLOAT16,DT_FLOAT}))
  2580. .OUTPUT(output1, TensorType({DT_FLOAT16,DT_FLOAT}))
  2581. .ATTR(axes, ListInt, {})
  2582. .ATTR(keep_dims, Bool, false)
  2583. .OP_END_FACTORY_REG(ConfusionMulGrad)
  2584. /**
  2585. *@brief Function fused multiply l2 loss calculation. \n
  2586. *@par Inputs:
  2587. *@li x1: A Tensor of type float16, float32.
  2588. *@li x2: A Tensor of type float16, float32.
  2589. *@li x3: A Tensor of type float16, float32. \n
  2590. *@par Outputs:
  2591. *@li y1: A Tensor of shape and dtype of first output, which should have \n
  2592. shape (1,) and dtype as input.
  2593. *@li y2: A Tensor of shape and dtype of second output, should be same shape and type as input.
  2594. *@par Restrictions:
  2595. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2596. */
  2597. REG_OP(FusedMulAddNL2loss)
  2598. .INPUT(x1, TensorType::NumberType())
  2599. .INPUT(x2, TensorType::NumberType())
  2600. .INPUT(x3, TensorType::NumberType())
  2601. .OUTPUT(y1, TensorType::NumberType())
  2602. .OUTPUT(y2, TensorType::NumberType())
  2603. .OP_END_FACTORY_REG(FusedMulAddNL2loss)
  2604. /**
  2605. *@brief Tests whether the input exceeds a threshold. \n
  2606. *@par Inputs:
  2607. *@li x: A Tensor with any format. Must be one of the following types: float16, float32. \n
  2608. *@par Attributes:
  2609. *@li threshold: A required float32. Defaults to "0.0". "x" is compared with
  2610. "threshold", outputs "1" for inputs above threshold; "0" otherwise. \n
  2611. *@par Outputs:
  2612. *@li y: A Tensor with any format. Has the same type as the input. Must be one
  2613. of the following types: float16, float32.
  2614. *@par Third-party framework compatibility
  2615. * Compatible with the Caffe operator Threshold.
  2616. */
  2617. REG_OP(Threshold)
  2618. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
  2619. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  2620. .ATTR(threshold, Float, 0.0)
  2621. .OP_END_FACTORY_REG(Threshold);
  2622. /**
  2623. *@brief Returns the index number corresponding to the maximum value entered. \n
  2624. *@par Inputs:
  2625. *@li x: A tensor. Must be one of the following types: float16, float32. \n
  2626. *@par Attributes:
  2627. *@li axis: An optional int. Specify the axis to be cut at the input tensor. If
  2628. this parameter is not provided, find the topk for each batch. Defaults to 10000
  2629. *@li out_max_val: An optional bool. Whether to output the maximum value. If it
  2630. is True, the maximum value and index are output, otherwise only the index is
  2631. output.
  2632. * Defaults to False
  2633. *@li topk: An optional int. It means the number of top tok in each axis (the
  2634. value is greater than or equal to 1), and the value range must be in [1,x.shape
  2635. (axis)].
  2636. * Defaults to 1 \n
  2637. *@par Outputs:
  2638. *@li indices: A tensor of type float16, float32, int32. The index of the maximum value of the output.
  2639. *@li values: A tensor of type float16, float32.Output tensor, including maximum index or maximum value.
  2640. *@par Third-party framework compatibility
  2641. * Compatible with the Caffe operator ArgMax.
  2642. */
  2643. REG_OP(ArgMaxWithK)
  2644. .INPUT(x, TensorType({DT_FLOAT, DT_FLOAT16}))
  2645. .OUTPUT(indices, TensorType({DT_INT32, DT_FLOAT, DT_FLOAT16}))
  2646. .OUTPUT(values, TensorType({DT_FLOAT, DT_FLOAT16}))
  2647. .ATTR(axis, Int, 10000)
  2648. .ATTR(out_max_val, Bool, false)
  2649. .ATTR(topk, Int, 1)
  2650. .OP_END_FACTORY_REG(ArgMaxWithK)
  2651. /**
  2652. *@brief Multiply tensor with scale. \n
  2653. *@par Inputs:
  2654. *Five inputs, including:
  2655. * @li x1: A Tensor. Must be one of the following types:int32,int16, float16, float32.
  2656. * @li x2: A scale. Must be float. \n
  2657. *@par Outputs:
  2658. *@li y: A Tensor. Has the same type and shape as "x1". \n
  2659. *@par Third-party framework compatibility:
  2660. * Compatible with the Pytorch operator muls.
  2661. */
  2662. REG_OP(Muls)
  2663. .INPUT(x, TensorType({DT_FLOAT,DT_INT16,DT_INT32,DT_FLOAT16}))
  2664. .OUTPUT(y, TensorType({DT_FLOAT,DT_INT16,DT_INT32,DT_FLOAT16}))
  2665. .REQUIRED_ATTR(value, Float)
  2666. .OP_END_FACTORY_REG(Muls)
  2667. /**
  2668. *@brief Fill tensor with scale. \n
  2669. *@par Inputs:
  2670. *Five inputs, including:
  2671. * @li x1: A Tensor. Must be one of the following types:int32,int16, float16, float32.
  2672. * @li x2: A scale. Must be float. \n
  2673. *@par Outputs:
  2674. *@li y: A Tensor. Has the same type and shape as "x1". \n
  2675. *@par Third-party framework compatibility:
  2676. * Compatible with the Pytorch operator fills.
  2677. */
  2678. REG_OP(Fills)
  2679. .INPUT(x, TensorType({DT_FLOAT,DT_INT16,DT_INT32,DT_FLOAT16}))
  2680. .OUTPUT(y, TensorType({DT_FLOAT,DT_INT16,DT_INT32,DT_FLOAT16}))
  2681. .REQUIRED_ATTR(value,Float)
  2682. .OP_END_FACTORY_REG(Fills)
  2683. /**
  2684. *@brief Add tensor with scale. \n
  2685. *@par Inputs:
  2686. *Five inputs, including:
  2687. * @li x1: A Tensor. Must be one of the following types:int32,int16, float16, float32.
  2688. * @li x2: A scale. Must be float. \n
  2689. *@par Outputs:
  2690. *@li y: A Tensor. Has the same type and shape as "x1". \n
  2691. *@par Third-party framework compatibility:
  2692. * Compatible with the Pytorch operator adds.
  2693. */
  2694. REG_OP(Adds)
  2695. .INPUT(x, TensorType({DT_FLOAT,DT_INT16,DT_INT32,DT_FLOAT16}))
  2696. .OUTPUT(y, TensorType({DT_FLOAT,DT_INT16,DT_INT32,DT_FLOAT16}))
  2697. .REQUIRED_ATTR(value,Float)
  2698. .OP_END_FACTORY_REG(Adds)
  2699. /**
  2700. *@brief Computes the product of x and y and returns 0 if the y is zero, even if x is NaN or infinite. \n
  2701. *@par Inputs:
  2702. * @li x1: A Tensor. Must be one of the following types:float16, float32, double, complex64, complex128.
  2703. * @li x2: A Tensor. Has the same type and shape as "x1". \n
  2704. *@par Outputs:
  2705. *y: A Tensor. Has the same type and shape as "x1". \n
  2706. *@par Third-party framework compatibility:
  2707. * Compatible with the TensorFlow operator MulNoNan.
  2708. */
  2709. REG_OP(MulNoNan)
  2710. .INPUT(x1, TensorType::NumberType()) /* "First operand." */
  2711. .INPUT(x2, TensorType::NumberType()) /* "Second operand." */
  2712. .OUTPUT(y, TensorType::NumberType()) /* "Result, has same element type as two inputs" */
  2713. .OP_END_FACTORY_REG(MulNoNan)
  2714. /**
  2715. *@brief Add tensor with scale. \n
  2716. *@par Inputs:
  2717. * @li x1: A Tensor dtype of int32, float16, float32.
  2718. * @li x2: A Tensor dtype of int32, float16, float32. \n
  2719. *@par Attributes:
  2720. *alpha: Float scalar apply to x2:x2*alpha
  2721. *@par Outputs:
  2722. *y: A Tensor. should be same shape and type as "x1". \n
  2723. *@par Third-party framework compatibility:
  2724. * Compatible with the Pytorch operator Axpy.
  2725. */
  2726. REG_OP(Axpy)
  2727. .INPUT(x1, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16}))
  2728. .INPUT(x2, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16}))
  2729. .OUTPUT(y, TensorType({DT_FLOAT, DT_INT32, DT_FLOAT16}))
  2730. .REQUIRED_ATTR(alpha, Float)
  2731. .OP_END_FACTORY_REG(Axpy)
  2732. /**
  2733. *@brief Creates a criterion that measures the loss given input tensors x1 x2
  2734. and a Tensor label y with values 1 or -1. \n
  2735. *@par Inputs:
  2736. *@li x1: A ND Tensor with one of the following types: int8, uint8, int32, float16, float32.
  2737. *@li x2: A ND Tensor with one of the following types: int8, uint8, int32, float16, float32.
  2738. *@li target: A ND Tensor with one of the following types: int8, int32, float16, float32. \n
  2739. *@par Attributes:
  2740. *@li margin: A optional float32. Defaults to "0.0".
  2741. *@li reduction: A optional string. Defaults to "mean". \n
  2742. *@par Outputs:
  2743. *@li y: A ND Tensor with Must be float32.
  2744. *@par Third-party framework compatibility
  2745. * Compatible with the PyTorch operator CosineEmbeddingLoss.
  2746. */
  2747. REG_OP(CosineEmbeddingLoss)
  2748. .INPUT(x1, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  2749. .INPUT(x2, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  2750. .INPUT(target, TensorType({DT_INT8, DT_UINT8, DT_INT16, DT_INT32, DT_INT64, DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  2751. .ATTR(margin, Float, 0)
  2752. .ATTR(reduction, String, "mean")
  2753. .OUTPUT(y, TensorType({DT_FLOAT}))
  2754. .OP_END_FACTORY_REG(CosineEmbeddingLoss)
  2755. /**
  2756. *@brief Kullback-Leibler divergence. \n
  2757. *@par Inputs:
  2758. * Two inputs, including:
  2759. *@li x: Tensor of arbitrary shape.
  2760. *@li target: Tensor of the same shape and dtype as x. \n
  2761. *@par Attributes:
  2762. *reduction: An required "string", Specifies the reduction to apply to the output;
  2763. * Reduction only supports the two modes of "sum" and "batchmean". \n
  2764. *@par Outputs:
  2765. *y: A ND Tensor of the same dtype as x.
  2766. *@par Third-party framework compatibility
  2767. *Compatible with the PyTorch operator kl_div.
  2768. */
  2769. REG_OP(KLDiv)
  2770. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  2771. .INPUT(target, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  2772. .REQUIRED_ATTR(reduction, String)
  2773. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_DOUBLE}))
  2774. .OP_END_FACTORY_REG(KLDiv)
  2775. /**
  2776. *@brief copy data from x to y.. \n
  2777. *@par Inputs:
  2778. *One inputs, including:
  2779. * @li x: A Tensor. Must be one of the following types: float16, float32, int8, uint8, int32, bool. \n
  2780. *@par Outputs:
  2781. *y: A Tensor. Has the same type as "x". \n
  2782. *@par Third-party framework compatibility
  2783. *@par Restrictions:
  2784. *Warning: THIS FUNCTION IS EXPERIMENTAL. Please do not use.
  2785. */
  2786. REG_OP(TensorMove)
  2787. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8, DT_BOOL}))
  2788. .OUTPUT(y, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT32, DT_INT8, DT_UINT8, DT_BOOL}))
  2789. .OP_END_FACTORY_REG(TensorMove)
  2790. /**
  2791. *@brief copy data from x to x. \n
  2792. *@par Inputs:
  2793. *One inputs, including:
  2794. * @li x: A Tensor. Must be one of the following types: float16, float32, int8, uint8, int16, uint16, int32, uint32, int64, uint64. \n
  2795. *@par Outputs:
  2796. *output_x: A Tensor. Has the same type as "x". \n
  2797. *@par Third-party framework compatibility
  2798. */
  2799. REG_OP(TensorRedirect)
  2800. .INPUT(x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8,
  2801. DT_INT64, DT_INT16, DT_UINT16, DT_UINT64, DT_UINT32}))
  2802. .OUTPUT(output_x, TensorType({DT_FLOAT16, DT_FLOAT, DT_INT8, DT_INT32, DT_UINT8,
  2803. DT_INT64, DT_INT16, DT_UINT16, DT_UINT64, DT_UINT32}))
  2804. .OP_END_FACTORY_REG(TensorRedirect)
  2805. } // namespace ge
  2806. #endif // GE_OP_ELEWISE_CALCULATION_OPS_H

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