executorch-schema.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461
  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. PACKED_INT8_4C1W: 8,
  1066. DEFAULT_LAYOUT: 255
  1067. };
  1068. vkgraph.VkTensor = class VkTensor {
  1069. static decode(reader, position) {
  1070. const $ = new vkgraph.VkTensor();
  1071. $.datatype = reader.int8_(position, 4, 0);
  1072. $.dims = reader.array(position, 6, Uint32Array);
  1073. $.constant_id = reader.int32_(position, 8, 0);
  1074. $.mem_obj_id = reader.int32_(position, 10, 0);
  1075. $.storage_type = reader.uint8_(position, 12, 255);
  1076. $.memory_layout = reader.uint8_(position, 14, 255);
  1077. $.staging_datatype = reader.int8_(position, 16, 127);
  1078. return $;
  1079. }
  1080. };
  1081. vkgraph.Null = class Null {
  1082. static decode(/* reader, position */) {
  1083. const $ = new vkgraph.Null();
  1084. return $;
  1085. }
  1086. };
  1087. vkgraph.Int = class Int {
  1088. static decode(reader, position) {
  1089. const $ = new vkgraph.Int();
  1090. $.int_val = reader.int64_(position, 4, 0n);
  1091. return $;
  1092. }
  1093. };
  1094. vkgraph.Bool = class Bool {
  1095. static decode(reader, position) {
  1096. const $ = new vkgraph.Bool();
  1097. $.bool_val = reader.bool_(position, 4, false);
  1098. return $;
  1099. }
  1100. };
  1101. vkgraph.Double = class Double {
  1102. static decode(reader, position) {
  1103. const $ = new vkgraph.Double();
  1104. $.double_val = reader.float64_(position, 4, 0);
  1105. return $;
  1106. }
  1107. };
  1108. vkgraph.String = class String {
  1109. static decode(reader, position) {
  1110. const $ = new vkgraph.String();
  1111. $.string_val = reader.string_(position, 4, null);
  1112. return $;
  1113. }
  1114. };
  1115. vkgraph.IntList = class IntList {
  1116. static decode(reader, position) {
  1117. const $ = new vkgraph.IntList();
  1118. $.items = reader.int64s_(position, 4);
  1119. return $;
  1120. }
  1121. };
  1122. vkgraph.DoubleList = class DoubleList {
  1123. static decode(reader, position) {
  1124. const $ = new vkgraph.DoubleList();
  1125. $.items = reader.array(position, 4, Float64Array);
  1126. return $;
  1127. }
  1128. };
  1129. vkgraph.BoolList = class BoolList {
  1130. static decode(reader, position) {
  1131. const $ = new vkgraph.BoolList();
  1132. $.items = reader.bools_(position, 4);
  1133. return $;
  1134. }
  1135. };
  1136. vkgraph.ValueList = class ValueList {
  1137. static decode(reader, position) {
  1138. const $ = new vkgraph.ValueList();
  1139. $.items = reader.array(position, 4, Int32Array);
  1140. return $;
  1141. }
  1142. };
  1143. vkgraph.SymInt = class SymInt {
  1144. static decode(reader, position) {
  1145. const $ = new vkgraph.SymInt();
  1146. $.value = reader.int32_(position, 4, 0);
  1147. return $;
  1148. }
  1149. };
  1150. vkgraph.GraphTypes = class {
  1151. static decode(reader, position, type) {
  1152. switch (type) {
  1153. case 1: return vkgraph.Null.decode(reader, position);
  1154. case 2: return vkgraph.Int.decode(reader, position);
  1155. case 3: return vkgraph.Double.decode(reader, position);
  1156. case 4: return vkgraph.Bool.decode(reader, position);
  1157. case 5: return vkgraph.VkTensor.decode(reader, position);
  1158. case 6: return vkgraph.IntList.decode(reader, position);
  1159. case 7: return vkgraph.DoubleList.decode(reader, position);
  1160. case 8: return vkgraph.BoolList.decode(reader, position);
  1161. case 9: return vkgraph.ValueList.decode(reader, position);
  1162. case 10: return vkgraph.String.decode(reader, position);
  1163. case 11: return vkgraph.SymInt.decode(reader, position);
  1164. default: return undefined;
  1165. }
  1166. }
  1167. };
  1168. vkgraph.VkValue = class VkValue {
  1169. static decode(reader, position) {
  1170. const $ = new vkgraph.VkValue();
  1171. $.value = reader.union(position, 4, vkgraph.GraphTypes);
  1172. return $;
  1173. }
  1174. };
  1175. vkgraph.VkBytes = class VkBytes {
  1176. static decode(reader, position) {
  1177. const $ = new vkgraph.VkBytes();
  1178. $.offset = reader.uint64_(position, 4, 0n);
  1179. $.length = reader.uint64_(position, 6, 0n);
  1180. $.named_key = reader.string_(position, 8, null);
  1181. return $;
  1182. }
  1183. };
  1184. vkgraph.VkGraph = class VkGraph {
  1185. static identifier(reader) {
  1186. return reader.identifier === 'VK00';
  1187. }
  1188. static create(reader) {
  1189. return vkgraph.VkGraph.decode(reader, reader.root);
  1190. }
  1191. static decode(reader, position) {
  1192. const $ = new vkgraph.VkGraph();
  1193. $.version = reader.string_(position, 4, null);
  1194. $.chain = reader.tables(position, 6, vkgraph.OperatorCall);
  1195. $.values = reader.tables(position, 8, vkgraph.VkValue);
  1196. $.input_ids = reader.array(position, 10, Uint32Array);
  1197. $.output_ids = reader.array(position, 12, Uint32Array);
  1198. $.constants = reader.tables(position, 14, vkgraph.VkBytes);
  1199. $.shaders = reader.tables(position, 16, vkgraph.VkBytes);
  1200. $.storage_type_override = reader.uint8_(position, 18, 255);
  1201. $.memory_layout_override = reader.uint8_(position, 20, 255);
  1202. return $;
  1203. }
  1204. };