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 134 kB

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

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