pytorch-schema.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. export const torch = {};
  2. export const executorch_flatbuffer = {};
  3. torch.jit = torch.jit || {};
  4. torch.jit.mobile = torch.jit.mobile || {};
  5. torch.jit.mobile.serialization = torch.jit.mobile.serialization || {};
  6. torch.jit.mobile.serialization.Int = class Int {
  7. static decode(reader, position) {
  8. const $ = new torch.jit.mobile.serialization.Int();
  9. $.int_val = reader.int64(position + 0);
  10. return $;
  11. }
  12. };
  13. torch.jit.mobile.serialization.Bool = class Bool {
  14. static decode(reader, position) {
  15. const $ = new torch.jit.mobile.serialization.Bool();
  16. $.bool_val = reader.bool(position + 0);
  17. return $;
  18. }
  19. };
  20. torch.jit.mobile.serialization.Double = class Double {
  21. static decode(reader, position) {
  22. const $ = new torch.jit.mobile.serialization.Double();
  23. $.double_val = reader.float64(position + 0);
  24. return $;
  25. }
  26. };
  27. torch.jit.mobile.serialization.PerTensorAffineSchema = class PerTensorAffineSchema {
  28. static decode(reader, position) {
  29. const $ = new torch.jit.mobile.serialization.PerTensorAffineSchema();
  30. $.q_scale = reader.float64(position + 0);
  31. $.q_zero_point = reader.int32(position + 4);
  32. return $;
  33. }
  34. };
  35. torch.jit.mobile.serialization.QuantizedSchema = class QuantizedSchema {
  36. static decode(reader, position) {
  37. const $ = new torch.jit.mobile.serialization.QuantizedSchema();
  38. $.qscheme = reader.int8_(position, 4, 0);
  39. $.scale = reader.float64_(position, 6, 0);
  40. $.zero_point = reader.int32_(position, 8, 0);
  41. $.scales = reader.table(position, 10, torch.jit.mobile.serialization.TensorMetadata);
  42. $.zero_points = reader.table(position, 12, torch.jit.mobile.serialization.TensorMetadata);
  43. $.axis = reader.int32_(position, 14, 0);
  44. return $;
  45. }
  46. };
  47. torch.jit.mobile.serialization.TensorMetadata = class TensorMetadata {
  48. static decode(reader, position) {
  49. const $ = new torch.jit.mobile.serialization.TensorMetadata();
  50. $.storage_location_index = reader.uint32_(position, 4, 0);
  51. $.scalar_type = reader.int8_(position, 6, 0);
  52. $.storage_offset = reader.int32_(position, 8, 0);
  53. $.sizes = reader.array(position, 10, Int32Array);
  54. $.strides = reader.array(position, 12, Int32Array);
  55. $.requires_grad = reader.bool_(position, 14, false);
  56. $.quantized_schema = reader.table(position, 16, torch.jit.mobile.serialization.QuantizedSchema);
  57. return $;
  58. }
  59. };
  60. torch.jit.mobile.serialization.String = class String {
  61. static decode(reader, position) {
  62. const $ = new torch.jit.mobile.serialization.String();
  63. $.data = reader.string_(position, 4, null);
  64. return $;
  65. }
  66. };
  67. torch.jit.mobile.serialization.Device = class Device {
  68. static decode(reader, position) {
  69. const $ = new torch.jit.mobile.serialization.Device();
  70. $.str = reader.string_(position, 4, null);
  71. return $;
  72. }
  73. };
  74. torch.jit.mobile.serialization.List = class List {
  75. static decode(reader, position) {
  76. const $ = new torch.jit.mobile.serialization.List();
  77. $.items = reader.array(position, 4, Uint32Array);
  78. $.annotation_str = reader.string_(position, 6, null);
  79. return $;
  80. }
  81. };
  82. torch.jit.mobile.serialization.IntList = class IntList {
  83. static decode(reader, position) {
  84. const $ = new torch.jit.mobile.serialization.IntList();
  85. $.items = reader.int64s_(position, 4);
  86. return $;
  87. }
  88. };
  89. torch.jit.mobile.serialization.DoubleList = class DoubleList {
  90. static decode(reader, position) {
  91. const $ = new torch.jit.mobile.serialization.DoubleList();
  92. $.items = reader.array(position, 4, Float64Array);
  93. return $;
  94. }
  95. };
  96. torch.jit.mobile.serialization.BoolList = class BoolList {
  97. static decode(reader, position) {
  98. const $ = new torch.jit.mobile.serialization.BoolList();
  99. $.items = reader.bools_(position, 4);
  100. return $;
  101. }
  102. };
  103. torch.jit.mobile.serialization.Tuple = class Tuple {
  104. static decode(reader, position) {
  105. const $ = new torch.jit.mobile.serialization.Tuple();
  106. $.items = reader.array(position, 4, Uint32Array);
  107. return $;
  108. }
  109. };
  110. torch.jit.mobile.serialization.Dict = class Dict {
  111. static decode(reader, position) {
  112. const $ = new torch.jit.mobile.serialization.Dict();
  113. $.keys = reader.array(position, 4, Uint32Array);
  114. $.values = reader.array(position, 6, Uint32Array);
  115. $.annotation_str = reader.string_(position, 8, null);
  116. return $;
  117. }
  118. };
  119. torch.jit.mobile.serialization.TypeType = {
  120. UNSET: 0,
  121. CLASS_WITH_FIELD: 1,
  122. CUSTOM_CLASS: 2,
  123. CLASS_WITH_SETSTATE: 3,
  124. NON_OBJ: 4
  125. };
  126. torch.jit.mobile.serialization.ObjectType = class ObjectType {
  127. static decode(reader, position) {
  128. const $ = new torch.jit.mobile.serialization.ObjectType();
  129. $.type_name = reader.string_(position, 4, null);
  130. $.type = reader.uint8_(position, 6, 0);
  131. $.attr_names = reader.strings_(position, 8);
  132. return $;
  133. }
  134. };
  135. torch.jit.mobile.serialization.Object = class Object {
  136. static decode(reader, position) {
  137. const $ = new torch.jit.mobile.serialization.Object();
  138. $.type_index = reader.uint32_(position, 4, 0);
  139. $.state = reader.uint32_(position, 6, 0);
  140. $.attrs = reader.array(position, 8, Uint32Array);
  141. $.setstate_func = reader.uint32_(position, 10, 0);
  142. return $;
  143. }
  144. };
  145. torch.jit.mobile.serialization.ComplexDouble = class ComplexDouble {
  146. static decode(reader, position) {
  147. const $ = new torch.jit.mobile.serialization.ComplexDouble();
  148. $.real = reader.float64(position + 0);
  149. $.imag = reader.float64(position + 4);
  150. return $;
  151. }
  152. };
  153. torch.jit.mobile.serialization.EnumValue = class EnumValue {
  154. static decode(reader, position) {
  155. const $ = new torch.jit.mobile.serialization.EnumValue();
  156. $.type_name = reader.string_(position, 4, null);
  157. $.value = reader.uint32_(position, 6, 0);
  158. return $;
  159. }
  160. };
  161. torch.jit.mobile.serialization.Instruction = class Instruction {
  162. static decode(reader, position) {
  163. const $ = new torch.jit.mobile.serialization.Instruction();
  164. $.op = reader.int8(position + 0);
  165. $.n = reader.uint16(position + 2);
  166. $.x = reader.int32(position + 4);
  167. return $;
  168. }
  169. };
  170. torch.jit.mobile.serialization.Operator = class Operator {
  171. static decode(reader, position) {
  172. const $ = new torch.jit.mobile.serialization.Operator();
  173. $.name = reader.string_(position, 4, null);
  174. $.overload_name = reader.string_(position, 6, null);
  175. $.num_args_serialized = reader.int32_(position, 8, -1);
  176. return $;
  177. }
  178. };
  179. torch.jit.mobile.serialization.Arg = class Arg {
  180. static decode(reader, position) {
  181. const $ = new torch.jit.mobile.serialization.Arg();
  182. $.name = reader.string_(position, 4, null);
  183. $.type = reader.string_(position, 6, null);
  184. $.default_value = reader.uint32_(position, 8, 0);
  185. return $;
  186. }
  187. };
  188. torch.jit.mobile.serialization.Schema = class Schema {
  189. static decode(reader, position) {
  190. const $ = new torch.jit.mobile.serialization.Schema();
  191. $.arguments = reader.tables(position, 4, torch.jit.mobile.serialization.Arg);
  192. $.returns = reader.tables(position, 6, torch.jit.mobile.serialization.Arg);
  193. return $;
  194. }
  195. };
  196. torch.jit.mobile.serialization.DebugInfo = class DebugInfo {
  197. static decode(reader, position) {
  198. const $ = new torch.jit.mobile.serialization.DebugInfo();
  199. $.debug_handle = reader.int64s_(position, 4);
  200. return $;
  201. }
  202. };
  203. torch.jit.mobile.serialization.Function = class Function {
  204. static decode(reader, position) {
  205. const $ = new torch.jit.mobile.serialization.Function();
  206. $.qn = reader.string_(position, 4, null);
  207. $.instructions = reader.structs(position, 6, torch.jit.mobile.serialization.Instruction);
  208. $.operators = reader.tables(position, 8, torch.jit.mobile.serialization.Operator);
  209. $.constants = reader.array(position, 10, Uint32Array);
  210. $.type_annotations = reader.strings_(position, 12);
  211. $.register_size = reader.int32_(position, 14, 0);
  212. $.schema = reader.table(position, 16, torch.jit.mobile.serialization.Schema);
  213. $.debug_info = reader.table(position, 18, torch.jit.mobile.serialization.DebugInfo);
  214. $.class_type = reader.uint32_(position, 20, 0);
  215. return $;
  216. }
  217. };
  218. torch.jit.mobile.serialization.StorageData = class StorageData {
  219. static decode(reader, position) {
  220. const $ = new torch.jit.mobile.serialization.StorageData();
  221. $.data = reader.array(position, 4, Uint8Array);
  222. return $;
  223. }
  224. };
  225. torch.jit.mobile.serialization.IValueUnion = class {
  226. static decode(reader, position, type) {
  227. switch (type) {
  228. case 1: return torch.jit.mobile.serialization.Int.decode(reader, position);
  229. case 2: return torch.jit.mobile.serialization.Bool.decode(reader, position);
  230. case 3: return torch.jit.mobile.serialization.Double.decode(reader, position);
  231. case 4: return torch.jit.mobile.serialization.ComplexDouble.decode(reader, position);
  232. case 5: return torch.jit.mobile.serialization.TensorMetadata.decode(reader, position);
  233. case 6: return torch.jit.mobile.serialization.String.decode(reader, position);
  234. case 7: return torch.jit.mobile.serialization.List.decode(reader, position);
  235. case 8: return torch.jit.mobile.serialization.Tuple.decode(reader, position);
  236. case 9: return torch.jit.mobile.serialization.Dict.decode(reader, position);
  237. case 10: return torch.jit.mobile.serialization.Object.decode(reader, position);
  238. case 11: return torch.jit.mobile.serialization.IntList.decode(reader, position);
  239. case 12: return torch.jit.mobile.serialization.DoubleList.decode(reader, position);
  240. case 13: return torch.jit.mobile.serialization.BoolList.decode(reader, position);
  241. case 14: return torch.jit.mobile.serialization.Device.decode(reader, position);
  242. case 15: return torch.jit.mobile.serialization.EnumValue.decode(reader, position);
  243. case 16: return torch.jit.mobile.serialization.Function.decode(reader, position);
  244. default: return undefined;
  245. }
  246. }
  247. };
  248. torch.jit.mobile.serialization.IValue = class IValue {
  249. static decode(reader, position) {
  250. const $ = new torch.jit.mobile.serialization.IValue();
  251. $.val = reader.union(position, 4, torch.jit.mobile.serialization.IValueUnion);
  252. return $;
  253. }
  254. };
  255. torch.jit.mobile.serialization.ExtraFile = class ExtraFile {
  256. static decode(reader, position) {
  257. const $ = new torch.jit.mobile.serialization.ExtraFile();
  258. $.name = reader.string_(position, 4, null);
  259. $.content = reader.string_(position, 6, null);
  260. return $;
  261. }
  262. };
  263. torch.jit.mobile.serialization.Module = class Module {
  264. static identifier(reader) {
  265. return reader.identifier === 'PTMF';
  266. }
  267. static create(reader) {
  268. return torch.jit.mobile.serialization.Module.decode(reader, reader.root);
  269. }
  270. static decode(reader, position) {
  271. const $ = new torch.jit.mobile.serialization.Module();
  272. $.bytecode_version = reader.uint32_(position, 4, 0);
  273. $.extra_files = reader.tables(position, 6, torch.jit.mobile.serialization.ExtraFile);
  274. $.methods = reader.array(position, 8, Uint32Array);
  275. $.state_obj = reader.uint32_(position, 10, 0);
  276. $.ivalues = reader.tables(position, 12, torch.jit.mobile.serialization.IValue);
  277. $.storage_data_size = reader.int32_(position, 14, 0);
  278. $.storage_data = reader.tables(position, 16, torch.jit.mobile.serialization.StorageData);
  279. $.object_types = reader.tables(position, 18, torch.jit.mobile.serialization.ObjectType);
  280. $.jit_sources = reader.tables(position, 20, torch.jit.mobile.serialization.ExtraFile);
  281. $.jit_constants = reader.array(position, 22, Uint32Array);
  282. $.operator_version = reader.uint32_(position, 24, 0);
  283. $.mobile_ivalue_size = reader.uint32_(position, 26, 0);
  284. return $;
  285. }
  286. };
  287. executorch_flatbuffer.ScalarType = {
  288. BYTE: 0,
  289. CHAR: 1,
  290. SHORT: 2,
  291. INT: 3,
  292. LONG: 4,
  293. HALF: 5,
  294. FLOAT: 6,
  295. DOUBLE: 7,
  296. BOOL: 11,
  297. QINT8: 12,
  298. QUINT8: 13,
  299. QINT32: 14,
  300. QUINT4X2: 16,
  301. QUINT2X4: 17
  302. };
  303. executorch_flatbuffer.ContainerMetadata = class ContainerMetadata {
  304. static decode(reader, position) {
  305. const $ = new executorch_flatbuffer.ContainerMetadata();
  306. $.encoded_inp_str = reader.string_(position, 4, null);
  307. $.encoded_out_str = reader.string_(position, 6, null);
  308. return $;
  309. }
  310. };
  311. executorch_flatbuffer.Null = class Null {
  312. static decode(/* reader, position */) {
  313. const $ = new executorch_flatbuffer.Null();
  314. return $;
  315. }
  316. };
  317. executorch_flatbuffer.AllocationDetails = class AllocationDetails {
  318. static decode(reader, position) {
  319. const $ = new executorch_flatbuffer.AllocationDetails();
  320. $.memory_id = reader.uint32_(position, 4, 0);
  321. $.memory_offset_low = reader.uint32_(position, 6, 0);
  322. $.memory_offset_high = reader.uint32_(position, 8, 0);
  323. return $;
  324. }
  325. };
  326. executorch_flatbuffer.TensorShapeDynamism = {
  327. STATIC: 0,
  328. DYNAMIC_BOUND: 1,
  329. DYNAMIC_UNBOUND: 2
  330. };
  331. executorch_flatbuffer.Tensor = class Tensor {
  332. static decode(reader, position) {
  333. const $ = new executorch_flatbuffer.Tensor();
  334. $.scalar_type = reader.int8_(position, 4, 0);
  335. $.storage_offset = reader.int32_(position, 6, 0);
  336. $.sizes = reader.array(position, 8, Int32Array);
  337. $.dim_order = reader.array(position, 10, Uint8Array);
  338. $.requires_grad = reader.bool_(position, 12, false);
  339. $.constant_buffer_idx = reader.uint32_(position, 14, 0);
  340. $.allocation_info = reader.table(position, 16, executorch_flatbuffer.AllocationDetails);
  341. $.layout = reader.int8_(position, 18, 0);
  342. $.shape_dynamism = reader.int8_(position, 20, 0);
  343. return $;
  344. }
  345. };
  346. executorch_flatbuffer.Int = class Int {
  347. static decode(reader, position) {
  348. const $ = new executorch_flatbuffer.Int();
  349. $.int_val = reader.int64_(position, 4, 0n);
  350. return $;
  351. }
  352. };
  353. executorch_flatbuffer.Bool = class Bool {
  354. static decode(reader, position) {
  355. const $ = new executorch_flatbuffer.Bool();
  356. $.bool_val = reader.bool_(position, 4, false);
  357. return $;
  358. }
  359. };
  360. executorch_flatbuffer.Double = class Double {
  361. static decode(reader, position) {
  362. const $ = new executorch_flatbuffer.Double();
  363. $.double_val = reader.float64_(position, 4, 0);
  364. return $;
  365. }
  366. };
  367. executorch_flatbuffer.String = class String {
  368. static decode(reader, position) {
  369. const $ = new executorch_flatbuffer.String();
  370. $.string_val = reader.string_(position, 4, null);
  371. return $;
  372. }
  373. };
  374. executorch_flatbuffer.IntList = class IntList {
  375. static decode(reader, position) {
  376. const $ = new executorch_flatbuffer.IntList();
  377. $.items = reader.int64s_(position, 4);
  378. return $;
  379. }
  380. };
  381. executorch_flatbuffer.DoubleList = class DoubleList {
  382. static decode(reader, position) {
  383. const $ = new executorch_flatbuffer.DoubleList();
  384. $.items = reader.array(position, 4, Float64Array);
  385. return $;
  386. }
  387. };
  388. executorch_flatbuffer.BoolList = class BoolList {
  389. static decode(reader, position) {
  390. const $ = new executorch_flatbuffer.BoolList();
  391. $.items = reader.bools_(position, 4);
  392. return $;
  393. }
  394. };
  395. executorch_flatbuffer.TensorList = class TensorList {
  396. static decode(reader, position) {
  397. const $ = new executorch_flatbuffer.TensorList();
  398. $.items = reader.array(position, 4, Int32Array);
  399. return $;
  400. }
  401. };
  402. executorch_flatbuffer.OptionalTensorList = class OptionalTensorList {
  403. static decode(reader, position) {
  404. const $ = new executorch_flatbuffer.OptionalTensorList();
  405. $.items = reader.array(position, 4, Int32Array);
  406. return $;
  407. }
  408. };
  409. executorch_flatbuffer.KernelTypes = class {
  410. static decode(reader, position, type) {
  411. switch (type) {
  412. case 1: return executorch_flatbuffer.Null.decode(reader, position);
  413. case 2: return executorch_flatbuffer.Int.decode(reader, position);
  414. case 3: return executorch_flatbuffer.Bool.decode(reader, position);
  415. case 4: return executorch_flatbuffer.Double.decode(reader, position);
  416. case 5: return executorch_flatbuffer.Tensor.decode(reader, position);
  417. case 6: return executorch_flatbuffer.String.decode(reader, position);
  418. case 7: return executorch_flatbuffer.IntList.decode(reader, position);
  419. case 8: return executorch_flatbuffer.DoubleList.decode(reader, position);
  420. case 9: return executorch_flatbuffer.BoolList.decode(reader, position);
  421. case 10: return executorch_flatbuffer.TensorList.decode(reader, position);
  422. case 11: return executorch_flatbuffer.OptionalTensorList.decode(reader, position);
  423. default: return undefined;
  424. }
  425. }
  426. };
  427. executorch_flatbuffer.EValue = class EValue {
  428. static decode(reader, position) {
  429. const $ = new executorch_flatbuffer.EValue();
  430. $.val = reader.union(position, 4, executorch_flatbuffer.KernelTypes);
  431. return $;
  432. }
  433. };
  434. executorch_flatbuffer.Operator = class Operator {
  435. static decode(reader, position) {
  436. const $ = new executorch_flatbuffer.Operator();
  437. $.name = reader.string_(position, 4, null);
  438. $.overload = reader.string_(position, 6, null);
  439. return $;
  440. }
  441. };
  442. executorch_flatbuffer.KernelCall = class KernelCall {
  443. static decode(reader, position) {
  444. const $ = new executorch_flatbuffer.KernelCall();
  445. $.op_index = reader.int32_(position, 4, 0);
  446. $.args = reader.array(position, 6, Int32Array);
  447. return $;
  448. }
  449. };
  450. executorch_flatbuffer.DelegateCall = class DelegateCall {
  451. static decode(reader, position) {
  452. const $ = new executorch_flatbuffer.DelegateCall();
  453. $.delegate_index = reader.int32_(position, 4, 0);
  454. $.args = reader.array(position, 6, Int32Array);
  455. return $;
  456. }
  457. };
  458. executorch_flatbuffer.MoveCall = class MoveCall {
  459. static decode(reader, position) {
  460. const $ = new executorch_flatbuffer.MoveCall();
  461. $.move_from = reader.int32_(position, 4, 0);
  462. $.move_to = reader.int32_(position, 6, 0);
  463. return $;
  464. }
  465. };
  466. executorch_flatbuffer.JumpFalseCall = class JumpFalseCall {
  467. static decode(reader, position) {
  468. const $ = new executorch_flatbuffer.JumpFalseCall();
  469. $.cond_value_index = reader.int32_(position, 4, 0);
  470. $.destination_instruction = reader.int32_(position, 6, 0);
  471. return $;
  472. }
  473. };
  474. executorch_flatbuffer.FreeCall = class FreeCall {
  475. static decode(reader, position) {
  476. const $ = new executorch_flatbuffer.FreeCall();
  477. $.value_index = reader.int32_(position, 4, 0);
  478. return $;
  479. }
  480. };
  481. executorch_flatbuffer.InstructionArguments = class {
  482. static decode(reader, position, type) {
  483. switch (type) {
  484. case 1: return executorch_flatbuffer.KernelCall.decode(reader, position);
  485. case 2: return executorch_flatbuffer.DelegateCall.decode(reader, position);
  486. case 3: return executorch_flatbuffer.MoveCall.decode(reader, position);
  487. case 4: return executorch_flatbuffer.JumpFalseCall.decode(reader, position);
  488. case 5: return executorch_flatbuffer.FreeCall.decode(reader, position);
  489. default: return undefined;
  490. }
  491. }
  492. };
  493. executorch_flatbuffer.Instruction = class Instruction {
  494. static decode(reader, position) {
  495. const $ = new executorch_flatbuffer.Instruction();
  496. $.instr_args = reader.union(position, 4, executorch_flatbuffer.InstructionArguments);
  497. return $;
  498. }
  499. };
  500. executorch_flatbuffer.Frame = class Frame {
  501. static decode(reader, position) {
  502. const $ = new executorch_flatbuffer.Frame();
  503. $.filename = reader.string_(position, 4, null);
  504. $.lineno = reader.int32_(position, 6, 0);
  505. $.name = reader.string_(position, 8, null);
  506. $.context = reader.string_(position, 10, null);
  507. return $;
  508. }
  509. };
  510. executorch_flatbuffer.FrameList = class FrameList {
  511. static decode(reader, position) {
  512. const $ = new executorch_flatbuffer.FrameList();
  513. $.items = reader.tables(position, 4, executorch_flatbuffer.Frame);
  514. return $;
  515. }
  516. };
  517. executorch_flatbuffer.DataLocation = {
  518. INLINE: 0,
  519. SEGMENT: 1
  520. };
  521. executorch_flatbuffer.BackendDelegateDataReference = class BackendDelegateDataReference {
  522. static decode(reader, position) {
  523. const $ = new executorch_flatbuffer.BackendDelegateDataReference();
  524. $.location = reader.int8_(position, 4, 0);
  525. $.index = reader.uint32_(position, 6, 0);
  526. return $;
  527. }
  528. };
  529. executorch_flatbuffer.CompileSpec = class CompileSpec {
  530. static decode(reader, position) {
  531. const $ = new executorch_flatbuffer.CompileSpec();
  532. $.key = reader.string_(position, 4, null);
  533. $.value = reader.array(position, 6, Uint8Array);
  534. return $;
  535. }
  536. };
  537. executorch_flatbuffer.BackendDelegate = class BackendDelegate {
  538. static decode(reader, position) {
  539. const $ = new executorch_flatbuffer.BackendDelegate();
  540. $.id = reader.string_(position, 4, null);
  541. $.processed = reader.table(position, 6, executorch_flatbuffer.BackendDelegateDataReference);
  542. $.compile_specs = reader.tables(position, 8, executorch_flatbuffer.CompileSpec);
  543. return $;
  544. }
  545. };
  546. executorch_flatbuffer.Chain = class Chain {
  547. static decode(reader, position) {
  548. const $ = new executorch_flatbuffer.Chain();
  549. $.inputs = reader.array(position, 4, Int32Array);
  550. $.outputs = reader.array(position, 6, Int32Array);
  551. $.instructions = reader.tables(position, 8, executorch_flatbuffer.Instruction);
  552. $.stacktrace = reader.tables(position, 10, executorch_flatbuffer.FrameList);
  553. return $;
  554. }
  555. };
  556. executorch_flatbuffer.ExecutionPlan = class ExecutionPlan {
  557. static decode(reader, position) {
  558. const $ = new executorch_flatbuffer.ExecutionPlan();
  559. $.name = reader.string_(position, 4, null);
  560. $.container_meta_type = reader.table(position, 6, executorch_flatbuffer.ContainerMetadata);
  561. $.values = reader.tables(position, 8, executorch_flatbuffer.EValue);
  562. $.inputs = reader.array(position, 10, Int32Array);
  563. $.outputs = reader.array(position, 12, Int32Array);
  564. $.chains = reader.tables(position, 14, executorch_flatbuffer.Chain);
  565. $.operators = reader.tables(position, 16, executorch_flatbuffer.Operator);
  566. $.delegates = reader.tables(position, 18, executorch_flatbuffer.BackendDelegate);
  567. $.non_const_buffer_sizes = reader.int64s_(position, 20);
  568. return $;
  569. }
  570. };
  571. executorch_flatbuffer.Buffer = class Buffer {
  572. static decode(reader, position) {
  573. const $ = new executorch_flatbuffer.Buffer();
  574. $.storage = reader.array(position, 4, Uint8Array);
  575. return $;
  576. }
  577. };
  578. executorch_flatbuffer.BackendDelegateInlineData = class BackendDelegateInlineData {
  579. static decode(reader, position) {
  580. const $ = new executorch_flatbuffer.BackendDelegateInlineData();
  581. $.data = reader.array(position, 4, Uint8Array);
  582. return $;
  583. }
  584. };
  585. executorch_flatbuffer.DataSegment = class DataSegment {
  586. static decode(reader, position) {
  587. const $ = new executorch_flatbuffer.DataSegment();
  588. $.offset = reader.uint64_(position, 4, 0n);
  589. $.size = reader.uint64_(position, 6, 0n);
  590. return $;
  591. }
  592. };
  593. executorch_flatbuffer.SubsegmentOffsets = class SubsegmentOffsets {
  594. static decode(reader, position) {
  595. const $ = new executorch_flatbuffer.SubsegmentOffsets();
  596. $.segment_index = reader.uint32_(position, 4, 0);
  597. $.offsets = reader.uint64s_(position, 6);
  598. return $;
  599. }
  600. };
  601. executorch_flatbuffer.Program = class Program {
  602. static identifier(reader) {
  603. return reader.identifier === 'ET12';
  604. }
  605. static create(reader) {
  606. return executorch_flatbuffer.Program.decode(reader, reader.root);
  607. }
  608. static decode(reader, position) {
  609. const $ = new executorch_flatbuffer.Program();
  610. $.version = reader.uint32_(position, 4, 0);
  611. $.execution_plan = reader.tables(position, 6, executorch_flatbuffer.ExecutionPlan);
  612. $.constant_buffer = reader.tables(position, 8, executorch_flatbuffer.Buffer);
  613. $.backend_delegate_data = reader.tables(position, 10, executorch_flatbuffer.BackendDelegateInlineData);
  614. $.segments = reader.tables(position, 12, executorch_flatbuffer.DataSegment);
  615. $.constant_segment = reader.table(position, 14, executorch_flatbuffer.SubsegmentOffsets);
  616. return $;
  617. }
  618. };