executorch-schema.js 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  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. QUINT4X2: 16,
  18. QUINT2X4: 17,
  19. BITS16: 22,
  20. FLOAT8E5M2: 23,
  21. FLOAT8E4M3FN: 24,
  22. FLOAT8E5M2FNUZ: 25,
  23. FLOAT8E4M3FNUZ: 26,
  24. UINT16: 27,
  25. UINT32: 28,
  26. UINT64: 29
  27. };
  28. executorch_flatbuffer.ContainerMetadata = class ContainerMetadata {
  29. static decode(reader, position) {
  30. const $ = new executorch_flatbuffer.ContainerMetadata();
  31. $.encoded_inp_str = reader.string_(position, 4, null);
  32. $.encoded_out_str = reader.string_(position, 6, null);
  33. return $;
  34. }
  35. };
  36. executorch_flatbuffer.Null = class Null {
  37. static decode(/* reader, position */) {
  38. const $ = new executorch_flatbuffer.Null();
  39. return $;
  40. }
  41. };
  42. executorch_flatbuffer.AllocationDetails = class AllocationDetails {
  43. static decode(reader, position) {
  44. const $ = new executorch_flatbuffer.AllocationDetails();
  45. $.memory_id = reader.uint32_(position, 4, 0);
  46. $.memory_offset_low = reader.uint32_(position, 6, 0);
  47. $.memory_offset_high = reader.uint32_(position, 8, 0);
  48. return $;
  49. }
  50. };
  51. executorch_flatbuffer.TensorShapeDynamism = {
  52. STATIC: 0,
  53. DYNAMIC_BOUND: 1,
  54. DYNAMIC_UNBOUND: 2
  55. };
  56. executorch_flatbuffer.TensorDataLocation = {
  57. SEGMENT: 0,
  58. EXTERNAL: 1
  59. };
  60. executorch_flatbuffer.ExtraTensorInfo = class ExtraTensorInfo {
  61. static decode(reader, position) {
  62. const $ = new executorch_flatbuffer.ExtraTensorInfo();
  63. $.mutable_data_segments_idx = reader.uint64_(position, 4, 0n);
  64. $.fully_qualified_name = reader.string_(position, 6, null);
  65. $.location = reader.int8_(position, 8, 0);
  66. return $;
  67. }
  68. };
  69. executorch_flatbuffer.Tensor = class Tensor {
  70. static decode(reader, position) {
  71. const $ = new executorch_flatbuffer.Tensor();
  72. $.scalar_type = reader.int8_(position, 4, 0);
  73. $.storage_offset = reader.int32_(position, 6, 0);
  74. $.sizes = reader.array(position, 8, Int32Array);
  75. $.dim_order = reader.array(position, 10, Uint8Array);
  76. $.requires_grad = reader.bool_(position, 12, false);
  77. $.data_buffer_idx = reader.uint32_(position, 14, 0);
  78. $.allocation_info = reader.table(position, 16, executorch_flatbuffer.AllocationDetails);
  79. $.layout = reader.int8_(position, 18, 0);
  80. $.shape_dynamism = reader.int8_(position, 20, 0);
  81. $.extra_tensor_info = reader.table(position, 22, executorch_flatbuffer.ExtraTensorInfo);
  82. return $;
  83. }
  84. };
  85. executorch_flatbuffer.Int = class Int {
  86. static decode(reader, position) {
  87. const $ = new executorch_flatbuffer.Int();
  88. $.int_val = reader.int64_(position, 4, 0n);
  89. return $;
  90. }
  91. };
  92. executorch_flatbuffer.Bool = class Bool {
  93. static decode(reader, position) {
  94. const $ = new executorch_flatbuffer.Bool();
  95. $.bool_val = reader.bool_(position, 4, false);
  96. return $;
  97. }
  98. };
  99. executorch_flatbuffer.Double = class Double {
  100. static decode(reader, position) {
  101. const $ = new executorch_flatbuffer.Double();
  102. $.double_val = reader.float64_(position, 4, 0);
  103. return $;
  104. }
  105. };
  106. executorch_flatbuffer.String = class String {
  107. static decode(reader, position) {
  108. const $ = new executorch_flatbuffer.String();
  109. $.string_val = reader.string_(position, 4, null);
  110. return $;
  111. }
  112. };
  113. executorch_flatbuffer.IntList = class IntList {
  114. static decode(reader, position) {
  115. const $ = new executorch_flatbuffer.IntList();
  116. $.items = reader.int64s_(position, 4);
  117. return $;
  118. }
  119. };
  120. executorch_flatbuffer.DoubleList = class DoubleList {
  121. static decode(reader, position) {
  122. const $ = new executorch_flatbuffer.DoubleList();
  123. $.items = reader.array(position, 4, Float64Array);
  124. return $;
  125. }
  126. };
  127. executorch_flatbuffer.BoolList = class BoolList {
  128. static decode(reader, position) {
  129. const $ = new executorch_flatbuffer.BoolList();
  130. $.items = reader.bools_(position, 4);
  131. return $;
  132. }
  133. };
  134. executorch_flatbuffer.TensorList = class TensorList {
  135. static decode(reader, position) {
  136. const $ = new executorch_flatbuffer.TensorList();
  137. $.items = reader.array(position, 4, Int32Array);
  138. return $;
  139. }
  140. };
  141. executorch_flatbuffer.OptionalTensorList = class OptionalTensorList {
  142. static decode(reader, position) {
  143. const $ = new executorch_flatbuffer.OptionalTensorList();
  144. $.items = reader.array(position, 4, Int32Array);
  145. return $;
  146. }
  147. };
  148. executorch_flatbuffer.KernelTypes = class {
  149. static decode(reader, position, type) {
  150. switch (type) {
  151. case 1: return executorch_flatbuffer.Null.decode(reader, position);
  152. case 2: return executorch_flatbuffer.Int.decode(reader, position);
  153. case 3: return executorch_flatbuffer.Bool.decode(reader, position);
  154. case 4: return executorch_flatbuffer.Double.decode(reader, position);
  155. case 5: return executorch_flatbuffer.Tensor.decode(reader, position);
  156. case 6: return executorch_flatbuffer.String.decode(reader, position);
  157. case 7: return executorch_flatbuffer.IntList.decode(reader, position);
  158. case 8: return executorch_flatbuffer.DoubleList.decode(reader, position);
  159. case 9: return executorch_flatbuffer.BoolList.decode(reader, position);
  160. case 10: return executorch_flatbuffer.TensorList.decode(reader, position);
  161. case 11: return executorch_flatbuffer.OptionalTensorList.decode(reader, position);
  162. default: return undefined;
  163. }
  164. }
  165. };
  166. executorch_flatbuffer.EValue = class EValue {
  167. static decode(reader, position) {
  168. const $ = new executorch_flatbuffer.EValue();
  169. $.val = reader.union(position, 4, executorch_flatbuffer.KernelTypes);
  170. return $;
  171. }
  172. };
  173. executorch_flatbuffer.Operator = class Operator {
  174. static decode(reader, position) {
  175. const $ = new executorch_flatbuffer.Operator();
  176. $.name = reader.string_(position, 4, null);
  177. $.overload = reader.string_(position, 6, null);
  178. return $;
  179. }
  180. };
  181. executorch_flatbuffer.KernelCall = class KernelCall {
  182. static decode(reader, position) {
  183. const $ = new executorch_flatbuffer.KernelCall();
  184. $.op_index = reader.int32_(position, 4, 0);
  185. $.args = reader.array(position, 6, Int32Array);
  186. return $;
  187. }
  188. };
  189. executorch_flatbuffer.DelegateCall = class DelegateCall {
  190. static decode(reader, position) {
  191. const $ = new executorch_flatbuffer.DelegateCall();
  192. $.delegate_index = reader.int32_(position, 4, 0);
  193. $.args = reader.array(position, 6, Int32Array);
  194. return $;
  195. }
  196. };
  197. executorch_flatbuffer.MoveCall = class MoveCall {
  198. static decode(reader, position) {
  199. const $ = new executorch_flatbuffer.MoveCall();
  200. $.move_from = reader.int32_(position, 4, 0);
  201. $.move_to = reader.int32_(position, 6, 0);
  202. return $;
  203. }
  204. };
  205. executorch_flatbuffer.JumpFalseCall = class JumpFalseCall {
  206. static decode(reader, position) {
  207. const $ = new executorch_flatbuffer.JumpFalseCall();
  208. $.cond_value_index = reader.int32_(position, 4, 0);
  209. $.destination_instruction = reader.int32_(position, 6, 0);
  210. return $;
  211. }
  212. };
  213. executorch_flatbuffer.FreeCall = class FreeCall {
  214. static decode(reader, position) {
  215. const $ = new executorch_flatbuffer.FreeCall();
  216. $.value_index = reader.int32_(position, 4, 0);
  217. return $;
  218. }
  219. };
  220. executorch_flatbuffer.InstructionArguments = class {
  221. static decode(reader, position, type) {
  222. switch (type) {
  223. case 1: return executorch_flatbuffer.KernelCall.decode(reader, position);
  224. case 2: return executorch_flatbuffer.DelegateCall.decode(reader, position);
  225. case 3: return executorch_flatbuffer.MoveCall.decode(reader, position);
  226. case 4: return executorch_flatbuffer.JumpFalseCall.decode(reader, position);
  227. case 5: return executorch_flatbuffer.FreeCall.decode(reader, position);
  228. default: return undefined;
  229. }
  230. }
  231. };
  232. executorch_flatbuffer.Instruction = class Instruction {
  233. static decode(reader, position) {
  234. const $ = new executorch_flatbuffer.Instruction();
  235. $.instr_args = reader.union(position, 4, executorch_flatbuffer.InstructionArguments);
  236. return $;
  237. }
  238. };
  239. executorch_flatbuffer.Frame = class Frame {
  240. static decode(reader, position) {
  241. const $ = new executorch_flatbuffer.Frame();
  242. $.filename = reader.string_(position, 4, null);
  243. $.lineno = reader.int32_(position, 6, 0);
  244. $.name = reader.string_(position, 8, null);
  245. $.context = reader.string_(position, 10, null);
  246. return $;
  247. }
  248. };
  249. executorch_flatbuffer.FrameList = class FrameList {
  250. static decode(reader, position) {
  251. const $ = new executorch_flatbuffer.FrameList();
  252. $.items = reader.tables(position, 4, executorch_flatbuffer.Frame);
  253. return $;
  254. }
  255. };
  256. executorch_flatbuffer.DataLocation = {
  257. INLINE: 0,
  258. SEGMENT: 1
  259. };
  260. executorch_flatbuffer.BackendDelegateDataReference = class BackendDelegateDataReference {
  261. static decode(reader, position) {
  262. const $ = new executorch_flatbuffer.BackendDelegateDataReference();
  263. $.location = reader.int8_(position, 4, 0);
  264. $.index = reader.uint32_(position, 6, 0);
  265. return $;
  266. }
  267. };
  268. executorch_flatbuffer.CompileSpec = class CompileSpec {
  269. static decode(reader, position) {
  270. const $ = new executorch_flatbuffer.CompileSpec();
  271. $.key = reader.string_(position, 4, null);
  272. $.value = reader.array(position, 6, Uint8Array);
  273. return $;
  274. }
  275. };
  276. executorch_flatbuffer.BackendDelegate = class BackendDelegate {
  277. static decode(reader, position) {
  278. const $ = new executorch_flatbuffer.BackendDelegate();
  279. $.id = reader.string_(position, 4, null);
  280. $.processed = reader.table(position, 6, executorch_flatbuffer.BackendDelegateDataReference);
  281. $.compile_specs = reader.tables(position, 8, executorch_flatbuffer.CompileSpec);
  282. return $;
  283. }
  284. };
  285. executorch_flatbuffer.Chain = class Chain {
  286. static decode(reader, position) {
  287. const $ = new executorch_flatbuffer.Chain();
  288. $.inputs = reader.array(position, 4, Int32Array);
  289. $.outputs = reader.array(position, 6, Int32Array);
  290. $.instructions = reader.tables(position, 8, executorch_flatbuffer.Instruction);
  291. $.stacktrace = reader.tables(position, 10, executorch_flatbuffer.FrameList);
  292. return $;
  293. }
  294. };
  295. executorch_flatbuffer.ExecutionPlan = class ExecutionPlan {
  296. static decode(reader, position) {
  297. const $ = new executorch_flatbuffer.ExecutionPlan();
  298. $.name = reader.string_(position, 4, null);
  299. $.container_meta_type = reader.table(position, 6, executorch_flatbuffer.ContainerMetadata);
  300. $.values = reader.tables(position, 8, executorch_flatbuffer.EValue);
  301. $.inputs = reader.array(position, 10, Int32Array);
  302. $.outputs = reader.array(position, 12, Int32Array);
  303. $.chains = reader.tables(position, 14, executorch_flatbuffer.Chain);
  304. $.operators = reader.tables(position, 16, executorch_flatbuffer.Operator);
  305. $.delegates = reader.tables(position, 18, executorch_flatbuffer.BackendDelegate);
  306. $.non_const_buffer_sizes = reader.int64s_(position, 20);
  307. return $;
  308. }
  309. };
  310. executorch_flatbuffer.Buffer = class Buffer {
  311. static decode(reader, position) {
  312. const $ = new executorch_flatbuffer.Buffer();
  313. $.storage = reader.array(position, 4, Uint8Array);
  314. return $;
  315. }
  316. };
  317. executorch_flatbuffer.BackendDelegateInlineData = class BackendDelegateInlineData {
  318. static decode(reader, position) {
  319. const $ = new executorch_flatbuffer.BackendDelegateInlineData();
  320. $.data = reader.array(position, 4, Uint8Array);
  321. return $;
  322. }
  323. };
  324. executorch_flatbuffer.DataSegment = class DataSegment {
  325. static decode(reader, position) {
  326. const $ = new executorch_flatbuffer.DataSegment();
  327. $.offset = reader.uint64_(position, 4, 0n);
  328. $.size = reader.uint64_(position, 6, 0n);
  329. return $;
  330. }
  331. };
  332. executorch_flatbuffer.SubsegmentOffsets = class SubsegmentOffsets {
  333. static decode(reader, position) {
  334. const $ = new executorch_flatbuffer.SubsegmentOffsets();
  335. $.segment_index = reader.uint32_(position, 4, 0);
  336. $.offsets = reader.uint64s_(position, 6);
  337. return $;
  338. }
  339. };
  340. executorch_flatbuffer.NamedData = class NamedData {
  341. static decode(reader, position) {
  342. const $ = new executorch_flatbuffer.NamedData();
  343. $.key = reader.string_(position, 4, null);
  344. $.segment_index = reader.uint32_(position, 6, 0);
  345. return $;
  346. }
  347. };
  348. executorch_flatbuffer.Program = class Program {
  349. static identifier(reader) {
  350. return reader.identifier === 'ET12';
  351. }
  352. static create(reader) {
  353. return executorch_flatbuffer.Program.decode(reader, reader.root);
  354. }
  355. static decode(reader, position) {
  356. const $ = new executorch_flatbuffer.Program();
  357. $.version = reader.uint32_(position, 4, 0);
  358. $.execution_plan = reader.tables(position, 6, executorch_flatbuffer.ExecutionPlan);
  359. $.constant_buffer = reader.tables(position, 8, executorch_flatbuffer.Buffer);
  360. $.backend_delegate_data = reader.tables(position, 10, executorch_flatbuffer.BackendDelegateInlineData);
  361. $.segments = reader.tables(position, 12, executorch_flatbuffer.DataSegment);
  362. $.constant_segment = reader.table(position, 14, executorch_flatbuffer.SubsegmentOffsets);
  363. $.mutable_data_segments = reader.tables(position, 16, executorch_flatbuffer.SubsegmentOffsets);
  364. $.named_data = reader.tables(position, 18, executorch_flatbuffer.NamedData);
  365. return $;
  366. }
  367. };
  368. fb_xnnpack.XNNDatatype = {
  369. xnn_datatype_invalid: 0,
  370. xnn_datatype_fp32: 1,
  371. xnn_datatype_fp16: 2,
  372. xnn_datatype_qint8: 3,
  373. xnn_datatype_quint8: 4,
  374. xnn_datatype_qint32: 5,
  375. xnn_datatype_qcint8: 6,
  376. xnn_datatype_qcint32: 7,
  377. xnn_datatype_qcint4: 8,
  378. xnn_datatype_qdint8: 9,
  379. xnn_datatype_qbint4: 10
  380. };
  381. fb_xnnpack.XNNQuantParams = class {
  382. static decode(reader, position, type) {
  383. switch (type) {
  384. case 1: return fb_xnnpack.PerChannelQuant.decode(reader, position);
  385. case 2: return fb_xnnpack.PerTensorQuant.decode(reader, position);
  386. case 3: return fb_xnnpack.PerTokenDynamicQuant.decode(reader, position);
  387. case 4: return fb_xnnpack.PerChannelGroupQuant.decode(reader, position);
  388. default: return undefined;
  389. }
  390. }
  391. };
  392. fb_xnnpack.Buffer = class Buffer {
  393. static decode(reader, position) {
  394. const $ = new fb_xnnpack.Buffer();
  395. $.storage = reader.array(position, 4, Uint8Array);
  396. return $;
  397. }
  398. };
  399. fb_xnnpack.PerChannelGroupQuant = class PerChannelGroupQuant {
  400. static decode(reader, position) {
  401. const $ = new fb_xnnpack.PerChannelGroupQuant();
  402. $.scale = reader.array(position, 4, Float32Array);
  403. $.channel_dim = reader.int32_(position, 6, 0);
  404. $.group_size = reader.int32_(position, 8, 0);
  405. $.scale_bf16 = reader.array(position, 10, Uint16Array);
  406. return $;
  407. }
  408. };
  409. fb_xnnpack.PerChannelQuant = class PerChannelQuant {
  410. static decode(reader, position) {
  411. const $ = new fb_xnnpack.PerChannelQuant();
  412. $.scale = reader.array(position, 4, Float32Array);
  413. $.channel_dim = reader.int32_(position, 6, 0);
  414. return $;
  415. }
  416. };
  417. fb_xnnpack.PerTokenDynamicQuant = class PerTokenDynamicQuant {
  418. static decode(reader, position) {
  419. const $ = new fb_xnnpack.PerTokenDynamicQuant();
  420. $.num_nonbatch_dims = reader.int32_(position, 4, 0);
  421. return $;
  422. }
  423. };
  424. fb_xnnpack.PerTensorQuant = class PerTensorQuant {
  425. static decode(reader, position) {
  426. const $ = new fb_xnnpack.PerTensorQuant();
  427. $.scale = reader.float32_(position, 4, 0);
  428. $.zero_point = reader.int32_(position, 6, 0);
  429. return $;
  430. }
  431. };
  432. fb_xnnpack.XNNTensorValue = class XNNTensorValue {
  433. static decode(reader, position) {
  434. const $ = new fb_xnnpack.XNNTensorValue();
  435. $.datatype = reader.int16_(position, 4, 0);
  436. $.num_dims = reader.uint32_(position, 6, 0);
  437. $.dims = reader.array(position, 8, Uint32Array);
  438. $.constant_buffer_idx = reader.uint32_(position, 10, 0);
  439. $.external_id = reader.uint32_(position, 12, 0);
  440. $.flags = reader.uint32_(position, 14, 0);
  441. $.id_out = reader.uint32_(position, 16, 0);
  442. return $;
  443. }
  444. };
  445. fb_xnnpack.XNNQuantizedTensorValue = class XNNQuantizedTensorValue {
  446. static decode(reader, position) {
  447. const $ = new fb_xnnpack.XNNQuantizedTensorValue();
  448. $.tensor_value = reader.table(position, 4, fb_xnnpack.XNNTensorValue);
  449. $.quant_params = reader.union(position, 6, fb_xnnpack.XNNQuantParams);
  450. return $;
  451. }
  452. };
  453. fb_xnnpack.XNodeUnion = class {
  454. static decode(reader, position, type) {
  455. switch (type) {
  456. case 1: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  457. case 2: return fb_xnnpack.XNNFullyConnected.decode(reader, position);
  458. case 3: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  459. case 4: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  460. case 5: return fb_xnnpack.XNNStaticTranspose.decode(reader, position);
  461. case 6: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  462. case 7: return fb_xnnpack._XNNNodeConv.decode(reader, position);
  463. case 8: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  464. case 9: return fb_xnnpack.XNNStaticResizeBilinear2D.decode(reader, position);
  465. case 10: return fb_xnnpack.XNNStaticConstantPad.decode(reader, position);
  466. case 11: return fb_xnnpack._XNNPooling2D.decode(reader, position);
  467. case 12: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  468. case 13: return fb_xnnpack._XNNNodeConv.decode(reader, position);
  469. case 14: return fb_xnnpack._XNNPooling2D.decode(reader, position);
  470. case 15: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  471. case 16: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  472. case 17: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  473. case 18: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  474. case 19: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  475. case 20: return fb_xnnpack.XNNStaticReshape.decode(reader, position);
  476. case 21: return fb_xnnpack.XNNArgMaxPooling2d.decode(reader, position);
  477. case 22: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  478. case 23: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  479. case 24: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  480. case 25: return fb_xnnpack.XNNLeakyReLU.decode(reader, position);
  481. case 26: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  482. case 27: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  483. case 28: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  484. case 29: return fb_xnnpack.XNNELU.decode(reader, position);
  485. case 30: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  486. case 31: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  487. case 32: return fb_xnnpack._XNNCat.decode(reader, position);
  488. case 33: return fb_xnnpack._XNNCat.decode(reader, position);
  489. case 34: return fb_xnnpack._XNNCat.decode(reader, position);
  490. case 35: return fb_xnnpack.XNNStaticSlice.decode(reader, position);
  491. case 36: return fb_xnnpack.XNNScaledDotProductAttention.decode(reader, position);
  492. case 37: return fb_xnnpack._XNNNode2x1.decode(reader, position);
  493. case 38: return fb_xnnpack._XNNCat.decode(reader, position);
  494. case 39: return fb_xnnpack._XNNNodeConv.decode(reader, position);
  495. case 40: return fb_xnnpack._XNNNode1x1.decode(reader, position);
  496. default: return undefined;
  497. }
  498. }
  499. };
  500. fb_xnnpack.XValueUnion = class {
  501. static decode(reader, position, type) {
  502. switch (type) {
  503. case 1: return fb_xnnpack.XNNTensorValue.decode(reader, position);
  504. case 2: return fb_xnnpack.XNNQuantizedTensorValue.decode(reader, position);
  505. default: return undefined;
  506. }
  507. }
  508. };
  509. fb_xnnpack.OutputMinMax = class OutputMinMax {
  510. static decode(reader, position) {
  511. const $ = new fb_xnnpack.OutputMinMax();
  512. $.output_min = reader.float32_(position, 4, 0);
  513. $.output_max = reader.float32_(position, 6, 0);
  514. return $;
  515. }
  516. };
  517. fb_xnnpack.XNode = class XNode {
  518. static decode(reader, position) {
  519. const $ = new fb_xnnpack.XNode();
  520. $.xnode_union = reader.union(position, 4, fb_xnnpack.XNodeUnion);
  521. $.debug_handle = reader.uint32_(position, 8, 0);
  522. $.output_min_max = reader.table(position, 10, fb_xnnpack.OutputMinMax);
  523. return $;
  524. }
  525. };
  526. fb_xnnpack.XValue = class XValue {
  527. static decode(reader, position) {
  528. const $ = new fb_xnnpack.XValue();
  529. $.xvalue_union = reader.union(position, 4, fb_xnnpack.XValueUnion);
  530. return $;
  531. }
  532. };
  533. fb_xnnpack.XNNStaticTranspose = class XNNStaticTranspose {
  534. static decode(reader, position) {
  535. const $ = new fb_xnnpack.XNNStaticTranspose();
  536. $.num_dims = reader.uint32_(position, 4, 0);
  537. $.perm = reader.array(position, 6, Uint32Array);
  538. $.input_id = reader.uint32_(position, 8, 0);
  539. $.output_id = reader.uint32_(position, 10, 0);
  540. $.flags = reader.uint32_(position, 12, 0);
  541. return $;
  542. }
  543. };
  544. fb_xnnpack.XNNStaticResizeBilinear2D = class XNNStaticResizeBilinear2D {
  545. static decode(reader, position) {
  546. const $ = new fb_xnnpack.XNNStaticResizeBilinear2D();
  547. $.new_height = reader.uint32_(position, 4, 0);
  548. $.new_width = reader.uint32_(position, 6, 0);
  549. $.input_id = reader.uint32_(position, 8, 0);
  550. $.output_id = reader.uint32_(position, 10, 0);
  551. $.flags = reader.uint32_(position, 12, 0);
  552. return $;
  553. }
  554. };
  555. fb_xnnpack.XNNStaticConstantPad = class XNNStaticConstantPad {
  556. static decode(reader, position) {
  557. const $ = new fb_xnnpack.XNNStaticConstantPad();
  558. $.pre_paddings = reader.array(position, 4, Uint32Array);
  559. $.post_paddings = reader.array(position, 6, Uint32Array);
  560. $.padding_value = reader.float32_(position, 8, 0);
  561. $.input_id = reader.uint32_(position, 10, 0);
  562. $.output_id = reader.uint32_(position, 12, 0);
  563. $.flags = reader.uint32_(position, 14, 0);
  564. return $;
  565. }
  566. };
  567. fb_xnnpack._XNNNode2x1 = class _XNNNode2x1 {
  568. static decode(reader, position) {
  569. const $ = new fb_xnnpack._XNNNode2x1();
  570. $.input1_id = reader.uint32_(position, 4, 0);
  571. $.input2_id = reader.uint32_(position, 6, 0);
  572. $.output_id = reader.uint32_(position, 8, 0);
  573. $.flags = reader.uint32_(position, 10, 0);
  574. return $;
  575. }
  576. };
  577. fb_xnnpack._XNNNode1x1 = class _XNNNode1x1 {
  578. static decode(reader, position) {
  579. const $ = new fb_xnnpack._XNNNode1x1();
  580. $.input_id = reader.uint32_(position, 4, 0);
  581. $.output_id = reader.uint32_(position, 6, 0);
  582. $.flags = reader.uint32_(position, 8, 0);
  583. return $;
  584. }
  585. };
  586. fb_xnnpack._XNNCat = class _XNNCat {
  587. static decode(reader, position) {
  588. const $ = new fb_xnnpack._XNNCat();
  589. $.axis = reader.uint32_(position, 4, 0);
  590. $.input1_id = reader.uint32_(position, 6, 0);
  591. $.input2_id = reader.uint32_(position, 8, 0);
  592. $.input3_id = reader.uint32_(position, 10, 0);
  593. $.input4_id = reader.uint32_(position, 12, 0);
  594. $.output_id = reader.uint32_(position, 14, 0);
  595. $.flags = reader.uint32_(position, 16, 0);
  596. $.input5_id = reader.uint32_(position, 18, 0);
  597. return $;
  598. }
  599. };
  600. fb_xnnpack.XNNELU = class XNNELU {
  601. static decode(reader, position) {
  602. const $ = new fb_xnnpack.XNNELU();
  603. $.alpha = reader.float32_(position, 4, 0);
  604. $.input_id = reader.uint32_(position, 6, 0);
  605. $.output_id = reader.uint32_(position, 8, 0);
  606. $.flags = reader.uint32_(position, 10, 0);
  607. return $;
  608. }
  609. };
  610. fb_xnnpack.XNNFullyConnected = class XNNFullyConnected {
  611. static decode(reader, position) {
  612. const $ = new fb_xnnpack.XNNFullyConnected();
  613. $.input1_id = reader.uint32_(position, 4, 0);
  614. $.filter_id = reader.uint32_(position, 6, 0);
  615. $.bias_id = reader.uint32_(position, 8, 0);
  616. $.output_id = reader.uint32_(position, 10, 0);
  617. $.flags = reader.uint32_(position, 12, 0);
  618. return $;
  619. }
  620. };
  621. fb_xnnpack._XNNNodeConv = class _XNNNodeConv {
  622. static decode(reader, position) {
  623. const $ = new fb_xnnpack._XNNNodeConv();
  624. $.padding_top = reader.uint32_(position, 4, 0);
  625. $.padding_right = reader.uint32_(position, 6, 0);
  626. $.padding_bottom = reader.uint32_(position, 8, 0);
  627. $.padding_left = reader.uint32_(position, 10, 0);
  628. $.kernel_height = reader.uint32_(position, 12, 0);
  629. $.kernel_width = reader.uint32_(position, 14, 0);
  630. $.subsampling_height = reader.uint32_(position, 16, 0);
  631. $.subsampling_width = reader.uint32_(position, 18, 0);
  632. $.dilation_height = reader.uint32_(position, 20, 0);
  633. $.dilation_width = reader.uint32_(position, 22, 0);
  634. $.group_input_channels = reader.uint32_(position, 24, 0);
  635. $.group_output_channels = reader.uint32_(position, 26, 0);
  636. $.groups = reader.uint32_(position, 28, 0);
  637. $.adjustment_height = reader.uint32_(position, 30, 0);
  638. $.adjustment_width = reader.uint32_(position, 32, 0);
  639. $.input1_id = reader.uint32_(position, 34, 0);
  640. $.filter_id = reader.uint32_(position, 36, 0);
  641. $.bias_id = reader.uint32_(position, 38, 0);
  642. $.output_id = reader.uint32_(position, 40, 0);
  643. $.flags = reader.uint32_(position, 42, 0);
  644. return $;
  645. }
  646. };
  647. fb_xnnpack._XNNPooling2D = class _XNNPooling2D {
  648. static decode(reader, position) {
  649. const $ = new fb_xnnpack._XNNPooling2D();
  650. $.padding_top = reader.uint32_(position, 4, 0);
  651. $.padding_right = reader.uint32_(position, 6, 0);
  652. $.padding_bottom = reader.uint32_(position, 8, 0);
  653. $.padding_left = reader.uint32_(position, 10, 0);
  654. $.pooling_height = reader.uint32_(position, 12, 0);
  655. $.pooling_width = reader.uint32_(position, 14, 0);
  656. $.stride_height = reader.uint32_(position, 16, 0);
  657. $.stride_width = reader.uint32_(position, 18, 0);
  658. $.dilation_height = reader.uint32_(position, 20, 0);
  659. $.dilation_width = reader.uint32_(position, 22, 0);
  660. $.input_id = reader.uint32_(position, 24, 0);
  661. $.output_id = reader.uint32_(position, 26, 0);
  662. $.flags = reader.uint32_(position, 28, 0);
  663. return $;
  664. }
  665. };
  666. fb_xnnpack.XNNStaticReshape = class XNNStaticReshape {
  667. static decode(reader, position) {
  668. const $ = new fb_xnnpack.XNNStaticReshape();
  669. $.num_dims = reader.uint32_(position, 4, 0);
  670. $.new_shape = reader.array(position, 6, Uint32Array);
  671. $.input_id = reader.uint32_(position, 8, 0);
  672. $.output_id = reader.uint32_(position, 10, 0);
  673. $.flags = reader.uint32_(position, 12, 0);
  674. return $;
  675. }
  676. };
  677. fb_xnnpack.XNNStaticSlice = class XNNStaticSlice {
  678. static decode(reader, position) {
  679. const $ = new fb_xnnpack.XNNStaticSlice();
  680. $.num_dims = reader.uint32_(position, 4, 0);
  681. $.offsets = reader.array(position, 6, Uint32Array);
  682. $.sizes = reader.array(position, 8, Uint32Array);
  683. $.input_id = reader.uint32_(position, 10, 0);
  684. $.output_id = reader.uint32_(position, 12, 0);
  685. $.flags = reader.uint32_(position, 14, 0);
  686. return $;
  687. }
  688. };
  689. fb_xnnpack.XNNScaledDotProductAttention = class XNNScaledDotProductAttention {
  690. static decode(reader, position) {
  691. const $ = new fb_xnnpack.XNNScaledDotProductAttention();
  692. $.query_id = reader.uint32_(position, 4, 0);
  693. $.key_id = reader.uint32_(position, 6, 0);
  694. $.value_id = reader.uint32_(position, 8, 0);
  695. $.scale_id = reader.uint32_(position, 10, 0);
  696. $.mask_id = reader.uint32_(position, 12, 0);
  697. $.output_id = reader.uint32_(position, 14, 0);
  698. $.flags = reader.uint32_(position, 16, 0);
  699. return $;
  700. }
  701. };
  702. fb_xnnpack.XNNArgMaxPooling2d = class XNNArgMaxPooling2d {
  703. static decode(reader, position) {
  704. const $ = new fb_xnnpack.XNNArgMaxPooling2d();
  705. $.padding_top = reader.uint32_(position, 4, 0);
  706. $.padding_right = reader.uint32_(position, 6, 0);
  707. $.padding_bottom = reader.uint32_(position, 8, 0);
  708. $.padding_left = reader.uint32_(position, 10, 0);
  709. $.pooling_height = reader.uint32_(position, 12, 0);
  710. $.pooling_width = reader.uint32_(position, 14, 0);
  711. $.input_id = reader.uint32_(position, 16, 0);
  712. $.output_value_id = reader.uint32_(position, 18, 0);
  713. $.output_index_id = reader.uint32_(position, 20, 0);
  714. $.flags = reader.uint32_(position, 22, 0);
  715. return $;
  716. }
  717. };
  718. fb_xnnpack.XNNLeakyReLU = class XNNLeakyReLU {
  719. static decode(reader, position) {
  720. const $ = new fb_xnnpack.XNNLeakyReLU();
  721. $.negative_slope = reader.float32_(position, 4, 0);
  722. $.input_id = reader.uint32_(position, 6, 0);
  723. $.output_id = reader.uint32_(position, 8, 0);
  724. $.flags = reader.uint32_(position, 10, 0);
  725. return $;
  726. }
  727. };
  728. fb_xnnpack.ConstantDataOffset = class ConstantDataOffset {
  729. static decode(reader, position) {
  730. const $ = new fb_xnnpack.ConstantDataOffset();
  731. $.offset = reader.uint64_(position, 4, 0n);
  732. $.size = reader.uint64_(position, 6, 0n);
  733. $.named_key = reader.string_(position, 8, null);
  734. return $;
  735. }
  736. };
  737. fb_xnnpack.XNNGraph = class XNNGraph {
  738. static identifier(reader) {
  739. return reader.identifier === 'XN01';
  740. }
  741. static create(reader) {
  742. return fb_xnnpack.XNNGraph.decode(reader, reader.root);
  743. }
  744. static decode(reader, position) {
  745. const $ = new fb_xnnpack.XNNGraph();
  746. $.version = reader.string_(position, 4, null);
  747. $.xnodes = reader.tables(position, 6, fb_xnnpack.XNode);
  748. $.xvalues = reader.tables(position, 8, fb_xnnpack.XValue);
  749. $.num_externs = reader.uint32_(position, 10, 0);
  750. $.input_ids = reader.array(position, 12, Uint32Array);
  751. $.output_ids = reader.array(position, 14, Uint32Array);
  752. $.constant_buffer = reader.tables(position, 16, fb_xnnpack.Buffer);
  753. $.mem_buffer_sizes = reader.array(position, 18, Uint32Array);
  754. $.constant_data = reader.tables(position, 20, fb_xnnpack.ConstantDataOffset);
  755. return $;
  756. }
  757. };
  758. vkgraph.OperatorCall = class OperatorCall {
  759. static decode(reader, position) {
  760. const $ = new vkgraph.OperatorCall();
  761. $.node_id = reader.uint32_(position, 4, 0);
  762. $.name = reader.string_(position, 6, null);
  763. $.args = reader.array(position, 8, Int32Array);
  764. return $;
  765. }
  766. };
  767. vkgraph.VkDataType = {
  768. BOOL: 0,
  769. UINT8: 1,
  770. INT8: 2,
  771. INT32: 3,
  772. FLOAT16: 4,
  773. FLOAT32: 5
  774. };
  775. vkgraph.VkStorageType = {
  776. BUFFER: 0,
  777. TEXTURE_3D: 1,
  778. TEXTURE_2D: 2,
  779. DEFAULT_STORAGE: 255
  780. };
  781. vkgraph.VkMemoryLayout = {
  782. TENSOR_WIDTH_PACKED: 0,
  783. TENSOR_HEIGHT_PACKED: 1,
  784. TENSOR_CHANNELS_PACKED: 2,
  785. DEFAULT_LAYOUT: 255
  786. };
  787. vkgraph.VkTensor = class VkTensor {
  788. static decode(reader, position) {
  789. const $ = new vkgraph.VkTensor();
  790. $.datatype = reader.int8_(position, 4, 0);
  791. $.dims = reader.array(position, 6, Uint32Array);
  792. $.constant_id = reader.int32_(position, 8, 0);
  793. $.mem_obj_id = reader.int32_(position, 10, 0);
  794. $.storage_type = reader.uint8_(position, 12, 255);
  795. $.memory_layout = reader.uint8_(position, 14, 255);
  796. return $;
  797. }
  798. };
  799. vkgraph.Null = class Null {
  800. static decode(/* reader, position */) {
  801. const $ = new vkgraph.Null();
  802. return $;
  803. }
  804. };
  805. vkgraph.Int = class Int {
  806. static decode(reader, position) {
  807. const $ = new vkgraph.Int();
  808. $.int_val = reader.int64_(position, 4, 0n);
  809. return $;
  810. }
  811. };
  812. vkgraph.Bool = class Bool {
  813. static decode(reader, position) {
  814. const $ = new vkgraph.Bool();
  815. $.bool_val = reader.bool_(position, 4, false);
  816. return $;
  817. }
  818. };
  819. vkgraph.Double = class Double {
  820. static decode(reader, position) {
  821. const $ = new vkgraph.Double();
  822. $.double_val = reader.float64_(position, 4, 0);
  823. return $;
  824. }
  825. };
  826. vkgraph.String = class String {
  827. static decode(reader, position) {
  828. const $ = new vkgraph.String();
  829. $.string_val = reader.string_(position, 4, null);
  830. return $;
  831. }
  832. };
  833. vkgraph.IntList = class IntList {
  834. static decode(reader, position) {
  835. const $ = new vkgraph.IntList();
  836. $.items = reader.int64s_(position, 4);
  837. return $;
  838. }
  839. };
  840. vkgraph.DoubleList = class DoubleList {
  841. static decode(reader, position) {
  842. const $ = new vkgraph.DoubleList();
  843. $.items = reader.array(position, 4, Float64Array);
  844. return $;
  845. }
  846. };
  847. vkgraph.BoolList = class BoolList {
  848. static decode(reader, position) {
  849. const $ = new vkgraph.BoolList();
  850. $.items = reader.bools_(position, 4);
  851. return $;
  852. }
  853. };
  854. vkgraph.ValueList = class ValueList {
  855. static decode(reader, position) {
  856. const $ = new vkgraph.ValueList();
  857. $.items = reader.array(position, 4, Int32Array);
  858. return $;
  859. }
  860. };
  861. vkgraph.SymInt = class SymInt {
  862. static decode(reader, position) {
  863. const $ = new vkgraph.SymInt();
  864. $.value = reader.int32_(position, 4, 0);
  865. return $;
  866. }
  867. };
  868. vkgraph.GraphTypes = class {
  869. static decode(reader, position, type) {
  870. switch (type) {
  871. case 1: return vkgraph.Null.decode(reader, position);
  872. case 2: return vkgraph.Int.decode(reader, position);
  873. case 3: return vkgraph.Double.decode(reader, position);
  874. case 4: return vkgraph.Bool.decode(reader, position);
  875. case 5: return vkgraph.VkTensor.decode(reader, position);
  876. case 6: return vkgraph.IntList.decode(reader, position);
  877. case 7: return vkgraph.DoubleList.decode(reader, position);
  878. case 8: return vkgraph.BoolList.decode(reader, position);
  879. case 9: return vkgraph.ValueList.decode(reader, position);
  880. case 10: return vkgraph.String.decode(reader, position);
  881. case 11: return vkgraph.SymInt.decode(reader, position);
  882. default: return undefined;
  883. }
  884. }
  885. };
  886. vkgraph.VkValue = class VkValue {
  887. static decode(reader, position) {
  888. const $ = new vkgraph.VkValue();
  889. $.value = reader.union(position, 4, vkgraph.GraphTypes);
  890. return $;
  891. }
  892. };
  893. vkgraph.VkBytes = class VkBytes {
  894. static decode(reader, position) {
  895. const $ = new vkgraph.VkBytes();
  896. $.offset = reader.uint64_(position, 4, 0n);
  897. $.length = reader.uint64_(position, 6, 0n);
  898. return $;
  899. }
  900. };
  901. vkgraph.VkGraph = class VkGraph {
  902. static identifier(reader) {
  903. return reader.identifier === 'VK00';
  904. }
  905. static create(reader) {
  906. return vkgraph.VkGraph.decode(reader, reader.root);
  907. }
  908. static decode(reader, position) {
  909. const $ = new vkgraph.VkGraph();
  910. $.version = reader.string_(position, 4, null);
  911. $.chain = reader.tables(position, 6, vkgraph.OperatorCall);
  912. $.values = reader.tables(position, 8, vkgraph.VkValue);
  913. $.input_ids = reader.array(position, 10, Uint32Array);
  914. $.output_ids = reader.array(position, 12, Uint32Array);
  915. $.constants = reader.tables(position, 14, vkgraph.VkBytes);
  916. $.shaders = reader.tables(position, 16, vkgraph.VkBytes);
  917. $.storage_type_override = reader.uint8_(position, 18, 255);
  918. $.memory_layout_override = reader.uint8_(position, 20, 255);
  919. return $;
  920. }
  921. };