mnn-schema.js 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046
  1. var $root = flatbuffers.get('mnn');
  2. $root.MNN = $root.MNN || {};
  3. $root.MNN.NetSource = {
  4. CAFFE: 0,
  5. TENSORFLOW: 1,
  6. TFLITE: 2,
  7. ONNX: 3,
  8. TORCH: 4
  9. };
  10. $root.MNN.DataType = {
  11. DT_INVALID: 0,
  12. DT_FLOAT: 1,
  13. DT_DOUBLE: 2,
  14. DT_INT32: 3,
  15. DT_UINT8: 4,
  16. DT_INT16: 5,
  17. DT_INT8: 6,
  18. DT_STRING: 7,
  19. DT_COMPLEX64: 8,
  20. DT_INT64: 9,
  21. DT_BOOL: 10,
  22. DT_QINT8: 11,
  23. DT_QUINT8: 12,
  24. DT_QINT32: 13,
  25. DT_BFLOAT16: 14,
  26. DT_QINT16: 15,
  27. DT_QUINT16: 16,
  28. DT_UINT16: 17,
  29. DT_COMPLEX128: 18,
  30. DT_HALF: 19,
  31. DT_RESOURCE: 20,
  32. DT_VARIANT: 21
  33. };
  34. $root.MNN.MNN_DATA_FORMAT = {
  35. NCHW: 0,
  36. NHWC: 1,
  37. NC4HW4: 2,
  38. NHWC4: 3,
  39. UNKNOWN: 4
  40. };
  41. $root.MNN.Blob = class Blob {
  42. static decode(reader, position) {
  43. const $ = new $root.MNN.Blob();
  44. $.dims = reader.typedArray(position, 4, Int32Array);
  45. $.dataFormat = reader.int8_(position, 6, 0);
  46. $.dataType = reader.int32_(position, 8, 1);
  47. $.uint8s = reader.typedArray(position, 10, Uint8Array);
  48. $.int8s = reader.typedArray(position, 12, Int8Array);
  49. $.int32s = reader.typedArray(position, 14, Int32Array);
  50. $.int64s = reader.int64s_(position, 16);
  51. $.float32s = reader.typedArray(position, 18, Float32Array);
  52. $.strings = reader.strings_(position, 20);
  53. return $;
  54. }
  55. };
  56. $root.MNN.ListValue = class ListValue {
  57. static decode(reader, position) {
  58. const $ = new $root.MNN.ListValue();
  59. $.s = reader.strings_(position, 4);
  60. $.i = reader.typedArray(position, 6, Int32Array);
  61. $.f = reader.typedArray(position, 8, Float32Array);
  62. $.b = reader.bools_(position, 10);
  63. $.type = reader.typedArray(position, 12, Int32Array);
  64. return $;
  65. }
  66. };
  67. $root.MNN.Attribute = class Attribute {
  68. static decode(reader, position) {
  69. const $ = new $root.MNN.Attribute();
  70. $.s = reader.string_(position, 4, null);
  71. $.i = reader.int32_(position, 6, 0);
  72. $.b = reader.bool_(position, 8, false);
  73. $.key = reader.string_(position, 10, null);
  74. $.type = reader.int32_(position, 12, 0);
  75. $.f = reader.float32_(position, 14, 0);
  76. $.tensor = reader.table(position, 16, $root.MNN.Blob.decode);
  77. $.list = reader.table(position, 18, $root.MNN.ListValue.decode);
  78. $.func = reader.table(position, 20, $root.MNN.NamedAttrList.decode);
  79. return $;
  80. }
  81. };
  82. $root.MNN.NamedAttrList = class NamedAttrList {
  83. static decode(reader, position) {
  84. const $ = new $root.MNN.NamedAttrList();
  85. $.name = reader.string_(position, 4, null);
  86. $.attr = reader.tableArray(position, 6, $root.MNN.Attribute.decode);
  87. return $;
  88. }
  89. };
  90. $root.MNN.PadMode = {
  91. CAFFE: 0,
  92. VALID: 1,
  93. SAME: 2
  94. };
  95. $root.MNN.Convolution2DCommon = class Convolution2DCommon {
  96. static decode(reader, position) {
  97. const $ = new $root.MNN.Convolution2DCommon();
  98. $.padX = reader.int32_(position, 4, 0);
  99. $.padY = reader.int32_(position, 6, 0);
  100. $.kernelX = reader.int32_(position, 8, 1);
  101. $.kernelY = reader.int32_(position, 10, 1);
  102. $.strideX = reader.int32_(position, 12, 1);
  103. $.strideY = reader.int32_(position, 14, 1);
  104. $.dilateX = reader.int32_(position, 16, 1);
  105. $.dilateY = reader.int32_(position, 18, 1);
  106. $.padMode = reader.int8_(position, 20, 0);
  107. $.group = reader.int32_(position, 22, 1);
  108. $.outputCount = reader.int32_(position, 24, 0);
  109. $.inputCount = reader.int32_(position, 26, 0);
  110. $.relu = reader.bool_(position, 28, false);
  111. $.relu6 = reader.bool_(position, 30, false);
  112. $.pads = reader.typedArray(position, 32, Int32Array);
  113. $.outPads = reader.typedArray(position, 34, Int32Array);
  114. $.hasOutputShape = reader.bool_(position, 36, false);
  115. return $;
  116. }
  117. };
  118. $root.MNN.Convolution3DCommon = class Convolution3DCommon {
  119. static decode(reader, position) {
  120. const $ = new $root.MNN.Convolution3DCommon();
  121. $.dilates = reader.typedArray(position, 4, Int32Array);
  122. $.strides = reader.typedArray(position, 6, Int32Array);
  123. $.kernels = reader.typedArray(position, 8, Int32Array);
  124. $.pads = reader.typedArray(position, 10, Int32Array);
  125. $.padMode = reader.int8_(position, 12, 0);
  126. $.inputCount = reader.int32_(position, 14, 0);
  127. $.outputCount = reader.int32_(position, 16, 0);
  128. $.relu = reader.bool_(position, 18, false);
  129. $.relu6 = reader.bool_(position, 20, false);
  130. $.group = reader.int32_(position, 22, 1);
  131. return $;
  132. }
  133. };
  134. $root.MNN.SparseAlgo = {
  135. RANDOM: 0,
  136. SIMD_OC: 1
  137. };
  138. $root.MNN.SparseCommon = class SparseCommon {
  139. static decode(reader, position) {
  140. const $ = new $root.MNN.SparseCommon();
  141. $.method = reader.int8_(position, 4, 0);
  142. $.args = reader.tableArray(position, 6, $root.MNN.Attribute.decode);
  143. return $;
  144. }
  145. };
  146. $root.MNN.IDSTQuan = class IDSTQuan {
  147. static decode(reader, position) {
  148. const $ = new $root.MNN.IDSTQuan();
  149. $.buffer = reader.typedArray(position, 4, Int8Array);
  150. $.alpha = reader.typedArray(position, 6, Float32Array);
  151. $.type = reader.int32_(position, 8, 0);
  152. $.useInt32 = reader.bool_(position, 10, false);
  153. $.quantScale = reader.float32_(position, 12, 0);
  154. $.scaleIn = reader.float32_(position, 14, 0);
  155. $.scaleOut = reader.float32_(position, 16, 0);
  156. $.aMax = reader.int32_(position, 18, 0);
  157. $.aMin = reader.int32_(position, 20, 0);
  158. $.readType = reader.int32_(position, 22, 0);
  159. $.has_scaleInt = reader.bool_(position, 24, false);
  160. return $;
  161. }
  162. };
  163. $root.MNN.QuantizeAlgo = {
  164. DEFAULT: 0,
  165. OVERFLOW_AWARE: 1,
  166. WINOGRAD_AWARE: 2
  167. };
  168. $root.MNN.QuantizedFloatParam = class QuantizedFloatParam {
  169. static decode(reader, position) {
  170. const $ = new $root.MNN.QuantizedFloatParam();
  171. $.weight = reader.typedArray(position, 4, Int8Array);
  172. $.bias = reader.typedArray(position, 6, Int32Array);
  173. $.scale = reader.typedArray(position, 8, Float32Array);
  174. $.tensorScale = reader.typedArray(position, 10, Float32Array);
  175. $.method = reader.int8_(position, 12, 0);
  176. $.nbits = reader.int32_(position, 14, 8);
  177. $.zeroPoint = reader.int8_(position, 16, 0);
  178. $.outputZeroPoint = reader.int8_(position, 18, 0);
  179. $.clampMin = reader.int8_(position, 20, -128);
  180. $.clampMax = reader.int8_(position, 22, 127);
  181. $.winogradAttr = reader.typedArray(position, 24, Int32Array);
  182. return $;
  183. }
  184. };
  185. $root.MNN.Convolution2D = class Convolution2D {
  186. static decode(reader, position) {
  187. const $ = new $root.MNN.Convolution2D();
  188. $.common = reader.table(position, 4, $root.MNN.Convolution2DCommon.decode);
  189. $.weight = reader.typedArray(position, 6, Float32Array);
  190. $.bias = reader.typedArray(position, 8, Float32Array);
  191. $.quanParameter = reader.table(position, 10, $root.MNN.IDSTQuan.decode);
  192. $.symmetricQuan = reader.table(position, 12, $root.MNN.QuantizedFloatParam.decode);
  193. $.sparseParameter = reader.table(position, 14, $root.MNN.SparseCommon.decode);
  194. return $;
  195. }
  196. };
  197. $root.MNN.Convolution3D = class Convolution3D {
  198. static decode(reader, position) {
  199. const $ = new $root.MNN.Convolution3D();
  200. $.common = reader.table(position, 4, $root.MNN.Convolution3DCommon.decode);
  201. $.weight = reader.typedArray(position, 6, Float32Array);
  202. $.bias = reader.typedArray(position, 8, Float32Array);
  203. return $;
  204. }
  205. };
  206. $root.MNN.InnerProduct = class InnerProduct {
  207. static decode(reader, position) {
  208. const $ = new $root.MNN.InnerProduct();
  209. $.outputCount = reader.int32_(position, 4, 0);
  210. $.biasTerm = reader.int32_(position, 6, 0);
  211. $.weightSize = reader.int32_(position, 8, 0);
  212. $.weight = reader.typedArray(position, 10, Float32Array);
  213. $.bias = reader.typedArray(position, 12, Float32Array);
  214. $.axis = reader.int32_(position, 14, 0);
  215. $.transpose = reader.bool_(position, 16, false);
  216. $.quanParameter = reader.table(position, 18, $root.MNN.IDSTQuan.decode);
  217. return $;
  218. }
  219. };
  220. $root.MNN.PoolType = {
  221. MAXPOOL: 0,
  222. AVEPOOL: 1
  223. };
  224. $root.MNN.PoolPadType = {
  225. CAFFE: 0,
  226. VALID: 1,
  227. SAME: 2
  228. };
  229. $root.MNN.AvgPoolCountType = {
  230. DEFAULT: 0,
  231. INCLUDE_PADDING: 1,
  232. EXCLUDE_PADDING: 2
  233. };
  234. $root.MNN.Pool = class Pool {
  235. static decode(reader, position) {
  236. const $ = new $root.MNN.Pool();
  237. $.padX = reader.int32_(position, 4, 0);
  238. $.padY = reader.int32_(position, 6, 0);
  239. $.isGlobal = reader.bool_(position, 8, false);
  240. $.kernelX = reader.int32_(position, 10, 0);
  241. $.kernelY = reader.int32_(position, 12, 0);
  242. $.strideX = reader.int32_(position, 14, 0);
  243. $.strideY = reader.int32_(position, 16, 0);
  244. $.type = reader.int8_(position, 18, 0);
  245. $.padType = reader.int8_(position, 20, 0);
  246. $.dataType = reader.int32_(position, 22, 1);
  247. $.ceilModel = reader.bool_(position, 24, true);
  248. $.pads = reader.typedArray(position, 26, Int32Array);
  249. $.countType = reader.int8_(position, 28, 0);
  250. return $;
  251. }
  252. };
  253. $root.MNN.Pool3D = class Pool3D {
  254. static decode(reader, position) {
  255. const $ = new $root.MNN.Pool3D();
  256. $.strides = reader.typedArray(position, 4, Int32Array);
  257. $.kernels = reader.typedArray(position, 6, Int32Array);
  258. $.pads = reader.typedArray(position, 8, Int32Array);
  259. $.type = reader.int8_(position, 10, 0);
  260. $.padType = reader.int8_(position, 12, 0);
  261. $.isGlobal = reader.bool_(position, 14, false);
  262. return $;
  263. }
  264. };
  265. $root.MNN.Relu = class Relu {
  266. static decode(reader, position) {
  267. const $ = new $root.MNN.Relu();
  268. $.slope = reader.float32_(position, 4, 0);
  269. return $;
  270. }
  271. };
  272. $root.MNN.Relu6 = class Relu6 {
  273. static decode(reader, position) {
  274. const $ = new $root.MNN.Relu6();
  275. $.minValue = reader.float32_(position, 4, 0);
  276. $.maxValue = reader.float32_(position, 6, 6);
  277. return $;
  278. }
  279. };
  280. $root.MNN.PRelu = class PRelu {
  281. static decode(reader, position) {
  282. const $ = new $root.MNN.PRelu();
  283. $.slopeCount = reader.int32_(position, 4, 0);
  284. $.slope = reader.typedArray(position, 6, Float32Array);
  285. return $;
  286. }
  287. };
  288. $root.MNN.ELU = class ELU {
  289. static decode(reader, position) {
  290. const $ = new $root.MNN.ELU();
  291. $.alpha = reader.float32_(position, 4, 0);
  292. return $;
  293. }
  294. };
  295. $root.MNN.LRN = class LRN {
  296. static decode(reader, position) {
  297. const $ = new $root.MNN.LRN();
  298. $.regionType = reader.int32_(position, 4, 0);
  299. $.localSize = reader.int32_(position, 6, 0);
  300. $.alpha = reader.float32_(position, 8, 0);
  301. $.beta = reader.float32_(position, 10, 0);
  302. $.bias = reader.float32_(position, 12, 1);
  303. return $;
  304. }
  305. };
  306. $root.MNN.ArgMax = class ArgMax {
  307. static decode(reader, position) {
  308. const $ = new $root.MNN.ArgMax();
  309. $.outMaxVal = reader.int32_(position, 4, 0);
  310. $.topK = reader.int32_(position, 6, 0);
  311. $.axis = reader.int32_(position, 8, 0);
  312. $.softmaxThreshold = reader.int32_(position, 10, 0);
  313. return $;
  314. }
  315. };
  316. $root.MNN.Axis = class Axis {
  317. static decode(reader, position) {
  318. const $ = new $root.MNN.Axis();
  319. $.axis = reader.int32_(position, 4, 0);
  320. return $;
  321. }
  322. };
  323. $root.MNN.Input = class Input {
  324. static decode(reader, position) {
  325. const $ = new $root.MNN.Input();
  326. $.dims = reader.typedArray(position, 4, Int32Array);
  327. $.dtype = reader.int32_(position, 6, 1);
  328. $.dformat = reader.int8_(position, 8, 2);
  329. return $;
  330. }
  331. };
  332. $root.MNN.LSTM = class LSTM {
  333. static decode(reader, position) {
  334. const $ = new $root.MNN.LSTM();
  335. $.outputCount = reader.int32_(position, 4, 0);
  336. $.weightSize = reader.int32_(position, 6, 0);
  337. $.clippingThreshold = reader.float32_(position, 8, 0);
  338. $.weightI = reader.table(position, 10, $root.MNN.Blob.decode);
  339. $.weightH = reader.table(position, 12, $root.MNN.Blob.decode);
  340. $.bias = reader.table(position, 14, $root.MNN.Blob.decode);
  341. $.weightIQ = reader.table(position, 16, $root.MNN.Blob.decode);
  342. $.weightIA = reader.table(position, 18, $root.MNN.Blob.decode);
  343. $.quantScale = reader.float32_(position, 20, 0);
  344. return $;
  345. }
  346. };
  347. $root.MNN.Slice = class Slice {
  348. static decode(reader, position) {
  349. const $ = new $root.MNN.Slice();
  350. $.axis = reader.int32_(position, 4, 0);
  351. $.slicePoints = reader.typedArray(position, 6, Int32Array);
  352. $.sourceType = reader.int8_(position, 8, 0);
  353. return $;
  354. }
  355. };
  356. $root.MNN.BatchNorm = class BatchNorm {
  357. static decode(reader, position) {
  358. const $ = new $root.MNN.BatchNorm();
  359. $.channels = reader.int32_(position, 4, 0);
  360. $.slopeData = reader.typedArray(position, 6, Float32Array);
  361. $.meanData = reader.typedArray(position, 8, Float32Array);
  362. $.varData = reader.typedArray(position, 10, Float32Array);
  363. $.biasData = reader.typedArray(position, 12, Float32Array);
  364. $.Adata = reader.typedArray(position, 14, Float32Array);
  365. $.Bdata = reader.typedArray(position, 16, Float32Array);
  366. $.epsilon = reader.float32_(position, 18, 0.001);
  367. return $;
  368. }
  369. };
  370. $root.MNN.Scale = class Scale {
  371. static decode(reader, position) {
  372. const $ = new $root.MNN.Scale();
  373. $.channels = reader.int32_(position, 4, 0);
  374. $.scaleData = reader.typedArray(position, 6, Float32Array);
  375. $.biasData = reader.typedArray(position, 8, Float32Array);
  376. return $;
  377. }
  378. };
  379. $root.MNN.EltwiseType = {
  380. PROD: 0,
  381. SUM: 1,
  382. MAXIMUM: 2,
  383. SUB: 3
  384. };
  385. $root.MNN.Eltwise = class Eltwise {
  386. static decode(reader, position) {
  387. const $ = new $root.MNN.Eltwise();
  388. $.type = reader.int8_(position, 4, 0);
  389. $.coeff = reader.typedArray(position, 6, Float32Array);
  390. return $;
  391. }
  392. };
  393. $root.MNN.Flatten = class Flatten {
  394. static decode(reader, position) {
  395. const $ = new $root.MNN.Flatten();
  396. $.axis = reader.int32_(position, 4, 0);
  397. $.endAxis = reader.int32_(position, 6, 0);
  398. return $;
  399. }
  400. };
  401. $root.MNN.Permute = class Permute {
  402. static decode(reader, position) {
  403. const $ = new $root.MNN.Permute();
  404. $.dims = reader.typedArray(position, 4, Int32Array);
  405. return $;
  406. }
  407. };
  408. $root.MNN.Reshape = class Reshape {
  409. static decode(reader, position) {
  410. const $ = new $root.MNN.Reshape();
  411. $.dims = reader.typedArray(position, 4, Int32Array);
  412. $.dimType = reader.int8_(position, 6, 0);
  413. return $;
  414. }
  415. };
  416. $root.MNN.DetectionOutput = class DetectionOutput {
  417. static decode(reader, position) {
  418. const $ = new $root.MNN.DetectionOutput();
  419. $.classCount = reader.int32_(position, 4, 0);
  420. $.nmsThresholdold = reader.float32_(position, 6, 0);
  421. $.nmsTopK = reader.int32_(position, 8, 0);
  422. $.keepTopK = reader.int32_(position, 10, 0);
  423. $.confidenceThreshold = reader.float32_(position, 12, 0);
  424. $.shareLocation = reader.int32_(position, 14, 0);
  425. $.backgroundLable = reader.int32_(position, 16, 0);
  426. $.varianceEncodedTarget = reader.int32_(position, 18, 0);
  427. $.codeType = reader.int32_(position, 20, 0);
  428. $.objectnessScore = reader.float32_(position, 22, 0.01);
  429. return $;
  430. }
  431. };
  432. $root.MNN.RoiParameters = class RoiParameters {
  433. static decode(reader, position) {
  434. const $ = new $root.MNN.RoiParameters();
  435. $.pooledWidth = reader.int32_(position, 4, 0);
  436. $.pooledHeight = reader.int32_(position, 6, 0);
  437. $.spatialScale = reader.float32_(position, 8, 0);
  438. $.samplingRatio = reader.int32_(position, 10, -1);
  439. $.aligned = reader.bool_(position, 12, false);
  440. $.poolType = reader.int8_(position, 14, 1);
  441. return $;
  442. }
  443. };
  444. $root.MNN.Proposal = class Proposal {
  445. static decode(reader, position) {
  446. const $ = new $root.MNN.Proposal();
  447. $.featStride = reader.int32_(position, 4, 0);
  448. $.baseSize = reader.int32_(position, 6, 0);
  449. $.preNmsTopN = reader.int32_(position, 8, 0);
  450. $.afterNmsTopN = reader.int32_(position, 10, 0);
  451. $.nmsThreshold = reader.float32_(position, 12, 0);
  452. $.minSize = reader.int32_(position, 14, 0);
  453. $.ratios = reader.table(position, 16, $root.MNN.Blob.decode);
  454. $.scales = reader.table(position, 18, $root.MNN.Blob.decode);
  455. $.anchors = reader.table(position, 20, $root.MNN.Blob.decode);
  456. return $;
  457. }
  458. };
  459. $root.MNN.CoordinateTransformationMode = {
  460. NotSet: 0,
  461. AlignCorners: 1,
  462. HalfPixels: 2,
  463. PytorchHalfPixels: 3,
  464. Asymmetric: 4,
  465. TensorflowHalfPixels: 5,
  466. TensorflowCropAndResize: 6
  467. };
  468. $root.MNN.Interp = class Interp {
  469. static decode(reader, position) {
  470. const $ = new $root.MNN.Interp();
  471. $.widthScale = reader.float32_(position, 4, 0);
  472. $.heightScale = reader.float32_(position, 6, 0);
  473. $.outputWidth = reader.int32_(position, 8, 0);
  474. $.outputHeight = reader.int32_(position, 10, 0);
  475. $.resizeType = reader.int32_(position, 12, 0);
  476. $.alignCorners = reader.bool_(position, 14, false);
  477. $.halfPixelCenters = reader.bool_(position, 16, false);
  478. $.widthOffset = reader.float32_(position, 18, 0);
  479. $.heightOffset = reader.float32_(position, 20, 0);
  480. $.cubicCoeffA = reader.float32_(position, 22, -0.75);
  481. $.ctm = reader.int8_(position, 24, 0);
  482. return $;
  483. }
  484. };
  485. $root.MNN.Resize = class Resize {
  486. static decode(reader, position) {
  487. const $ = new $root.MNN.Resize();
  488. $.xScale = reader.float32_(position, 4, 0);
  489. $.yScale = reader.float32_(position, 6, 0);
  490. return $;
  491. }
  492. };
  493. $root.MNN.PriorBox = class PriorBox {
  494. static decode(reader, position) {
  495. const $ = new $root.MNN.PriorBox();
  496. $.minSizes = reader.typedArray(position, 4, Float32Array);
  497. $.maxSizes = reader.typedArray(position, 6, Float32Array);
  498. $.aspectRatios = reader.typedArray(position, 8, Float32Array);
  499. $.variances = reader.typedArray(position, 10, Float32Array);
  500. $.flip = reader.bool_(position, 12, false);
  501. $.clip = reader.bool_(position, 14, false);
  502. $.imageWidth = reader.int32_(position, 16, 0);
  503. $.imageHeight = reader.int32_(position, 18, 0);
  504. $.stepWidth = reader.int32_(position, 20, 0);
  505. $.stepHeight = reader.int32_(position, 22, 0);
  506. $.offset = reader.float32_(position, 24, 0);
  507. return $;
  508. }
  509. };
  510. $root.MNN.Normalize = class Normalize {
  511. static decode(reader, position) {
  512. const $ = new $root.MNN.Normalize();
  513. $.acrossSpatial = reader.int32_(position, 4, 0);
  514. $.channelShared = reader.int32_(position, 6, 0);
  515. $.eps = reader.float32_(position, 8, 0);
  516. $.scale = reader.typedArray(position, 10, Float32Array);
  517. return $;
  518. }
  519. };
  520. $root.MNN.EltwiseInt8 = class EltwiseInt8 {
  521. static decode(reader, position) {
  522. const $ = new $root.MNN.EltwiseInt8();
  523. $.type = reader.int8_(position, 4, 0);
  524. $.inputQuan0 = reader.table(position, 6, $root.MNN.QuantizedFloatParam.decode);
  525. $.inputQuan1 = reader.table(position, 8, $root.MNN.QuantizedFloatParam.decode);
  526. $.outputQuan = reader.table(position, 10, $root.MNN.QuantizedFloatParam.decode);
  527. return $;
  528. }
  529. };
  530. $root.MNN.CumSum = class CumSum {
  531. static decode(reader, position) {
  532. const $ = new $root.MNN.CumSum();
  533. $.exclusive = reader.bool_(position, 4, false);
  534. $.reverse = reader.bool_(position, 6, false);
  535. return $;
  536. }
  537. };
  538. $root.MNN.BinaryOpOperation = {
  539. ADD: 0,
  540. SUB: 1,
  541. MUL: 2,
  542. DIV: 3,
  543. MAX_TEMP: 4,
  544. MIN_TEMP: 5,
  545. POW: 6,
  546. REALDIV: 7,
  547. MINIMUM: 8,
  548. MAXIMUM: 9,
  549. GREATER: 10,
  550. GREATER_EQUAL: 11,
  551. LESS: 12,
  552. FLOORDIV: 13,
  553. SquaredDifference: 14,
  554. EQUAL: 15,
  555. LESS_EQUAL: 16,
  556. FLOORMOD: 17,
  557. MOD: 19,
  558. ATAN2: 20,
  559. LOGICALOR: 21,
  560. NOTEQUAL: 22,
  561. BITWISE_AND: 23,
  562. BITWISE_OR: 24,
  563. BITWISE_XOR: 25,
  564. LOGICALXOR: 26,
  565. LEFTSHIFT: 27,
  566. RIGHTSHIFT: 28
  567. };
  568. $root.MNN.BinaryOp = class BinaryOp {
  569. static decode(reader, position) {
  570. const $ = new $root.MNN.BinaryOp();
  571. $.opType = reader.int32_(position, 4, 0);
  572. $.T = reader.int32_(position, 6, 1);
  573. return $;
  574. }
  575. };
  576. $root.MNN.PackParam = class PackParam {
  577. static decode(reader, position) {
  578. const $ = new $root.MNN.PackParam();
  579. $.dataType = reader.int32_(position, 4, 0);
  580. $.axis = reader.int32_(position, 6, 0);
  581. return $;
  582. }
  583. };
  584. $root.MNN.StridedSliceParam = class StridedSliceParam {
  585. static decode(reader, position) {
  586. const $ = new $root.MNN.StridedSliceParam();
  587. $.Index = reader.int32_(position, 4, 0);
  588. $.T = reader.int32_(position, 6, 0);
  589. $.beginMask = reader.int32_(position, 8, 0);
  590. $.endMask = reader.int32_(position, 10, 0);
  591. $.ellipsisMask = reader.int32_(position, 12, 0);
  592. $.newAxisMask = reader.int32_(position, 14, 0);
  593. $.shrinkAxisMask = reader.int32_(position, 16, 0);
  594. return $;
  595. }
  596. };
  597. $root.MNN.SqueezeParam = class SqueezeParam {
  598. static decode(reader, position) {
  599. const $ = new $root.MNN.SqueezeParam();
  600. $.squeezeDims = reader.typedArray(position, 4, Int32Array);
  601. return $;
  602. }
  603. };
  604. $root.MNN.CastParam = class CastParam {
  605. static decode(reader, position) {
  606. const $ = new $root.MNN.CastParam();
  607. $.srcT = reader.int32_(position, 4, 0);
  608. $.dstT = reader.int32_(position, 6, 0);
  609. return $;
  610. }
  611. };
  612. $root.MNN.ReductionType = {
  613. SUM: 0,
  614. ASUM: 1,
  615. SUMSQ: 2,
  616. MEAN: 3,
  617. MAXIMUM: 4,
  618. MINIMUM: 5,
  619. PROD: 6,
  620. ANY: 7,
  621. ALL: 8
  622. };
  623. $root.MNN.ReductionParam = class ReductionParam {
  624. static decode(reader, position) {
  625. const $ = new $root.MNN.ReductionParam();
  626. $.operation = reader.int8_(position, 4, 0);
  627. $.dim = reader.typedArray(position, 6, Int32Array);
  628. $.coeff = reader.float32_(position, 8, 0);
  629. $.keepDims = reader.bool_(position, 10, false);
  630. $.dType = reader.int32_(position, 12, 1);
  631. return $;
  632. }
  633. };
  634. $root.MNN.Gather = class Gather {
  635. static decode(reader, position) {
  636. const $ = new $root.MNN.Gather();
  637. $.Tindices = reader.int32_(position, 4, 0);
  638. $.Tparams = reader.int32_(position, 6, 0);
  639. $.validateIndices = reader.bool_(position, 8, false);
  640. $.axis = reader.int32_(position, 10, 0);
  641. return $;
  642. }
  643. };
  644. $root.MNN.ExpandDims = class ExpandDims {
  645. static decode(reader, position) {
  646. const $ = new $root.MNN.ExpandDims();
  647. $.T = reader.int32_(position, 4, 0);
  648. $.Tdim = reader.int32_(position, 6, 0);
  649. $.axis = reader.int32_(position, 8, 0);
  650. return $;
  651. }
  652. };
  653. $root.MNN.Selu = class Selu {
  654. static decode(reader, position) {
  655. const $ = new $root.MNN.Selu();
  656. $.scale = reader.float32_(position, 4, 0);
  657. $.alpha = reader.float32_(position, 6, 0);
  658. return $;
  659. }
  660. };
  661. $root.MNN.AsString = class AsString {
  662. static decode(reader, position) {
  663. const $ = new $root.MNN.AsString();
  664. $.T = reader.int32_(position, 4, 0);
  665. $.precision = reader.int32_(position, 6, 0);
  666. $.scientific = reader.bool_(position, 8, false);
  667. $.shortest = reader.bool_(position, 10, false);
  668. $.width = reader.int32_(position, 12, 0);
  669. $.fillString = reader.string_(position, 14, null);
  670. return $;
  671. }
  672. };
  673. $root.MNN.ReduceJoin = class ReduceJoin {
  674. static decode(reader, position) {
  675. const $ = new $root.MNN.ReduceJoin();
  676. $.keepDims = reader.bool_(position, 4, false);
  677. $.separator = reader.string_(position, 6, null);
  678. return $;
  679. }
  680. };
  681. $root.MNN.UnaryOpOperation = {
  682. ABS: 0,
  683. NEG: 1,
  684. FLOOR: 2,
  685. CEIL: 3,
  686. SQUARE: 4,
  687. SQRT: 5,
  688. RSQRT: 6,
  689. EXP: 7,
  690. LOG: 8,
  691. SIN: 9,
  692. COS: 10,
  693. TAN: 11,
  694. ASIN: 12,
  695. ACOS: 13,
  696. ATAN: 14,
  697. RECIPROCAL: 15,
  698. LOG1P: 16,
  699. BNLL: 17,
  700. ACOSH: 18,
  701. SINH: 19,
  702. ASINH: 20,
  703. ATANH: 21,
  704. SIGN: 22,
  705. ROUND: 23,
  706. COSH: 24,
  707. ERF: 25,
  708. ERFC: 26,
  709. ERFINV: 27,
  710. EXPM1: 28,
  711. SIGMOID: 29,
  712. TANH: 30,
  713. HARDSWISH: 31,
  714. GELU: 32,
  715. GELU_STANDARD: 33
  716. };
  717. $root.MNN.UnaryOp = class UnaryOp {
  718. static decode(reader, position) {
  719. const $ = new $root.MNN.UnaryOp();
  720. $.opType = reader.int32_(position, 4, 0);
  721. $.T = reader.int32_(position, 6, 0);
  722. return $;
  723. }
  724. };
  725. $root.MNN.TopKV2 = class TopKV2 {
  726. static decode(reader, position) {
  727. const $ = new $root.MNN.TopKV2();
  728. $.T = reader.int32_(position, 4, 1);
  729. $.sorted = reader.bool_(position, 6, false);
  730. $.largest = reader.bool_(position, 8, true);
  731. return $;
  732. }
  733. };
  734. $root.MNN.CropAndResizeMethod = {
  735. BILINEAR: 0,
  736. NEAREST: 1
  737. };
  738. $root.MNN.CropAndResize = class CropAndResize {
  739. static decode(reader, position) {
  740. const $ = new $root.MNN.CropAndResize();
  741. $.extrapolationValue = reader.float32_(position, 4, 0);
  742. $.method = reader.int8_(position, 6, 0);
  743. return $;
  744. }
  745. };
  746. $root.MNN.Fill = class Fill {
  747. static decode(/* reader, position */) {
  748. const $ = new $root.MNN.Fill();
  749. return $;
  750. }
  751. };
  752. $root.MNN.GatherV2 = class GatherV2 {
  753. static decode(reader, position) {
  754. const $ = new $root.MNN.GatherV2();
  755. $.Taxis = reader.int32_(position, 4, 0);
  756. $.Tindices = reader.int32_(position, 6, 0);
  757. $.Tparams = reader.int32_(position, 8, 0);
  758. return $;
  759. }
  760. };
  761. $root.MNN.NonMaxSuppressionV2 = class NonMaxSuppressionV2 {
  762. static decode(/* reader, position */) {
  763. const $ = new $root.MNN.NonMaxSuppressionV2();
  764. return $;
  765. }
  766. };
  767. $root.MNN.Range = class Range {
  768. static decode(reader, position) {
  769. const $ = new $root.MNN.Range();
  770. $.Tidx = reader.int32_(position, 4, 0);
  771. return $;
  772. }
  773. };
  774. $root.MNN.Rank = class Rank {
  775. static decode(/* reader, position */) {
  776. const $ = new $root.MNN.Rank();
  777. return $;
  778. }
  779. };
  780. $root.MNN.Size = class Size {
  781. static decode(reader, position) {
  782. const $ = new $root.MNN.Size();
  783. $.outputDataType = reader.int32_(position, 4, 0);
  784. return $;
  785. }
  786. };
  787. $root.MNN.Transpose = class Transpose {
  788. static decode(reader, position) {
  789. const $ = new $root.MNN.Transpose();
  790. $.Tperm = reader.int32_(position, 4, 0);
  791. return $;
  792. }
  793. };
  794. $root.MNN.SliceTf = class SliceTf {
  795. static decode(reader, position) {
  796. const $ = new $root.MNN.SliceTf();
  797. $.T = reader.int32_(position, 4, 0);
  798. return $;
  799. }
  800. };
  801. $root.MNN.QuantizeMaxMin = class QuantizeMaxMin {
  802. static decode(reader, position) {
  803. const $ = new $root.MNN.QuantizeMaxMin();
  804. $.T = reader.int32_(position, 4, 0);
  805. return $;
  806. }
  807. };
  808. $root.MNN.Crop = class Crop {
  809. static decode(reader, position) {
  810. const $ = new $root.MNN.Crop();
  811. $.axis = reader.int32_(position, 4, 2);
  812. $.offset = reader.typedArray(position, 6, Int32Array);
  813. return $;
  814. }
  815. };
  816. $root.MNN.SpaceBatch = class SpaceBatch {
  817. static decode(reader, position) {
  818. const $ = new $root.MNN.SpaceBatch();
  819. $.blockShape = reader.table(position, 4, $root.MNN.Blob.decode);
  820. $.padding = reader.table(position, 6, $root.MNN.Blob.decode);
  821. return $;
  822. }
  823. };
  824. $root.MNN.MatMul = class MatMul {
  825. static decode(reader, position) {
  826. const $ = new $root.MNN.MatMul();
  827. $.T = reader.int32_(position, 4, 0);
  828. $.transposeA = reader.bool_(position, 6, false);
  829. $.transposeB = reader.bool_(position, 8, false);
  830. $.weight = reader.typedArray(position, 10, Float32Array);
  831. $.bias = reader.typedArray(position, 12, Float32Array);
  832. return $;
  833. }
  834. };
  835. $root.MNN.MomentsParam = class MomentsParam {
  836. static decode(reader, position) {
  837. const $ = new $root.MNN.MomentsParam();
  838. $.dim = reader.typedArray(position, 4, Int32Array);
  839. $.keepDims = reader.bool_(position, 6, true);
  840. $.dType = reader.int32_(position, 8, 1);
  841. return $;
  842. }
  843. };
  844. $root.MNN.RNNParam = class RNNParam {
  845. static decode(reader, position) {
  846. const $ = new $root.MNN.RNNParam();
  847. $.numUnits = reader.int32_(position, 4, 0);
  848. $.isBidirectionalRNN = reader.bool_(position, 6, false);
  849. $.linearBeforeReset = reader.bool_(position, 8, false);
  850. $.keepAllOutputs = reader.bool_(position, 10, false);
  851. $.fwGateWeight = reader.table(position, 12, $root.MNN.Blob.decode);
  852. $.fwGateBias = reader.table(position, 14, $root.MNN.Blob.decode);
  853. $.fwCandidateWeight = reader.table(position, 16, $root.MNN.Blob.decode);
  854. $.fwCandidateBias = reader.table(position, 18, $root.MNN.Blob.decode);
  855. $.fwRecurrentBias = reader.table(position, 20, $root.MNN.Blob.decode);
  856. $.bwGateWeight = reader.table(position, 22, $root.MNN.Blob.decode);
  857. $.bwGateBias = reader.table(position, 24, $root.MNN.Blob.decode);
  858. $.bwCandidateWeight = reader.table(position, 26, $root.MNN.Blob.decode);
  859. $.bwCandidateBias = reader.table(position, 28, $root.MNN.Blob.decode);
  860. $.bwRecurrentBias = reader.table(position, 30, $root.MNN.Blob.decode);
  861. return $;
  862. }
  863. };
  864. $root.MNN.BatchMatMulParam = class BatchMatMulParam {
  865. static decode(reader, position) {
  866. const $ = new $root.MNN.BatchMatMulParam();
  867. $.adjX = reader.bool_(position, 4, false);
  868. $.adjY = reader.bool_(position, 6, false);
  869. return $;
  870. }
  871. };
  872. $root.MNN.DepthToSpaceMode = {
  873. DCR: 0,
  874. CRD: 1
  875. };
  876. $root.MNN.DepthSpaceParam = class DepthSpaceParam {
  877. static decode(reader, position) {
  878. const $ = new $root.MNN.DepthSpaceParam();
  879. $.blockSize = reader.int32_(position, 4, 0);
  880. $.mode = reader.int8_(position, 6, 0);
  881. return $;
  882. }
  883. };
  884. $root.MNN.ReverseSequenceParam = class ReverseSequenceParam {
  885. static decode(reader, position) {
  886. const $ = new $root.MNN.ReverseSequenceParam();
  887. $.batchDim = reader.int32_(position, 4, 0);
  888. $.seqDim = reader.int32_(position, 6, 0);
  889. return $;
  890. }
  891. };
  892. $root.MNN.DetectionPostProcessParam = class DetectionPostProcessParam {
  893. static decode(reader, position) {
  894. const $ = new $root.MNN.DetectionPostProcessParam();
  895. $.maxDetections = reader.int32_(position, 4, 0);
  896. $.maxClassesPerDetection = reader.int32_(position, 6, 0);
  897. $.detectionsPerClass = reader.int32_(position, 8, 0);
  898. $.nmsScoreThreshold = reader.float32_(position, 10, 0);
  899. $.iouThreshold = reader.float32_(position, 12, 0);
  900. $.numClasses = reader.int32_(position, 14, 0);
  901. $.useRegularNMS = reader.bool_(position, 16, false);
  902. $.centerSizeEncoding = reader.typedArray(position, 18, Float32Array);
  903. return $;
  904. }
  905. };
  906. $root.MNN.OneHotParam = class OneHotParam {
  907. static decode(reader, position) {
  908. const $ = new $root.MNN.OneHotParam();
  909. $.dType = reader.int32_(position, 4, 1);
  910. $.axis = reader.int32_(position, 6, -1);
  911. return $;
  912. }
  913. };
  914. $root.MNN.PadValueMode = {
  915. CONSTANT: 0,
  916. REFLECT: 1,
  917. SYMMETRIC: 2,
  918. EDGE: 3
  919. };
  920. $root.MNN.PadParam = class PadParam {
  921. static decode(reader, position) {
  922. const $ = new $root.MNN.PadParam();
  923. $.mode = reader.int8_(position, 4, 0);
  924. return $;
  925. }
  926. };
  927. $root.MNN.LayerNorm = class LayerNorm {
  928. static decode(reader, position) {
  929. const $ = new $root.MNN.LayerNorm();
  930. $.axis = reader.typedArray(position, 4, Int32Array);
  931. $.epsilon = reader.float32_(position, 6, 0);
  932. $.gamma = reader.typedArray(position, 8, Float32Array);
  933. $.beta = reader.typedArray(position, 10, Float32Array);
  934. $.group = reader.int32_(position, 12, 1);
  935. return $;
  936. }
  937. };
  938. $root.MNN.RandomUniform = class RandomUniform {
  939. static decode(reader, position) {
  940. const $ = new $root.MNN.RandomUniform();
  941. $.seed = reader.int32_(position, 4, 0);
  942. $.seed2 = reader.int32_(position, 6, 0);
  943. $.type = reader.int32_(position, 8, 1);
  944. $.low = reader.float32_(position, 10, 0);
  945. $.high = reader.float32_(position, 12, 1);
  946. return $;
  947. }
  948. };
  949. $root.MNN.TensorArray = class TensorArray {
  950. static decode(reader, position) {
  951. const $ = new $root.MNN.TensorArray();
  952. $.dynamic_size = reader.bool_(position, 4, false);
  953. $.identical_element_shapes = reader.bool_(position, 6, false);
  954. $.element_shape = reader.typedArray(position, 8, Int32Array);
  955. $.T = reader.int32_(position, 10, 1);
  956. $.axis = reader.int32_(position, 12, 0);
  957. $.keepdims = reader.bool_(position, 14, true);
  958. $.new_axis = reader.bool_(position, 16, false);
  959. return $;
  960. }
  961. };
  962. $root.MNN.LSTMBlockCell = class LSTMBlockCell {
  963. static decode(reader, position) {
  964. const $ = new $root.MNN.LSTMBlockCell();
  965. $.cell_clip = reader.float32_(position, 4, 3);
  966. $.forget_bias = reader.float32_(position, 6, 1);
  967. $.use_peephole = reader.bool_(position, 8, false);
  968. return $;
  969. }
  970. };
  971. $root.MNN.FusedActivation = {
  972. kTfLiteActNone: 0,
  973. kTfLiteActRelu: 1,
  974. kTfLiteActRelu1: 2,
  975. kTfLiteActRelu6: 3,
  976. kTfLiteActTanh: 4,
  977. kTfLiteActSignBit: 5,
  978. kTfLiteActSigmoid: 6
  979. };
  980. $root.MNN.QuantizedParam = class QuantizedParam {
  981. static decode(reader, position) {
  982. const $ = new $root.MNN.QuantizedParam();
  983. $.zeroPoint = reader.int32_(position, 4, 0);
  984. $.scale = reader.float32_(position, 6, 0);
  985. return $;
  986. }
  987. };
  988. $root.MNN.QuantizedAdd = class QuantizedAdd {
  989. static decode(reader, position) {
  990. const $ = new $root.MNN.QuantizedAdd();
  991. $.activationType = reader.int8_(position, 4, 0);
  992. $.input1QuantizedParam = reader.table(position, 6, $root.MNN.QuantizedParam.decode);
  993. $.input2QuantizedParam = reader.table(position, 8, $root.MNN.QuantizedParam.decode);
  994. $.outputQuantizedParam = reader.table(position, 10, $root.MNN.QuantizedParam.decode);
  995. return $;
  996. }
  997. };
  998. $root.MNN.ModeFormat = {
  999. TENSORFLOW: 0,
  1000. TFLITE: 1
  1001. };
  1002. $root.MNN.QuantizeMode = {
  1003. MIN_COMBINED: 0,
  1004. MIN_FIRST: 1,
  1005. SCALED: 2
  1006. };
  1007. $root.MNN.Dequantize = class Dequantize {
  1008. static decode(reader, position) {
  1009. const $ = new $root.MNN.Dequantize();
  1010. $.inputQuantizedParam = reader.table(position, 4, $root.MNN.QuantizedParam.decode);
  1011. $.mode = reader.int8_(position, 6, 0);
  1012. $.modelFormat = reader.int8_(position, 8, 0);
  1013. $.type = reader.int32_(position, 10, 0);
  1014. return $;
  1015. }
  1016. };
  1017. $root.MNN.QuantizedAvgPool = class QuantizedAvgPool {
  1018. static decode(reader, position) {
  1019. const $ = new $root.MNN.QuantizedAvgPool();
  1020. $.kernelX = reader.int32_(position, 4, 0);
  1021. $.kernelY = reader.int32_(position, 6, 0);
  1022. $.modelFormat = reader.int8_(position, 8, 0);
  1023. $.outputActivationMax = reader.int32_(position, 10, 0);
  1024. $.outputActivationMin = reader.int32_(position, 12, 0);
  1025. $.padType = reader.int8_(position, 14, 0);
  1026. $.padX = reader.int32_(position, 16, 0);
  1027. $.padY = reader.int32_(position, 18, 0);
  1028. $.strideX = reader.int32_(position, 20, 0);
  1029. $.strideY = reader.int32_(position, 22, 0);
  1030. $.type = reader.int32_(position, 24, 0);
  1031. return $;
  1032. }
  1033. };
  1034. $root.MNN.QuantizedBiasAdd = class QuantizedBiasAdd {
  1035. static decode(reader, position) {
  1036. const $ = new $root.MNN.QuantizedBiasAdd();
  1037. $.bias = reader.typedArray(position, 4, Int32Array);
  1038. $.inputType = reader.int32_(position, 6, 0);
  1039. $.max = reader.int32_(position, 8, 0);
  1040. $.min = reader.int32_(position, 10, 0);
  1041. $.outputType = reader.int32_(position, 12, 0);
  1042. return $;
  1043. }
  1044. };
  1045. $root.MNN.QuantizedConcat = class QuantizedConcat {
  1046. static decode(reader, position) {
  1047. const $ = new $root.MNN.QuantizedConcat();
  1048. $.activationType = reader.int8_(position, 4, 0);
  1049. $.axis = reader.int32_(position, 6, 0);
  1050. $.inputScale = reader.typedArray(position, 8, Float32Array);
  1051. $.inputZeroPoint = reader.typedArray(position, 10, Int32Array);
  1052. $.outputQuantizedParam = reader.table(position, 12, $root.MNN.QuantizedParam.decode);
  1053. return $;
  1054. }
  1055. };
  1056. $root.MNN.QuantizedLogistic = class QuantizedLogistic {
  1057. static decode(reader, position) {
  1058. const $ = new $root.MNN.QuantizedLogistic();
  1059. $.inputQuantizedParam = reader.table(position, 4, $root.MNN.QuantizedParam.decode);
  1060. $.outputQuantizedParam = reader.table(position, 6, $root.MNN.QuantizedParam.decode);
  1061. return $;
  1062. }
  1063. };
  1064. $root.MNN.QuantizedMatMul = class QuantizedMatMul {
  1065. static decode(reader, position) {
  1066. const $ = new $root.MNN.QuantizedMatMul();
  1067. $.transposeA = reader.bool_(position, 4, false);
  1068. $.transposeB = reader.bool_(position, 6, false);
  1069. return $;
  1070. }
  1071. };
  1072. $root.MNN.QuantizedMaxPool = class QuantizedMaxPool {
  1073. static decode(reader, position) {
  1074. const $ = new $root.MNN.QuantizedMaxPool();
  1075. $.kernelX = reader.int32_(position, 4, 0);
  1076. $.kernelY = reader.int32_(position, 6, 0);
  1077. $.modelFormat = reader.int8_(position, 8, 0);
  1078. $.outputActivationMax = reader.int32_(position, 10, 0);
  1079. $.outputActivationMin = reader.int32_(position, 12, 0);
  1080. $.padType = reader.int8_(position, 14, 0);
  1081. $.padX = reader.int32_(position, 16, 0);
  1082. $.padY = reader.int32_(position, 18, 0);
  1083. $.strideX = reader.int32_(position, 20, 0);
  1084. $.strideY = reader.int32_(position, 22, 0);
  1085. $.type = reader.int32_(position, 24, 0);
  1086. return $;
  1087. }
  1088. };
  1089. $root.MNN.QuantizedRelu = class QuantizedRelu {
  1090. static decode(reader, position) {
  1091. const $ = new $root.MNN.QuantizedRelu();
  1092. $.type = reader.int32_(position, 4, 0);
  1093. return $;
  1094. }
  1095. };
  1096. $root.MNN.QuantizedRelu6 = class QuantizedRelu6 {
  1097. static decode(reader, position) {
  1098. const $ = new $root.MNN.QuantizedRelu6();
  1099. $.type = reader.int32_(position, 4, 0);
  1100. return $;
  1101. }
  1102. };
  1103. $root.MNN.QuantizedReshape = class QuantizedReshape {
  1104. static decode(reader, position) {
  1105. const $ = new $root.MNN.QuantizedReshape();
  1106. $.dims = reader.typedArray(position, 4, Int32Array);
  1107. $.modelFormat = reader.int8_(position, 6, 0);
  1108. return $;
  1109. }
  1110. };
  1111. $root.MNN.QuantizedSoftmax = class QuantizedSoftmax {
  1112. static decode(reader, position) {
  1113. const $ = new $root.MNN.QuantizedSoftmax();
  1114. $.beta = reader.float32_(position, 4, 0);
  1115. $.inputScale = reader.float32_(position, 6, 0);
  1116. return $;
  1117. }
  1118. };
  1119. $root.MNN.QuantizeRoundMode = {
  1120. HALF_AWAY_FROM_ZERO: 0,
  1121. HALF_TO_EVEN: 1
  1122. };
  1123. $root.MNN.QuantizeV2 = class QuantizeV2 {
  1124. static decode(reader, position) {
  1125. const $ = new $root.MNN.QuantizeV2();
  1126. $.type = reader.int32_(position, 4, 0);
  1127. $.mode = reader.int8_(position, 6, 0);
  1128. $.roundMode = reader.int8_(position, 8, 0);
  1129. return $;
  1130. }
  1131. };
  1132. $root.MNN.RequantizationRange = class RequantizationRange {
  1133. static decode(/* reader, position */) {
  1134. const $ = new $root.MNN.RequantizationRange();
  1135. return $;
  1136. }
  1137. };
  1138. $root.MNN.Requantize = class Requantize {
  1139. static decode(/* reader, position */) {
  1140. const $ = new $root.MNN.Requantize();
  1141. return $;
  1142. }
  1143. };
  1144. $root.MNN.TfQuantizedConv2D = class TfQuantizedConv2D {
  1145. static decode(reader, position) {
  1146. const $ = new $root.MNN.TfQuantizedConv2D();
  1147. $.bias = reader.typedArray(position, 4, Int32Array);
  1148. $.biasflag = reader.bool_(position, 6, false);
  1149. $.common = reader.table(position, 8, $root.MNN.Convolution2DCommon.decode);
  1150. $.weight = reader.typedArray(position, 10, Uint8Array);
  1151. $.activationType = reader.int8_(position, 12, 0);
  1152. $.multiplier = reader.int32_(position, 14, 0);
  1153. $.outMax = reader.int32_(position, 16, 0);
  1154. $.outMin = reader.int32_(position, 18, 0);
  1155. $.shift = reader.int32_(position, 20, 0);
  1156. $.biasQuantizedParam = reader.table(position, 22, $root.MNN.QuantizedParam.decode);
  1157. $.depthMultiplier = reader.int32_(position, 24, 0);
  1158. $.filterQuantizedParam = reader.table(position, 26, $root.MNN.QuantizedParam.decode);
  1159. $.inputQuantizedParam = reader.table(position, 28, $root.MNN.QuantizedParam.decode);
  1160. $.modelFormat = reader.int8_(position, 30, 0);
  1161. $.outputQuantizedParam = reader.table(position, 32, $root.MNN.QuantizedParam.decode);
  1162. return $;
  1163. }
  1164. };
  1165. $root.MNN.ExtraInfo = class ExtraInfo {
  1166. static decode(reader, position) {
  1167. const $ = new $root.MNN.ExtraInfo();
  1168. $.buffer = reader.typedArray(position, 4, Int8Array);
  1169. $.name = reader.string_(position, 6, null);
  1170. $.version = reader.string_(position, 8, null);
  1171. return $;
  1172. }
  1173. };
  1174. $root.MNN.TensorConvertInfo = class TensorConvertInfo {
  1175. static decode(reader, position) {
  1176. const $ = new $root.MNN.TensorConvertInfo();
  1177. $.source = reader.int8_(position, 4, 0);
  1178. $.dest = reader.int8_(position, 6, 0);
  1179. return $;
  1180. }
  1181. };
  1182. $root.MNN.SampleMode = {
  1183. BILINEAR: 0,
  1184. NEAREST: 1
  1185. };
  1186. $root.MNN.BorderMode = {
  1187. ZEROS: 0,
  1188. CLAMP: 1,
  1189. REFLECTION: 2
  1190. };
  1191. $root.MNN.GridSample = class GridSample {
  1192. static decode(reader, position) {
  1193. const $ = new $root.MNN.GridSample();
  1194. $.mode = reader.int8_(position, 4, 0);
  1195. $.paddingMode = reader.int8_(position, 6, 0);
  1196. $.alignCorners = reader.bool_(position, 8, false);
  1197. return $;
  1198. }
  1199. };
  1200. $root.MNN.ImageFormatType = {
  1201. RGBA: 0,
  1202. RGB: 1,
  1203. BGR: 2,
  1204. GRAY: 3,
  1205. BGRA: 4,
  1206. YCrCb: 5,
  1207. YUV: 6,
  1208. HSV: 7,
  1209. XYZ: 8,
  1210. BGR555: 9,
  1211. BGR565: 10,
  1212. YUV_NV21: 11,
  1213. YUV_NV12: 12,
  1214. YUV_I420: 13,
  1215. HSV_FULL: 14
  1216. };
  1217. $root.MNN.FilterType = {
  1218. NEAREST: 0,
  1219. BILINEAR: 1,
  1220. BICUBIC: 2
  1221. };
  1222. $root.MNN.WrapType = {
  1223. CLAMP_TO_EDGE: 0,
  1224. ZERO: 1,
  1225. REPEAT: 2
  1226. };
  1227. $root.MNN.ImageProcessParam = class ImageProcessParam {
  1228. static decode(reader, position) {
  1229. const $ = new $root.MNN.ImageProcessParam();
  1230. $.filterType = reader.int8_(position, 4, 0);
  1231. $.sourceFormat = reader.int32_(position, 6, 0);
  1232. $.destFormat = reader.int32_(position, 8, 0);
  1233. $.wrap = reader.int8_(position, 10, 0);
  1234. $.mean = reader.typedArray(position, 12, Float32Array);
  1235. $.normal = reader.typedArray(position, 14, Float32Array);
  1236. $.transform = reader.typedArray(position, 16, Float32Array);
  1237. $.paddingValue = reader.int8_(position, 18, 0);
  1238. $.shape = reader.typedArray(position, 20, Int32Array);
  1239. $.outputType = reader.int32_(position, 22, 0);
  1240. $.draw = reader.bool_(position, 24, false);
  1241. return $;
  1242. }
  1243. };
  1244. $root.MNN.OpType = {
  1245. AbsVal: 0,
  1246. QuantizedAdd: 1,
  1247. ArgMax: 2,
  1248. AsString: 3,
  1249. InstanceNorm: 4,
  1250. BatchToSpaceND: 5,
  1251. Bias: 6,
  1252. BinaryOp: 7,
  1253. Bnll: 8,
  1254. Cast: 9,
  1255. Concat: 10,
  1256. Const: 11,
  1257. Convolution: 12,
  1258. ConvolutionDepthwise: 13,
  1259. Crop: 14,
  1260. CropAndResize: 15,
  1261. ImageProcess: 16,
  1262. Deconvolution: 17,
  1263. DeconvolutionDepthwise: 18,
  1264. Dequantize: 19,
  1265. DetectionOutput: 20,
  1266. Dropout: 21,
  1267. Eltwise: 22,
  1268. ELU: 23,
  1269. Unique: 24,
  1270. Exp: 25,
  1271. ExpandDims: 26,
  1272. Fill: 27,
  1273. Flatten: 28,
  1274. Im2Col: 29,
  1275. Gather: 30,
  1276. GatherV2: 31,
  1277. Im2Seq: 32,
  1278. InnerProduct: 33,
  1279. Input: 34,
  1280. Interp: 35,
  1281. Log: 36,
  1282. LRN: 37,
  1283. LSTM: 38,
  1284. MatMul: 39,
  1285. MVN: 40,
  1286. NonMaxSuppression: 41,
  1287. NonMaxSuppressionV2: 42,
  1288. Normalize: 43,
  1289. Pack: 44,
  1290. Padding: 45,
  1291. Permute: 46,
  1292. Pooling: 47,
  1293. Power: 48,
  1294. PReLU: 49,
  1295. PriorBox: 50,
  1296. Proposal: 51,
  1297. QuantizedAvgPool: 52,
  1298. QuantizedBiasAdd: 53,
  1299. QuantizedConcat: 54,
  1300. QuantizedDepthwiseConv2D: 55,
  1301. QuantizedLogistic: 56,
  1302. QuantizedMatMul: 57,
  1303. QuantizedMaxPool: 58,
  1304. QuantizedRelu: 59,
  1305. QuantizedRelu6: 60,
  1306. QuantizedReshape: 61,
  1307. QuantizedSoftmax: 62,
  1308. QuantizeMaxMin: 63,
  1309. QuantizeV2: 64,
  1310. Range: 65,
  1311. Rank: 66,
  1312. ReduceJoin: 67,
  1313. Reduction: 68,
  1314. ReLU: 69,
  1315. ReLU6: 70,
  1316. RequantizationRange: 71,
  1317. Requantize: 72,
  1318. Reshape: 73,
  1319. Resize: 74,
  1320. RNN: 75,
  1321. ROIPooling: 76,
  1322. Scale: 77,
  1323. Selu: 78,
  1324. Seq2Out: 79,
  1325. Shape: 80,
  1326. Sigmoid: 81,
  1327. Size: 82,
  1328. Slice: 83,
  1329. SliceTf: 84,
  1330. Softmax: 85,
  1331. SpaceToBatchND: 86,
  1332. SpatialProduct: 87,
  1333. Col2Im: 88,
  1334. Segment: 89,
  1335. Squeeze: 90,
  1336. StridedSlice: 91,
  1337. StringJoin: 92,
  1338. StringSplit: 93,
  1339. StringToNumber: 94,
  1340. TanH: 95,
  1341. TfQuantizedConv2D: 96,
  1342. Threshold: 97,
  1343. Tile: 98,
  1344. TopKV2: 99,
  1345. Transpose: 100,
  1346. UnaryOp: 101,
  1347. Unpack: 102,
  1348. Where: 103,
  1349. Moments: 104,
  1350. RNNSequenceGRU: 105,
  1351. BatchMatMul: 106,
  1352. Unsqueeze: 107,
  1353. CosineSimilarity: 108,
  1354. DepthToSpace: 109,
  1355. SpaceToDepth: 110,
  1356. ReverseSequence: 111,
  1357. Pooling3D: 112,
  1358. Convolution3D: 113,
  1359. MatrixBandPart: 114,
  1360. GatherND: 115,
  1361. DetectionPostProcess: 116,
  1362. UnravelIndex: 117,
  1363. ScatterNd: 118,
  1364. OneHot: 119,
  1365. BroadcastTo: 120,
  1366. Dilation2D: 121,
  1367. Raster: 128,
  1368. ConvertTensor: 129,
  1369. ArgMin: 130,
  1370. LinSpace: 131,
  1371. RandomUniform: 132,
  1372. TensorArray: 133,
  1373. TensorArraySize: 134,
  1374. TensorArrayRead: 135,
  1375. TensorArrayWrite: 136,
  1376. TensorArrayGather: 137,
  1377. TensorArrayScatter: 138,
  1378. TensorArraySplit: 139,
  1379. TensorArrayConcat: 140,
  1380. LSTMBlockCell: 141,
  1381. Reverse: 142,
  1382. ROIAlign: 143,
  1383. RandomNormal: 144,
  1384. TensorArrayInsert: 145,
  1385. TensorArrayErase: 146,
  1386. EyeLike: 147,
  1387. CumSum: 148,
  1388. Det: 149,
  1389. CumProd: 150,
  1390. ScatterElements: 151,
  1391. GatherElements: 152,
  1392. Svd: 153,
  1393. Histogram: 154,
  1394. Plugin: 256,
  1395. Select: 257,
  1396. ZerosLike: 258,
  1397. Broastcast: 259,
  1398. SetDiff1D: 260,
  1399. ReluGrad: 261,
  1400. Relu6Grad: 262,
  1401. PoolGrad: 263,
  1402. SoftmaxGrad: 264,
  1403. Conv2DBackPropFilter: 265,
  1404. TrainableParam: 266,
  1405. BatchNorm: 267,
  1406. ZeroGrad: 268,
  1407. Extra: 512,
  1408. ConvInt8: 513,
  1409. Int8ToFloat: 514,
  1410. DepthwiseConvInt8: 515,
  1411. PoolInt8: 516,
  1412. FloatToInt8: 517,
  1413. EltwiseInt8: 518,
  1414. While: 600,
  1415. If: 601,
  1416. LayerNorm: 603,
  1417. GridSample: 604
  1418. };
  1419. $root.MNN.Plugin = class Plugin {
  1420. static decode(reader, position) {
  1421. const $ = new $root.MNN.Plugin();
  1422. $.type = reader.string_(position, 4, null);
  1423. $.attr = reader.tableArray(position, 6, $root.MNN.Attribute.decode);
  1424. return $;
  1425. }
  1426. };
  1427. $root.MNN.Extra = class Extra {
  1428. static decode(reader, position) {
  1429. const $ = new $root.MNN.Extra();
  1430. $.type = reader.string_(position, 4, null);
  1431. $.engine = reader.string_(position, 6, null);
  1432. $.info = reader.typedArray(position, 8, Int8Array);
  1433. $.attr = reader.tableArray(position, 10, $root.MNN.Attribute.decode);
  1434. return $;
  1435. }
  1436. };
  1437. $root.MNN.StringVec = class StringVec {
  1438. static decode(reader, position) {
  1439. const $ = new $root.MNN.StringVec();
  1440. $.data = reader.strings_(position, 4);
  1441. return $;
  1442. }
  1443. };
  1444. $root.MNN.WhileParam = class WhileParam {
  1445. static decode(reader, position) {
  1446. const $ = new $root.MNN.WhileParam();
  1447. $.cond_graph = reader.string_(position, 4, null);
  1448. $.body_graph = reader.string_(position, 6, null);
  1449. $.aliases_inputs = reader.tableArray(position, 8, $root.MNN.StringVec.decode);
  1450. $.aliases_outputs = reader.strings_(position, 10);
  1451. $.aliases_updates = reader.tableArray(position, 12, $root.MNN.StringVec.decode);
  1452. return $;
  1453. }
  1454. };
  1455. $root.MNN.IfParam = class IfParam {
  1456. static decode(reader, position) {
  1457. const $ = new $root.MNN.IfParam();
  1458. $.then_graph = reader.string_(position, 4, null);
  1459. $.else_graph = reader.string_(position, 6, null);
  1460. $.aliases_inputs = reader.tableArray(position, 8, $root.MNN.StringVec.decode);
  1461. $.aliases_outputs = reader.tableArray(position, 10, $root.MNN.StringVec.decode);
  1462. return $;
  1463. }
  1464. };
  1465. $root.MNN.RegionCommand = class RegionCommand {
  1466. static decode(reader, position) {
  1467. const $ = new $root.MNN.RegionCommand();
  1468. $.op = reader.table(position, 4, $root.MNN.Op.decode);
  1469. $.steps = reader.typedArray(position, 6, Int32Array);
  1470. $.size = reader.typedArray(position, 8, Int32Array);
  1471. $.indexes = reader.typedArray(position, 10, Int32Array);
  1472. $.view = reader.tableArray(position, 12, $root.MNN.View.decode);
  1473. $.fuse = reader.int32_(position, 14, -1);
  1474. $.iterIndexes = reader.typedArray(position, 16, Int32Array);
  1475. return $;
  1476. }
  1477. };
  1478. $root.MNN.LoopParam = class LoopParam {
  1479. static decode(reader, position) {
  1480. const $ = new $root.MNN.LoopParam();
  1481. $.tensorNumber = reader.int32_(position, 4, 0);
  1482. $.outputIndexes = reader.typedArray(position, 6, Int32Array);
  1483. $.inputIndexes = reader.typedArray(position, 8, Int32Array);
  1484. $.midTensors = reader.tableArray(position, 10, $root.MNN.TensorDescribe.decode);
  1485. $.parallel = reader.bool_(position, 12, true);
  1486. $.loopNumber = reader.int32_(position, 14, 0);
  1487. $.commands = reader.tableArray(position, 16, $root.MNN.RegionCommand.decode);
  1488. $.initCommand = reader.table(position, 18, $root.MNN.RegionCommand.decode);
  1489. return $;
  1490. }
  1491. };
  1492. $root.MNN.OpParameter = class {
  1493. static decode(reader, position, type) {
  1494. switch (type) {
  1495. case 1: return $root.MNN.QuantizedAdd.decode(reader, position);
  1496. case 2: return $root.MNN.ArgMax.decode(reader, position);
  1497. case 3: return $root.MNN.AsString.decode(reader, position);
  1498. case 4: return $root.MNN.Axis.decode(reader, position);
  1499. case 5: return $root.MNN.BatchNorm.decode(reader, position);
  1500. case 6: return $root.MNN.BinaryOp.decode(reader, position);
  1501. case 7: return $root.MNN.Blob.decode(reader, position);
  1502. case 8: return $root.MNN.CastParam.decode(reader, position);
  1503. case 9: return $root.MNN.Convolution2D.decode(reader, position);
  1504. case 10: return $root.MNN.Crop.decode(reader, position);
  1505. case 11: return $root.MNN.CropAndResize.decode(reader, position);
  1506. case 12: return $root.MNN.Dequantize.decode(reader, position);
  1507. case 13: return $root.MNN.DetectionOutput.decode(reader, position);
  1508. case 14: return $root.MNN.Eltwise.decode(reader, position);
  1509. case 15: return $root.MNN.ExpandDims.decode(reader, position);
  1510. case 16: return $root.MNN.Fill.decode(reader, position);
  1511. case 17: return $root.MNN.Flatten.decode(reader, position);
  1512. case 18: return $root.MNN.Gather.decode(reader, position);
  1513. case 19: return $root.MNN.GatherV2.decode(reader, position);
  1514. case 20: return $root.MNN.InnerProduct.decode(reader, position);
  1515. case 21: return $root.MNN.Input.decode(reader, position);
  1516. case 22: return $root.MNN.Interp.decode(reader, position);
  1517. case 23: return $root.MNN.LRN.decode(reader, position);
  1518. case 24: return $root.MNN.LSTM.decode(reader, position);
  1519. case 25: return $root.MNN.MatMul.decode(reader, position);
  1520. case 26: return $root.MNN.NonMaxSuppressionV2.decode(reader, position);
  1521. case 27: return $root.MNN.Normalize.decode(reader, position);
  1522. case 28: return $root.MNN.PackParam.decode(reader, position);
  1523. case 29: return $root.MNN.Permute.decode(reader, position);
  1524. case 30: return $root.MNN.Plugin.decode(reader, position);
  1525. case 31: return $root.MNN.Pool.decode(reader, position);
  1526. case 32: return $root.MNN.PRelu.decode(reader, position);
  1527. case 33: return $root.MNN.PriorBox.decode(reader, position);
  1528. case 34: return $root.MNN.Proposal.decode(reader, position);
  1529. case 35: return $root.MNN.QuantizedAvgPool.decode(reader, position);
  1530. case 36: return $root.MNN.QuantizedBiasAdd.decode(reader, position);
  1531. case 37: return $root.MNN.QuantizedConcat.decode(reader, position);
  1532. case 38: return $root.MNN.QuantizedLogistic.decode(reader, position);
  1533. case 39: return $root.MNN.QuantizedMatMul.decode(reader, position);
  1534. case 40: return $root.MNN.QuantizedMaxPool.decode(reader, position);
  1535. case 41: return $root.MNN.QuantizedRelu.decode(reader, position);
  1536. case 42: return $root.MNN.QuantizedRelu6.decode(reader, position);
  1537. case 43: return $root.MNN.QuantizedReshape.decode(reader, position);
  1538. case 44: return $root.MNN.QuantizedSoftmax.decode(reader, position);
  1539. case 45: return $root.MNN.QuantizeMaxMin.decode(reader, position);
  1540. case 46: return $root.MNN.QuantizeV2.decode(reader, position);
  1541. case 47: return $root.MNN.Range.decode(reader, position);
  1542. case 48: return $root.MNN.Rank.decode(reader, position);
  1543. case 49: return $root.MNN.ReduceJoin.decode(reader, position);
  1544. case 50: return $root.MNN.ReductionParam.decode(reader, position);
  1545. case 51: return $root.MNN.Relu.decode(reader, position);
  1546. case 52: return $root.MNN.Relu6.decode(reader, position);
  1547. case 53: return $root.MNN.RequantizationRange.decode(reader, position);
  1548. case 54: return $root.MNN.Requantize.decode(reader, position);
  1549. case 55: return $root.MNN.Reshape.decode(reader, position);
  1550. case 56: return $root.MNN.Resize.decode(reader, position);
  1551. case 57: return $root.MNN.RoiParameters.decode(reader, position);
  1552. case 58: return $root.MNN.Scale.decode(reader, position);
  1553. case 59: return $root.MNN.Selu.decode(reader, position);
  1554. case 60: return $root.MNN.Size.decode(reader, position);
  1555. case 61: return $root.MNN.Slice.decode(reader, position);
  1556. case 62: return $root.MNN.SliceTf.decode(reader, position);
  1557. case 63: return $root.MNN.SpaceBatch.decode(reader, position);
  1558. case 64: return $root.MNN.SqueezeParam.decode(reader, position);
  1559. case 65: return $root.MNN.StridedSliceParam.decode(reader, position);
  1560. case 66: return $root.MNN.TensorConvertInfo.decode(reader, position);
  1561. case 67: return $root.MNN.TfQuantizedConv2D.decode(reader, position);
  1562. case 68: return $root.MNN.TopKV2.decode(reader, position);
  1563. case 69: return $root.MNN.Transpose.decode(reader, position);
  1564. case 70: return $root.MNN.UnaryOp.decode(reader, position);
  1565. case 71: return $root.MNN.MomentsParam.decode(reader, position);
  1566. case 72: return $root.MNN.RNNParam.decode(reader, position);
  1567. case 73: return $root.MNN.BatchMatMulParam.decode(reader, position);
  1568. case 74: return $root.MNN.QuantizedFloatParam.decode(reader, position);
  1569. case 75: return $root.MNN.DepthSpaceParam.decode(reader, position);
  1570. case 76: return $root.MNN.EltwiseInt8.decode(reader, position);
  1571. case 77: return $root.MNN.ReverseSequenceParam.decode(reader, position);
  1572. case 78: return $root.MNN.Extra.decode(reader, position);
  1573. case 79: return $root.MNN.Pool3D.decode(reader, position);
  1574. case 80: return $root.MNN.Convolution3D.decode(reader, position);
  1575. case 81: return $root.MNN.ELU.decode(reader, position);
  1576. case 82: return $root.MNN.DetectionPostProcessParam.decode(reader, position);
  1577. case 83: return $root.MNN.OneHotParam.decode(reader, position);
  1578. case 84: return $root.MNN.PadParam.decode(reader, position);
  1579. case 85: return $root.MNN.WhileParam.decode(reader, position);
  1580. case 86: return $root.MNN.IfParam.decode(reader, position);
  1581. case 87: return $root.MNN.RandomUniform.decode(reader, position);
  1582. case 88: return $root.MNN.LayerNorm.decode(reader, position);
  1583. case 89: return $root.MNN.TensorArray.decode(reader, position);
  1584. case 90: return $root.MNN.LSTMBlockCell.decode(reader, position);
  1585. case 91: return $root.MNN.GridSample.decode(reader, position);
  1586. case 92: return $root.MNN.LoopParam.decode(reader, position);
  1587. case 93: return $root.MNN.ImageProcessParam.decode(reader, position);
  1588. case 94: return $root.MNN.CumSum.decode(reader, position);
  1589. default: return undefined;
  1590. }
  1591. }
  1592. static decodeText(reader, json, type) {
  1593. switch (type) {
  1594. case 'QuantizedAdd': return $root.MNN.QuantizedAdd.decodeText(reader, json);
  1595. case 'ArgMax': return $root.MNN.ArgMax.decodeText(reader, json);
  1596. case 'AsString': return $root.MNN.AsString.decodeText(reader, json);
  1597. case 'Axis': return $root.MNN.Axis.decodeText(reader, json);
  1598. case 'BatchNorm': return $root.MNN.BatchNorm.decodeText(reader, json);
  1599. case 'BinaryOp': return $root.MNN.BinaryOp.decodeText(reader, json);
  1600. case 'Blob': return $root.MNN.Blob.decodeText(reader, json);
  1601. case 'CastParam': return $root.MNN.CastParam.decodeText(reader, json);
  1602. case 'Convolution2D': return $root.MNN.Convolution2D.decodeText(reader, json);
  1603. case 'Crop': return $root.MNN.Crop.decodeText(reader, json);
  1604. case 'CropAndResize': return $root.MNN.CropAndResize.decodeText(reader, json);
  1605. case 'Dequantize': return $root.MNN.Dequantize.decodeText(reader, json);
  1606. case 'DetectionOutput': return $root.MNN.DetectionOutput.decodeText(reader, json);
  1607. case 'Eltwise': return $root.MNN.Eltwise.decodeText(reader, json);
  1608. case 'ExpandDims': return $root.MNN.ExpandDims.decodeText(reader, json);
  1609. case 'Fill': return $root.MNN.Fill.decodeText(reader, json);
  1610. case 'Flatten': return $root.MNN.Flatten.decodeText(reader, json);
  1611. case 'Gather': return $root.MNN.Gather.decodeText(reader, json);
  1612. case 'GatherV2': return $root.MNN.GatherV2.decodeText(reader, json);
  1613. case 'InnerProduct': return $root.MNN.InnerProduct.decodeText(reader, json);
  1614. case 'Input': return $root.MNN.Input.decodeText(reader, json);
  1615. case 'Interp': return $root.MNN.Interp.decodeText(reader, json);
  1616. case 'LRN': return $root.MNN.LRN.decodeText(reader, json);
  1617. case 'LSTM': return $root.MNN.LSTM.decodeText(reader, json);
  1618. case 'MatMul': return $root.MNN.MatMul.decodeText(reader, json);
  1619. case 'NonMaxSuppressionV2': return $root.MNN.NonMaxSuppressionV2.decodeText(reader, json);
  1620. case 'Normalize': return $root.MNN.Normalize.decodeText(reader, json);
  1621. case 'PackParam': return $root.MNN.PackParam.decodeText(reader, json);
  1622. case 'Permute': return $root.MNN.Permute.decodeText(reader, json);
  1623. case 'Plugin': return $root.MNN.Plugin.decodeText(reader, json);
  1624. case 'Pool': return $root.MNN.Pool.decodeText(reader, json);
  1625. case 'PRelu': return $root.MNN.PRelu.decodeText(reader, json);
  1626. case 'PriorBox': return $root.MNN.PriorBox.decodeText(reader, json);
  1627. case 'Proposal': return $root.MNN.Proposal.decodeText(reader, json);
  1628. case 'QuantizedAvgPool': return $root.MNN.QuantizedAvgPool.decodeText(reader, json);
  1629. case 'QuantizedBiasAdd': return $root.MNN.QuantizedBiasAdd.decodeText(reader, json);
  1630. case 'QuantizedConcat': return $root.MNN.QuantizedConcat.decodeText(reader, json);
  1631. case 'QuantizedLogistic': return $root.MNN.QuantizedLogistic.decodeText(reader, json);
  1632. case 'QuantizedMatMul': return $root.MNN.QuantizedMatMul.decodeText(reader, json);
  1633. case 'QuantizedMaxPool': return $root.MNN.QuantizedMaxPool.decodeText(reader, json);
  1634. case 'QuantizedRelu': return $root.MNN.QuantizedRelu.decodeText(reader, json);
  1635. case 'QuantizedRelu6': return $root.MNN.QuantizedRelu6.decodeText(reader, json);
  1636. case 'QuantizedReshape': return $root.MNN.QuantizedReshape.decodeText(reader, json);
  1637. case 'QuantizedSoftmax': return $root.MNN.QuantizedSoftmax.decodeText(reader, json);
  1638. case 'QuantizeMaxMin': return $root.MNN.QuantizeMaxMin.decodeText(reader, json);
  1639. case 'QuantizeV2': return $root.MNN.QuantizeV2.decodeText(reader, json);
  1640. case 'Range': return $root.MNN.Range.decodeText(reader, json);
  1641. case 'Rank': return $root.MNN.Rank.decodeText(reader, json);
  1642. case 'ReduceJoin': return $root.MNN.ReduceJoin.decodeText(reader, json);
  1643. case 'ReductionParam': return $root.MNN.ReductionParam.decodeText(reader, json);
  1644. case 'Relu': return $root.MNN.Relu.decodeText(reader, json);
  1645. case 'Relu6': return $root.MNN.Relu6.decodeText(reader, json);
  1646. case 'RequantizationRange': return $root.MNN.RequantizationRange.decodeText(reader, json);
  1647. case 'Requantize': return $root.MNN.Requantize.decodeText(reader, json);
  1648. case 'Reshape': return $root.MNN.Reshape.decodeText(reader, json);
  1649. case 'Resize': return $root.MNN.Resize.decodeText(reader, json);
  1650. case 'RoiParameters': return $root.MNN.RoiParameters.decodeText(reader, json);
  1651. case 'Scale': return $root.MNN.Scale.decodeText(reader, json);
  1652. case 'Selu': return $root.MNN.Selu.decodeText(reader, json);
  1653. case 'Size': return $root.MNN.Size.decodeText(reader, json);
  1654. case 'Slice': return $root.MNN.Slice.decodeText(reader, json);
  1655. case 'SliceTf': return $root.MNN.SliceTf.decodeText(reader, json);
  1656. case 'SpaceBatch': return $root.MNN.SpaceBatch.decodeText(reader, json);
  1657. case 'SqueezeParam': return $root.MNN.SqueezeParam.decodeText(reader, json);
  1658. case 'StridedSliceParam': return $root.MNN.StridedSliceParam.decodeText(reader, json);
  1659. case 'TensorConvertInfo': return $root.MNN.TensorConvertInfo.decodeText(reader, json);
  1660. case 'TfQuantizedConv2D': return $root.MNN.TfQuantizedConv2D.decodeText(reader, json);
  1661. case 'TopKV2': return $root.MNN.TopKV2.decodeText(reader, json);
  1662. case 'Transpose': return $root.MNN.Transpose.decodeText(reader, json);
  1663. case 'UnaryOp': return $root.MNN.UnaryOp.decodeText(reader, json);
  1664. case 'MomentsParam': return $root.MNN.MomentsParam.decodeText(reader, json);
  1665. case 'RNNParam': return $root.MNN.RNNParam.decodeText(reader, json);
  1666. case 'BatchMatMulParam': return $root.MNN.BatchMatMulParam.decodeText(reader, json);
  1667. case 'QuantizedFloatParam': return $root.MNN.QuantizedFloatParam.decodeText(reader, json);
  1668. case 'DepthSpaceParam': return $root.MNN.DepthSpaceParam.decodeText(reader, json);
  1669. case 'EltwiseInt8': return $root.MNN.EltwiseInt8.decodeText(reader, json);
  1670. case 'ReverseSequenceParam': return $root.MNN.ReverseSequenceParam.decodeText(reader, json);
  1671. case 'Extra': return $root.MNN.Extra.decodeText(reader, json);
  1672. case 'Pool3D': return $root.MNN.Pool3D.decodeText(reader, json);
  1673. case 'Convolution3D': return $root.MNN.Convolution3D.decodeText(reader, json);
  1674. case 'ELU': return $root.MNN.ELU.decodeText(reader, json);
  1675. case 'DetectionPostProcessParam': return $root.MNN.DetectionPostProcessParam.decodeText(reader, json);
  1676. case 'OneHotParam': return $root.MNN.OneHotParam.decodeText(reader, json);
  1677. case 'PadParam': return $root.MNN.PadParam.decodeText(reader, json);
  1678. case 'WhileParam': return $root.MNN.WhileParam.decodeText(reader, json);
  1679. case 'IfParam': return $root.MNN.IfParam.decodeText(reader, json);
  1680. case 'RandomUniform': return $root.MNN.RandomUniform.decodeText(reader, json);
  1681. case 'LayerNorm': return $root.MNN.LayerNorm.decodeText(reader, json);
  1682. case 'TensorArray': return $root.MNN.TensorArray.decodeText(reader, json);
  1683. case 'LSTMBlockCell': return $root.MNN.LSTMBlockCell.decodeText(reader, json);
  1684. case 'GridSample': return $root.MNN.GridSample.decodeText(reader, json);
  1685. case 'LoopParam': return $root.MNN.LoopParam.decodeText(reader, json);
  1686. case 'ImageProcessParam': return $root.MNN.ImageProcessParam.decodeText(reader, json);
  1687. case 'CumSum': return $root.MNN.CumSum.decodeText(reader, json);
  1688. default: return undefined;
  1689. }
  1690. }
  1691. };
  1692. $root.MNN.Op = class Op {
  1693. static decode(reader, position) {
  1694. const $ = new $root.MNN.Op();
  1695. $.inputIndexes = reader.typedArray(position, 4, Int32Array);
  1696. $.main = reader.union(position, 6, $root.MNN.OpParameter.decode);
  1697. $.name = reader.string_(position, 10, null);
  1698. $.outputIndexes = reader.typedArray(position, 12, Int32Array);
  1699. $.type = reader.int32_(position, 14, 0);
  1700. $.defaultDimentionFormat = reader.int8_(position, 16, 1);
  1701. return $;
  1702. }
  1703. };
  1704. $root.MNN.View = class View {
  1705. static decode(reader, position) {
  1706. const $ = new $root.MNN.View();
  1707. $.offset = reader.int32_(position, 4, 0);
  1708. $.stride = reader.typedArray(position, 6, Int32Array);
  1709. return $;
  1710. }
  1711. };
  1712. $root.MNN.Region = class Region {
  1713. static decode(reader, position) {
  1714. const $ = new $root.MNN.Region();
  1715. $.src = reader.table(position, 4, $root.MNN.View.decode);
  1716. $.dst = reader.table(position, 6, $root.MNN.View.decode);
  1717. $.size = reader.typedArray(position, 8, Int32Array);
  1718. $.origin = reader.int32_(position, 10, 0);
  1719. return $;
  1720. }
  1721. };
  1722. $root.MNN.TensorDescribe = class TensorDescribe {
  1723. static decode(reader, position) {
  1724. const $ = new $root.MNN.TensorDescribe();
  1725. $.blob = reader.table(position, 4, $root.MNN.Blob.decode);
  1726. $.index = reader.int32_(position, 6, 0);
  1727. $.name = reader.string_(position, 8, null);
  1728. $.regions = reader.tableArray(position, 10, $root.MNN.Region.decode);
  1729. $.quantInfo = reader.table(position, 12, $root.MNN.TensorQuantInfo.decode);
  1730. return $;
  1731. }
  1732. };
  1733. $root.MNN.ForwardType = {
  1734. CPU: 0,
  1735. METAL: 1,
  1736. OPENCL: 2,
  1737. OPENGLES: 3,
  1738. VULKAN: 4
  1739. };
  1740. $root.MNN.Usage = {
  1741. INFERENCE: 0,
  1742. TRAIN: 1,
  1743. INFERENCE_STATIC: 2
  1744. };
  1745. $root.MNN.SubGraphProto = class SubGraphProto {
  1746. static decode(reader, position) {
  1747. const $ = new $root.MNN.SubGraphProto();
  1748. $.name = reader.string_(position, 4, null);
  1749. $.inputs = reader.typedArray(position, 6, Int32Array);
  1750. $.outputs = reader.typedArray(position, 8, Int32Array);
  1751. $.tensors = reader.strings_(position, 10);
  1752. $.nodes = reader.tableArray(position, 12, $root.MNN.Op.decode);
  1753. $.extraTensorDescribe = reader.tableArray(position, 14, $root.MNN.TensorDescribe.decode);
  1754. return $;
  1755. }
  1756. };
  1757. $root.MNN.TensorQuantInfo = class TensorQuantInfo {
  1758. static decode(reader, position) {
  1759. const $ = new $root.MNN.TensorQuantInfo();
  1760. $.scale = reader.float32_(position, 4, 0);
  1761. $.zero = reader.float32_(position, 6, 0);
  1762. $.min = reader.float32_(position, 8, -128);
  1763. $.max = reader.float32_(position, 10, 127);
  1764. $.type = reader.int32_(position, 12, 0);
  1765. return $;
  1766. }
  1767. };
  1768. $root.MNN.Net = class Net {
  1769. static create(reader) {
  1770. return $root.MNN.Net.decode(reader, reader.root);
  1771. }
  1772. static decode(reader, position) {
  1773. const $ = new $root.MNN.Net();
  1774. $.bizCode = reader.string_(position, 4, null);
  1775. $.extraTensorDescribe = reader.tableArray(position, 6, $root.MNN.TensorDescribe.decode);
  1776. $.extraInfo = reader.table(position, 8, $root.MNN.ExtraInfo.decode);
  1777. $.oplists = reader.tableArray(position, 10, $root.MNN.Op.decode);
  1778. $.outputName = reader.strings_(position, 12);
  1779. $.preferForwardType = reader.int8_(position, 14, 0);
  1780. $.sourceType = reader.int8_(position, 16, 0);
  1781. $.tensorName = reader.strings_(position, 18);
  1782. $.tensorNumber = reader.int32_(position, 20, 0);
  1783. $.usage = reader.int8_(position, 22, 0);
  1784. $.subgraphs = reader.tableArray(position, 24, $root.MNN.SubGraphProto.decode);
  1785. $.mnn_uuid = reader.string_(position, 26, null);
  1786. return $;
  1787. }
  1788. };