executorch-schema.js 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  1. export const executorch_flatbuffer = {};
  2. export const fb_xnnpack = {};
  3. export const vkgraph = {};
  4. executorch_flatbuffer.ScalarType = {
  5. BYTE: 0,
  6. CHAR: 1,
  7. SHORT: 2,
  8. INT: 3,
  9. LONG: 4,
  10. HALF: 5,
  11. FLOAT: 6,
  12. DOUBLE: 7,
  13. BOOL: 11,
  14. QINT8: 12,
  15. QUINT8: 13,
  16. QINT32: 14,
  17. BFLOAT16: 15,
  18. QUINT4X2: 16,
  19. QUINT2X4: 17,
  20. BITS16: 22,
  21. FLOAT8E5M2: 23,
  22. FLOAT8E4M3FN: 24,
  23. FLOAT8E5M2FNUZ: 25,
  24. FLOAT8E4M3FNUZ: 26,
  25. UINT16: 27,
  26. UINT32: 28,
  27. UINT64: 29
  28. };
  29. executorch_flatbuffer.ContainerMetadata = class ContainerMetadata {
  30. static decode(reader, position) {
  31. const $ = new executorch_flatbuffer.ContainerMetadata();
  32. $.encoded_inp_str = reader.string_(position, 4, null);
  33. $.encoded_out_str = reader.string_(position, 6, null);
  34. return $;
  35. }
  36. };
  37. executorch_flatbuffer.Null = class Null {
  38. static decode(/* reader, position */) {
  39. const $ = new executorch_flatbuffer.Null();
  40. return $;
  41. }
  42. };
  43. executorch_flatbuffer.AllocationDetails = class AllocationDetails {
  44. static decode(reader, position) {
  45. const $ = new executorch_flatbuffer.AllocationDetails();
  46. $.memory_id = reader.uint32_(position, 4, 0);
  47. $.memory_offset_low = reader.uint32_(position, 6, 0);
  48. $.memory_offset_high = reader.uint32_(position, 8, 0);
  49. return $;
  50. }
  51. };
  52. executorch_flatbuffer.TensorShapeDynamism = {
  53. STATIC: 0,
  54. DYNAMIC_BOUND: 1,
  55. DYNAMIC_UNBOUND: 2
  56. };
  57. executorch_flatbuffer.TensorDataLocation = {
  58. SEGMENT: 0,
  59. EXTERNAL: 1
  60. };
  61. executorch_flatbuffer.ExtraTensorInfo = class ExtraTensorInfo {
  62. static decode(reader, position) {
  63. const $ = new executorch_flatbuffer.ExtraTensorInfo();
  64. $.mutable_data_segments_idx = reader.uint64_(position, 4, 0n);
  65. $.fully_qualified_name = reader.string_(position, 6, null);
  66. $.location = reader.int8_(position, 8, 0);
  67. return $;
  68. }
  69. };
  70. executorch_flatbuffer.Tensor = class Tensor {
  71. static decode(reader, position) {
  72. const $ = new executorch_flatbuffer.Tensor();
  73. $.scalar_type = reader.int8_(position, 4, 0);
  74. $.storage_offset = reader.int32_(position, 6, 0);
  75. $.sizes = reader.array(position, 8, Int32Array);
  76. $.dim_order = reader.array(position, 10, Uint8Array);
  77. $.requires_grad = reader.bool_(position, 12, false);
  78. $.data_buffer_idx = reader.uint32_(position, 14, 0);
  79. $.allocation_info = reader.table(position, 16, executorch_flatbuffer.AllocationDetails);
  80. $.layout = reader.int8_(position, 18, 0);
  81. $.shape_dynamism = reader.int8_(position, 20, 0);
  82. $.extra_tensor_info = reader.table(position, 22, executorch_flatbuffer.ExtraTensorInfo);
  83. return $;
  84. }
  85. };
  86. executorch_flatbuffer.Int = class Int {
  87. static decode(reader, position) {
  88. const $ = new executorch_flatbuffer.Int();
  89. $.int_val = reader.int64_(position, 4, 0n);
  90. return $;
  91. }
  92. };
  93. executorch_flatbuffer.Bool = class Bool {
  94. static decode(reader, position) {
  95. const $ = new executorch_flatbuffer.Bool();
  96. $.bool_val = reader.bool_(position, 4, false);
  97. return $;
  98. }
  99. };
  100. executorch_flatbuffer.Double = class Double {
  101. static decode(reader, position) {
  102. const $ = new executorch_flatbuffer.Double();
  103. $.double_val = reader.float64_(position, 4, 0);
  104. return $;
  105. }
  106. };
  107. executorch_flatbuffer.String = class String {
  108. static decode(reader, position) {
  109. const $ = new executorch_flatbuffer.String();
  110. $.string_val = reader.string_(position, 4, null);
  111. return $;
  112. }
  113. };
  114. executorch_flatbuffer.IntList = class IntList {
  115. static decode(reader, position) {
  116. const $ = new executorch_flatbuffer.IntList();
  117. $.items = reader.int64s_(position, 4);
  118. return $;
  119. }
  120. };
  121. executorch_flatbuffer.DoubleList = class DoubleList {
  122. static decode(reader, position) {
  123. const $ = new executorch_flatbuffer.DoubleList();
  124. $.items = reader.array(position, 4, Float64Array);
  125. return $;
  126. }
  127. };
  128. executorch_flatbuffer.BoolList = class BoolList {
  129. static decode(reader, position) {
  130. const $ = new executorch_flatbuffer.BoolList();
  131. $.items = reader.bools_(position, 4);
  132. return $;
  133. }
  134. };
  135. executorch_flatbuffer.TensorList = class TensorList {
  136. static decode(reader, position) {
  137. const $ = new executorch_flatbuffer.TensorList();
  138. $.items = reader.array(position, 4, Int32Array);
  139. return $;
  140. }
  141. };
  142. executorch_flatbuffer.OptionalTensorList = class OptionalTensorList {
  143. static decode(reader, position) {
  144. const $ = new executorch_flatbuffer.OptionalTensorList();
  145. $.items = reader.array(position, 4, Int32Array);
  146. return $;
  147. }
  148. };
  149. executorch_flatbuffer.KernelTypes = class {
  150. static decode(reader, position, type) {
  151. switch (type) {
  152. case 1: return executorch_flatbuffer.Null.decode(reader, position);
  153. case 2: return executorch_flatbuffer.Int.decode(reader, position);
  154. case 3: return executorch_flatbuffer.Bool.decode(reader, position);
  155. case 4: return executorch_flatbuffer.Double.decode(reader, position);
  156. case 5: return executorch_flatbuffer.Tensor.decode(reader, position);
  157. case 6: return executorch_flatbuffer.String.decode(reader, position);
  158. case 7: return executorch_flatbuffer.IntList.decode(reader, position);
  159. case 8: return executorch_flatbuffer.DoubleList.decode(reader, position);
  160. case 9: return executorch_flatbuffer.BoolList.decode(reader, position);
  161. case 10: return executorch_flatbuffer.TensorList.decode(reader, position);
  162. case 11: return executorch_flatbuffer.OptionalTensorList.decode(reader, position);
  163. default: return undefined;
  164. }
  165. }
  166. };
  167. executorch_flatbuffer.EValue = class EValue {
  168. static decode(reader, position) {
  169. const $ = new executorch_flatbuffer.EValue();
  170. $.val = reader.union(position, 4, executorch_flatbuffer.KernelTypes);
  171. return $;
  172. }
  173. };
  174. executorch_flatbuffer.Operator = class Operator {
  175. static decode(reader, position) {
  176. const $ = new executorch_flatbuffer.Operator();
  177. $.name = reader.string_(position, 4, null);
  178. $.overload = reader.string_(position, 6, null);
  179. return $;
  180. }
  181. };
  182. executorch_flatbuffer.KernelCall = class KernelCall {
  183. static decode(reader, position) {
  184. const $ = new executorch_flatbuffer.KernelCall();
  185. $.op_index = reader.int32_(position, 4, 0);
  186. $.args = reader.array(position, 6, Int32Array);
  187. return $;
  188. }
  189. };
  190. executorch_flatbuffer.DelegateCall = class DelegateCall {
  191. static decode(reader, position) {
  192. const $ = new executorch_flatbuffer.DelegateCall();
  193. $.delegate_index = reader.int32_(position, 4, 0);
  194. $.args = reader.array(position, 6, Int32Array);
  195. return $;
  196. }
  197. };
  198. executorch_flatbuffer.MoveCall = class MoveCall {
  199. static decode(reader, position) {
  200. const $ = new executorch_flatbuffer.MoveCall();
  201. $.move_from = reader.int32_(position, 4, 0);
  202. $.move_to = reader.int32_(position, 6, 0);
  203. return $;
  204. }
  205. };
  206. executorch_flatbuffer.JumpFalseCall = class JumpFalseCall {
  207. static decode(reader, position) {
  208. const $ = new executorch_flatbuffer.JumpFalseCall();
  209. $.cond_value_index = reader.int32_(position, 4, 0);
  210. $.destination_instruction = reader.int32_(position, 6, 0);
  211. return $;
  212. }
  213. };
  214. executorch_flatbuffer.FreeCall = class FreeCall {
  215. static decode(reader, position) {
  216. const $ = new executorch_flatbuffer.FreeCall();
  217. $.value_index = reader.int32_(position, 4, 0);
  218. return $;
  219. }
  220. };
  221. executorch_flatbuffer.InstructionArguments = class {
  222. static decode(reader, position, type) {
  223. switch (type) {
  224. case 1: return executorch_flatbuffer.KernelCall.decode(reader, position);
  225. case 2: return executorch_flatbuffer.DelegateCall.decode(reader, position);
  226. case 3: return executorch_flatbuffer.MoveCall.decode(reader, position);
  227. case 4: return executorch_flatbuffer.JumpFalseCall.decode(reader, position);
  228. case 5: return executorch_flatbuffer.FreeCall.decode(reader, position);
  229. default: return undefined;
  230. }
  231. }
  232. };
  233. executorch_flatbuffer.Instruction = class Instruction {
  234. static decode(reader, position) {
  235. const $ = new executorch_flatbuffer.Instruction();
  236. $.instr_args = reader.union(position, 4, executorch_flatbuffer.InstructionArguments);
  237. return $;
  238. }
  239. };
  240. executorch_flatbuffer.Frame = class Frame {
  241. static decode(reader, position) {
  242. const $ = new executorch_flatbuffer.Frame();
  243. $.filename = reader.string_(position, 4, null);
  244. $.lineno = reader.int32_(position, 6, 0);
  245. $.name = reader.string_(position, 8, null);
  246. $.context = reader.string_(position, 10, null);
  247. return $;
  248. }
  249. };
  250. executorch_flatbuffer.FrameList = class FrameList {
  251. static decode(reader, position) {
  252. const $ = new executorch_flatbuffer.FrameList();
  253. $.items = reader.tables(position, 4, executorch_flatbuffer.Frame);
  254. return $;
  255. }
  256. };
  257. executorch_flatbuffer.DataLocation = {
  258. INLINE: 0,
  259. SEGMENT: 1
  260. };
  261. executorch_flatbuffer.BackendDelegateDataReference = class BackendDelegateDataReference {
  262. static decode(reader, position) {
  263. const $ = new executorch_flatbuffer.BackendDelegateDataReference();
  264. $.location = reader.int8_(position, 4, 0);
  265. $.index = reader.uint32_(position, 6, 0);
  266. return $;
  267. }
  268. };
  269. executorch_flatbuffer.CompileSpec = class CompileSpec {
  270. static decode(reader, position) {
  271. const $ = new executorch_flatbuffer.CompileSpec();
  272. $.key = reader.string_(position, 4, null);
  273. $.value = reader.array(position, 6, Uint8Array);
  274. return $;
  275. }
  276. };
  277. executorch_flatbuffer.BackendDelegate = class BackendDelegate {
  278. static decode(reader, position) {
  279. const $ = new executorch_flatbuffer.BackendDelegate();
  280. $.id = reader.string_(position, 4, null);
  281. $.processed = reader.table(position, 6, executorch_flatbuffer.BackendDelegateDataReference);
  282. $.compile_specs = reader.tables(position, 8, executorch_flatbuffer.CompileSpec);
  283. return $;
  284. }
  285. };
  286. executorch_flatbuffer.Chain = class Chain {
  287. static decode(reader, position) {
  288. const $ = new executorch_flatbuffer.Chain();
  289. $.inputs = reader.array(position, 4, Int32Array);
  290. $.outputs = reader.array(position, 6, Int32Array);
  291. $.instructions = reader.tables(position, 8, executorch_flatbuffer.Instruction);
  292. $.stacktrace = reader.tables(position, 10, executorch_flatbuffer.FrameList);
  293. return $;
  294. }
  295. };
  296. executorch_flatbuffer.ExecutionPlan = class ExecutionPlan {
  297. static decode(reader, position) {
  298. const $ = new executorch_flatbuffer.ExecutionPlan();
  299. $.name = reader.string_(position, 4, null);
  300. $.container_meta_type = reader.table(position, 6, executorch_flatbuffer.ContainerMetadata);
  301. $.values = reader.tables(position, 8, executorch_flatbuffer.EValue);
  302. $.inputs = reader.array(position, 10, Int32Array);
  303. $.outputs = reader.array(position, 12, Int32Array);
  304. $.chains = reader.tables(position, 14, executorch_flatbuffer.Chain);
  305. $.operators = reader.tables(position, 16, executorch_flatbuffer.Operator);
  306. $.delegates = reader.tables(position, 18, executorch_flatbuffer.BackendDelegate);
  307. $.non_const_buffer_sizes = reader.int64s_(position, 20);
  308. return $;
  309. }
  310. };
  311. executorch_flatbuffer.Buffer = class Buffer {
  312. static decode(reader, position) {
  313. const $ = new executorch_flatbuffer.Buffer();
  314. $.storage = reader.array(position, 4, Uint8Array);
  315. return $;
  316. }
  317. };
  318. executorch_flatbuffer.BackendDelegateInlineData = class BackendDelegateInlineData {
  319. static decode(reader, position) {
  320. const $ = new executorch_flatbuffer.BackendDelegateInlineData();
  321. $.data = reader.array(position, 4, Uint8Array);
  322. return $;
  323. }
  324. };
  325. executorch_flatbuffer.DataSegment = class DataSegment {
  326. static decode(reader, position) {
  327. const $ = new executorch_flatbuffer.DataSegment();
  328. $.offset = reader.uint64_(position, 4, 0n);
  329. $.size = reader.uint64_(position, 6, 0n);
  330. return $;
  331. }
  332. };
  333. executorch_flatbuffer.SubsegmentOffsets = class SubsegmentOffsets {
  334. static decode(reader, position) {
  335. const $ = new executorch_flatbuffer.SubsegmentOffsets();
  336. $.segment_index = reader.uint32_(position, 4, 0);
  337. $.offsets = reader.uint64s_(position, 6);
  338. return $;
  339. }
  340. };
  341. executorch_flatbuffer.NamedData = class NamedData {
  342. static decode(reader, position) {
  343. const $ = new executorch_flatbuffer.NamedData();
  344. $.key = reader.string_(position, 4, null);
  345. $.segment_index = reader.uint32_(position, 6, 0);
  346. return $;
  347. }
  348. };
  349. executorch_flatbuffer.Program = class Program {
  350. static identifier(reader) {
  351. return reader.identifier === 'ET12';
  352. }
  353. static create(reader) {
  354. return executorch_flatbuffer.Program.decode(reader, reader.root);
  355. }
  356. static decode(reader, position) {
  357. const $ = new executorch_flatbuffer.Program();
  358. $.version = reader.uint32_(position, 4, 0);
  359. $.execution_plan = reader.tables(position, 6, executorch_flatbuffer.ExecutionPlan);
  360. $.constant_buffer = reader.tables(position, 8, executorch_flatbuffer.Buffer);
  361. $.backend_delegate_data = reader.tables(position, 10, executorch_flatbuffer.BackendDelegateInlineData);
  362. $.segments = reader.tables(position, 12, executorch_flatbuffer.DataSegment);
  363. $.constant_segment = reader.table(position, 14, executorch_flatbuffer.SubsegmentOffsets);
  364. $.mutable_data_segments = reader.tables(position, 16, executorch_flatbuffer.SubsegmentOffsets);
  365. $.named_data = reader.tables(position, 18, executorch_flatbuffer.NamedData);
  366. return $;
  367. }
  368. };
  369. fb_xnnpack.XNNDatatype = {
  370. xnn_datatype_invalid: 0,
  371. xnn_datatype_fp32: 1,
  372. xnn_datatype_fp16: 2,
  373. xnn_datatype_qint8: 3,
  374. xnn_datatype_quint8: 4,
  375. xnn_datatype_qint32: 5,
  376. xnn_datatype_qcint8: 6,
  377. xnn_datatype_qcint32: 7,
  378. xnn_datatype_qcint4: 8,
  379. xnn_datatype_qdint8: 9,
  380. xnn_datatype_qbint4: 10,
  381. xnn_datatype_qpint8: 11,
  382. xnn_datatype_int32: 12,
  383. xnn_datatype_pfp32: 13,
  384. xnn_datatype_bf16: 14
  385. };
  386. fb_xnnpack.XNNQuantParams = class {
  387. static decode(reader, position, type) {
  388. switch (type) {
  389. case 1: return fb_xnnpack.PerChannelQuant.decode(reader, position);
  390. case 2: return fb_xnnpack.PerTensorQuant.decode(reader, position);
  391. case 3: return fb_xnnpack.PerTokenDynamicQuant.decode(reader, position);
  392. case 4: return fb_xnnpack.PerChannelGroupQuant.decode(reader, position);
  393. default: return undefined;
  394. }
  395. }
  396. };
  397. fb_xnnpack.Buffer = class Buffer {
  398. static decode(reader, position) {
  399. const $ = new fb_xnnpack.Buffer();
  400. $.storage = reader.array(position, 4, Uint8Array);
  401. return $;
  402. }
  403. };
  404. fb_xnnpack.PerChannelGroupQuant = class PerChannelGroupQuant {
  405. static decode(reader, position) {
  406. const $ = new fb_xnnpack.PerChannelGroupQuant();
  407. $.scale = reader.array(position, 4, Float32Array);
  408. $.channel_dim = reader.int32_(position, 6, 0);
  409. $.group_size = reader.int32_(position, 8, 0);
  410. $.scale_bf16 = reader.array(position, 10, Uint16Array);
  411. $.scale_buffer_idx = reader.uint32_(position, 12, 0);
  412. $.num_scales = reader.uint32_(position, 14, 0);
  413. return $;
  414. }
  415. };
  416. fb_xnnpack.PerChannelQuant = class PerChannelQuant {
  417. static decode(reader, position) {
  418. const $ = new fb_xnnpack.PerChannelQuant();
  419. $.scale = reader.array(position, 4, Float32Array);
  420. $.channel_dim = reader.int32_(position, 6, 0);
  421. $.scale_buffer_idx = reader.uint32_(position, 8, 0);
  422. $.num_scales = reader.uint32_(position, 10, 0);
  423. return $;
  424. }
  425. };
  426. fb_xnnpack.PerTokenDynamicQuant = class PerTokenDynamicQuant {
  427. static decode(reader, position) {
  428. const $ = new fb_xnnpack.PerTokenDynamicQuant();
  429. $.num_nonbatch_dims = reader.int32_(position, 4, 0);
  430. return $;
  431. }
  432. };
  433. fb_xnnpack.PerTensorQuant = class PerTensorQuant {
  434. static decode(reader, position) {
  435. const $ = new fb_xnnpack.PerTensorQuant();
  436. $.scale = reader.float32_(position, 4, 0);
  437. $.zero_point = reader.int32_(position, 6, 0);
  438. return $;
  439. }
  440. };
  441. fb_xnnpack.XNNTensorValue = class XNNTensorValue {
  442. static decode(reader, position) {
  443. const $ = new fb_xnnpack.XNNTensorValue();
  444. $.datatype = reader.int16_(position, 4, 0);
  445. $.num_dims = reader.uint32_(position, 6, 0);
  446. $.dims = reader.array(position, 8, Uint32Array);
  447. $.constant_buffer_idx = reader.uint32_(position, 10, 0);
  448. $.external_id = reader.uint32_(position, 12, 0);
  449. $.flags = reader.uint32_(position, 14, 0);
  450. $.id_out = reader.uint32_(position, 16, 0);
  451. return $;
  452. }
  453. };
  454. fb_xnnpack.XNNQuantizedTensorValue = class XNNQuantizedTensorValue {
  455. static decode(reader, position) {
  456. const $ = new fb_xnnpack.XNNQuantizedTensorValue();
  457. $.tensor_value = reader.table(position, 4, fb_xnnpack.XNNTensorValue);
  458. $.quant_params = reader.union(position, 6, fb_xnnpack.XNNQuantParams);
  459. return $;
  460. }
  461. };
  462. fb_xnnpack.XNodeUnion = class {
  463. static decode(reader, position, type) {
  464. switch (type) {
  465. case 1: return fb_xnnpack.XNNAdd.decode(reader, position);
  466. case 2: return fb_xnnpack.XNNFullyConnected.decode(reader, position);
  467. case 3: return fb_xnnpack.XNNSoftmax.decode(reader, position);
  468. case 4: return fb_xnnpack.XNNSigmoid.decode(reader, position);
  469. case 5: return fb_xnnpack.XNNStaticTranspose.decode(reader, position);
  470. case 6: return fb_xnnpack.XNNClamp.decode(reader, position);
  471. case 7: return fb_xnnpack.XNNConv2d.decode(reader, position);
  472. case 8: return fb_xnnpack.XNNDiv.decode(reader, position);
  473. case 9: return fb_xnnpack.XNNStaticResizeBilinear2D.decode(reader, position);
  474. case 10: return fb_xnnpack.XNNStaticConstantPad.decode(reader, position);
  475. case 11: return fb_xnnpack.XNNAvgPooling2d.decode(reader, position);
  476. case 12: return fb_xnnpack.XNNMinimum.decode(reader, position);
  477. case 13: return fb_xnnpack.XNNDepthwiseConv2d.decode(reader, position);
  478. case 14: return fb_xnnpack.XNNMaxPooling2d.decode(reader, position);
  479. case 15: return fb_xnnpack.XNNMultiply.decode(reader, position);
  480. case 16: return fb_xnnpack.XNNSubtract.decode(reader, position);
  481. case 17: return fb_xnnpack.XNNFloor.decode(reader, position);
  482. case 18: return fb_xnnpack.XNNConvert.decode(reader, position);
  483. case 19: return fb_xnnpack.XNNGlobalAvgPooling2d.decode(reader, position);
  484. case 20: return fb_xnnpack.XNNStaticReshape.decode(reader, position);
  485. case 21: return fb_xnnpack.XNNArgMaxPooling2d.decode(reader, position);
  486. case 22: return fb_xnnpack.XNNSquareRoot.decode(reader, position);
  487. case 23: return fb_xnnpack.XNNCeiling.decode(reader, position);
  488. case 24: return fb_xnnpack.XNNHardswish.decode(reader, position);
  489. case 25: return fb_xnnpack.XNNLeakyReLU.decode(reader, position);
  490. case 26: return fb_xnnpack.XNNMaximum.decode(reader, position);
  491. case 27: return fb_xnnpack.XNNNegate.decode(reader, position);
  492. case 28: return fb_xnnpack.XNNSquare.decode(reader, position);
  493. case 29: return fb_xnnpack.XNNELU.decode(reader, position);
  494. case 30: return fb_xnnpack.XNNAbs.decode(reader, position);
  495. case 31: return fb_xnnpack.XNNPReLU.decode(reader, position);
  496. case 32: return fb_xnnpack.XNNConcatenate2.decode(reader, position);
  497. case 33: return fb_xnnpack.XNNConcatenate3.decode(reader, position);
  498. case 34: return fb_xnnpack.XNNConcatenate4.decode(reader, position);
  499. case 35: return fb_xnnpack.XNNStaticSlice.decode(reader, position);
  500. case 36: return fb_xnnpack.XNNScaledDotProductAttention.decode(reader, position);
  501. case 37: return fb_xnnpack.XNNBatchMatrixMultiply.decode(reader, position);
  502. case 38: return fb_xnnpack.XNNConcatenate5.decode(reader, position);
  503. case 39: return fb_xnnpack.XNNConvTranspose2d.decode(reader, position);
  504. case 40: return fb_xnnpack.XNNReciprocalSquareRoot.decode(reader, position);
  505. case 41: return fb_xnnpack.XNNLog.decode(reader, position);
  506. case 42: return fb_xnnpack.XNNGelu.decode(reader, position);
  507. case 43: return fb_xnnpack.XNNTanh.decode(reader, position);
  508. case 44: return fb_xnnpack.XNNExp.decode(reader, position);
  509. case 45: return fb_xnnpack.XNNSin.decode(reader, position);
  510. case 46: return fb_xnnpack.XNNCopy.decode(reader, position);
  511. case 47: return fb_xnnpack.XNNCos.decode(reader, position);
  512. default: return undefined;
  513. }
  514. }
  515. };
  516. fb_xnnpack.XValueUnion = class {
  517. static decode(reader, position, type) {
  518. switch (type) {
  519. case 1: return fb_xnnpack.XNNTensorValue.decode(reader, position);
  520. case 2: return fb_xnnpack.XNNQuantizedTensorValue.decode(reader, position);
  521. default: return undefined;
  522. }
  523. }
  524. };
  525. fb_xnnpack.OutputMinMax = class OutputMinMax {
  526. static decode(reader, position) {
  527. const $ = new fb_xnnpack.OutputMinMax();
  528. $.output_min = reader.float32_(position, 4, 0);
  529. $.output_max = reader.float32_(position, 6, 0);
  530. return $;
  531. }
  532. };
  533. fb_xnnpack.XNode = class XNode {
  534. static decode(reader, position) {
  535. const $ = new fb_xnnpack.XNode();
  536. $.xnode_union = reader.union(position, 4, fb_xnnpack.XNodeUnion);
  537. $.debug_handle = reader.uint32_(position, 8, 0);
  538. $.output_min_max = reader.table(position, 10, fb_xnnpack.OutputMinMax);
  539. return $;
  540. }
  541. };
  542. fb_xnnpack.XValue = class XValue {
  543. static decode(reader, position) {
  544. const $ = new fb_xnnpack.XValue();
  545. $.xvalue_union = reader.union(position, 4, fb_xnnpack.XValueUnion);
  546. return $;
  547. }
  548. };
  549. fb_xnnpack.XNNStaticTranspose = class XNNStaticTranspose {
  550. static decode(reader, position) {
  551. const $ = new fb_xnnpack.XNNStaticTranspose();
  552. $.num_dims = reader.uint32_(position, 4, 0);
  553. $.perm = reader.array(position, 6, Uint32Array);
  554. $.input_id = reader.uint32_(position, 8, 0);
  555. $.output_id = reader.uint32_(position, 10, 0);
  556. $.flags = reader.uint32_(position, 12, 0);
  557. return $;
  558. }
  559. };
  560. fb_xnnpack.XNNStaticResizeBilinear2D = class XNNStaticResizeBilinear2D {
  561. static decode(reader, position) {
  562. const $ = new fb_xnnpack.XNNStaticResizeBilinear2D();
  563. $.new_height = reader.uint32_(position, 4, 0);
  564. $.new_width = reader.uint32_(position, 6, 0);
  565. $.input_id = reader.uint32_(position, 8, 0);
  566. $.output_id = reader.uint32_(position, 10, 0);
  567. $.flags = reader.uint32_(position, 12, 0);
  568. return $;
  569. }
  570. };
  571. fb_xnnpack.XNNStaticConstantPad = class XNNStaticConstantPad {
  572. static decode(reader, position) {
  573. const $ = new fb_xnnpack.XNNStaticConstantPad();
  574. $.pre_paddings = reader.array(position, 4, Uint32Array);
  575. $.post_paddings = reader.array(position, 6, Uint32Array);
  576. $.padding_value = reader.float32_(position, 8, 0);
  577. $.input_id = reader.uint32_(position, 10, 0);
  578. $.output_id = reader.uint32_(position, 12, 0);
  579. $.flags = reader.uint32_(position, 14, 0);
  580. return $;
  581. }
  582. };
  583. fb_xnnpack._XNNNode2x1 = class _XNNNode2x1 {
  584. static decode(reader, position, $) {
  585. $ = $ || new fb_xnnpack._XNNNode2x1();
  586. $.input1_id = reader.uint32_(position, 4, 0);
  587. $.input2_id = reader.uint32_(position, 6, 0);
  588. $.output_id = reader.uint32_(position, 8, 0);
  589. $.flags = reader.uint32_(position, 10, 0);
  590. return $;
  591. }
  592. };
  593. fb_xnnpack._XNNNode1x1 = class _XNNNode1x1 {
  594. static decode(reader, position, $) {
  595. $ = $ || new fb_xnnpack._XNNNode1x1();
  596. $.input_id = reader.uint32_(position, 4, 0);
  597. $.output_id = reader.uint32_(position, 6, 0);
  598. $.flags = reader.uint32_(position, 8, 0);
  599. return $;
  600. }
  601. };
  602. fb_xnnpack._XNNCat = class _XNNCat {
  603. static decode(reader, position, $) {
  604. $ = $ || new fb_xnnpack._XNNCat();
  605. $.axis = reader.uint32_(position, 4, 0);
  606. $.input1_id = reader.uint32_(position, 6, 0);
  607. $.input2_id = reader.uint32_(position, 8, 0);
  608. $.input3_id = reader.uint32_(position, 10, 0);
  609. $.input4_id = reader.uint32_(position, 12, 0);
  610. $.output_id = reader.uint32_(position, 14, 0);
  611. $.flags = reader.uint32_(position, 16, 0);
  612. $.input5_id = reader.uint32_(position, 18, 0);
  613. return $;
  614. }
  615. };
  616. fb_xnnpack.XNNELU = class XNNELU {
  617. static decode(reader, position) {
  618. const $ = new fb_xnnpack.XNNELU();
  619. $.alpha = reader.float32_(position, 4, 0);
  620. $.input_id = reader.uint32_(position, 6, 0);
  621. $.output_id = reader.uint32_(position, 8, 0);
  622. $.flags = reader.uint32_(position, 10, 0);
  623. return $;
  624. }
  625. };
  626. fb_xnnpack.XNNFullyConnected = class XNNFullyConnected {
  627. static decode(reader, position) {
  628. const $ = new fb_xnnpack.XNNFullyConnected();
  629. $.input1_id = reader.uint32_(position, 4, 0);
  630. $.filter_id = reader.uint32_(position, 6, 0);
  631. $.bias_id = reader.uint32_(position, 8, 0);
  632. $.output_id = reader.uint32_(position, 10, 0);
  633. $.flags = reader.uint32_(position, 12, 0);
  634. return $;
  635. }
  636. };
  637. fb_xnnpack._XNNNodeConv = class _XNNNodeConv {
  638. static decode(reader, position, $) {
  639. $ = $ || new fb_xnnpack._XNNNodeConv();
  640. $.padding_top = reader.uint32_(position, 4, 0);
  641. $.padding_right = reader.uint32_(position, 6, 0);
  642. $.padding_bottom = reader.uint32_(position, 8, 0);
  643. $.padding_left = reader.uint32_(position, 10, 0);
  644. $.kernel_height = reader.uint32_(position, 12, 0);
  645. $.kernel_width = reader.uint32_(position, 14, 0);
  646. $.subsampling_height = reader.uint32_(position, 16, 0);
  647. $.subsampling_width = reader.uint32_(position, 18, 0);
  648. $.dilation_height = reader.uint32_(position, 20, 0);
  649. $.dilation_width = reader.uint32_(position, 22, 0);
  650. $.group_input_channels = reader.uint32_(position, 24, 0);
  651. $.group_output_channels = reader.uint32_(position, 26, 0);
  652. $.groups = reader.uint32_(position, 28, 0);
  653. $.adjustment_height = reader.uint32_(position, 30, 0);
  654. $.adjustment_width = reader.uint32_(position, 32, 0);
  655. $.input1_id = reader.uint32_(position, 34, 0);
  656. $.filter_id = reader.uint32_(position, 36, 0);
  657. $.bias_id = reader.uint32_(position, 38, 0);
  658. $.output_id = reader.uint32_(position, 40, 0);
  659. $.flags = reader.uint32_(position, 42, 0);
  660. return $;
  661. }
  662. };
  663. fb_xnnpack._XNNPooling2D = class _XNNPooling2D {
  664. static decode(reader, position, $) {
  665. $ = $ || new fb_xnnpack._XNNPooling2D();
  666. $.padding_top = reader.uint32_(position, 4, 0);
  667. $.padding_right = reader.uint32_(position, 6, 0);
  668. $.padding_bottom = reader.uint32_(position, 8, 0);
  669. $.padding_left = reader.uint32_(position, 10, 0);
  670. $.pooling_height = reader.uint32_(position, 12, 0);
  671. $.pooling_width = reader.uint32_(position, 14, 0);
  672. $.stride_height = reader.uint32_(position, 16, 0);
  673. $.stride_width = reader.uint32_(position, 18, 0);
  674. $.dilation_height = reader.uint32_(position, 20, 0);
  675. $.dilation_width = reader.uint32_(position, 22, 0);
  676. $.input_id = reader.uint32_(position, 24, 0);
  677. $.output_id = reader.uint32_(position, 26, 0);
  678. $.flags = reader.uint32_(position, 28, 0);
  679. return $;
  680. }
  681. };
  682. fb_xnnpack.XNNStaticReshape = class XNNStaticReshape {
  683. static decode(reader, position) {
  684. const $ = new fb_xnnpack.XNNStaticReshape();
  685. $.num_dims = reader.uint32_(position, 4, 0);
  686. $.new_shape = reader.array(position, 6, Uint32Array);
  687. $.input_id = reader.uint32_(position, 8, 0);
  688. $.output_id = reader.uint32_(position, 10, 0);
  689. $.flags = reader.uint32_(position, 12, 0);
  690. return $;
  691. }
  692. };
  693. fb_xnnpack.XNNStaticSlice = class XNNStaticSlice {
  694. static decode(reader, position) {
  695. const $ = new fb_xnnpack.XNNStaticSlice();
  696. $.num_dims = reader.uint32_(position, 4, 0);
  697. $.offsets = reader.array(position, 6, Uint32Array);
  698. $.sizes = reader.array(position, 8, Uint32Array);
  699. $.input_id = reader.uint32_(position, 10, 0);
  700. $.output_id = reader.uint32_(position, 12, 0);
  701. $.flags = reader.uint32_(position, 14, 0);
  702. return $;
  703. }
  704. };
  705. fb_xnnpack.XNNScaledDotProductAttention = class XNNScaledDotProductAttention {
  706. static decode(reader, position) {
  707. const $ = new fb_xnnpack.XNNScaledDotProductAttention();
  708. $.query_id = reader.uint32_(position, 4, 0);
  709. $.key_id = reader.uint32_(position, 6, 0);
  710. $.value_id = reader.uint32_(position, 8, 0);
  711. $.scale_id = reader.uint32_(position, 10, 0);
  712. $.mask_id = reader.uint32_(position, 12, 0);
  713. $.output_id = reader.uint32_(position, 14, 0);
  714. $.flags = reader.uint32_(position, 16, 0);
  715. return $;
  716. }
  717. };
  718. fb_xnnpack.XNNArgMaxPooling2d = class XNNArgMaxPooling2d {
  719. static decode(reader, position) {
  720. const $ = new fb_xnnpack.XNNArgMaxPooling2d();
  721. $.padding_top = reader.uint32_(position, 4, 0);
  722. $.padding_right = reader.uint32_(position, 6, 0);
  723. $.padding_bottom = reader.uint32_(position, 8, 0);
  724. $.padding_left = reader.uint32_(position, 10, 0);
  725. $.pooling_height = reader.uint32_(position, 12, 0);
  726. $.pooling_width = reader.uint32_(position, 14, 0);
  727. $.input_id = reader.uint32_(position, 16, 0);
  728. $.output_value_id = reader.uint32_(position, 18, 0);
  729. $.output_index_id = reader.uint32_(position, 20, 0);
  730. $.flags = reader.uint32_(position, 22, 0);
  731. return $;
  732. }
  733. };
  734. fb_xnnpack.XNNLeakyReLU = class XNNLeakyReLU {
  735. static decode(reader, position) {
  736. const $ = new fb_xnnpack.XNNLeakyReLU();
  737. $.negative_slope = reader.float32_(position, 4, 0);
  738. $.input_id = reader.uint32_(position, 6, 0);
  739. $.output_id = reader.uint32_(position, 8, 0);
  740. $.flags = reader.uint32_(position, 10, 0);
  741. return $;
  742. }
  743. };
  744. fb_xnnpack.ConstantDataOffset = class ConstantDataOffset {
  745. static decode(reader, position) {
  746. const $ = new fb_xnnpack.ConstantDataOffset();
  747. $.offset = reader.uint64_(position, 4, 0n);
  748. $.size = reader.uint64_(position, 6, 0n);
  749. $.named_key = reader.string_(position, 8, null);
  750. return $;
  751. }
  752. };
  753. fb_xnnpack.XNNGraph = class XNNGraph {
  754. static identifier(reader) {
  755. return reader.identifier === 'XN01';
  756. }
  757. static create(reader) {
  758. return fb_xnnpack.XNNGraph.decode(reader, reader.root);
  759. }
  760. static decode(reader, position) {
  761. const $ = new fb_xnnpack.XNNGraph();
  762. $.version = reader.string_(position, 4, null);
  763. $.xnodes = reader.tables(position, 6, fb_xnnpack.XNode);
  764. $.xvalues = reader.tables(position, 8, fb_xnnpack.XValue);
  765. $.num_externs = reader.uint32_(position, 10, 0);
  766. $.input_ids = reader.array(position, 12, Uint32Array);
  767. $.output_ids = reader.array(position, 14, Uint32Array);
  768. $.constant_buffer = reader.tables(position, 16, fb_xnnpack.Buffer);
  769. $.mem_buffer_sizes = reader.array(position, 18, Uint32Array);
  770. $.constant_data = reader.tables(position, 20, fb_xnnpack.ConstantDataOffset);
  771. return $;
  772. }
  773. };
  774. fb_xnnpack.XNNAdd = class XNNAdd {
  775. static decode(reader, position) {
  776. const $ = new fb_xnnpack.XNNAdd();
  777. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  778. return $;
  779. }
  780. };
  781. fb_xnnpack.XNNSoftmax = class XNNSoftmax {
  782. static decode(reader, position) {
  783. const $ = new fb_xnnpack.XNNSoftmax();
  784. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  785. return $;
  786. }
  787. };
  788. fb_xnnpack.XNNSigmoid = class XNNSigmoid {
  789. static decode(reader, position) {
  790. const $ = new fb_xnnpack.XNNSigmoid();
  791. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  792. return $;
  793. }
  794. };
  795. fb_xnnpack.XNNClamp = class XNNClamp {
  796. static decode(reader, position) {
  797. const $ = new fb_xnnpack.XNNClamp();
  798. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  799. return $;
  800. }
  801. };
  802. fb_xnnpack.XNNConv2d = class XNNConv2d {
  803. static decode(reader, position) {
  804. const $ = new fb_xnnpack.XNNConv2d();
  805. fb_xnnpack._XNNNodeConv.decode(reader, position, $);
  806. return $;
  807. }
  808. };
  809. fb_xnnpack.XNNDiv = class XNNDiv {
  810. static decode(reader, position) {
  811. const $ = new fb_xnnpack.XNNDiv();
  812. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  813. return $;
  814. }
  815. };
  816. fb_xnnpack.XNNAvgPooling2d = class XNNAvgPooling2d {
  817. static decode(reader, position) {
  818. const $ = new fb_xnnpack.XNNAvgPooling2d();
  819. fb_xnnpack._XNNPooling2D.decode(reader, position, $);
  820. return $;
  821. }
  822. };
  823. fb_xnnpack.XNNMinimum = class XNNMinimum {
  824. static decode(reader, position) {
  825. const $ = new fb_xnnpack.XNNMinimum();
  826. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  827. return $;
  828. }
  829. };
  830. fb_xnnpack.XNNDepthwiseConv2d = class XNNDepthwiseConv2d {
  831. static decode(reader, position) {
  832. const $ = new fb_xnnpack.XNNDepthwiseConv2d();
  833. fb_xnnpack._XNNNodeConv.decode(reader, position, $);
  834. return $;
  835. }
  836. };
  837. fb_xnnpack.XNNMaxPooling2d = class XNNMaxPooling2d {
  838. static decode(reader, position) {
  839. const $ = new fb_xnnpack.XNNMaxPooling2d();
  840. fb_xnnpack._XNNPooling2D.decode(reader, position, $);
  841. return $;
  842. }
  843. };
  844. fb_xnnpack.XNNMultiply = class XNNMultiply {
  845. static decode(reader, position) {
  846. const $ = new fb_xnnpack.XNNMultiply();
  847. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  848. return $;
  849. }
  850. };
  851. fb_xnnpack.XNNSubtract = class XNNSubtract {
  852. static decode(reader, position) {
  853. const $ = new fb_xnnpack.XNNSubtract();
  854. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  855. return $;
  856. }
  857. };
  858. fb_xnnpack.XNNFloor = class XNNFloor {
  859. static decode(reader, position) {
  860. const $ = new fb_xnnpack.XNNFloor();
  861. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  862. return $;
  863. }
  864. };
  865. fb_xnnpack.XNNConvert = class XNNConvert {
  866. static decode(reader, position) {
  867. const $ = new fb_xnnpack.XNNConvert();
  868. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  869. return $;
  870. }
  871. };
  872. fb_xnnpack.XNNGlobalAvgPooling2d = class XNNGlobalAvgPooling2d {
  873. static decode(reader, position) {
  874. const $ = new fb_xnnpack.XNNGlobalAvgPooling2d();
  875. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  876. return $;
  877. }
  878. };
  879. fb_xnnpack.XNNSquareRoot = class XNNSquareRoot {
  880. static decode(reader, position) {
  881. const $ = new fb_xnnpack.XNNSquareRoot();
  882. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  883. return $;
  884. }
  885. };
  886. fb_xnnpack.XNNCeiling = class XNNCeiling {
  887. static decode(reader, position) {
  888. const $ = new fb_xnnpack.XNNCeiling();
  889. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  890. return $;
  891. }
  892. };
  893. fb_xnnpack.XNNHardswish = class XNNHardswish {
  894. static decode(reader, position) {
  895. const $ = new fb_xnnpack.XNNHardswish();
  896. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  897. return $;
  898. }
  899. };
  900. fb_xnnpack.XNNMaximum = class XNNMaximum {
  901. static decode(reader, position) {
  902. const $ = new fb_xnnpack.XNNMaximum();
  903. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  904. return $;
  905. }
  906. };
  907. fb_xnnpack.XNNNegate = class XNNNegate {
  908. static decode(reader, position) {
  909. const $ = new fb_xnnpack.XNNNegate();
  910. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  911. return $;
  912. }
  913. };
  914. fb_xnnpack.XNNSquare = class XNNSquare {
  915. static decode(reader, position) {
  916. const $ = new fb_xnnpack.XNNSquare();
  917. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  918. return $;
  919. }
  920. };
  921. fb_xnnpack.XNNAbs = class XNNAbs {
  922. static decode(reader, position) {
  923. const $ = new fb_xnnpack.XNNAbs();
  924. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  925. return $;
  926. }
  927. };
  928. fb_xnnpack.XNNPReLU = class XNNPReLU {
  929. static decode(reader, position) {
  930. const $ = new fb_xnnpack.XNNPReLU();
  931. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  932. return $;
  933. }
  934. };
  935. fb_xnnpack.XNNConcatenate2 = class XNNConcatenate2 {
  936. static decode(reader, position) {
  937. const $ = new fb_xnnpack.XNNConcatenate2();
  938. fb_xnnpack._XNNCat.decode(reader, position, $);
  939. return $;
  940. }
  941. };
  942. fb_xnnpack.XNNConcatenate3 = class XNNConcatenate3 {
  943. static decode(reader, position) {
  944. const $ = new fb_xnnpack.XNNConcatenate3();
  945. fb_xnnpack._XNNCat.decode(reader, position, $);
  946. return $;
  947. }
  948. };
  949. fb_xnnpack.XNNConcatenate4 = class XNNConcatenate4 {
  950. static decode(reader, position) {
  951. const $ = new fb_xnnpack.XNNConcatenate4();
  952. fb_xnnpack._XNNCat.decode(reader, position, $);
  953. return $;
  954. }
  955. };
  956. fb_xnnpack.XNNBatchMatrixMultiply = class XNNBatchMatrixMultiply {
  957. static decode(reader, position) {
  958. const $ = new fb_xnnpack.XNNBatchMatrixMultiply();
  959. fb_xnnpack._XNNNode2x1.decode(reader, position, $);
  960. return $;
  961. }
  962. };
  963. fb_xnnpack.XNNConcatenate5 = class XNNConcatenate5 {
  964. static decode(reader, position) {
  965. const $ = new fb_xnnpack.XNNConcatenate5();
  966. fb_xnnpack._XNNCat.decode(reader, position, $);
  967. return $;
  968. }
  969. };
  970. fb_xnnpack.XNNConvTranspose2d = class XNNConvTranspose2d {
  971. static decode(reader, position) {
  972. const $ = new fb_xnnpack.XNNConvTranspose2d();
  973. fb_xnnpack._XNNNodeConv.decode(reader, position, $);
  974. return $;
  975. }
  976. };
  977. fb_xnnpack.XNNReciprocalSquareRoot = class XNNReciprocalSquareRoot {
  978. static decode(reader, position) {
  979. const $ = new fb_xnnpack.XNNReciprocalSquareRoot();
  980. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  981. return $;
  982. }
  983. };
  984. fb_xnnpack.XNNLog = class XNNLog {
  985. static decode(reader, position) {
  986. const $ = new fb_xnnpack.XNNLog();
  987. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  988. return $;
  989. }
  990. };
  991. fb_xnnpack.XNNGelu = class XNNGelu {
  992. static decode(reader, position) {
  993. const $ = new fb_xnnpack.XNNGelu();
  994. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  995. return $;
  996. }
  997. };
  998. fb_xnnpack.XNNTanh = class XNNTanh {
  999. static decode(reader, position) {
  1000. const $ = new fb_xnnpack.XNNTanh();
  1001. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  1002. return $;
  1003. }
  1004. };
  1005. fb_xnnpack.XNNExp = class XNNExp {
  1006. static decode(reader, position) {
  1007. const $ = new fb_xnnpack.XNNExp();
  1008. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  1009. return $;
  1010. }
  1011. };
  1012. fb_xnnpack.XNNSin = class XNNSin {
  1013. static decode(reader, position) {
  1014. const $ = new fb_xnnpack.XNNSin();
  1015. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  1016. return $;
  1017. }
  1018. };
  1019. fb_xnnpack.XNNCopy = class XNNCopy {
  1020. static decode(reader, position) {
  1021. const $ = new fb_xnnpack.XNNCopy();
  1022. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  1023. return $;
  1024. }
  1025. };
  1026. fb_xnnpack.XNNCos = class XNNCos {
  1027. static decode(reader, position) {
  1028. const $ = new fb_xnnpack.XNNCos();
  1029. fb_xnnpack._XNNNode1x1.decode(reader, position, $);
  1030. return $;
  1031. }
  1032. };
  1033. vkgraph.OperatorCall = class OperatorCall {
  1034. static decode(reader, position) {
  1035. const $ = new vkgraph.OperatorCall();
  1036. $.node_id = reader.uint32_(position, 4, 0);
  1037. $.name = reader.string_(position, 6, null);
  1038. $.args = reader.array(position, 8, Int32Array);
  1039. return $;
  1040. }
  1041. };
  1042. vkgraph.VkDataType = {
  1043. BOOL: 0,
  1044. UINT8: 1,
  1045. INT8: 2,
  1046. INT32: 3,
  1047. FLOAT16: 4,
  1048. FLOAT32: 5,
  1049. FLOAT64: 6,
  1050. INT64: 7,
  1051. UNSET: 127
  1052. };
  1053. vkgraph.VkStorageType = {
  1054. BUFFER: 0,
  1055. TEXTURE_3D: 1,
  1056. TEXTURE_2D: 2,
  1057. DEFAULT_STORAGE: 255
  1058. };
  1059. vkgraph.VkMemoryLayout = {
  1060. TENSOR_WIDTH_PACKED: 0,
  1061. TENSOR_HEIGHT_PACKED: 1,
  1062. TENSOR_CHANNELS_PACKED: 2,
  1063. PACKED_INT8_4W4C: 3,
  1064. PACKED_INT8_4H4W: 4,
  1065. DEFAULT_LAYOUT: 255
  1066. };
  1067. vkgraph.VkTensor = class VkTensor {
  1068. static decode(reader, position) {
  1069. const $ = new vkgraph.VkTensor();
  1070. $.datatype = reader.int8_(position, 4, 0);
  1071. $.dims = reader.array(position, 6, Uint32Array);
  1072. $.constant_id = reader.int32_(position, 8, 0);
  1073. $.mem_obj_id = reader.int32_(position, 10, 0);
  1074. $.storage_type = reader.uint8_(position, 12, 255);
  1075. $.memory_layout = reader.uint8_(position, 14, 255);
  1076. $.staging_datatype = reader.int8_(position, 16, 127);
  1077. return $;
  1078. }
  1079. };
  1080. vkgraph.Null = class Null {
  1081. static decode(/* reader, position */) {
  1082. const $ = new vkgraph.Null();
  1083. return $;
  1084. }
  1085. };
  1086. vkgraph.Int = class Int {
  1087. static decode(reader, position) {
  1088. const $ = new vkgraph.Int();
  1089. $.int_val = reader.int64_(position, 4, 0n);
  1090. return $;
  1091. }
  1092. };
  1093. vkgraph.Bool = class Bool {
  1094. static decode(reader, position) {
  1095. const $ = new vkgraph.Bool();
  1096. $.bool_val = reader.bool_(position, 4, false);
  1097. return $;
  1098. }
  1099. };
  1100. vkgraph.Double = class Double {
  1101. static decode(reader, position) {
  1102. const $ = new vkgraph.Double();
  1103. $.double_val = reader.float64_(position, 4, 0);
  1104. return $;
  1105. }
  1106. };
  1107. vkgraph.String = class String {
  1108. static decode(reader, position) {
  1109. const $ = new vkgraph.String();
  1110. $.string_val = reader.string_(position, 4, null);
  1111. return $;
  1112. }
  1113. };
  1114. vkgraph.IntList = class IntList {
  1115. static decode(reader, position) {
  1116. const $ = new vkgraph.IntList();
  1117. $.items = reader.int64s_(position, 4);
  1118. return $;
  1119. }
  1120. };
  1121. vkgraph.DoubleList = class DoubleList {
  1122. static decode(reader, position) {
  1123. const $ = new vkgraph.DoubleList();
  1124. $.items = reader.array(position, 4, Float64Array);
  1125. return $;
  1126. }
  1127. };
  1128. vkgraph.BoolList = class BoolList {
  1129. static decode(reader, position) {
  1130. const $ = new vkgraph.BoolList();
  1131. $.items = reader.bools_(position, 4);
  1132. return $;
  1133. }
  1134. };
  1135. vkgraph.ValueList = class ValueList {
  1136. static decode(reader, position) {
  1137. const $ = new vkgraph.ValueList();
  1138. $.items = reader.array(position, 4, Int32Array);
  1139. return $;
  1140. }
  1141. };
  1142. vkgraph.SymInt = class SymInt {
  1143. static decode(reader, position) {
  1144. const $ = new vkgraph.SymInt();
  1145. $.value = reader.int32_(position, 4, 0);
  1146. return $;
  1147. }
  1148. };
  1149. vkgraph.GraphTypes = class {
  1150. static decode(reader, position, type) {
  1151. switch (type) {
  1152. case 1: return vkgraph.Null.decode(reader, position);
  1153. case 2: return vkgraph.Int.decode(reader, position);
  1154. case 3: return vkgraph.Double.decode(reader, position);
  1155. case 4: return vkgraph.Bool.decode(reader, position);
  1156. case 5: return vkgraph.VkTensor.decode(reader, position);
  1157. case 6: return vkgraph.IntList.decode(reader, position);
  1158. case 7: return vkgraph.DoubleList.decode(reader, position);
  1159. case 8: return vkgraph.BoolList.decode(reader, position);
  1160. case 9: return vkgraph.ValueList.decode(reader, position);
  1161. case 10: return vkgraph.String.decode(reader, position);
  1162. case 11: return vkgraph.SymInt.decode(reader, position);
  1163. default: return undefined;
  1164. }
  1165. }
  1166. };
  1167. vkgraph.VkValue = class VkValue {
  1168. static decode(reader, position) {
  1169. const $ = new vkgraph.VkValue();
  1170. $.value = reader.union(position, 4, vkgraph.GraphTypes);
  1171. return $;
  1172. }
  1173. };
  1174. vkgraph.VkBytes = class VkBytes {
  1175. static decode(reader, position) {
  1176. const $ = new vkgraph.VkBytes();
  1177. $.offset = reader.uint64_(position, 4, 0n);
  1178. $.length = reader.uint64_(position, 6, 0n);
  1179. $.named_key = reader.string_(position, 8, null);
  1180. return $;
  1181. }
  1182. };
  1183. vkgraph.VkGraph = class VkGraph {
  1184. static identifier(reader) {
  1185. return reader.identifier === 'VK00';
  1186. }
  1187. static create(reader) {
  1188. return vkgraph.VkGraph.decode(reader, reader.root);
  1189. }
  1190. static decode(reader, position) {
  1191. const $ = new vkgraph.VkGraph();
  1192. $.version = reader.string_(position, 4, null);
  1193. $.chain = reader.tables(position, 6, vkgraph.OperatorCall);
  1194. $.values = reader.tables(position, 8, vkgraph.VkValue);
  1195. $.input_ids = reader.array(position, 10, Uint32Array);
  1196. $.output_ids = reader.array(position, 12, Uint32Array);
  1197. $.constants = reader.tables(position, 14, vkgraph.VkBytes);
  1198. $.shaders = reader.tables(position, 16, vkgraph.VkBytes);
  1199. $.storage_type_override = reader.uint8_(position, 18, 255);
  1200. $.memory_layout_override = reader.uint8_(position, 20, 255);
  1201. return $;
  1202. }
  1203. };