dlc-schema.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. var $root = flatbuffers.get('dlc');
  2. $root.dlc = $root.dlc || {};
  3. $root.dlc.NetDef = class NetDef {
  4. static decode(reader, position) {
  5. const $ = new $root.dlc.NetDef();
  6. $.unk1 = reader.int32_(position, 4, 0);
  7. $.nodes = reader.tableArray(position, 6, $root.dlc.Node.decode);
  8. $.unk2 = reader.typedArray(position, 8, Int32Array);
  9. $.unk3 = reader.typedArray(position, 10, Int32Array);
  10. $.attributes = reader.tableArray(position, 12, $root.dlc.Attribute.decode);
  11. return $;
  12. }
  13. };
  14. $root.dlc.NetParam = class NetParam {
  15. static decode(reader, position) {
  16. const $ = new $root.dlc.NetParam();
  17. $.weights = reader.tableArray(position, 4, $root.dlc.Weights.decode);
  18. return $;
  19. }
  20. };
  21. $root.dlc.Node = class Node {
  22. static decode(reader, position) {
  23. const $ = new $root.dlc.Node();
  24. $.index = reader.int32_(position, 4, 0);
  25. $.name = reader.string_(position, 6, null);
  26. $.type = reader.string_(position, 8, null);
  27. $.inputs = reader.strings_(position, 10);
  28. $.outputs = reader.strings_(position, 12);
  29. $.attributes = reader.tableArray(position, 14, $root.dlc.Attribute.decode);
  30. return $;
  31. }
  32. };
  33. $root.dlc.Weights = class Weights {
  34. static decode(reader, position) {
  35. const $ = new $root.dlc.Weights();
  36. $.name = reader.string_(position, 4, null);
  37. $.tensors = reader.tableArray(position, 6, $root.dlc.Tensor.decode);
  38. return $;
  39. }
  40. };
  41. $root.dlc.Tensor = class Tensor {
  42. static decode(reader, position) {
  43. const $ = new $root.dlc.Tensor();
  44. $.name = reader.string_(position, 4, null);
  45. $.shape = reader.typedArray(position, 6, Int32Array);
  46. $.data = reader.table(position, 8, $root.dlc.TensorData.decode);
  47. $.attributes = reader.tableArray(position, 10, $root.dlc.Attribute.decode);
  48. return $;
  49. }
  50. };
  51. $root.dlc.TensorData = class TensorData {
  52. static decode(reader, position) {
  53. const $ = new $root.dlc.TensorData();
  54. $.data_type = reader.uint8_(position, 4, 0);
  55. $.bytes = reader.typedArray(position, 6, Uint8Array);
  56. $.floats = reader.typedArray(position, 8, Float32Array);
  57. return $;
  58. }
  59. };
  60. $root.dlc.Attribute = class Attribute {
  61. static decode(reader, position) {
  62. const $ = new $root.dlc.Attribute();
  63. $.name = reader.string_(position, 4, null);
  64. $.type = reader.uint8_(position, 6, 0);
  65. $.bool_value = reader.bool_(position, 8, false);
  66. $.int32_value = reader.int32_(position, 10, 0);
  67. $.uint32_value = reader.uint32_(position, 12, 0);
  68. $.float32_value = reader.float32_(position, 14, 0);
  69. $.string_value = reader.string_(position, 16, null);
  70. $.unk6 = reader.typedArray(position, 18, Int8Array);
  71. $.byte_list = reader.typedArray(position, 20, Int8Array);
  72. $.int32_list = reader.typedArray(position, 22, Int32Array);
  73. $.float32_list = reader.typedArray(position, 24, Float32Array);
  74. $.unk10 = reader.typedArray(position, 26, Int8Array);
  75. $.attributes = reader.tableArray(position, 28, $root.dlc.Attribute.decode);
  76. return $;
  77. }
  78. };
  79. $root.dlc.Activation = {
  80. ReLU: 1,
  81. Sigmoid: 3
  82. };