| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860 |
- #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
- // Copyright (c) Facebook, Inc. and its affiliates.
- // All rights reserved.
- //
- // Copyright 2019 Google LLC
- //
- // This source code is licensed under the BSD-style license found in the
- // LICENSE file in the root directory of this source tree.
- #pragma once
- #include <stdbool.h>
- #include <stddef.h>
- #include <stdint.h>
- #include "pthreadpool.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- /// The number of bytes XNNPACK may read beyond array bounds.
- /// The caller must allocate at least this many extra bytes after the tensor data passed to XNNPACK.
- ///
- /// Note: XNNPACK reads, but never writes beyond array bounds.
- #if XNN_ARCH_HEXAGON
- #define XNN_EXTRA_BYTES 128
- #else
- #define XNN_EXTRA_BYTES 16
- #endif // XNN_ARCH_HEXAGON
- /// Maximum number of dimensions in tensor shape.
- #define XNN_MAX_TENSOR_DIMS 6
- /// A value ID that cannot be valid.
- #define XNN_INVALID_VALUE_ID UINT32_MAX
- /// Allow sparse inference in a Runtime.
- ///
- /// Note: this flag is a hint to XNNPACK that it should consider sparse inference, but does not guarantee it.
- #define XNN_FLAG_HINT_SPARSE_INFERENCE 0x00000001
- /// Allow IEEE FP16 inference in a Runtime.
- ///
- /// Note: this flag hints XNNPACK to consider IEEE FP16 inference, but does not guarantee it.
- #define XNN_FLAG_HINT_FP16_INFERENCE 0x00000002
- /// Force IEEE FP16 inference in a Runtime, and fail if FP16 inference is not possible.
- ///
- /// Note: this flag guarantees that XNNPACK will use IEEE FP16 inference, or fail to create the Runtime object.
- /// Warning: on x86 systems FP16 computations will be emulated at a substantial performance cost.
- #define XNN_FLAG_FORCE_FP16_INFERENCE 0x00000004
- /// Enable timing of each operator's runtime.
- #define XNN_FLAG_BASIC_PROFILING 0x00000008
- /// Enable the just-in-time compiler.
- #define XNN_FLAG_JIT 0x00000010
- /// The convolution operator represents a depthwise convolution, and use HWGo layout for filters.
- #define XNN_FLAG_DEPTHWISE_CONVOLUTION 0x00000001
- /// Assume transposed weights in a fully connected operator.
- #define XNN_FLAG_TRANSPOSE_WEIGHTS 0x00000001
- /// The operator assumes NHWC layout for the input, regardless of the output layout.
- #define XNN_FLAG_INPUT_NHWC 0x00000002
- /// Match "SAME" padding in TensorFlow. Exact padding values are computed dynamically depending on input size.
- #define XNN_FLAG_TENSORFLOW_SAME_PADDING 0x00000004
- /// Assume transposed weights in a batch matrix multiply operator.
- #define XNN_FLAG_TRANSPOSE_B XNN_FLAG_TRANSPOSE_WEIGHTS
- /// Assume transposed input in a batch matrix multiply operator.
- #define XNN_FLAG_TRANSPOSE_A 0x00000002
- /// Implicitly flatten and reshape input of a Fully Connected operator into a 2D tensor.
- #define XNN_FLAG_TENSORFLOW_RESHAPE_2D 0x00000004
- /// Match behaviour of TensorFlow 1.x.
- #define XNN_FLAG_TENSORFLOW_LEGACY_MODE 0x00000004
- /// Static weights of the FP16 operator are in FP32 format.
- #define XNN_FLAG_FP32_STATIC_WEIGHTS 0x00000008
- /// Static biases of the FP16 operator are in FP32 format.
- #define XNN_FLAG_FP32_STATIC_BIASES 0x00000080
- /// Align corners of input and output images in resize operations.
- #define XNN_FLAG_ALIGN_CORNERS 0x00000008
- /// Yield worker threads of the thread pool to the system scheduler after the inference.
- #define XNN_FLAG_YIELD_WORKERS 0x00000010
- /// Use transient indirection buffer to reduce memory footprint
- #define XNN_FLAG_TRANSIENT_INDIRECTION_BUFFER 0x00000020
- /// Retain reduced dimensions with length 1.
- #define XNN_FLAG_KEEP_DIMS 0x00000040
- // Next unused flag value: 0x00000100.
- /// The number of entries in an array of xnn_quantization_params that XNNPACK may read beyond array bounds.
- /// The caller must allocate at least this many extra xnn_quantization_params before passing the array to XNNPACK.
- ///
- /// Note: XNNPACK reads, but never writes beyond array bounds.
- #define XNN_EXTRA_QUANTIZATION_PARAMS 15
- /// The minimum blocksize for blockwise quantized operators.
- #define XNN_MIN_BLOCKSIZE 32
- #ifdef __GNUC__
- #define XNN_DEPRECATED __attribute__((deprecated))
- #else
- #define XNN_DEPRECATED
- #endif
- struct xnn_quantization_params {
- int32_t zero_point;
- float scale;
- };
- /// Status code for any XNNPACK function call.
- enum xnn_status {
- /// The call succeeded, and all output arguments now contain valid data.
- xnn_status_success = 0,
- xnn_status_uninitialized = 1,
- xnn_status_invalid_parameter = 2,
- xnn_status_invalid_state = 3,
- xnn_status_unsupported_parameter = 4,
- xnn_status_unsupported_hardware = 5,
- xnn_status_out_of_memory = 6,
- xnn_status_reallocation_required = 7,
- xnn_status_deprecated = 8,
- };
- struct xnn_allocator {
- /// User-specified pointer that will be passed as-is to all functions in this structure.
- void* context;
- /// Pointer to a function to be called for general memory allocation.
- ///
- /// @param context - The user-specified pointer from xnn_allocator structure.
- /// @param size - The size of the memory block to allocate, in bytes.
- ///
- /// @returns Pointer to the allocated memory block of at least @ref size bytes.
- /// If allocation fails, the function must return NULL.
- void* (*allocate)(void* context, size_t size);
- /// Pointer to a function to be called for general memory re-allocation, i.e. to increase or shrink a previously
- /// allocated memory block. The content of the old memory block is copied to the new memory block.
- ///
- /// @param context - The user-specified pointer from xnn_allocator structure.
- /// @param pointer - Pointer to a memory block allocated by @ref allocate or @ref reallocate functions. Can be NULL.
- /// If the pointer is NULL, the @ref reallocate call is equivalent to an @ref allocate call.
- /// @param size - The new size of the memory block to allocate, in bytes.
- ///
- /// @returns Pointer to the newly allocated memory block of at least @ref size bytes with the content of the previous
- /// memory block.
- /// If allocation fails, the function must return NULL, but must not release the previous memory block.
- void* (*reallocate)(void* context, void* pointer, size_t size);
- /// Pointer to a function to be called for general memory de-allocation.
- ///
- /// @param context - The user-specified pointer from xnn_allocator structure.
- /// @param pointer - Pointer to a memory block allocated by @ref allocate or @ref reallocate functions. Can be NULL.
- /// If the pointer is NULL, the @ref deallocate call is a no-op.
- void (*deallocate)(void* context, void* pointer);
- /// Pointer to a function to be called for aligned memory allocation.
- ///
- /// @param context - The user-specified pointer from xnn_allocator structure.
- /// @param alignment - The alignment of the memory block to allocate, in bytes. Alignment is always a power-of-2.
- /// @param size - The size of the memory block to allocate, in bytes.
- ///
- /// @returns Pointer to the allocated memory block of at least @ref size bytes.
- /// If allocation fails, the function must return NULL.
- void* (*aligned_allocate)(void* context, size_t alignment, size_t size);
- /// Pointer to a function to be called for aligned memory deallocation.
- ///
- /// @param context - The user-specified pointer from xnn_allocator structure.
- /// @param pointer - Pointer to a memory block allocated by @ref aligned_allocate function. Can be NULL.
- /// If the pointer is NULL, the @ref aligned_deallocate call is a no-op.
- void (*aligned_deallocate)(void* context, void* pointer);
- };
- /// Initialize XNNPACK library.
- ///
- /// XNNPACK must be successfully initialized before use. During initialization, XNNPACK populates internal structures
- /// depending on the host processor. Initialization can be time-consuming.
- ///
- /// @param[in] allocator - structure with function pointers to be use for memory allocation and de-allocation.
- /// If this argument is NULL, system-provided memory management functions (e.g. malloc/free)
- /// will be used.
- ///
- /// @retval xnn_status_success - XNNPACK is successfully initialized and ready to use.
- /// @retval xnn_status_out_of_memory - initialization failed due to out-of-memory condition.
- /// @retval xnn_status_unsupported_hardware - initialization failed because the host processor does not satisfy the
- /// minimum hardware requirements for XNNPACK. E.g. this may happen on x86
- /// processors without SSE2 extension, or on 32-bit ARM processors without
- /// the NEON SIMD extension.
- enum xnn_status xnn_initialize(const struct xnn_allocator* allocator);
- /// Deinitialize XNNPACK library.
- ///
- /// To avoid memory and resource leaks, users must call xnn_deinitialize once for each successful xnn_initialize call.
- ///
- /// @retval xnn_status_success - deinitialization call succeeded.
- enum xnn_status xnn_deinitialize(void);
- /// Get the microkernel implementation build identifier's data.
- ///
- /// That identifier will be unique for the current set of microkernels implementations.
- ///
- /// @returns A pointer to the current identifier's data.
- const void* xnn_experimental_get_build_identifier_data();
- /// Get the microkernel implementation build identifier's data size.
- ///
- /// @returns The size in bytes of the identifier's data.
- size_t xnn_experimental_get_build_identifier_size();
- /// Check whether the given data matches this version's identifier.
- ///
- /// @returns The size in bytes of the identifier's data.
- bool xnn_experimental_check_build_identifier(const void* data, size_t size);
- /// Subgraph is an abstract representation of a neural network model.
- /// Subgraph objects are used to define Values (tensors) and Nodes (operators) comprising the model.
- typedef struct xnn_subgraph* xnn_subgraph_t;
- /// Create a empty Subgraph object.
- ///
- /// @param external_value_ids - number of Value IDs to reserve for communication with external graph representation.
- /// The Subgraph object would avoid creating internal Value IDs in the
- /// [0, reserved_value_ids-1] range.
- /// @param flags - binary features of the subgraph. No supported flags are currently defined.
- /// @param subgraph_out - pointer to the variable that will be initialized with a handle to the Subgraph object upon
- /// successful return.
- enum xnn_status xnn_create_subgraph(
- uint32_t external_value_ids,
- uint32_t flags,
- xnn_subgraph_t* subgraph_out);
- /// Destroy a Subgraph object, as well as Values, and Nodes associated with the subgraph.
- ///
- /// @param subgraph - the Subgraph object to destroy.
- enum xnn_status xnn_delete_subgraph(
- xnn_subgraph_t subgraph);
- #define XNN_VALUE_FLAG_EXTERNAL_INPUT 0x00000001
- #define XNN_VALUE_FLAG_EXTERNAL_OUTPUT 0x00000002
- #define XNN_VALUE_FLAG_PERSISTENT 0x00000004
- #define XNN_INVALID_VALUE_ID UINT32_MAX
- /// Type of elements in a Value object.
- enum xnn_datatype {
- /// Invalid data type. Valid Values never have this datatype.
- xnn_datatype_invalid = 0,
- /// IEEE754 single-precision floating-point.
- xnn_datatype_fp32 = 1,
- /// IEEE754 half-precision floating-point.
- xnn_datatype_fp16 = 2,
- /// Quantized 8-bit signed integer with shared per-Value quantization
- /// parameters.
- xnn_datatype_qint8 = 3,
- /// Quantized 8-bit unsigned integer with shared per-Value quantization
- /// parameters.
- xnn_datatype_quint8 = 4,
- /// Quantized 32-bit signed integer with shared per-Value quantization
- /// parameters.
- xnn_datatype_qint32 = 5,
- /// Quantized 8-bit signed integer with shared per-channel quantization
- /// parameters.
- xnn_datatype_qcint8 = 6,
- /// Quantized 32-bit signed integer with shared per-channel quantization
- /// parameters.
- xnn_datatype_qcint32 = 7,
- /// Quantized 4-bit signed integer with shared per-channel quantization
- /// parameters.
- xnn_datatype_qcint4 = 8,
- /// Dynamically quantized 8-bit signed integer with per-batch quantization
- /// parameters.
- xnn_datatype_qdint8 = 9,
- /// Dynamically quantized 8-bit signed integers packed with their per-row
- /// quantization parameters.
- xnn_datatype_qpint8 = 10,
- /// 32-bit signed integers.
- xnn_datatype_int32 = 11,
- /// Quantized 4-bit signed integer with shared per-channel-block quantization
- /// parameters.
- xnn_datatype_qbint4 = 12,
- /// IEEE754 single-precision packed floating-point.
- xnn_datatype_pfp32 = 13,
- /// BFloat16, i.e. the upper 16 bits of a float32.
- xnn_datatype_bf16 = 14,
- /// Dynamically quantized 8-bit unsigned integer with per-batch quantization
- /// parameters.
- xnn_datatype_qduint8 = 15,
- };
- /// Define a tensor-type Value and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Value.
- /// @param datatype - type of the tensor elements.
- /// @param num_dims - number of dimensions in the shape.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- /// @param data - pointer to static data used for tensor initialization. If the tensor is not statically initialized,
- /// this pointer must be is NULL. If non-NULL, the life-time of the static data must exceed the life-time
- /// of the Subgraph object, and of any Runtime objects created from the Subgraph.
- /// @param external_id - external ID for the Value. The ID must be within the range of reversed Value IDs specified on
- /// the Subgraph creation. If the external ID is XNN_INVALID_VALUE_ID, an internal ID will be
- /// created for the Value.
- /// @param flags - binary features of the Value. Supported values are any combination of XNN_VALUE_FLAG_EXTERNAL_INPUT
- /// and XNN_VALUE_FLAG_EXTERNAL_OUTPUT.
- /// @param id_out - pointer to the variable that will be initialized with the Value ID upon successful return. If a
- /// valid @a external_id was provided, the variable will be initialized with the @a external_id value.
- enum xnn_status xnn_define_tensor_value(
- xnn_subgraph_t subgraph,
- enum xnn_datatype datatype,
- size_t num_dims,
- const size_t* dims,
- const void* data,
- uint32_t external_id,
- uint32_t flags,
- uint32_t* id_out);
- /// Define a quantized tensor-type Value and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Value.
- /// @param datatype - type of the tensor elements.
- /// @param zero_point - offset from zero to subtract from the quantized elements in the Value.
- /// @param scale - multiplication factor to convert quantized elements to real representation.
- /// @param num_dims - number of dimensions in the shape.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- /// @param data - pointer to static data used for tensor initialization. If the tensor is not statically initialized,
- /// this pointer must be is NULL. If non-NULL, the life-time of the static data must exceed the life-time
- /// of the Subgraph object, and of any Runtime objects created from the Subgraph.
- /// @param external_id - external ID for the Value. The ID must be within the range of reversed Value IDs specified on
- /// the Subgraph creation. If the external ID is XNN_INVALID_VALUE_ID, an internal ID will be
- /// created for the Value.
- /// @param flags - binary features of the Value. Supported values are any combination of XNN_VALUE_FLAG_EXTERNAL_INPUT
- /// and XNN_VALUE_FLAG_EXTERNAL_OUTPUT.
- /// @param id_out - pointer to the variable that will be initialized with the Value ID upon successful return. If a
- /// valid @a external_id was provided, the variable will be initialized with the @a external_id value.
- enum xnn_status xnn_define_quantized_tensor_value(
- xnn_subgraph_t subgraph,
- enum xnn_datatype datatype,
- int32_t zero_point,
- float scale,
- size_t num_dims,
- const size_t* dims,
- const void* data,
- uint32_t external_id,
- uint32_t flags,
- uint32_t* id_out);
- enum xnn_status xnn_define_channelwise_quantized_tensor_value(
- xnn_subgraph_t subgraph,
- enum xnn_datatype datatype,
- const float* scale,
- size_t num_dims,
- size_t channel_dim,
- const size_t* dims,
- const void* data,
- uint32_t external_id,
- uint32_t flags,
- uint32_t* id_out);
- /// Validate the dimensions, channel_dim, zero point, datatype, and scale of a quantized tensor-type.
- ///
- /// @param datatype - type of the tensor elements.
- /// @param zero_point - offset from zero to subtract from the quantized elements in the Value.
- /// @param scale - multiplication factor to convert quantized elements to real representation.
- /// @param num_dims - number of dimensions in the shape.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- enum xnn_status xnn_validate_quantized_tensor(
- enum xnn_datatype datatype,
- int32_t zero_point,
- float scale,
- size_t num_dims,
- const size_t* dims);
- /// Validate the dimensions, channel_dim, zero point, datatype, and scales of a channelwise quantized tensor-type.
- ///
- /// @param datatype - type of the tensor elements.
- /// @param zero_point - offset from zero to subtract from the quantized elements in the Value.
- /// @param scale - per-channel multiplication factors to convert quantized elements to real representation.
- /// @param num_dims - number of dimensions in the shape.
- /// @param channel_dim - index of the channel dimension in the tensor with per-channel quantization parameters.
- /// Typically this is the first dimension (dimension #0) of the filter tensors in the Convolution,
- /// Deconvolution, and Fully Connected operators and the last dimension of the filter tensors in
- /// the Depthwise Convolution operators.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- enum xnn_status xnn_validate_channelwise_quantized_tensor(
- enum xnn_datatype datatype,
- int32_t zero_point,
- const float* scale,
- size_t num_dims,
- size_t channel_dim,
- const size_t* dims);
- /// Define a channelwise quantized tensor-type Value and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Value.
- /// @param datatype - type of the tensor elements.
- /// @param zero_point - offset from zero to subtract from the quantized elements in the Value.
- /// @param scale - per-channel multiplication factors to convert quantized elements to real representation.
- /// @param num_dims - number of dimensions in the shape.
- /// @param channel_dim - index of the channel dimension in the tensor with per-channel quantization parameters.
- /// Typically this is the first dimension (dimension #0) of the filter tensors in the Convolution,
- /// Deconvolution, and Fully Connected operators and the last dimension of the filter tensors in
- /// the Depthwise Convolution operators.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- /// @param data - pointer to static data used for tensor initialization. If the tensor is not statically initialized,
- /// this pointer must be is NULL. If non-NULL, the life-time of the static data must exceed the life-time
- /// of the Subgraph object, and of any Runtime objects created from the Subgraph.
- /// @param external_id - external ID for the Value. The ID must be within the range of reversed Value IDs specified on
- /// the Subgraph creation. If the external ID is XNN_INVALID_VALUE_ID, an internal ID will be
- /// created for the Value.
- /// @param flags - binary features of the Value. Supported values are any combination of XNN_VALUE_FLAG_EXTERNAL_INPUT
- /// and XNN_VALUE_FLAG_EXTERNAL_OUTPUT.
- /// @param id_out - pointer to the variable that will be initialized with the Value ID upon successful return. If a
- /// valid @a external_id was provided, the variable will be initialized with the @a external_id value.
- enum xnn_status xnn_define_channelwise_quantized_tensor_value_v2(
- xnn_subgraph_t subgraph,
- enum xnn_datatype datatype,
- int32_t zero_point,
- const float* scale,
- size_t num_dims,
- size_t channel_dim,
- const size_t* dims,
- const void* data,
- uint32_t external_id,
- uint32_t flags,
- uint32_t* id_out);
- /// Define a blockwise quantized tensor-type Value and add it to a Subgraph.
- /// @param block_size - size of a block in the tensor with blockwise quantization parameters. Block is defined as
- /// number of input channel element per output channel.
- /// For Fully connected operators with 2d filters of size [output_channels, input_channels],
- /// expecting number of scale values to be = output_channels * (input_channels / block_size).
- enum xnn_status xnn_define_blockwise_quantized_tensor_value(
- xnn_subgraph_t subgraph,
- enum xnn_datatype datatype,
- int32_t zero_point,
- const uint16_t* scale,
- size_t num_dims,
- size_t channel_dim,
- size_t block_size,
- const size_t* dims,
- const void* data,
- uint32_t external_id,
- uint32_t flags,
- uint32_t* id_out);
- /// Define a dynamically quantized tensor-type Value and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Value.
- /// @param datatype - type of the tensor elements.
- /// @param num_dims - number of dimensions in the shape.
- /// @param num_non_batch_dims - number of non-batch dimensions in the shape. The leading (num_dims - num_non_batch_dims)
- /// dimensions will be flattened and treated as batch size. A set of quantization parameters
- /// will be calculated for each batch element.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- /// @param external_id - external ID for the Value. The ID must be within the range of reversed Value IDs specified on
- /// the Subgraph creation. If the external ID is XNN_INVALID_VALUE_ID, an internal ID will be
- /// created for the Value.
- /// @param flags - binary features of the Value. No supported flags are currently defined.
- /// @param id_out - pointer to the variable that will be initialized with the Value ID upon successful return. If a
- /// valid @a external_id was provided, the variable will be initialized with the @a external_id value.
- enum xnn_status xnn_define_dynamically_quantized_tensor_value(
- xnn_subgraph_t subgraph,
- enum xnn_datatype datatype,
- size_t num_dims,
- size_t num_nonbatch_dims,
- const size_t* dims,
- uint32_t external_id,
- uint32_t flags,
- uint32_t* id_out);
- /// Type of unary operation
- enum xnn_unary_operator {
- xnn_unary_invalid = -1,
- xnn_unary_convert,
- xnn_unary_clamp,
- xnn_unary_abs,
- xnn_unary_bankers_rounding,
- xnn_unary_ceiling,
- xnn_unary_elu,
- xnn_unary_exp,
- xnn_unary_floor,
- xnn_unary_gelu,
- xnn_unary_hardswish,
- xnn_unary_leaky_relu,
- xnn_unary_log,
- xnn_unary_negate,
- xnn_unary_sigmoid,
- xnn_unary_square,
- xnn_unary_square_root,
- xnn_unary_reciprocal_square_root,
- xnn_unary_tanh,
- // The following operators are experimental and may be removed.
- xnn_unary_cube_root,
- xnn_unary_cosine,
- xnn_unary_sine,
- xnn_unary_count_leading_zeros,
- xnn_unary_bitwise_not,
- xnn_unary_popcount,
- xnn_unary_sign,
- };
- /// Parameters for xnn_define_unary
- union xnn_unary_params {
- struct {
- /// lower bound for clipping output values.
- float min;
- /// upper bound for clipping output values.
- float max;
- } clamp;
- struct {
- /// scale factor for negative input elements.
- float alpha;
- } elu;
- struct {
- /// scale factor for negative input elements.
- float negative_slope;
- } leaky_relu;
- };
- /// Define a unary operator Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param operator - type of unary operator to define.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param params - parameters to be interpreted by the specific operator type.
- /// @param flags - binary features of the Node. No supported flags are currently defined.
- enum xnn_status xnn_define_unary(
- xnn_subgraph_t subgraph,
- enum xnn_unary_operator type,
- const union xnn_unary_params* params,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Convert Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Convert Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_convert(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Convolution Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_padding_top - implicit zero-padding above 2D input data. Must be 0 if XNN_FLAG_TENSORFLOW_SAME_PADDING
- /// flag is specified.
- /// @param input_padding_right - implicit zero-padding to the right of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_bottom - implicit zero-padding below 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_left - implicit zero-padding to the left of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param kernel_height - kernel (filter) height.
- /// @param kernel_width - kernel (filter) width.
- /// @param subsampling_height - height of subsampling region for convolution output (convolution height stride).
- /// @param subsampling_width - width of subsampling region for convolution output (convolution width stride).
- /// @param dilation_height - dilation of kernel elements along the height dimension.
- /// @param dilation_width - dilation of kernel elements along the width dimension.
- /// @param groups - number of convolution groups.
- /// @param group_input_channels - number of input channels per group.
- /// @param group_output_channels - number of output channels per group.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, groups * group_input_channels] dimensions
- /// @param filter_id - Value ID for the filter tensor. The filter tensor must ge a 4D tensor defined in the @a subgraph
- /// with [groups * group_output_channels, kernel_height, kernel_width, group_input_channels]
- /// dimensions.
- /// @param bias_id - Value ID for the bias tensor, or XNN_INVALID_VALUE_ID for a 2D Convolution Node without a bias. If
- /// present, the bias tensor must be a 1D tensor defined in the @a subgraph with [groups *
- /// group_output_channels] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, OH, OW, groups * group_output_channels] dimensions.
- /// @param flags - binary features of the 2D Convolution Node. The only currently supported values is
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING.
- enum xnn_status xnn_define_convolution_2d(
- xnn_subgraph_t subgraph,
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t filter_id,
- uint32_t bias_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Deconvolution (Transposed Convolution) Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param padding_top - implicit padding above 2D output data.
- /// @param padding_right - implicit padding to the right of 2D output data.
- /// @param padding_bottom - implicit padding below 2D output data.
- /// @param padding_left - implicit padding to the left of 2D output data.
- /// @param adjustment_height - additional elements in the bottom of the 2D output data.
- /// @param adjustment_width - additional elements to the right of the 2D output data.
- /// @param kernel_height - kernel (filter) height.
- /// @param kernel_width - kernel (filter) width.
- /// @param upsampling_height - height of upsampling region for deconvolution input (deconvolution height stride).
- /// @param upsampling_width - width of upsampling region for deconvolution input (deconvolution width stride).
- /// @param dilation_height - dilation of kernel elements along the height dimension.
- /// @param dilation_width - dilation of kernel elements along the width dimension.
- /// @param groups - number of convolution groups.
- /// @param group_input_channels - number of input channels per group.
- /// @param group_output_channels - number of output channels per group.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, groups * group_input_channels] dimensions
- /// @param filter_id - Value ID for the filter tensor. The filter tensor must ge a 4D tensor defined in the @a subgraph
- /// with [groups * group_output_channels, kernel_height, kernel_width, group_input_channels]
- /// dimensions.
- /// @param bias_id - Value ID for the bias tensor, or XNN_INVALID_VALUE_ID for a 2D Convolution Node without a bias. If
- /// present, the bias tensor must be a 1D tensor defined in the @a subgraph with
- /// [groups * group_output_channels] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, OH, OW, groups * group_output_channels] dimensions.
- /// @param flags - binary features of the 2D Deconvolution Node. No supported flags are currently defined.
- enum xnn_status xnn_define_deconvolution_2d(
- xnn_subgraph_t subgraph,
- uint32_t padding_top,
- uint32_t padding_right,
- uint32_t padding_bottom,
- uint32_t padding_left,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t upsampling_height,
- uint32_t upsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t filter_id,
- uint32_t bias_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Depthwise Convolution Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_padding_top - implicit zero-padding above 2D input data. Must be 0 if XNN_FLAG_TENSORFLOW_SAME_PADDING
- /// flag is specified.
- /// @param input_padding_right - implicit zero-padding to the right of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_bottom - implicit zero-padding below 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_left - implicit zero-padding to the left of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param kernel_height - kernel (filter) height.
- /// @param kernel_width - kernel (filter) width.
- /// @param subsampling_height - height of subsampling region for convolution output (convolution height stride).
- /// @param subsampling_width - width of subsampling region for convolution output (convolution width stride).
- /// @param dilation_height - dilation of kernel elements along the height dimension.
- /// @param dilation_width - dilation of kernel elements along the width dimension.
- /// @param depth_multiplier - ratio of output channels to input channels.
- /// @param input_channels - number of input channels.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, input_channels] dimensions
- /// @param filter_id - Value ID for the filter tensor. The filter tensor must ge a 4D tensor defined in the @a subgraph
- /// with [1, kernel_height, kernel_width, input_channels * depth_multiplier] dimensions.
- /// @param bias_id - Value ID for the bias tensor, or XNN_INVALID_VALUE_ID for a 2D Depthwise Convolution Node without
- /// a bias. If present, the bias tensor must be a 1D tensor defined in the @a subgraph with
- /// [input_channels * depth_multiplier] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, OH, OW, input_channels * depth_multiplier] dimensions.
- /// @param flags - binary features of the 2D Depthwise Convolution Node. The only currently supported values is
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING.
- enum xnn_status xnn_define_depthwise_convolution_2d(
- xnn_subgraph_t subgraph,
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t depth_multiplier,
- size_t input_channels,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t filter_id,
- uint32_t bias_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Depth To Space Node 2D and add it to a Subgraph.
- ///
- /// The Depth To Space 2D Node rearranges data from depth into blocks of spatial data (a reverse transform to
- /// Space To Depth). For a given input pixel, an output square of pixels with side @a block_size is formed from values
- /// in the corresponding number of its channels. The output depth is therefore @a block_size x @a block_size times
- /// smaller than that of the input.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param block_size - the size of the spatial block.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, OC * block_size * block_size] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH * block_size, IW * block_size, OC] dimensions.
- /// @param flags - binary features of the input_channels Node. No supported flags are currently defined.
- enum xnn_status xnn_define_depth_to_space_2d(
- xnn_subgraph_t subgraph,
- uint32_t block_size,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- enum xnn_status xnn_define_depth_to_space(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t block_size,
- uint32_t flags);
- /// Define a 1D Global Average Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a dense tensor with 2 or more dimensions
- /// defined in the @a subgraph. Averaging is performed across the second-innermost dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a dense tensor with 2 or more
- /// dimensions defined in the @a subgraph.
- /// @param flags - binary features of the 1D Global Average Pooling Node. The only currently supported value is
- /// XNN_FLAG_KEEP_DIMS.
- XNN_DEPRECATED enum xnn_status xnn_define_global_average_pooling_1d(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Global Average Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a dense tensor with 3 or more dimensions
- /// defined in the @a subgraph. Averaging is performed across the second- and third-innermost
- /// dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a dense tensor with 3 or more
- /// dimensions defined in the @a subgraph.
- /// @param flags - binary features of the 2D Global Average Pooling Node. The only currently supported value is
- /// XNN_FLAG_KEEP_DIMS.
- XNN_DEPRECATED enum xnn_status xnn_define_global_average_pooling_2d(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 1D Global Sum Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a dense tensor with 2 or more dimensions
- /// defined in the @a subgraph. Averaging is performed across the second-innermost dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a dense tensor with 2 or more
- /// dimensions defined in the @a subgraph.
- /// @param flags - binary features of the 1D Global Sum Pooling Node. The only currently supported value is
- /// XNN_FLAG_KEEP_DIMS.
- XNN_DEPRECATED enum xnn_status xnn_define_global_sum_pooling_1d(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Global Sum Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a dense tensor with 3 or more dimensions
- /// defined in the @a subgraph. Averaging is performed across the second- and third-innermost
- /// dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a dense tensor with 3 or more
- /// dimensions defined in the @a subgraph.
- /// @param flags - binary features of the 2D Global Sum Pooling Node. The only currently supported value is
- /// XNN_FLAG_KEEP_DIMS.
- XNN_DEPRECATED enum xnn_status xnn_define_global_sum_pooling_2d(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Average Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_padding_top - implicit zero-padding above 2D input data. Must be 0 if XNN_FLAG_TENSORFLOW_SAME_PADDING
- /// flag is specified.
- /// @param input_padding_right - implicit zero-padding to the right of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_bottom - implicit zero-padding below 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_left - implicit zero-padding to the left of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param pooling_height - pooling (kernel) height.
- /// @param pooling_width - pooling (kernel) width.
- /// @param stride_height - displacing of the pooling window in the vertical dimension of the input pixels corresponding
- /// to vertically adjacent output pixels.
- /// @param stride_width - displacing of the pooling window in the horizontal dimension of the input pixels corresponding
- /// to horizontally adjacent output pixels.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, channels] dimensions
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, OH, OW, channels] dimensions.
- /// @param flags - binary features of the 2D Average Pooling Node. The only currently supported values is
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING.
- enum xnn_status xnn_define_average_pooling_2d(
- xnn_subgraph_t subgraph,
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Fully Connected Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be an N-dimensional tensor defined in the
- /// @a subgraph. If XNN_FLAG_TENSORFLOW_RESHAPE_2D is not specified, the input tensor must be at least
- /// 1D and its last dimension must match the last dimension of the filter tensor. In particular, if
- /// input is a 2D tensor, it must have [batch_size, input_channels] dimensions.
- /// If XNN_FLAG_TENSORFLOW_RESHAPE_2D is specified, the number of elements in the input tensor must be
- /// divisible by the input_channels. The tensor will be first flattened into a 1D tensor of
- /// [num_input_elements] dimensions, then reshaped into a 2D tensor of
- /// [num_input_elements / input_channels, input_channels] dimensions where num_input_elements is the
- /// total number of elements in the input tensor.
- /// @param filter_id - Value ID for the filter tensor. The filter tensor must a 2D tensor defined in the @a subgraph.
- /// If the XNN_FLAG_TRANSPOSE_WEIGHTS flag is not specified, the filter tensor must have
- /// [output_channels, input_channels] dimensions. If the XNN_FLAG_TRANSPOSE_WEIGHTS flag is
- /// specified, the filter tensor must have [input_channels, output_channels] dimensions.
- /// @param bias_id - Value ID for the bias tensor, or XNN_INVALID_VALUE_ID for a Fully Connected Node without a bias.
- /// If present, the bias tensor must be a 1D tensor defined in the @a subgraph with [output_channels]
- /// dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph.
- /// If XNN_FLAG_TENSORFLOW_RESHAPE_2D is not specified, the output tensor must have the same
- /// dimensionality as the input tensor, all its dimensions but the last one must match the
- /// corresponding dimensions of the input tensor, and the last dimensions of the output tensor must
- /// match the first dimension of the filter tensor. In particular, if input is a 2D tensor, output
- /// must be a 2D tensor of [batch_size, output_channels] dimensions.
- /// If XNN_FLAG_TENSORFLOW_RESHAPE_2D is specified, output must be a 2D tensor of
- /// [num_input_elements / input_channels, output_channels] dimensions where num_input_elements is the
- /// total number of elements in the input tensor.
- /// @param flags - binary features of the Fully Connected Node. The only currently supported values are
- /// XNN_FLAG_TENSORFLOW_RESHAPE_2D and XNN_FLAG_TRANSPOSE_WEIGHTS.
- enum xnn_status xnn_define_fully_connected(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t filter_id,
- uint32_t bias_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Sparse Fully Connected Node and add it to a Subgraph.
- ///
- /// This operator is experimental, and will be removed in the future.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be an N-dimensional tensor defined in the
- /// @a subgraph. If XNN_FLAG_TENSORFLOW_RESHAPE_2D is not specified, the input tensor must be at least
- /// 1D and its last dimension must match the last dimension of the filter tensor. In particular, if
- /// input is a 2D tensor, it must have [batch_size, input_channels] dimensions.
- /// If XNN_FLAG_TENSORFLOW_RESHAPE_2D is specified, the number of elements in the input tensor must be
- /// divisible by the input_channels. The tensor will be first flattened into a 1D tensor of
- /// [num_input_elements] dimensions, then reshaped into a 2D tensor of
- /// [num_input_elements / input_channels, input_channels] dimensions where num_input_elements is the
- /// total number of elements in the input tensor.
- /// @param filter_id - Value ID for the filter tensor. The filter tensor must a 2D tensor defined in the @a subgraph.
- /// If the XNN_FLAG_TRANSPOSE_WEIGHTS flag is not specified, the filter tensor must have
- /// [output_channels, input_channels] dimensions. If the XNN_FLAG_TRANSPOSE_WEIGHTS flag is
- /// specified, the filter tensor must have [input_channels, output_channels] dimensions.
- /// @param bias_id - Value ID for the bias tensor, or XNN_INVALID_VALUE_ID for a Fully Connected Node without a bias.
- /// If present, the bias tensor must be a 1D tensor defined in the @a subgraph with [output_channels]
- /// dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph.
- /// If XNN_FLAG_TENSORFLOW_RESHAPE_2D is not specified, the output tensor must have the same
- /// dimensionality as the input tensor, all its dimensions but the last one must match the
- /// corresponding dimensions of the input tensor, and the last dimensions of the output tensor must
- /// match the first dimension of the filter tensor. In particular, if input is a 2D tensor, output
- /// must be a 2D tensor of [batch_size, output_channels] dimensions.
- /// If XNN_FLAG_TENSORFLOW_RESHAPE_2D is specified, output must be a 2D tensor of
- /// [num_input_elements / input_channels, output_channels] dimensions where num_input_elements is the
- /// total number of elements in the input tensor.
- /// @param flags - binary features of the Fully Connected Node. The only currently supported values are
- /// XNN_FLAG_TENSORFLOW_RESHAPE_2D and XNN_FLAG_TRANSPOSE_WEIGHTS.
- enum xnn_status xnn_define_fully_connected_sparse(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t filter_id,
- uint32_t bias_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Max Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_padding_top - implicit zero-padding above 2D input data. Must be 0 if XNN_FLAG_TENSORFLOW_SAME_PADDING
- /// flag is specified.
- /// @param input_padding_right - implicit zero-padding to the right of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_bottom - implicit zero-padding below 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param input_padding_left - implicit zero-padding to the left of 2D input data. Must be 0 if
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING flag is specified.
- /// @param pooling_height - pooling (kernel) height.
- /// @param pooling_width - pooling (kernel) width.
- /// @param stride_height - displacing of the pooling window in the vertical dimension of the input pixels corresponding
- /// to vertically adjacent output pixels.
- /// @param stride_width - displacing of the pooling window in the horizontal dimension of the input pixels corresponding
- /// to horizontally adjacent output pixels.
- /// @param dilation_height - dilation of pooling elements along the height dimension.
- /// @param dilation_width - dilation of pooling elements along the width dimension.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, channels] dimensions
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, OH, OW, channels] dimensions.
- /// @param flags - binary features of the 2D Max Pooling Node. The only currently supported values is
- /// XNN_FLAG_TENSORFLOW_SAME_PADDING.
- enum xnn_status xnn_define_max_pooling_2d(
- xnn_subgraph_t subgraph,
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D ArgMax Pooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_padding_top - implicit zero-padding above 2D input data.
- /// @param input_padding_right - implicit zero-padding to the right of 2D input data.
- /// @param input_padding_bottom - implicit zero-padding below 2D input data.
- /// @param input_padding_left - implicit zero-padding to the left of 2D input data.
- /// @param pooling_height - pooling (kernel) height. Vertical stride between pooling regions match this value.
- /// @param pooling_width - pooling (kernel) width. Horizontal stride between pooling regions match this value.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, channels] dimensions
- /// @param output_value_id - Value ID for the output tensor with the maximum values in the pools. The output tensor must
- /// be a 4D tensor defined in the @a subgraph with [N, OH, OW, channels] dimensions.
- /// @param output_index_id - Value ID for the output tensor with the indexes of the maximum values in the pools. The
- /// output tensor must be a 4D tensor defined in the @a subgraph with [N, OH, OW, channels]
- /// dimensions.
- /// @param flags - binary features of the 2D ArgMax Pooling Node. No supported flags are currently defined.
- enum xnn_status xnn_define_argmax_pooling_2d(
- xnn_subgraph_t subgraph,
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t input_id,
- uint32_t output_value_id,
- uint32_t output_index_id,
- uint32_t flags);
- /// Define a 2D UnPooling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param padding_top - implicit padding above 2D output data.
- /// @param padding_right - implicit padding to the right of 2D output data.
- /// @param padding_bottom - implicit padding below 2D output data.
- /// @param padding_left - implicit padding to the left of 2D output data.
- /// @param pooling_height - height of the pooling window.
- /// @param pooling_width - width of the pooling window.
- /// @param input_value_id - Value ID for the input tensor with the max-pooling values to invert. The input value tensor
- /// must be a 4D tensor defined in the @a subgraph with [N, IH, IW, channels] dimensions.
- /// @param input_index_id - Value ID for the input tensor with the indices of the per-pool maximum values produced by
- /// a 2D UnPooling Node. The input tensor must be a 4D tensor defined in the @a subgraph with
- /// [N, IH, IW, channels] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, OH, OW, channels] dimensions.
- /// @param flags - binary features of the 2D UnPooling Node. No supported flags are currently defined.
- enum xnn_status xnn_define_unpooling_2d(
- xnn_subgraph_t subgraph,
- uint32_t padding_top,
- uint32_t padding_right,
- uint32_t padding_bottom,
- uint32_t padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t input_value_id,
- uint32_t input_index_id,
- uint32_t output_id,
- uint32_t flags);
- enum xnn_binary_operator {
- xnn_binary_invalid = -1,
- xnn_binary_add,
- xnn_binary_subtract,
- xnn_binary_multiply,
- xnn_binary_divide,
- xnn_binary_maximum,
- xnn_binary_minimum,
- xnn_binary_copysign,
- xnn_binary_squared_difference,
- xnn_binary_prelu,
- // The following operators are experimental and may be removed.
- xnn_binary_modulus,
- xnn_binary_atan2,
- xnn_binary_pow,
- xnn_binary_bitwise_and,
- xnn_binary_bitwise_or,
- xnn_binary_bitwise_xor,
- xnn_binary_shift_left,
- xnn_binary_shift_right_logical,
- xnn_binary_shift_right_arithmetic,
- };
- struct xnn_binary_params {
- /// lower bound for clipping output values.
- double output_min;
- /// upper bound for clipping output values.
- double output_max;
- };
- /// Define a 2-Input binary operator Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param type - Type of operator to apply to the two inputs.
- /// @param params - Optional parameters for the operator.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Node. No supported flags are currently defined.
- enum xnn_status xnn_define_binary(
- xnn_subgraph_t subgraph,
- enum xnn_binary_operator type,
- const struct xnn_binary_params* params,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2-Input Add Node and add it to a Subgraph.
- ///
- /// The 2-Input Add Node computes elementwise addition of two tensor inputs with numpy broadcasting rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Add Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_add2(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2-Input Multiply Node and add it to a Subgraph.
- ///
- /// The 2-Input Multiply Node computes elementwise multiplication of two tensor inputs with numpy broadcasting rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Multiply Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_multiply2(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- // Cap operations applied to logits (Q * K) of attention operator.
- enum xnn_attention_logits_cap_type {
- // No capping.
- xnn_attention_logits_cap_type_none = 0,
- // Cap the absolute values of logits by tanh: tanh(logits / cap) * cap
- xnn_attention_logits_cap_type_tanh
- };
- // Params when the cap type is xnn_attention_logits_cap_type_tanh.
- struct xnn_attention_logits_cap_tanh_params {
- float cap;
- };
- /// Define a Scaled Dot-Product Attention Node and add it to a Subgraph.
- ///
- /// This operator is experimental.
- ///
- /// The Scaled Dot-Product Attention Node computes a multi-head or multi-query scaled dot attention on the query, key,
- /// and value tensors.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param cap_type - type of cap to be applied to the logits.
- /// @param cap_params - parameters for the cap. Must be a pointer to xnn_attention_logits_cap_tanh_params if cap_type
- /// is xnn_attention_logits_cap_type_tanh.
- /// @param query_id - Value ID for the query tensor. The query tensor must be a 3+-dimensional tensor defined in the
- /// @a subgraph with the dimensions as [*, H, T, C], where H/T/C are the heads/tokens/channels, and *
- /// is the 0 or more dimensions treated as batch size.
- /// @param key_id - Value ID for the key tensor. The key tensor must be a 2+--dimensional tensor defined in the
- /// @a subgraph. It can have the same number of dimensions as the query, with the dimensions as
- /// [*, H, U, C] (multi-head), or have 1 less dimension than the query, with the dimensions as
- /// as [*, U, C] (multi-query, number of heads omitted implies single head), where H/U/C are the
- /// heads/key_value_tokens/channels, and * is the 0 or more dimensions treated as batch size. These
- /// batch size dimensions must be the same as query.
- /// @param value_id - Value ID for the value tensor. The value tensor must be a 2+--dimensional tensor defined in the
- /// @a subgraph. It can have the same number of dimensions as the query, with the dimensions as
- /// [*, H, U, D] (multi-head), or have 1 less dimension than the query, with the dimensions as
- /// as [*, U, D] (multi-query, number of heads omitted implies single head), where H/U/D are the
- /// heads/key_value_tokens/value_channels, and * is the 0 or more dimensions treated as batch size.
- /// These batch size dimensions must be the same as query and key.
- /// @param scale_id - Value ID for the scale tensor. The scale tensor must be a 1D tensor defined in the @a subgraph
- /// with [C] dimensions. The query tensor is multiplied with this scale tensor before the dot product
- /// with the key tensor.
- /// @param mask_id - Value ID for the mask tensor. The mask tensor must be a 2D tensor defined in the @a subgraph with
- /// [T, U] dimensions. The mask tensor is added to the logits (query dot value).
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 3+-dimensional tensor defined in the
- /// @a subgraph with the dimensions as [*, H, T, D], where H/T/D are the heads/tokens/value_channels,
- /// and * is the 0 or more dimensions treated as batch size. These batch size dimensions must be the
- /// same as query, key, and value.
- /// @param flags - binary features of the Scaled Dot Product Attention Node. No supported flags are currently defined.
- enum xnn_status xnn_define_scaled_dot_product_attention(
- xnn_subgraph_t subgraph,
- enum xnn_attention_logits_cap_type cap_type,
- const void* cap_params,
- uint32_t query_id,
- uint32_t key_id,
- uint32_t value_id,
- uint32_t scale_id,
- uint32_t mask_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Subtract Node and add it to a Subgraph.
- ///
- /// The Subtract Node computes elementwise subtraction of two tensor inputs with numpy broadcasting rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Subtract Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_subtract(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Divide Node and add it to a Subgraph.
- ///
- /// The Divide Node computes elementwise division of two tensor inputs with numpy broadcasting rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Divide Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_divide(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2-Input Maximum Node and add it to a Subgraph.
- ///
- /// The 2-Input Maximum Node computes elementwise maximum of two tensor inputs with numpy broadcasting rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Maximum Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_maximum2(
- xnn_subgraph_t subgraph,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2-Input Minimum Node and add it to a Subgraph.
- ///
- /// The 2-Input Minimum Node computes elementwise minimum of two tensor inputs with numpy broadcasting rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Minimum Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_minimum2(
- xnn_subgraph_t subgraph,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Squared Difference Node and add it to a Subgraph.
- ///
- /// The Squared Difference Node computes elementwise squared difference of two tensor inputs with numpy broadcasting
- /// rules.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the second
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an M-dimensional tensor defined in
- /// the @a subgraph with each dimension either equal to the corresponding dimension of the first
- /// input, or equal to 1. In the latter case, the elements of the input tensor are broadcasted along
- /// that dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a max(N,M)-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the maximum between the corresponding dimension
- /// of the two inputs.
- /// @param flags - binary features of the Squared Difference Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_squared_difference(
- xnn_subgraph_t subgraph,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Constant Pad Node with static padding specification and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param pre_paddings - number of padding elements to insert before input elements for every dimension. This array
- /// must have as many elements as the number of dimensions in the input tensor.
- /// @param post_paddings - number of padding elements to insert after input elements for every dimension. This array
- /// must have as many elements as the number of dimensions in the input tensor.
- /// @param padding_value - constant value used to initialize padding elements.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor with padding.
- /// @param flags - binary features of the Constant Pad Node. No supported flags are currently defined.
- enum xnn_status xnn_define_static_constant_pad(
- xnn_subgraph_t subgraph,
- const size_t* pre_paddings,
- const size_t* post_paddings,
- float padding_value,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Expand Dims Node with and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param num_new_axes - number of new axes of size 1 to be inserted.
- /// @param new_axes - The axis positions of the new axes in the expanded dimensions.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor with padding.
- /// @param flags - binary features of the Constant Pad Node. No supported flags are currently defined.
- enum xnn_status xnn_define_static_expand_dims(
- xnn_subgraph_t subgraph,
- size_t num_new_axes,
- const size_t* new_axes,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Mean Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param num_reduction_axes - number of axes along which mean is computed.
- /// @param reduction_axes - axes along which mean is computed.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a dense tensor with at least
- /// @a num_reduction_axes dimensions defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a dense tensor defined in the
- /// @a subgraph with @a num_reduction_axes fewer dimensions than the input tensor (if
- /// XNN_FLAG_KEEP_DIMS is not specified), or has same dimension rank but the dimension at
- /// @a reduction_axes reduced to 1 (if XNN_FLAG_KEEP_DIMS is specified).
- /// @param flags - binary features of the Mean Node. The only currently supported value is XNN_FLAG_KEEP_DIMS
- XNN_DEPRECATED enum xnn_status xnn_define_static_mean(
- xnn_subgraph_t subgraph,
- size_t num_reduction_axes,
- const size_t* reduction_axes,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- enum xnn_reduce_operator {
- xnn_reduce_invalid = -1,
- xnn_reduce_sum,
- xnn_reduce_mean,
- };
- /// Define a Reduce Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param num_reduction_axes - number of axes along which reduce is computed.
- /// @param reduction_axes - axes along which reduce is computed.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a dense tensor with at least
- /// @a num_reduction_axes dimensions defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a dense tensor defined in the
- /// @a subgraph with @a num_reduction_axes fewer dimensions than the input tensor (if
- /// XNN_FLAG_KEEP_DIMS is not specified), or has same dimension rank but the dimension at
- /// @a reduction_axes reduced to 1 (if XNN_FLAG_KEEP_DIMS is specified).
- /// @param flags - binary features of the Reduce Node. The only currently supported value is XNN_FLAG_KEEP_DIMS
- enum xnn_status xnn_define_static_reduce(
- xnn_subgraph_t subgraph,
- enum xnn_reduce_operator reduce_operator_type,
- size_t num_reduction_axes,
- const size_t* reduction_axes,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Reduce Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param num_reduction_axes - number of axes along which reduce is computed.
- /// @param reduction_axes - axes along which reduce is computed. Negative values
- /// are interpreted as offsets from @a
- /// num_reduction_axes.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a
- /// dense tensor with at least @a num_reduction_axes
- /// dimensions defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be
- /// a dense tensor defined in the @a subgraph with @a
- /// num_reduction_axes fewer dimensions than the input tensor
- /// (if XNN_FLAG_KEEP_DIMS is not specified), or has same
- /// dimension rank but the dimension at
- /// @a reduction_axes reduced to 1 (if XNN_FLAG_KEEP_DIMS is
- /// specified).
- /// @param flags - binary features of the Reduce Node. The only currently
- /// supported value is XNN_FLAG_KEEP_DIMS
- enum xnn_status xnn_define_static_reduce_v2( //
- xnn_subgraph_t subgraph, //
- enum xnn_reduce_operator reduce_operator_type, //
- size_t num_reduction_axes, //
- const int64_t* reduction_axes, //
- uint32_t input_id, //
- uint32_t output_id, //
- uint32_t flags);
- /// Define a 2-Input Concatenate Node and add it to a Subgraph.
- ///
- /// The 2-Input Concatenate Node concatenates two tensors along a specified axis.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param axis - the axis to concatenate the two input tensors along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// second input.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// first input.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a N-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the dimension of both inputs, except the axis
- /// dimension, where it is the sum of the corresponding dimensions of both inputs.
- /// @param flags - binary features of the Concatenate Node. No supported flags are currently defined.
- enum xnn_status xnn_define_concatenate2(
- xnn_subgraph_t subgraph,
- int32_t axis,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 3-Input Concatenate Node and add it to a Subgraph.
- ///
- /// The 3-Input Concatenate Node concatenates three tensors along a specified axis.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param axis - the axis to concatenate the two input tensors along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input3_id - Value ID for the third input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a N-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the dimension of all inputs, except the axis
- /// dimension, where it is the sum of the corresponding dimensions of all inputs.
- /// @param flags - binary features of the Concatenate Node. No supported flags are currently defined.
- enum xnn_status xnn_define_concatenate3(
- xnn_subgraph_t subgraph,
- int32_t axis,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t input3_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 4-Input Concatenate Node and add it to a Subgraph.
- ///
- /// The 4-Input Concatenate Node concatenates four tensors along a specified axis.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param axis - the axis to concatenate the two input tensors along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input3_id - Value ID for the third input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input4_id - Value ID for the fourth input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a N-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the dimension of all inputs, except the axis
- /// dimension, where it is the sum of the corresponding dimensions of all inputs.
- /// @param flags - binary features of the Concatenate Node. No supported flags are currently defined.
- enum xnn_status xnn_define_concatenate4(
- xnn_subgraph_t subgraph,
- int32_t axis,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t input3_id,
- uint32_t input4_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 5-Input Concatenate Node and add it to a Subgraph.
- ///
- /// The 5-Input Concatenate Node concatenates four tensors along a specified axis.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param axis - the axis to concatenate the two input tensors along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input3_id - Value ID for the third input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input4_id - Value ID for the fourth input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param input5_id - Value ID for the fourth input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph with each dimension, except the axis, equal to the corresponding dimension of the
- /// other inputs.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a N-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to the dimension of all inputs, except the axis
- /// dimension, where it is the sum of the corresponding dimensions of all inputs.
- enum xnn_status xnn_define_concatenate5(
- xnn_subgraph_t subgraph,
- int32_t axis,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t input3_id,
- uint32_t input4_id,
- uint32_t input5_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Copy Sign Node and add it to a Subgraph.
- ///
- /// The Copy Sign Node copies the sign of the second input to the first input.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be defined in the @a subgraph.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor.
- /// @param flags - binary features of the Copy Sign Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_copysign(
- xnn_subgraph_t subgraph,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Copy Node and add it to a Subgraph.
- ///
- /// The Copy Node copies an input tensor to an output tensor.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the first input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Copy Node. No supported flags are currently defined.
- enum xnn_status xnn_define_copy(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2-Output Split Node and add it to a Subgraph.
- ///
- /// The 2-Output Split Node splits an input tensor into two output tensors along a specified axis evenly.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param split_dim - the dimension to split the input tensor along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input_id - Value ID for the input tensor. The input tensor must be an N-dimensional tensor defined in the @a
- /// subgraph.
- /// @param output1_id - Value ID for the first output tensor. The output tensor must be an N-dimensional tensor defined
- /// in the @a subgraph with each dimension, except the axis, equal to the corresponding dimension
- /// of the second output. The split_dim dimension is half of the input's split_dim.
- /// @param output2_id - Value ID for the second output tensor. The output tensor must be an N-dimensional tensor
- /// defined in the @a subgraph with each dimension, except the axis, equal to the corresponding
- /// dimension of the first output. The split_dim dimension is half of the input's split_dim.
- /// @param flags - binary features of the Split Node. No supported flags are currently defined.
- enum xnn_status xnn_define_even_split2(
- xnn_subgraph_t subgraph,
- int32_t split_dim,
- uint32_t input_id,
- uint32_t output1_id,
- uint32_t output2_id,
- uint32_t flags);
- /// Define a 3-Output Split Node and add it to a Subgraph.
- ///
- /// The 3-Output Split Node splits an input tensor into three output tensors along a specified axis evenly.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param split_dim - the dimension to split the input tensor along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input_id - Value ID for the input tensor. The input tensor must be an N-dimensional tensor defined in the @a
- /// subgraph.
- /// @param output1_id - Value ID for the first output tensor. The output tensor must be an N-dimensional tensor defined
- /// in the @a subgraph with each dimension, except the axis, equal to the corresponding dimension
- /// of the second and third output. The split_dim dimension is one third of the input's split_dim.
- /// @param output2_id - Value ID for the second output tensor. The output tensor must be an N-dimensional tensor
- /// defined in the @a subgraph with each dimension, except the axis, equal to the corresponding
- /// dimension of the first and third output. The split_dim dimension is one third of the input's
- /// split_dim.
- /// @param output3_id - Value ID for the third output tensor. The output tensor must be an N-dimensional tensor
- /// defined in the @a subgraph with each dimension, except the axis, equal to the corresponding
- /// dimension of the second and third output. The split_dim dimension is one third of the input's
- /// split_dim.
- /// @param flags - binary features of the Split Node. No supported flags are currently defined.
- enum xnn_status xnn_define_even_split3(
- xnn_subgraph_t subgraph,
- int32_t split_dim,
- uint32_t input_id,
- uint32_t output1_id,
- uint32_t output2_id,
- uint32_t output3_id,
- uint32_t flags);
- /// Define a 4-Output Split Node and add it to a Subgraph.
- ///
- /// The 4-Output Split Node splits an input tensor into four output tensors along a specified axis evenly.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param split_dim - the dimension to split the input tensor along. If this is less than zero, the number of
- /// dimensions is added to it.
- /// @param input_id - Value ID for the input tensor. The input tensor must be an N-dimensional tensor defined in the @a
- /// subgraph.
- /// @param output1_id - Value ID for the first output tensor. The output tensor must be an N-dimensional tensor defined
- /// in the @a subgraph with each dimension, except the axis, equal to the corresponding dimension
- /// of the other output tensors. The split_dim dimension is one fourth of the input's split_dim.
- /// @param output2_id - Value ID for the second output tensor. The output tensor must be an N-dimensional tensor
- /// defined in the @a subgraph with each dimension, except the axis, equal to the corresponding
- /// dimension of the other output tensors. The split_dim dimension is one fourth of the input's
- /// split_dim.
- /// @param output3_id - Value ID for the third output tensor. The output tensor must be an N-dimensional tensor
- /// defined in the @a subgraph with each dimension, except the axis, equal to the corresponding
- /// dimension of the other output tensors. The split_dim dimension is one fourth of the input's
- /// split_dim.
- /// @param output4_id - Value ID for the fourth output tensor. The output tensor must be an N-dimensional tensor
- /// defined in the @a subgraph with each dimension, except the axis, equal to the corresponding
- /// dimension of the other output tensors. The split_dim dimension is one fourth of the input's
- /// split_dim.
- /// @param flags - binary features of the Split Node. No supported flags are currently defined.
- enum xnn_status xnn_define_even_split4(
- xnn_subgraph_t subgraph,
- int32_t split_dim,
- uint32_t input_id,
- uint32_t output1_id,
- uint32_t output2_id,
- uint32_t output3_id,
- uint32_t output4_id,
- uint32_t flags);
- /// Define a Reshape Node with static shape specification and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param num_dims - number of shape dimensions in the output tensor.
- /// @param new_shape - shape dimensions of the output tensor.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor with padding.
- /// @param flags - binary features of the Reshape Node. No supported flags are currently defined.
- enum xnn_status xnn_define_static_reshape(
- xnn_subgraph_t subgraph,
- size_t num_dims,
- const size_t* new_shape,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a 2D Resize Bilinear Node with static output height & width specification and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param new_height - height dimension of the output tensor.
- /// @param new_width - width dimension of the output tensor.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, H, W, C] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, new_height, new_width, C] dimensions.
- /// @param flags - binary features of the 2D Resize Bilinear Node. The only currently supported values are
- /// XNN_FLAG_TENSORFLOW_LEGACY_MODE and XNN_FLAG_ALIGN_CORNERS, which are mutually exclusive.
- enum xnn_status xnn_define_static_resize_bilinear_2d(
- xnn_subgraph_t subgraph,
- size_t new_height,
- size_t new_width,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a PReLU (Parametric ReLU) Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, H, W, channels] dimensions.
- /// @param slope_id - Value ID for the slope tensor. The slope tensor must be a 1D tensor defined in the @a subgraph with
- /// either [1] or [channels] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, H, W, channels] dimensions.
- /// @param flags - binary features of the PReLU Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_prelu(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t slope_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a RoPE (Rotary Positional Embeddings) Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param max_tokens - deprecated.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [batch, tokens, heads, channels] dimensions.
- /// @param weights_id - Value ID for the weights tensor. The weights tensor must be a 2D tensor defined in the
- /// @a subgraph with [max_tokens, channels] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [batch, tokens, heads, channels] dimensions.
- /// @param flags - binary features of the RoPE Node. No supported flags are currently defined.
- enum xnn_status xnn_define_rope(
- xnn_subgraph_t subgraph,
- size_t max_sequence_size,
- uint32_t input_id,
- uint32_t weights_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Abs Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Abs Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_abs(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Bankers' Rounding Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Bankers' Rounding Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_bankers_rounding(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Batch Matrix Multiply Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input1_id - Value ID for the first input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph. It must be at least 3D. The first N-2 dimensions must match the second input
- /// tensor. The last 2 dimensions are [M, K]. If XNN_FLAG_TRANSPOSE_B is not specified, the last
- /// dimension must match the second last dimension of the second input tensor. If
- /// XNN_FLAG_TRANSPOSE_B is specified, the last dimension must match the last dimension of the
- /// second input tensor.
- /// @param input2_id - Value ID for the second input tensor. The input tensor must be an N-dimensional tensor defined
- /// in the @a subgraph. It must be at least 3D. The first N-2 dimensions must match the first input
- /// tensor. If XNN_FLAG_TRANSPOSE_B is not specified, the last 2 dimensions are [K, N], and the
- /// second last dimension must match the last dimension of the first input tensor. If
- /// XNN_FLAG_TRANSPOSE_B is specified, the last 2 dimensions are [N, K], and the last dimension must
- /// match the last dimension of the first input tensor.
- /// @param output_id - Value ID for the output tensor. The output tensor must be an N-dimensional tensor defined in the
- /// @a subgraph. It must be at least 3D. The first N-2 dimensions must match the first and second
- /// input tensors . The last 2 dimensions must be [M, N].
- /// @param flags - binary features of the Batch Matrix Multiply Node. The only currently supported value is
- /// XNN_FLAG_TRANSPOSE_B.
- enum xnn_status xnn_define_batch_matrix_multiply(
- xnn_subgraph_t subgraph,
- uint32_t input1_id,
- uint32_t input2_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Ceiling Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Ceiling Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_ceiling(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Clamp Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param output_min - lower bound for clipping output values.
- /// @param output_max - upper bound for clipping output values.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Clamp Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_clamp(
- xnn_subgraph_t subgraph,
- float output_min,
- float output_max,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define an ELU (Exponential Linear Unit) Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param alpha - scale factor for negative output elements.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the ELU Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_elu(
- xnn_subgraph_t subgraph,
- float alpha,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Exp Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Exp Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_exp(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Floor Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Floor Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_floor(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define an GELU (Gaussian Error Linear Unit) Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the GELU Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_gelu(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a HardSwish Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the HardSwish Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_hardswish(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Leaky ReLU Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param negative_slope - scale factor for negative input elements.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Leaky ReLU Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_leaky_relu(
- xnn_subgraph_t subgraph,
- float negative_slope,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Log Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Log Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_log(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Negate Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Negate Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_negate(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Sigmoid Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Sigmoid Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_sigmoid(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a SoftMax Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph, and have at
- /// least one dimension.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the SoftMax Node. No supported flags are currently defined.
- enum xnn_status xnn_define_softmax(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Space To Depth 2D Node and add it to a Subgraph.
- ///
- /// The Space To Depth 2D Node rearranges blocks of spatial data into blocks (a reverse transform to Depth To Space 2D).
- /// For a given input pixel, an output square of pixels with side @a block_size is formed from values in the
- /// corresponding number of its channels. The output depth is therefore @a block_size x @a block_size times greater
- /// than that of the input.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param block_size - the size of the spatial block.
- /// @param input_id - Value ID for the input tensor. The input tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH * block_size, IW * block_size, OC] dimensions.
- /// @param output_id - Value ID for the output tensor. The output tensor must be a 4D tensor defined in the @a subgraph
- /// with [N, IH, IW, OC * block_size * block_size] dimensions.
- /// @param flags - binary features of the input_channels Node. No supported flags are currently defined.
- enum xnn_status xnn_define_space_to_depth_2d(
- xnn_subgraph_t subgraph,
- uint32_t block_size,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Square Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Square Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_square(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Square Root Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Square Root Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_square_root(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Reciprocal Square Root Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be
- /// defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be
- /// defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Square Root Node. No supported flags
- /// are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_reciprocal_square_root(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- enum xnn_status xnn_define_static_slice(
- xnn_subgraph_t subgraph,
- size_t num_dims,
- const size_t* offsets,
- const size_t* sizes,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Static Slice Node add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param num_dims - number of shape dimensions in the input and output tensor.
- /// @param offsets - offsets in each dimension of the input tensor. This array must have @a num_dims elements. Can be
- /// negative meaning that the offset is relative to the end of the dimension.
- /// @param sizes - size of each dimension in output tensor. This array must have @a num_dims elements.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// dimensions must match @a sizes.
- /// @param flags - binary features of the Static Slice Node. No supported flags are currently defined.
- enum xnn_status xnn_define_static_slice_v2( //
- xnn_subgraph_t subgraph, //
- size_t num_dims, //
- const int64_t* offsets, //
- const size_t* sizes, //
- uint32_t input_id, //
- uint32_t output_id, //
- uint32_t flags);
- /// Define a Static Transpose Node and add it to a Subgraph.
- ///
- /// The Static Transpose Node applies a generalized transpose to the input tensor using the permuation in perm.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be an N-dimensional tensor defined in
- /// the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be an N-dimensional tensor defined
- /// in the @a subgraph with each dimension equal to its corresponding permuted input dimension.
- /// @param num_dims - the number of permutation dimensions. This must be equal to the number of input dimensions.
- /// @param perm - The permutation of the axis of the input tensor. The perm array must must contain 0 to N-1 in the
- /// permuted order.
- /// @param flags - binary features of the Static Transpose Node. No supported flags are currently defined.
- enum xnn_status xnn_define_static_transpose(
- xnn_subgraph_t subgraph,
- size_t num_dims,
- const size_t* perm,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Define a Tanh Node and add it to a Subgraph.
- ///
- /// @param subgraph - a Subgraph object that will own the created Node.
- /// @param input_id - Value ID for the input tensor. The input tensor must be defined in the @a subgraph.
- /// @param output_id - Value ID for the output tensor. The output tensor must be defined in the @a subgraph, and its
- /// shape must match the shape of the input tensor.
- /// @param flags - binary features of the Tanh Node. No supported flags are currently defined.
- XNN_DEPRECATED enum xnn_status xnn_define_tanh(
- xnn_subgraph_t subgraph,
- uint32_t input_id,
- uint32_t output_id,
- uint32_t flags);
- /// Code cache is a cache for JIT generated code.
- typedef struct xnn_code_cache* xnn_code_cache_t;
- /// Weights cache can be finalized in these ways:
- enum xnn_weights_cache_finalization_kind {
- /// Weights cache is finalized, no insert operations into the weights cache is allowed, even if the "inserted"
- /// weights already exist in thee cache. Weights cache memory will also be trimmed to page boundary and set to
- /// read-only (to prevent writes).
- xnn_weights_cache_finalization_kind_hard,
- /// Weights cache will be finalized with some extra space at the end, this allows for "inserting" into the cache only
- /// if the weights are already in the cache, and errors on inserting uncached weights. There is memory overhead.
- xnn_weights_cache_finalization_kind_soft,
- };
- /// A combination of multiple factors to uniquely locate the weights cache.
- struct xnn_weights_cache_look_up_key {
- /// The unique seed for each ukernel. It is guaranteed that each ukernel provides
- /// a consistent and identical seed.
- uint32_t seed;
- /// Pointer to the original kernel.
- const void* kernel;
- /// Pointer to the original bias, could be NULL.
- const void* bias;
- };
- /// A group of function pointers to manage weights cache. All functions may be
- /// called on multi threads.
- struct xnn_weights_cache_provider {
- /// User-specified pointer that will be passed as-is to all functions in this
- /// structure.
- void* context;
- /// Looks up the tuple of {cache_key, kernel, bias} in the cache. If it is found,
- /// returns the offset to the found entry for reuse. Otherwise, returns SIZE_MAX.
- /// @param context - The user-specified pointer from xnn_weights_cache_provider structure.
- /// @param cache_key - The key used to locate the weights cache entry.
- size_t (*look_up)(void* context, const struct xnn_weights_cache_look_up_key* cache_key);
- /// Ensures that cache has enough space for `n` bytes. Returns the address to
- /// store weight cache. Returns NULL if fails to reserve space.
- /// @param context - The user-specified pointer from xnn_weights_cache_provider structure.
- /// @param n - size to be reserved.
- void* (*reserve_space)(void* context, size_t n);
- /// Looks up packed weights at `ptr` in the cache. If it is found, reuse it.
- /// Otherwise, it is added to the cache. Returns the offset to the cache.
- /// @param context - The user-specified pointer from xnn_weights_cache_provider structure.
- /// @param cache_key - The key used to locate the weights cache entry.
- /// @param ptr - pointer pointing to the packed weight.
- /// @param size - size of the packed weight.
- size_t (*look_up_or_insert)(void* context, const struct xnn_weights_cache_look_up_key* cache_key, void* ptr, size_t size);
- /// Returns whether the cache is finalized.
- /// @param context - The user-specified pointer from xnn_weights_cache_provider structure.
- bool (*is_finalized)(void* context);
- /// Returns the absolute pointer corresponding to `offset`, where the offset is returned from
- /// `look_up` or `get_or_insert`. This function must be called after finalize.
- /// @param context - The user-specified pointer from xnn_weights_cache_provider structure.
- /// @param offset - offset to the start of internal buffer
- void* (*offset_to_addr)(void* context, size_t offset);
- /// Destroy a weights cache object, as well as memory used for the cache.
- /// @param context - The user-specified pointer from xnn_weights_cache_provider structure.
- enum xnn_status (*delete_cache)(void* context);
- };
- /// Weights cache is a cache for packed weights. It can be reused between runtimes.
- typedef struct xnn_weights_cache_provider* xnn_weights_cache_t;
- /// Create a weights cache object specifying the initial size of weights cache (in bytes).
- ///
- /// @param[in] size - initial capacity of the weights cache (in bytes), i.e. it can hold size bytes without growing.
- /// @param weights_cache_out - pointer to the variable that will be initialized to a handle to the weights cache provider
- /// upon successful return. Once created, the weights cache provider can be shared between
- /// different Runtime objects.
- enum xnn_status xnn_create_weights_cache_with_size(size_t size, xnn_weights_cache_t* weights_cache_out);
- enum xnn_status xnn_create_weights_cache(xnn_weights_cache_t* weights_cache_out);
- /// Finalizes the weights cache. The kind of finalization is specified by `finalization_kind`.
- /// @param weights_cache - the weights cache object to finalize.
- /// @param finalization_kind - the kind of finalization.
- enum xnn_status xnn_finalize_weights_cache(
- xnn_weights_cache_t weights_cache,
- enum xnn_weights_cache_finalization_kind finalization_kind);
- // Wrapper function of the function pointers in `xnn_weights_cache_t`.
- bool xnn_weights_cache_is_finalized(xnn_weights_cache_t cache);
- /// Destroy a weights cache object, as well as memory used for the cache.
- /// @param weights_cache - the weights cache object to destroy.
- enum xnn_status xnn_delete_weights_cache(xnn_weights_cache_t weights_cache);
- typedef struct xnn_workspace* xnn_workspace_t;
- /// Create a workspace object.
- /// @param workspace_out - pointer to the variable that will be initialized to a handle to the workspace object upon
- /// successful return. Once created, the workspace can be shared between different Runtime
- /// objects.
- enum xnn_status xnn_create_workspace(xnn_workspace_t* workspace_out);
- /// Destroy a workspace object, as well as memory used by the workspace. Object destruction can be deferred until all
- /// Runtime objects created with this workspace are destroyed.
- /// @param workspace - the workspace object to destroy.
- enum xnn_status xnn_release_workspace(xnn_workspace_t workspace);
- /// Runtime is a combination of an execution plan for subgraph Nodes and a memory manager for subgraph Values.
- typedef struct xnn_runtime* xnn_runtime_t;
- enum xnn_profile_info {
- /// Returns a size_t containing the number of operators.
- xnn_profile_info_num_operators,
- /// Returns a char[] containing the null character separated names of all operators.
- xnn_profile_info_operator_name,
- /// Returns a uint64_t[] with the runtimes of all operators in the same order as xnn_profile_info_operator_name.
- xnn_profile_info_operator_timing,
- };
- /// Return profile information for all operators.
- ///
- /// @param runtime - a Runtime object created with @ref xnn_create_runtime, @ref xnn_create_runtime_v2 or
- /// @ref xnn_create_runtime_v3.
- /// @param param_name - type of profile information required.
- /// @param param_value_size - the size in bytes of memory pointed to by param_value. If this is not sufficient then
- /// param_value_size_ret will be set to the required size and xnn_status_out_of_memory will be
- /// returned.
- /// @param param_value - a pointer to memory location where appropriate values for a given param_value will be written.
- /// @param param_value_size_ret - returns number of bytes required to write the result if param_value_size is not
- /// sufficient.
- enum xnn_status xnn_get_runtime_profiling_info(xnn_runtime_t runtime,
- enum xnn_profile_info param_name,
- size_t param_value_size,
- void* param_value,
- size_t* param_value_size_ret);
- /// Create a Runtime object from a subgraph.
- ///
- /// @param subgraph - a Subgraph object with all Values and Nodes that would be handled by the runtime. No Values or
- /// Nodes can be added to the runtime once it is constructed.
- /// @param weights_cache - a cache for packed weights. The runtime will look up and reuse packed weights in this cache,
- /// this will reduce memory allocated for packed weights.
- /// @param workspace - a workspace to hold internal tensors. The runtime will allocate space used for internal tensors
- /// and track them using workspace. Workspace can be shared and reused across different runtimes. If
- /// workspace is NULL, there will be no sharing: each runtime has its own workspace.
- /// @param threadpool - the thread pool to be used for parallelisation of computations in the runtime. If the thread
- /// pool is NULL, the computation would run on the caller thread without parallelization.
- /// @param flags - binary features of the runtime. The only currently supported values are
- /// XNN_FLAG_HINT_SPARSE_INFERENCE, XNN_FLAG_HINT_FP16_INFERENCE, XNN_FLAG_FORCE_FP16_INFERENCE,
- /// XNN_FLAG_YIELD_WORKERS, and XNN_FLAG_TRANSIENT_INDIRECTION_BUFFER. If XNN_FLAG_YIELD_WORKERS is
- /// specified, worker threads would be yielded to the system scheduler after processing the last operator
- /// in the Runtime. If XNN_FLAG_TRANSIENT_INDIRECTION_BUFFER is specified, convolution operators will
- /// initialize indirection buffers on each inference run using temporary memory in the workspace, instead
- /// of initializing persistent indirection buffers once.
- /// @param runtime_out - pointer to the variable that will be initialized with a handle to the Runtime object upon
- /// successful return. Once constructed, the Runtime object is independent of the Subgraph object
- /// used to create it.
- enum xnn_status xnn_create_runtime_v4(
- xnn_subgraph_t subgraph,
- xnn_weights_cache_t weights_cache,
- xnn_workspace_t workspace,
- pthreadpool_t threadpool,
- uint32_t flags,
- xnn_runtime_t* runtime_out);
- enum xnn_status xnn_create_runtime_v3(
- xnn_subgraph_t subgraph,
- xnn_weights_cache_t weights_cache,
- pthreadpool_t threadpool,
- uint32_t flags,
- xnn_runtime_t* runtime_out);
- enum xnn_status xnn_create_runtime_v2(
- xnn_subgraph_t subgraph,
- pthreadpool_t threadpool,
- uint32_t flags,
- xnn_runtime_t* runtime_out);
- enum xnn_status xnn_create_runtime(
- xnn_subgraph_t subgraph,
- xnn_runtime_t* runtime_out);
- struct xnn_external_value {
- uint32_t id;
- void* data;
- };
- /// Reshape an external value.
- ///
- /// @param external_id - external ID for the Value. The ID must be within the range of reversed Value IDs specified on
- /// the Subgraph creation. If the external ID is XNN_INVALID_VALUE_ID, an internal ID will be
- /// created for the Value.
- /// @param num_dims - number of dimensions in the shape.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. If num_dims is 0, this pointer can be NULL.
- /// XNNPACK does not keep any pointers to this array after the function returns.
- enum xnn_status xnn_reshape_external_value(
- xnn_runtime_t runtime,
- uint32_t external_id,
- size_t num_dims,
- const size_t* dims);
- /// Get the external value shape.
- ///
- /// @param external_id - external ID for the Value. The ID must be within the range of reversed Value IDs specified on
- /// the Subgraph creation. The external ID can not be XNN_INVALID_VALUE_ID.
- /// @param num_dims - A valid pointer into which the number of dimensions in the shape will be written. It can not be larger than XNN_MAX_TENSOR_DIMS.
- /// @param dims - pointer to an array of @a num_dims shape dimensions. This pointer can't be NULL. It must be large enough to hold
- /// at least @a num_dims elements. XNNPACK does not keep any pointers to this array after the function returns.
- enum xnn_status xnn_get_external_value_shape(
- xnn_runtime_t runtime,
- uint32_t external_id,
- size_t* num_dims,
- size_t* dims);
- /// Reshape the XNNPACK runtime.
- ///
- /// Propagates the shapes of input tensors through the graph to determine the shapes of intermediate and output tensors.
- /// Memory is allocated if required. Output tensor shapes are returned by xnn_get_external_value_shape.
- ///
- /// @param runtime - a Runtime object created with @ref xnn_create_runtime or @ref xnn_create_runtime_v2.
- enum xnn_status xnn_reshape_runtime(
- xnn_runtime_t runtime);
- /// Deprecated. Use xnn_reshape_runtime and xnn_setup_runtime_v2.
- ///
- /// Setup data pointers for external inputs and outputs in a Runtime object and
- /// allocate memory.
- ///
- /// @param runtime - a Runtime object created with @ref xnn_create_runtime or @ref xnn_create_runtime_v2.
- /// @param num_external_values - the number of external inputs and outputs specified in this call. This number must
- /// match the number of external inputs and outputs in the runtime, i.e. all external
- /// inputs and outputs in the runtime must be specified in one call.
- /// @param external_values - array with location information for all external inputs and outputs in the runtime.
- enum xnn_status xnn_setup_runtime(
- xnn_runtime_t runtime,
- size_t num_external_values,
- const struct xnn_external_value* external_values);
- /// Setup data pointers for external inputs and outputs in a Runtime object.
- /// Should be called after xnn_reshape_runtime.
- ///
- /// @param runtime - a Runtime object created with @ref xnn_create_runtime or @ref xnn_create_runtime_v2.
- /// @param num_external_values - the number of external inputs and outputs specified in this call. This number must
- /// match the number of external inputs and outputs in the runtime, i.e. all external
- /// inputs and outputs in the runtime must be specified in one call.
- /// @param external_values - array with location information for all external inputs and outputs in the runtime.
- enum xnn_status xnn_setup_runtime_v2(
- xnn_runtime_t runtime,
- size_t num_external_values,
- const struct xnn_external_value* external_values);
- /// Execute forward pass for all operators in the runtime.
- ///
- /// @param runtime - the Runtime object with the execution plan to invoke.
- enum xnn_status xnn_invoke_runtime(
- xnn_runtime_t runtime);
- /// Destroy a Runtime object, as well as operators and memory associated with it.
- ///
- /// @param runtime - the Runtime object to destroy.
- enum xnn_status xnn_delete_runtime(
- xnn_runtime_t runtime);
- typedef struct xnn_operator* xnn_operator_t;
- enum xnn_status xnn_run_operator(
- xnn_operator_t op,
- pthreadpool_t threadpool);
- enum xnn_status xnn_delete_operator(
- xnn_operator_t op);
- /// Operator API:
- /// - create operator will create and populate a xnn_operator_t
- /// - reshape operator will update fields in xnn_operator_t with shape/dimensions and parallelization information
- /// - setup operator will update pointers to input and outputs
- /// Each supported operator must have a create, reshape, and setup function. (Optionally a run function.)
- /// Operators listed below are in alphabetical order by operator name; within each operator, we sort alphabetically by
- /// data layout and type. We also group create, reshape, setup (and optionally run) functions of each operator together.
- enum xnn_status xnn_create_binary_elementwise_nd(
- enum xnn_binary_operator type,
- enum xnn_datatype datatype,
- const struct xnn_quantization_params* input1_quantization,
- const struct xnn_quantization_params* input2_quantization,
- const struct xnn_quantization_params* output_quantization,
- uint32_t flags,
- xnn_operator_t* binary_op_out);
- enum xnn_status xnn_reshape_binary_elementwise_nd(
- xnn_operator_t binary_op,
- size_t num_input1_dims,
- const size_t* input1_shape,
- size_t num_input2_dims,
- const size_t* input2_shape,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_binary_elementwise_nd(
- xnn_operator_t binary_op,
- const void* input1,
- const void* input2,
- void* output);
- enum xnn_status xnn_run_binary_elementwise_nd(
- enum xnn_binary_operator type,
- enum xnn_datatype datatype,
- const struct xnn_quantization_params* input1_quantization,
- const struct xnn_quantization_params* input2_quantization,
- const struct xnn_quantization_params* output_quantization,
- uint32_t flags,
- size_t num_input1_dims,
- const size_t* input1_shape,
- size_t num_input2_dims,
- const size_t* input2_shape,
- const void* input1,
- const void* input2,
- void* output,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_unary_elementwise_nc(
- enum xnn_unary_operator op_type,
- enum xnn_datatype input_datatype,
- enum xnn_datatype output_datatype,
- const union xnn_unary_params* params,
- const struct xnn_quantization_params* input_quantization,
- const struct xnn_quantization_params* output_quantization,
- uint32_t flags,
- xnn_operator_t* op_out);
- enum xnn_status xnn_reshape_unary_elementwise_nc(
- xnn_operator_t op,
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_unary_elementwise_nc(
- xnn_operator_t op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_unary_elementwise_nc(
- // create parameters
- enum xnn_unary_operator op_type,
- enum xnn_datatype input_datatype,
- enum xnn_datatype output_datatype,
- const union xnn_unary_params* params,
- const struct xnn_quantization_params* input_quantization,
- const struct xnn_quantization_params* output_quantization,
- uint32_t flags,
- // reshape parameters
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool,
- // setup parameters
- const void* input,
- void* output);
- enum xnn_status xnn_create_argmax_pooling2d_nhwc_f32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t flags,
- xnn_operator_t* argmax_pooling_op_out);
- enum xnn_status xnn_reshape_argmax_pooling2d_nhwc_f32(
- xnn_operator_t argmax_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_argmax_pooling2d_nhwc_f32(
- xnn_operator_t argmax_pooling_op,
- void* workspace,
- const float* input,
- float* output,
- uint32_t* index);
- enum xnn_status xnn_create_average_pooling2d_nhwc_f16(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_operator_t* average_pooling_op_out);
- enum xnn_status xnn_reshape_average_pooling2d_nhwc_f16(
- xnn_operator_t average_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_average_pooling2d_nhwc_f16(
- xnn_operator_t average_pooling_op,
- void* workspace,
- const void* input,
- void* output);
- enum xnn_status xnn_create_average_pooling2d_nhwc_f32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_operator_t* average_pooling_op_out);
- enum xnn_status xnn_reshape_average_pooling2d_nhwc_f32(
- xnn_operator_t average_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_average_pooling2d_nhwc_f32(
- xnn_operator_t average_pooling_op,
- void* workspace,
- const float* input,
- float* output);
- enum xnn_status xnn_create_average_pooling2d_nhwc_qu8(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint8_t input_zero_point,
- float input_scale,
- uint8_t output_zero_point,
- float output_scale,
- uint8_t output_min,
- uint8_t output_max,
- uint32_t flags,
- xnn_operator_t* average_pooling_op_out);
- enum xnn_status xnn_reshape_average_pooling2d_nhwc_qu8(
- xnn_operator_t average_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_average_pooling2d_nhwc_qu8(
- xnn_operator_t average_pooling_op,
- void* workspace,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_batch_matrix_multiply_nc_f16(
- uint32_t flags,
- xnn_operator_t* batch_matrix_multiply_op);
- enum xnn_status xnn_reshape_batch_matrix_multiply_nc_f16(
- xnn_operator_t batch_matrix_multiply_op, size_t num_batch_dims,
- const size_t* batch_dims_a, const size_t* batch_dims_b, size_t m, size_t k,
- size_t n, size_t* workspace_size, size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_batch_matrix_multiply_nc_f16(
- xnn_operator_t batch_matrix_multiply_op, void* workspace,
- const void* input_a, const void* input_b, void* output);
- enum xnn_status xnn_create_batch_matrix_multiply_nc_f32(
- uint32_t flags, xnn_operator_t* batch_matrix_multiply_op);
- enum xnn_status xnn_create_batch_matrix_multiply_nc_f32_const_weights(
- size_t batch_size_b, size_t k, size_t n, const float* data_b,
- uint32_t flags, xnn_operator_t* batch_matrix_multiply_op);
- enum xnn_status xnn_reshape_batch_matrix_multiply_nc_f32(
- xnn_operator_t batch_matrix_multiply_op, size_t num_batch_dims,
- const size_t* batch_dims_a, const size_t* batch_dims_b, size_t m, size_t k,
- size_t n, size_t* workspace_size, size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_batch_matrix_multiply_nc_f32(
- xnn_operator_t batch_matrix_multiply_op, void* workspace,
- const float* input_a, const float* input_b, float* output);
- enum xnn_status xnn_create_batch_matrix_multiply_nc_qd8_f32_qc8w(
- size_t batch_size_b, size_t k, size_t n, const int8_t* data_b,
- const float* scale_b, uint32_t flags,
- xnn_operator_t* batch_matrix_multiply_op);
- enum xnn_status xnn_reshape_batch_matrix_multiply_nc_qd8_f32_qc8w(
- xnn_operator_t batch_matrix_multiply_op, size_t num_batch_dims,
- const size_t* batch_dims_a, const size_t* batch_dims_b, size_t m, size_t k,
- size_t n, pthreadpool_t threadpool);
- enum xnn_status xnn_setup_batch_matrix_multiply_nc_qd8_f32_qc8w(
- xnn_operator_t batch_matrix_multiply_op, const int8_t* input_a,
- const struct xnn_quantization_params* quantization_params,
- float* output);
- enum xnn_status xnn_create_channel_shuffle_nc_x8(
- size_t groups,
- size_t group_channels,
- size_t input_stride,
- size_t output_stride,
- uint32_t flags,
- xnn_operator_t* channel_shuffle_op_out);
- enum xnn_status xnn_reshape_channel_shuffle_nc_x8(
- xnn_operator_t channel_shuffle_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_channel_shuffle_nc_x8(
- xnn_operator_t channel_shuffle_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_channel_shuffle_nc_x32(
- size_t groups,
- size_t group_channels,
- size_t input_stride,
- size_t output_stride,
- uint32_t flags,
- xnn_operator_t* channel_shuffle_op_out);
- enum xnn_status xnn_reshape_channel_shuffle_nc_x32(
- xnn_operator_t channel_shuffle_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_channel_shuffle_nc_x32(
- xnn_operator_t channel_shuffle_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_constant_pad_nd_x8(
- const void* padding_value,
- uint32_t flags,
- xnn_operator_t* constant_pad_op_out);
- enum xnn_status xnn_reshape_constant_pad_nd_x8(
- xnn_operator_t constant_pad_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* pre_padding,
- const size_t* post_padding,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_constant_pad_nd_x8(
- xnn_operator_t constant_pad_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_constant_pad_nd_x8(
- uint32_t flags,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* pre_paddings,
- const size_t* post_paddings,
- const void* input,
- void* output,
- const void* padding_value,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_constant_pad_nd_x16(
- const void* padding_value,
- uint32_t flags,
- xnn_operator_t* constant_pad_op_out);
- enum xnn_status xnn_reshape_constant_pad_nd_x16(
- xnn_operator_t constant_pad_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* pre_padding,
- const size_t* post_padding,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_constant_pad_nd_x16(
- xnn_operator_t constant_pad_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_constant_pad_nd_x16(
- uint32_t flags,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* pre_paddings,
- const size_t* post_paddings,
- const void* input,
- void* output,
- const void* padding_value,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_constant_pad_nd_x32(
- const void* padding_value,
- uint32_t flags,
- xnn_operator_t* constant_pad_op_out);
- enum xnn_status xnn_reshape_constant_pad_nd_x32(
- xnn_operator_t constant_pad_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* pre_padding,
- const size_t* post_padding,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_constant_pad_nd_x32(
- xnn_operator_t constant_pad_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_constant_pad_nd_x32(
- uint32_t flags,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* pre_paddings,
- const size_t* post_paddings,
- const void* input,
- void* output,
- const void* padding_value,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_convert_nc_f16_qd8(
- uint32_t flags,
- xnn_operator_t* convert_op_out);
- enum xnn_status xnn_reshape_convert_nc_f16_qd8(
- xnn_operator_t convert_op,
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool);
- // quantization_params must be padded with at least XNN_EXTRA_QUANTIZATION_PARAMS entries.
- enum xnn_status xnn_setup_convert_nc_f16_qd8(
- xnn_operator_t convert_op,
- const void* input,
- int8_t* output,
- struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_create_convert_nc_f32_qd8(
- uint32_t flags,
- xnn_operator_t* convert_op_out);
- enum xnn_status xnn_reshape_convert_nc_f32_qd8(
- xnn_operator_t convert_op,
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool);
- // quantization_params must be padded with at least XNN_EXTRA_QUANTIZATION_PARAMS entries.
- enum xnn_status xnn_setup_convert_nc_f32_qd8(
- xnn_operator_t convert_op,
- const float* input,
- int8_t* output,
- struct xnn_quantization_params* quantization_params);
- XNN_DEPRECATED enum xnn_status xnn_run_convert_nc_f32_f16(
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- size_t batch_size,
- const float* input,
- void* output,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_convolution2d_nchw_f16(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nchw_f16(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nchw_f16(
- xnn_operator_t convolution_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_convolution2d_nchw_f32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- const float* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nchw_f32(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nchw_f32(
- xnn_operator_t convolution_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_convolution2d_nhwc_f16(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nhwc_f16(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nhwc_f16(
- xnn_operator_t convolution_op,
- void* workspace,
- const void* input,
- void* output);
- enum xnn_status xnn_create_convolution2d_nhwc_f32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- const float* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_create_convolution2d_nhwc_f32_f16(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- // Forward declare.
- struct xnn_post_operation;
- /// Deprecated
- enum xnn_status xnn_create_fused_convolution2d_nhwc_f32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- const float* kernel,
- const float* bias,
- size_t num_post_operations,
- struct xnn_post_operation* post_operations,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nhwc_f32(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nhwc_f32(
- xnn_operator_t convolution_op,
- void* workspace,
- const float* input,
- float* output);
- enum xnn_status xnn_create_convolution2d_nhwc_qd8_f16_qc8w(
- uint32_t input_padding_top, uint32_t input_padding_right,
- uint32_t input_padding_bottom, uint32_t input_padding_left,
- uint32_t kernel_height, uint32_t kernel_width, uint32_t subsampling_height,
- uint32_t subsampling_width, uint32_t dilation_height,
- uint32_t dilation_width, uint32_t groups, size_t group_input_channels,
- size_t group_output_channels, size_t input_channel_stride,
- size_t output_channel_stride, const float* kernel_scale,
- const int8_t* kernel, const float* bias, float output_min, float output_max,
- uint32_t flags, xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache, xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_create_convolution2d_nhwc_qd8_f32_qc8w(
- uint32_t input_padding_top, uint32_t input_padding_right,
- uint32_t input_padding_bottom, uint32_t input_padding_left,
- uint32_t kernel_height, uint32_t kernel_width, uint32_t subsampling_height,
- uint32_t subsampling_width, uint32_t dilation_height,
- uint32_t dilation_width, uint32_t groups, size_t group_input_channels,
- size_t group_output_channels, size_t input_channel_stride,
- size_t output_channel_stride, const float* kernel_scale,
- const int8_t* kernel, const float* bias, float output_min, float output_max,
- uint32_t flags, xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache, xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_create_convolution2d_nhwc_qs8(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- int8_t input_zero_point,
- float input_scale,
- float kernel_scale,
- const int8_t* kernel,
- const int32_t* bias,
- int8_t output_zero_point,
- float output_scale,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nhwc_qd8_f16_qc8w(
- xnn_operator_t convolution_op, size_t batch_size, size_t input_height,
- size_t input_width, size_t* workspace_size, size_t* workspace_alignment,
- size_t* output_height_out, size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_reshape_convolution2d_nhwc_qd8_f32_qc8w(
- xnn_operator_t convolution_op, size_t batch_size, size_t input_height,
- size_t input_width, size_t* workspace_size, size_t* workspace_alignment,
- size_t* output_height_out, size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_reshape_convolution2d_nhwc_qs8(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nhwc_qd8_f16_qc8w(
- xnn_operator_t convolution_op, void* workspace, const int8_t* input,
- void* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_setup_convolution2d_nhwc_qd8_f32_qc8w(
- xnn_operator_t convolution_op, void* workspace, const int8_t* input,
- float* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_setup_convolution2d_nhwc_qs8(
- xnn_operator_t convolution_op,
- void* workspace,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_convolution2d_nhwc_qs8_qc8w(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- int8_t input_zero_point,
- float input_scale,
- const float* kernel_scale,
- const int8_t* kernel,
- const int32_t* bias,
- int8_t output_zero_point,
- float output_scale,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nhwc_qs8_qc8w(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nhwc_qs8_qc8w(
- xnn_operator_t convolution_op,
- void* workspace,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_convolution2d_nhwc_qu8(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t subsampling_height,
- uint32_t subsampling_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_channel_stride,
- size_t output_channel_stride,
- uint8_t input_zero_point,
- float input_scale,
- uint8_t kernel_zero_point,
- float kernel_scale,
- const uint8_t* kernel,
- const int32_t* bias,
- uint8_t output_zero_point,
- float output_scale,
- uint8_t output_min,
- uint8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* convolution_op_out);
- enum xnn_status xnn_reshape_convolution2d_nhwc_qu8(
- xnn_operator_t convolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* workspace_size,
- size_t* workspace_alignment,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_convolution2d_nhwc_qu8(
- xnn_operator_t convolution_op,
- void* workspace,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_copy_nc_x8(
- uint32_t flags,
- xnn_operator_t* copy_op_out);
- enum xnn_status xnn_reshape_copy_nc_x8(
- xnn_operator_t copy_op,
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_copy_nc_x8(
- xnn_operator_t copy_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_copy_nc_x16(
- uint32_t flags,
- xnn_operator_t* copy_op_out);
- enum xnn_status xnn_reshape_copy_nc_x16(
- xnn_operator_t copy_op,
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_copy_nc_x16(
- xnn_operator_t copy_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_copy_nc_x32(
- uint32_t flags,
- xnn_operator_t* copy_op_out);
- enum xnn_status xnn_reshape_copy_nc_x32(
- xnn_operator_t copy_op,
- size_t batch_size,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_copy_nc_x32(
- xnn_operator_t copy_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_copy_nc_x32(
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- size_t batch_size,
- const uint32_t* input,
- uint32_t* output,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_deconvolution2d_nhwc_f16(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_reshape_deconvolution2d_nhwc_f16(
- xnn_operator_t deconvolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_deconvolution2d_nhwc_f16(
- xnn_operator_t deconvolution_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_deconvolution2d_nhwc_f32(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- const float* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_create_deconvolution2d_nhwc_f32_f16(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_reshape_deconvolution2d_nhwc_f32(
- xnn_operator_t deconvolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_deconvolution2d_nhwc_f32(
- xnn_operator_t deconvolution_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_deconvolution2d_nhwc_qd8_f32_qc8w(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- const float* kernel_scale,
- const int8_t* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_reshape_deconvolution2d_nhwc_qd8_f32_qc8w(
- xnn_operator_t deconvolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_deconvolution2d_nhwc_qd8_f32_qc8w(
- xnn_operator_t deconvolution_op,
- const int8_t* input,
- float* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_create_deconvolution2d_nhwc_qs8(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- int8_t input_zero_point,
- float input_scale,
- float kernel_scale,
- const int8_t* kernel,
- const int32_t* bias,
- int8_t output_zero_point,
- float output_scale,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_reshape_deconvolution2d_nhwc_qs8(
- xnn_operator_t deconvolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_deconvolution2d_nhwc_qs8(
- xnn_operator_t deconvolution_op,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_deconvolution2d_nhwc_qs8_qc8w(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- int8_t input_zero_point,
- float input_scale,
- const float* kernel_scale,
- const int8_t* kernel,
- const int32_t* bias,
- int8_t output_zero_point,
- float output_scale,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_reshape_deconvolution2d_nhwc_qs8_qc8w(
- xnn_operator_t deconvolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_deconvolution2d_nhwc_qs8_qc8w(
- xnn_operator_t deconvolution_op,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_deconvolution2d_nhwc_qu8(
- uint32_t output_padding_top,
- uint32_t output_padding_right,
- uint32_t output_padding_bottom,
- uint32_t output_padding_left,
- uint32_t kernel_height,
- uint32_t kernel_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint32_t groups,
- size_t group_input_channels,
- size_t group_output_channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- uint8_t input_zero_point,
- float input_scale,
- uint8_t kernel_zero_point,
- float kernel_scale,
- const uint8_t* kernel,
- const int32_t* bias,
- uint8_t output_zero_point,
- float output_scale,
- uint8_t output_min,
- uint8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* deconvolution_op_out);
- enum xnn_status xnn_reshape_deconvolution2d_nhwc_qu8(
- xnn_operator_t deconvolution_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- uint32_t adjustment_height,
- uint32_t adjustment_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_deconvolution2d_nhwc_qu8(
- xnn_operator_t deconvolution_op,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_depth_to_space_nchw2nhwc_x16(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* depth_to_space_op_out);
- enum xnn_status xnn_reshape_depth_to_space_nchw2nhwc_x16(
- xnn_operator_t depth_to_space_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_depth_to_space_nchw2nhwc_x16(
- xnn_operator_t depth_to_space_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_depth_to_space_nchw2nhwc_x32(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* depth_to_space_op_out);
- enum xnn_status xnn_reshape_depth_to_space_nchw2nhwc_x32(
- xnn_operator_t depth_to_space_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_depth_to_space_nchw2nhwc_x32(
- xnn_operator_t depth_to_space_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_depth_to_space_nhwc_x8(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* depth_to_space_op_out);
- enum xnn_status xnn_reshape_depth_to_space_nhwc_x8(
- xnn_operator_t depth_to_space_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_depth_to_space_nhwc_x8(
- xnn_operator_t depth_to_space_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_depth_to_space_nhwc_x16(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* depth_to_space_op_out);
- enum xnn_status xnn_reshape_depth_to_space_nhwc_x16(
- xnn_operator_t depth_to_space_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_depth_to_space_nhwc_x16(
- xnn_operator_t depth_to_space_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_depth_to_space_nhwc_x32(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* depth_to_space_op_out);
- enum xnn_status xnn_reshape_depth_to_space_nhwc_x32(
- xnn_operator_t depth_to_space_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_depth_to_space_nhwc_x32(
- xnn_operator_t depth_to_space_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_dynamic_fully_connected_nc_f16(
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_operator_t* dynamic_fully_connected_op_out);
- enum xnn_status xnn_reshape_dynamic_fully_connected_nc_f16(
- xnn_operator_t dynamic_fully_connected_op,
- size_t batch_size,
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_dynamic_fully_connected_nc_f16(
- xnn_operator_t dynamic_fully_connected_op,
- void* workspace,
- const void* input,
- const void* kernel,
- const void* bias,
- void* output);
- enum xnn_status xnn_create_dynamic_fully_connected_nc_f32(
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_operator_t* dynamic_fully_connected_op_out);
- enum xnn_status xnn_reshape_dynamic_fully_connected_nc_f32(
- xnn_operator_t dynamic_fully_connected_op,
- size_t batch_size,
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_dynamic_fully_connected_nc_f32(
- xnn_operator_t dynamic_fully_connected_op,
- void* workspace,
- const float* input,
- const float* kernel,
- const float* bias,
- float* output);
- enum xnn_status xnn_create_fully_connected_nc_f16(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_f16(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_f16(
- xnn_operator_t fully_connected_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_fully_connected_nc_f32_f16(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- const void* kernel,
- const void* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_create_fully_connected_nc_f32(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- const float* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_f32_f16(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_reshape_fully_connected_nc_f32(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_f32_f16(
- xnn_operator_t fully_connected_op,
- const float* input,
- float* output);
- enum xnn_status xnn_setup_fully_connected_nc_f32(
- xnn_operator_t fully_connected_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_fully_connected_nc_f32_qc4w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- uint8_t kernel_zero_point,
- const float* kernel_scale,
- const uint8_t* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_f32_qc4w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_f32_qc4w(
- xnn_operator_t fully_connected_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_fully_connected_nc_f32_qc8w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- const float* kernel_scale,
- const int8_t* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_f32_qc8w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_f32_qc8w(
- xnn_operator_t fully_connected_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_fully_connected_nc_qd8_f16_qc4w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- uint8_t kernel_zero_point,
- const float* kernel_scale,
- const void* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_setup_fully_connected_nc_qd8_f16_qc4w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- void* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_reshape_fully_connected_nc_qd8_f16_qc4w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_fully_connected_nc_qd8_f16_qb4w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- size_t block_size,
- uint8_t kernel_zero_point,
- const uint16_t* kernel_scale,
- const void* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_qd8_f16_qb4w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_qd8_f16_qb4w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- void* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_create_fully_connected_nc_qd8_f32_qc4w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- uint8_t kernel_zero_point,
- const float* kernel_scale,
- const void* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_setup_fully_connected_nc_qd8_f32_qc4w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- float* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_reshape_fully_connected_nc_qd8_f32_qc4w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_fully_connected_nc_qd8_f32_qb4w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- size_t block_size,
- uint8_t kernel_zero_point,
- const uint16_t* kernel_scale,
- const void* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_qd8_f32_qb4w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_qd8_f32_qb4w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- float* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_create_fully_connected_nc_qd8_f16_qc8w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- const float* kernel_scale,
- const int8_t* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_setup_fully_connected_nc_qd8_f16_qc8w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- void* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_reshape_fully_connected_nc_qd8_f16_qc8w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_fully_connected_nc_qd8_f32_qc8w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- const float* kernel_scale,
- const int8_t* kernel,
- const float* bias,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_setup_fully_connected_nc_qd8_f32_qc8w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- float* output,
- const struct xnn_quantization_params* quantization_params);
- enum xnn_status xnn_reshape_fully_connected_nc_qd8_f32_qc8w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_fully_connected_nc_qs8(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- int8_t input_zero_point,
- float input_scale,
- float kernel_scale,
- const int8_t* kernel,
- const int32_t* bias,
- int8_t output_zero_point,
- float output_scale,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_qs8(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_qs8(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_fully_connected_nc_qs8_qc8w(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- int8_t input_zero_point,
- float input_scale,
- const float* kernel_scale,
- const int8_t* kernel,
- const int32_t* bias,
- int8_t output_zero_point,
- float output_scale,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_qs8_qc8w(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_qs8_qc8w(
- xnn_operator_t fully_connected_op,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_fully_connected_nc_qu8(
- size_t input_channels,
- size_t output_channels,
- size_t input_stride,
- size_t output_stride,
- uint8_t input_zero_point,
- float input_scale,
- uint8_t kernel_zero_point,
- float kernel_scale,
- const uint8_t* kernel,
- const int32_t* bias,
- uint8_t output_zero_point,
- float output_scale,
- uint8_t output_min,
- uint8_t output_max,
- uint32_t flags,
- xnn_code_cache_t code_cache,
- xnn_weights_cache_t weights_cache,
- xnn_operator_t* fully_connected_op_out);
- enum xnn_status xnn_reshape_fully_connected_nc_qu8(
- xnn_operator_t fully_connected_op,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_fully_connected_nc_qu8(
- xnn_operator_t fully_connected_op,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_max_pooling2d_nhwc_f16(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_operator_t* max_pooling_op_out);
- enum xnn_status xnn_reshape_max_pooling2d_nhwc_f16(
- xnn_operator_t max_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_max_pooling2d_nhwc_f16(
- xnn_operator_t max_pooling_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_max_pooling2d_nhwc_f32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- float output_min,
- float output_max,
- uint32_t flags,
- xnn_operator_t* max_pooling_op_out);
- enum xnn_status xnn_reshape_max_pooling2d_nhwc_f32(
- xnn_operator_t max_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_max_pooling2d_nhwc_f32(
- xnn_operator_t max_pooling_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_max_pooling2d_nhwc_s8(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- int8_t output_min,
- int8_t output_max,
- uint32_t flags,
- xnn_operator_t* max_pooling_op_out);
- enum xnn_status xnn_reshape_max_pooling2d_nhwc_s8(
- xnn_operator_t max_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_max_pooling2d_nhwc_s8(
- xnn_operator_t max_pooling_op,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_max_pooling2d_nhwc_u8(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- uint32_t stride_height,
- uint32_t stride_width,
- uint32_t dilation_height,
- uint32_t dilation_width,
- uint8_t output_min,
- uint8_t output_max,
- uint32_t flags,
- xnn_operator_t* max_pooling_op_out);
- enum xnn_status xnn_reshape_max_pooling2d_nhwc_u8(
- xnn_operator_t max_pooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_max_pooling2d_nhwc_u8(
- xnn_operator_t max_pooling_op,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_reduce_nd(
- enum xnn_reduce_operator reduce_operator_type,
- enum xnn_datatype datatype,
- const struct xnn_quantization_params* input_quantization,
- const struct xnn_quantization_params* output_quantization,
- uint32_t flags,
- xnn_operator_t* reduce_op_out);
- enum xnn_status xnn_reshape_reduce_nd( //
- xnn_operator_t reduce_op, //
- size_t num_reduction_axes, //
- const int64_t* reduction_axes, //
- size_t num_input_dims, //
- const size_t* input_shape, //
- size_t* workspace_size, //
- size_t* workspace_alignment, //
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_reduce_nd(
- xnn_operator_t reduce_op,
- void* workspace,
- const void* input,
- void* output);
- enum xnn_status xnn_create_resize_bilinear2d_nchw_f32(
- size_t output_height,
- size_t output_width,
- uint32_t flags,
- xnn_operator_t* resize_op_out);
- enum xnn_status xnn_reshape_resize_bilinear2d_nchw_f32(
- xnn_operator_t resize_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_resize_bilinear2d_nchw_f32(
- xnn_operator_t resize_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_resize_bilinear2d_nchw_f16(
- size_t output_height,
- size_t output_width,
- uint32_t flags,
- xnn_operator_t* resize_op_out);
- enum xnn_status xnn_reshape_resize_bilinear2d_nchw_f16(
- xnn_operator_t resize_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_resize_bilinear2d_nchw_f16(
- xnn_operator_t resize_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_resize_bilinear2d_nhwc_f16(
- size_t output_height,
- size_t output_width,
- uint32_t flags,
- xnn_operator_t* resize_op_out);
- enum xnn_status xnn_reshape_resize_bilinear2d_nhwc_f16(
- xnn_operator_t resize_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_resize_bilinear2d_nhwc_f16(
- xnn_operator_t resize_op,
- void* workspace,
- const void* input,
- void* output);
- enum xnn_status xnn_create_resize_bilinear2d_nhwc_f32(
- size_t output_height,
- size_t output_width,
- uint32_t flags,
- xnn_operator_t* resize_op_out);
- enum xnn_status xnn_reshape_resize_bilinear2d_nhwc_f32(
- xnn_operator_t resize_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_resize_bilinear2d_nhwc_f32(
- xnn_operator_t resize_op,
- void* workspace,
- const float* input,
- float* output);
- enum xnn_status xnn_create_resize_bilinear2d_nhwc_s8(
- size_t output_height,
- size_t output_width,
- uint32_t flags,
- xnn_operator_t* resize_op_out);
- enum xnn_status xnn_reshape_resize_bilinear2d_nhwc_s8(
- xnn_operator_t resize_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_resize_bilinear2d_nhwc_s8(
- xnn_operator_t resize_op,
- void* workspace,
- const int8_t* input,
- int8_t* output);
- enum xnn_status xnn_create_resize_bilinear2d_nhwc_u8(
- size_t output_height,
- size_t output_width,
- uint32_t flags,
- xnn_operator_t* resize_op_out);
- enum xnn_status xnn_reshape_resize_bilinear2d_nhwc_u8(
- xnn_operator_t resize_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_resize_bilinear2d_nhwc_u8(
- xnn_operator_t resize_op,
- void* workspace,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_rope_nthc_f16(
- uint32_t flags,
- xnn_operator_t* rope_op_out);
- enum xnn_status xnn_reshape_rope_nthc_f16(
- xnn_operator_t rope_op,
- size_t batch_size,
- size_t tokens,
- size_t heads,
- size_t channels,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_rope_nthc_f16(
- xnn_operator_t rope_op,
- const void* input,
- const void* weights,
- void* output);
- enum xnn_status xnn_create_rope_nthc_f32(
- uint32_t flags,
- xnn_operator_t* rope_op_out);
- enum xnn_status xnn_reshape_rope_nthc_f32(
- xnn_operator_t rope_op,
- size_t batch_size,
- size_t tokens,
- size_t heads,
- size_t channels,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_rope_nthc_f32(
- xnn_operator_t rope_op,
- const float* input,
- const float* weights,
- float* output);
- // N: batch size
- // H: number of heads
- // T: tokens (sequence length)
- // C: channels (head dimension)
- enum xnn_status xnn_create_scaled_dot_product_attention_nhtc_f16(
- enum xnn_attention_logits_cap_type cap_type,
- const void* cap_params,
- uint32_t flags,
- xnn_operator_t* attention_op_out);
- enum xnn_status xnn_reshape_scaled_dot_product_attention_nhtc_f16(
- xnn_operator_t attention_op,
- size_t batch_size,
- size_t query_heads,
- // Number of tokens in query.
- size_t query_tokens,
- size_t key_value_heads,
- // Number of tokens in key/value. For self-attention, this is same as tokens.
- size_t key_value_tokens,
- size_t query_key_channels,
- size_t value_channels,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- // Query is of dimension [batch_size, query_heads, query_tokens, channels].
- // Key and value are of dimension [batch_size, key_value_heads, key_value_tokens, channels].
- // Scale is of dimension [channels].
- // Mask is of dimension [query_tokens, key_value_tokens].
- enum xnn_status xnn_setup_scaled_dot_product_attention_nhtc_f16(
- xnn_operator_t attention_op,
- void* workspace,
- const void* query,
- const void* key,
- const void* value,
- const void* scale,
- const void* mask,
- void* output);
- // N: batch size
- // H: number of heads
- // T: tokens (sequence length)
- // C: channels (head dimension)
- enum xnn_status xnn_create_scaled_dot_product_attention_nhtc_f32(
- enum xnn_attention_logits_cap_type cap_type,
- const void* cap_params,
- uint32_t flags,
- xnn_operator_t* attention_op_out);
- enum xnn_status xnn_reshape_scaled_dot_product_attention_nhtc_f32(
- xnn_operator_t attention_op,
- size_t batch_size,
- size_t query_heads,
- // Number of tokens in query.
- size_t query_tokens,
- size_t key_value_heads,
- // Number of tokens in key/value. For self-attention, this is same as tokens.
- size_t key_value_tokens,
- size_t query_key_channels,
- size_t value_channels,
- size_t* workspace_size,
- size_t* workspace_alignment,
- pthreadpool_t threadpool);
- // Query is of dimension [batch_size, query_heads, query_tokens, query_key_channels].
- // Key and value are of dimension [batch_size, key_value_heads, key_value_tokens, query_key_channels].
- // Scale is of dimension [query_key_channels].
- // Mask is of dimension [query_tokens, key_value_tokens].
- // Output is of dimension [batch_size, query_heads, query_tokens, value_channels].
- enum xnn_status xnn_setup_scaled_dot_product_attention_nhtc_f32(
- xnn_operator_t attention_op,
- void* workspace,
- const float* query,
- const float* key,
- const float* value,
- const float* scale,
- const float* mask,
- float* output);
- enum xnn_status xnn_create_slice_nd_x16(
- uint32_t flags,
- xnn_operator_t* slice_op_out);
- enum xnn_status xnn_reshape_slice_nd_x16(
- xnn_operator_t slice_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* offsets,
- const size_t* sizes,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_slice_nd_x16(
- xnn_operator_t slice_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_slice_nd_x32(
- uint32_t flags,
- xnn_operator_t* slice_op_out);
- enum xnn_status xnn_reshape_slice_nd_x32(
- xnn_operator_t slice_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* offsets,
- const size_t* sizes,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_slice_nd_x32(
- xnn_operator_t slice_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_slice_nd_x32(
- size_t num_dims,
- const size_t* input_shape,
- const size_t* offsets,
- const size_t* sizes,
- const void* input,
- void* output,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_softmax_nc_f16(
- uint32_t flags,
- xnn_operator_t* softmax_op_out);
- enum xnn_status xnn_reshape_softmax_nc_f16(
- xnn_operator_t softmax_op,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_softmax_nc_f16(
- xnn_operator_t softmax_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_softmax_nc_f32(
- uint32_t flags,
- xnn_operator_t* softmax_op_out);
- enum xnn_status xnn_reshape_softmax_nc_f32(
- xnn_operator_t softmax_op,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_softmax_nc_f32(
- xnn_operator_t softmax_op,
- const float* input,
- float* output);
- enum xnn_status xnn_create_softmax_nc_qu8(
- float input_scale,
- uint8_t output_zero_point,
- float output_scale,
- uint32_t flags,
- xnn_operator_t* softmax_op_out);
- enum xnn_status xnn_reshape_softmax_nc_qu8(
- xnn_operator_t softmax_op,
- size_t channels,
- size_t input_stride,
- size_t output_stride,
- size_t batch_size,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_softmax_nc_qu8(
- xnn_operator_t softmax_op,
- const uint8_t* input,
- uint8_t* output);
- enum xnn_status xnn_create_space_to_depth_nhwc_x16(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* space_to_depth_op_out);
- enum xnn_status xnn_reshape_space_to_depth_nhwc_x16(
- xnn_operator_t space_to_depth_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_space_to_depth_nhwc_x16(
- xnn_operator_t space_to_depth_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_space_to_depth_nhwc_x32(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* space_to_depth_op_out);
- enum xnn_status xnn_reshape_space_to_depth_nhwc_x32(
- xnn_operator_t space_to_depth_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_space_to_depth_nhwc_x32(
- xnn_operator_t space_to_depth_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_transpose_nd_x8(
- uint32_t flags,
- xnn_operator_t* transpose_op_out);
- enum xnn_status xnn_reshape_transpose_nd_x8(
- xnn_operator_t transpose_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_transpose_nd_x8(
- xnn_operator_t transpose_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_transpose_nd_x8(
- const void* input,
- void* output,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_transpose_nd_x16(
- uint32_t flags,
- xnn_operator_t* transpose_op_out);
- enum xnn_status xnn_reshape_transpose_nd_x16(
- xnn_operator_t transpose_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_transpose_nd_x16(
- xnn_operator_t transpose_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_transpose_nd_x16(
- const void* input,
- void* output,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_transpose_nd_x32(
- uint32_t flags,
- xnn_operator_t* transpose_op_out);
- enum xnn_status xnn_reshape_transpose_nd_x32(
- xnn_operator_t transpose_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_transpose_nd_x32(
- xnn_operator_t transpose_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_transpose_nd_x32(
- const void* input,
- void* output,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_transpose_nd_x64(
- uint32_t flags,
- xnn_operator_t* transpose_op_out);
- enum xnn_status xnn_reshape_transpose_nd_x64(
- xnn_operator_t transpose_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_transpose_nd_x64(
- xnn_operator_t transpose_op,
- const void* input,
- void* output);
- enum xnn_status xnn_run_transpose_nd_x64(
- const void* input,
- void* output,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* output_perm,
- uint32_t flags,
- pthreadpool_t threadpool);
- enum xnn_status xnn_create_unpooling2d_nhwc_x32(
- uint32_t input_padding_top,
- uint32_t input_padding_right,
- uint32_t input_padding_bottom,
- uint32_t input_padding_left,
- uint32_t pooling_height,
- uint32_t pooling_width,
- size_t channels,
- size_t input_pixel_stride,
- size_t output_pixel_stride,
- uint32_t flags,
- xnn_operator_t* unpooling_op_out);
- enum xnn_status xnn_reshape_unpooling2d_nhwc_x32(
- xnn_operator_t unpooling_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t* output_height_out,
- size_t* output_width_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_unpooling2d_nhwc_x32(
- xnn_operator_t unpooling_op,
- const void* input,
- const uint32_t* index,
- void* output);
- enum xnn_status xnn_create_slice_nd_x8(
- uint32_t flags,
- xnn_operator_t* slice_op_out);
- enum xnn_status xnn_reshape_slice_nd_x8(
- xnn_operator_t slice_op,
- size_t num_dims,
- const size_t* input_shape,
- const size_t* offsets,
- const size_t* sizes,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_slice_nd_x8(
- xnn_operator_t slice_op,
- const void* input,
- void* output);
- enum xnn_status xnn_create_space_to_depth_nhwc_x8(
- uint32_t block_size,
- uint32_t flags,
- xnn_operator_t* space_to_depth_op_out);
- enum xnn_status xnn_reshape_space_to_depth_nhwc_x8(
- xnn_operator_t space_to_depth_op,
- size_t batch_size,
- size_t input_height,
- size_t input_width,
- size_t input_channels,
- size_t* output_height_out,
- size_t* output_width_out,
- size_t* output_channels_out,
- pthreadpool_t threadpool);
- enum xnn_status xnn_setup_space_to_depth_nhwc_x8(
- xnn_operator_t space_to_depth_op,
- const void* input,
- void* output);
- #ifdef __cplusplus
- } // extern "C"
- #endif
- #else
- #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
- #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
|