mnn-schema.js 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044
  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. Plugin: 256,
  1393. Select: 257,
  1394. ZerosLike: 258,
  1395. Broastcast: 259,
  1396. SetDiff1D: 260,
  1397. ReluGrad: 261,
  1398. Relu6Grad: 262,
  1399. PoolGrad: 263,
  1400. SoftmaxGrad: 264,
  1401. Conv2DBackPropFilter: 265,
  1402. TrainableParam: 266,
  1403. BatchNorm: 267,
  1404. ZeroGrad: 268,
  1405. Extra: 512,
  1406. ConvInt8: 513,
  1407. Int8ToFloat: 514,
  1408. DepthwiseConvInt8: 515,
  1409. PoolInt8: 516,
  1410. FloatToInt8: 517,
  1411. EltwiseInt8: 518,
  1412. While: 600,
  1413. If: 601,
  1414. LayerNorm: 603,
  1415. GridSample: 604
  1416. };
  1417. $root.MNN.Plugin = class Plugin {
  1418. static decode(reader, position) {
  1419. const $ = new $root.MNN.Plugin();
  1420. $.type = reader.string_(position, 4, null);
  1421. $.attr = reader.tableArray(position, 6, $root.MNN.Attribute.decode);
  1422. return $;
  1423. }
  1424. };
  1425. $root.MNN.Extra = class Extra {
  1426. static decode(reader, position) {
  1427. const $ = new $root.MNN.Extra();
  1428. $.type = reader.string_(position, 4, null);
  1429. $.engine = reader.string_(position, 6, null);
  1430. $.info = reader.typedArray(position, 8, Int8Array);
  1431. $.attr = reader.tableArray(position, 10, $root.MNN.Attribute.decode);
  1432. return $;
  1433. }
  1434. };
  1435. $root.MNN.StringVec = class StringVec {
  1436. static decode(reader, position) {
  1437. const $ = new $root.MNN.StringVec();
  1438. $.data = reader.strings_(position, 4);
  1439. return $;
  1440. }
  1441. };
  1442. $root.MNN.WhileParam = class WhileParam {
  1443. static decode(reader, position) {
  1444. const $ = new $root.MNN.WhileParam();
  1445. $.cond_graph = reader.string_(position, 4, null);
  1446. $.body_graph = reader.string_(position, 6, null);
  1447. $.aliases_inputs = reader.tableArray(position, 8, $root.MNN.StringVec.decode);
  1448. $.aliases_outputs = reader.strings_(position, 10);
  1449. $.aliases_updates = reader.tableArray(position, 12, $root.MNN.StringVec.decode);
  1450. return $;
  1451. }
  1452. };
  1453. $root.MNN.IfParam = class IfParam {
  1454. static decode(reader, position) {
  1455. const $ = new $root.MNN.IfParam();
  1456. $.then_graph = reader.string_(position, 4, null);
  1457. $.else_graph = reader.string_(position, 6, null);
  1458. $.aliases_inputs = reader.tableArray(position, 8, $root.MNN.StringVec.decode);
  1459. $.aliases_outputs = reader.tableArray(position, 10, $root.MNN.StringVec.decode);
  1460. return $;
  1461. }
  1462. };
  1463. $root.MNN.RegionCommand = class RegionCommand {
  1464. static decode(reader, position) {
  1465. const $ = new $root.MNN.RegionCommand();
  1466. $.op = reader.table(position, 4, $root.MNN.Op.decode);
  1467. $.steps = reader.typedArray(position, 6, Int32Array);
  1468. $.size = reader.typedArray(position, 8, Int32Array);
  1469. $.indexes = reader.typedArray(position, 10, Int32Array);
  1470. $.view = reader.tableArray(position, 12, $root.MNN.View.decode);
  1471. $.fuse = reader.int32_(position, 14, -1);
  1472. $.iterIndexes = reader.typedArray(position, 16, Int32Array);
  1473. return $;
  1474. }
  1475. };
  1476. $root.MNN.LoopParam = class LoopParam {
  1477. static decode(reader, position) {
  1478. const $ = new $root.MNN.LoopParam();
  1479. $.tensorNumber = reader.int32_(position, 4, 0);
  1480. $.outputIndexes = reader.typedArray(position, 6, Int32Array);
  1481. $.inputIndexes = reader.typedArray(position, 8, Int32Array);
  1482. $.midTensors = reader.tableArray(position, 10, $root.MNN.TensorDescribe.decode);
  1483. $.parallel = reader.bool_(position, 12, true);
  1484. $.loopNumber = reader.int32_(position, 14, 0);
  1485. $.commands = reader.tableArray(position, 16, $root.MNN.RegionCommand.decode);
  1486. $.initCommand = reader.table(position, 18, $root.MNN.RegionCommand.decode);
  1487. return $;
  1488. }
  1489. };
  1490. $root.MNN.OpParameter = class {
  1491. static decode(reader, position, type) {
  1492. switch (type) {
  1493. case 1: return $root.MNN.QuantizedAdd.decode(reader, position);
  1494. case 2: return $root.MNN.ArgMax.decode(reader, position);
  1495. case 3: return $root.MNN.AsString.decode(reader, position);
  1496. case 4: return $root.MNN.Axis.decode(reader, position);
  1497. case 5: return $root.MNN.BatchNorm.decode(reader, position);
  1498. case 6: return $root.MNN.BinaryOp.decode(reader, position);
  1499. case 7: return $root.MNN.Blob.decode(reader, position);
  1500. case 8: return $root.MNN.CastParam.decode(reader, position);
  1501. case 9: return $root.MNN.Convolution2D.decode(reader, position);
  1502. case 10: return $root.MNN.Crop.decode(reader, position);
  1503. case 11: return $root.MNN.CropAndResize.decode(reader, position);
  1504. case 12: return $root.MNN.Dequantize.decode(reader, position);
  1505. case 13: return $root.MNN.DetectionOutput.decode(reader, position);
  1506. case 14: return $root.MNN.Eltwise.decode(reader, position);
  1507. case 15: return $root.MNN.ExpandDims.decode(reader, position);
  1508. case 16: return $root.MNN.Fill.decode(reader, position);
  1509. case 17: return $root.MNN.Flatten.decode(reader, position);
  1510. case 18: return $root.MNN.Gather.decode(reader, position);
  1511. case 19: return $root.MNN.GatherV2.decode(reader, position);
  1512. case 20: return $root.MNN.InnerProduct.decode(reader, position);
  1513. case 21: return $root.MNN.Input.decode(reader, position);
  1514. case 22: return $root.MNN.Interp.decode(reader, position);
  1515. case 23: return $root.MNN.LRN.decode(reader, position);
  1516. case 24: return $root.MNN.LSTM.decode(reader, position);
  1517. case 25: return $root.MNN.MatMul.decode(reader, position);
  1518. case 26: return $root.MNN.NonMaxSuppressionV2.decode(reader, position);
  1519. case 27: return $root.MNN.Normalize.decode(reader, position);
  1520. case 28: return $root.MNN.PackParam.decode(reader, position);
  1521. case 29: return $root.MNN.Permute.decode(reader, position);
  1522. case 30: return $root.MNN.Plugin.decode(reader, position);
  1523. case 31: return $root.MNN.Pool.decode(reader, position);
  1524. case 32: return $root.MNN.PRelu.decode(reader, position);
  1525. case 33: return $root.MNN.PriorBox.decode(reader, position);
  1526. case 34: return $root.MNN.Proposal.decode(reader, position);
  1527. case 35: return $root.MNN.QuantizedAvgPool.decode(reader, position);
  1528. case 36: return $root.MNN.QuantizedBiasAdd.decode(reader, position);
  1529. case 37: return $root.MNN.QuantizedConcat.decode(reader, position);
  1530. case 38: return $root.MNN.QuantizedLogistic.decode(reader, position);
  1531. case 39: return $root.MNN.QuantizedMatMul.decode(reader, position);
  1532. case 40: return $root.MNN.QuantizedMaxPool.decode(reader, position);
  1533. case 41: return $root.MNN.QuantizedRelu.decode(reader, position);
  1534. case 42: return $root.MNN.QuantizedRelu6.decode(reader, position);
  1535. case 43: return $root.MNN.QuantizedReshape.decode(reader, position);
  1536. case 44: return $root.MNN.QuantizedSoftmax.decode(reader, position);
  1537. case 45: return $root.MNN.QuantizeMaxMin.decode(reader, position);
  1538. case 46: return $root.MNN.QuantizeV2.decode(reader, position);
  1539. case 47: return $root.MNN.Range.decode(reader, position);
  1540. case 48: return $root.MNN.Rank.decode(reader, position);
  1541. case 49: return $root.MNN.ReduceJoin.decode(reader, position);
  1542. case 50: return $root.MNN.ReductionParam.decode(reader, position);
  1543. case 51: return $root.MNN.Relu.decode(reader, position);
  1544. case 52: return $root.MNN.Relu6.decode(reader, position);
  1545. case 53: return $root.MNN.RequantizationRange.decode(reader, position);
  1546. case 54: return $root.MNN.Requantize.decode(reader, position);
  1547. case 55: return $root.MNN.Reshape.decode(reader, position);
  1548. case 56: return $root.MNN.Resize.decode(reader, position);
  1549. case 57: return $root.MNN.RoiParameters.decode(reader, position);
  1550. case 58: return $root.MNN.Scale.decode(reader, position);
  1551. case 59: return $root.MNN.Selu.decode(reader, position);
  1552. case 60: return $root.MNN.Size.decode(reader, position);
  1553. case 61: return $root.MNN.Slice.decode(reader, position);
  1554. case 62: return $root.MNN.SliceTf.decode(reader, position);
  1555. case 63: return $root.MNN.SpaceBatch.decode(reader, position);
  1556. case 64: return $root.MNN.SqueezeParam.decode(reader, position);
  1557. case 65: return $root.MNN.StridedSliceParam.decode(reader, position);
  1558. case 66: return $root.MNN.TensorConvertInfo.decode(reader, position);
  1559. case 67: return $root.MNN.TfQuantizedConv2D.decode(reader, position);
  1560. case 68: return $root.MNN.TopKV2.decode(reader, position);
  1561. case 69: return $root.MNN.Transpose.decode(reader, position);
  1562. case 70: return $root.MNN.UnaryOp.decode(reader, position);
  1563. case 71: return $root.MNN.MomentsParam.decode(reader, position);
  1564. case 72: return $root.MNN.RNNParam.decode(reader, position);
  1565. case 73: return $root.MNN.BatchMatMulParam.decode(reader, position);
  1566. case 74: return $root.MNN.QuantizedFloatParam.decode(reader, position);
  1567. case 75: return $root.MNN.DepthSpaceParam.decode(reader, position);
  1568. case 76: return $root.MNN.EltwiseInt8.decode(reader, position);
  1569. case 77: return $root.MNN.ReverseSequenceParam.decode(reader, position);
  1570. case 78: return $root.MNN.Extra.decode(reader, position);
  1571. case 79: return $root.MNN.Pool3D.decode(reader, position);
  1572. case 80: return $root.MNN.Convolution3D.decode(reader, position);
  1573. case 81: return $root.MNN.ELU.decode(reader, position);
  1574. case 82: return $root.MNN.DetectionPostProcessParam.decode(reader, position);
  1575. case 83: return $root.MNN.OneHotParam.decode(reader, position);
  1576. case 84: return $root.MNN.PadParam.decode(reader, position);
  1577. case 85: return $root.MNN.WhileParam.decode(reader, position);
  1578. case 86: return $root.MNN.IfParam.decode(reader, position);
  1579. case 87: return $root.MNN.RandomUniform.decode(reader, position);
  1580. case 88: return $root.MNN.LayerNorm.decode(reader, position);
  1581. case 89: return $root.MNN.TensorArray.decode(reader, position);
  1582. case 90: return $root.MNN.LSTMBlockCell.decode(reader, position);
  1583. case 91: return $root.MNN.GridSample.decode(reader, position);
  1584. case 92: return $root.MNN.LoopParam.decode(reader, position);
  1585. case 93: return $root.MNN.ImageProcessParam.decode(reader, position);
  1586. case 94: return $root.MNN.CumSum.decode(reader, position);
  1587. default: return undefined;
  1588. }
  1589. }
  1590. static decodeText(reader, json, type) {
  1591. switch (type) {
  1592. case 'QuantizedAdd': return $root.MNN.QuantizedAdd.decodeText(reader, json);
  1593. case 'ArgMax': return $root.MNN.ArgMax.decodeText(reader, json);
  1594. case 'AsString': return $root.MNN.AsString.decodeText(reader, json);
  1595. case 'Axis': return $root.MNN.Axis.decodeText(reader, json);
  1596. case 'BatchNorm': return $root.MNN.BatchNorm.decodeText(reader, json);
  1597. case 'BinaryOp': return $root.MNN.BinaryOp.decodeText(reader, json);
  1598. case 'Blob': return $root.MNN.Blob.decodeText(reader, json);
  1599. case 'CastParam': return $root.MNN.CastParam.decodeText(reader, json);
  1600. case 'Convolution2D': return $root.MNN.Convolution2D.decodeText(reader, json);
  1601. case 'Crop': return $root.MNN.Crop.decodeText(reader, json);
  1602. case 'CropAndResize': return $root.MNN.CropAndResize.decodeText(reader, json);
  1603. case 'Dequantize': return $root.MNN.Dequantize.decodeText(reader, json);
  1604. case 'DetectionOutput': return $root.MNN.DetectionOutput.decodeText(reader, json);
  1605. case 'Eltwise': return $root.MNN.Eltwise.decodeText(reader, json);
  1606. case 'ExpandDims': return $root.MNN.ExpandDims.decodeText(reader, json);
  1607. case 'Fill': return $root.MNN.Fill.decodeText(reader, json);
  1608. case 'Flatten': return $root.MNN.Flatten.decodeText(reader, json);
  1609. case 'Gather': return $root.MNN.Gather.decodeText(reader, json);
  1610. case 'GatherV2': return $root.MNN.GatherV2.decodeText(reader, json);
  1611. case 'InnerProduct': return $root.MNN.InnerProduct.decodeText(reader, json);
  1612. case 'Input': return $root.MNN.Input.decodeText(reader, json);
  1613. case 'Interp': return $root.MNN.Interp.decodeText(reader, json);
  1614. case 'LRN': return $root.MNN.LRN.decodeText(reader, json);
  1615. case 'LSTM': return $root.MNN.LSTM.decodeText(reader, json);
  1616. case 'MatMul': return $root.MNN.MatMul.decodeText(reader, json);
  1617. case 'NonMaxSuppressionV2': return $root.MNN.NonMaxSuppressionV2.decodeText(reader, json);
  1618. case 'Normalize': return $root.MNN.Normalize.decodeText(reader, json);
  1619. case 'PackParam': return $root.MNN.PackParam.decodeText(reader, json);
  1620. case 'Permute': return $root.MNN.Permute.decodeText(reader, json);
  1621. case 'Plugin': return $root.MNN.Plugin.decodeText(reader, json);
  1622. case 'Pool': return $root.MNN.Pool.decodeText(reader, json);
  1623. case 'PRelu': return $root.MNN.PRelu.decodeText(reader, json);
  1624. case 'PriorBox': return $root.MNN.PriorBox.decodeText(reader, json);
  1625. case 'Proposal': return $root.MNN.Proposal.decodeText(reader, json);
  1626. case 'QuantizedAvgPool': return $root.MNN.QuantizedAvgPool.decodeText(reader, json);
  1627. case 'QuantizedBiasAdd': return $root.MNN.QuantizedBiasAdd.decodeText(reader, json);
  1628. case 'QuantizedConcat': return $root.MNN.QuantizedConcat.decodeText(reader, json);
  1629. case 'QuantizedLogistic': return $root.MNN.QuantizedLogistic.decodeText(reader, json);
  1630. case 'QuantizedMatMul': return $root.MNN.QuantizedMatMul.decodeText(reader, json);
  1631. case 'QuantizedMaxPool': return $root.MNN.QuantizedMaxPool.decodeText(reader, json);
  1632. case 'QuantizedRelu': return $root.MNN.QuantizedRelu.decodeText(reader, json);
  1633. case 'QuantizedRelu6': return $root.MNN.QuantizedRelu6.decodeText(reader, json);
  1634. case 'QuantizedReshape': return $root.MNN.QuantizedReshape.decodeText(reader, json);
  1635. case 'QuantizedSoftmax': return $root.MNN.QuantizedSoftmax.decodeText(reader, json);
  1636. case 'QuantizeMaxMin': return $root.MNN.QuantizeMaxMin.decodeText(reader, json);
  1637. case 'QuantizeV2': return $root.MNN.QuantizeV2.decodeText(reader, json);
  1638. case 'Range': return $root.MNN.Range.decodeText(reader, json);
  1639. case 'Rank': return $root.MNN.Rank.decodeText(reader, json);
  1640. case 'ReduceJoin': return $root.MNN.ReduceJoin.decodeText(reader, json);
  1641. case 'ReductionParam': return $root.MNN.ReductionParam.decodeText(reader, json);
  1642. case 'Relu': return $root.MNN.Relu.decodeText(reader, json);
  1643. case 'Relu6': return $root.MNN.Relu6.decodeText(reader, json);
  1644. case 'RequantizationRange': return $root.MNN.RequantizationRange.decodeText(reader, json);
  1645. case 'Requantize': return $root.MNN.Requantize.decodeText(reader, json);
  1646. case 'Reshape': return $root.MNN.Reshape.decodeText(reader, json);
  1647. case 'Resize': return $root.MNN.Resize.decodeText(reader, json);
  1648. case 'RoiParameters': return $root.MNN.RoiParameters.decodeText(reader, json);
  1649. case 'Scale': return $root.MNN.Scale.decodeText(reader, json);
  1650. case 'Selu': return $root.MNN.Selu.decodeText(reader, json);
  1651. case 'Size': return $root.MNN.Size.decodeText(reader, json);
  1652. case 'Slice': return $root.MNN.Slice.decodeText(reader, json);
  1653. case 'SliceTf': return $root.MNN.SliceTf.decodeText(reader, json);
  1654. case 'SpaceBatch': return $root.MNN.SpaceBatch.decodeText(reader, json);
  1655. case 'SqueezeParam': return $root.MNN.SqueezeParam.decodeText(reader, json);
  1656. case 'StridedSliceParam': return $root.MNN.StridedSliceParam.decodeText(reader, json);
  1657. case 'TensorConvertInfo': return $root.MNN.TensorConvertInfo.decodeText(reader, json);
  1658. case 'TfQuantizedConv2D': return $root.MNN.TfQuantizedConv2D.decodeText(reader, json);
  1659. case 'TopKV2': return $root.MNN.TopKV2.decodeText(reader, json);
  1660. case 'Transpose': return $root.MNN.Transpose.decodeText(reader, json);
  1661. case 'UnaryOp': return $root.MNN.UnaryOp.decodeText(reader, json);
  1662. case 'MomentsParam': return $root.MNN.MomentsParam.decodeText(reader, json);
  1663. case 'RNNParam': return $root.MNN.RNNParam.decodeText(reader, json);
  1664. case 'BatchMatMulParam': return $root.MNN.BatchMatMulParam.decodeText(reader, json);
  1665. case 'QuantizedFloatParam': return $root.MNN.QuantizedFloatParam.decodeText(reader, json);
  1666. case 'DepthSpaceParam': return $root.MNN.DepthSpaceParam.decodeText(reader, json);
  1667. case 'EltwiseInt8': return $root.MNN.EltwiseInt8.decodeText(reader, json);
  1668. case 'ReverseSequenceParam': return $root.MNN.ReverseSequenceParam.decodeText(reader, json);
  1669. case 'Extra': return $root.MNN.Extra.decodeText(reader, json);
  1670. case 'Pool3D': return $root.MNN.Pool3D.decodeText(reader, json);
  1671. case 'Convolution3D': return $root.MNN.Convolution3D.decodeText(reader, json);
  1672. case 'ELU': return $root.MNN.ELU.decodeText(reader, json);
  1673. case 'DetectionPostProcessParam': return $root.MNN.DetectionPostProcessParam.decodeText(reader, json);
  1674. case 'OneHotParam': return $root.MNN.OneHotParam.decodeText(reader, json);
  1675. case 'PadParam': return $root.MNN.PadParam.decodeText(reader, json);
  1676. case 'WhileParam': return $root.MNN.WhileParam.decodeText(reader, json);
  1677. case 'IfParam': return $root.MNN.IfParam.decodeText(reader, json);
  1678. case 'RandomUniform': return $root.MNN.RandomUniform.decodeText(reader, json);
  1679. case 'LayerNorm': return $root.MNN.LayerNorm.decodeText(reader, json);
  1680. case 'TensorArray': return $root.MNN.TensorArray.decodeText(reader, json);
  1681. case 'LSTMBlockCell': return $root.MNN.LSTMBlockCell.decodeText(reader, json);
  1682. case 'GridSample': return $root.MNN.GridSample.decodeText(reader, json);
  1683. case 'LoopParam': return $root.MNN.LoopParam.decodeText(reader, json);
  1684. case 'ImageProcessParam': return $root.MNN.ImageProcessParam.decodeText(reader, json);
  1685. case 'CumSum': return $root.MNN.CumSum.decodeText(reader, json);
  1686. default: return undefined;
  1687. }
  1688. }
  1689. };
  1690. $root.MNN.Op = class Op {
  1691. static decode(reader, position) {
  1692. const $ = new $root.MNN.Op();
  1693. $.inputIndexes = reader.typedArray(position, 4, Int32Array);
  1694. $.main = reader.union(position, 6, $root.MNN.OpParameter.decode);
  1695. $.name = reader.string_(position, 10, null);
  1696. $.outputIndexes = reader.typedArray(position, 12, Int32Array);
  1697. $.type = reader.int32_(position, 14, 0);
  1698. $.defaultDimentionFormat = reader.int8_(position, 16, 1);
  1699. return $;
  1700. }
  1701. };
  1702. $root.MNN.View = class View {
  1703. static decode(reader, position) {
  1704. const $ = new $root.MNN.View();
  1705. $.offset = reader.int32_(position, 4, 0);
  1706. $.stride = reader.typedArray(position, 6, Int32Array);
  1707. return $;
  1708. }
  1709. };
  1710. $root.MNN.Region = class Region {
  1711. static decode(reader, position) {
  1712. const $ = new $root.MNN.Region();
  1713. $.src = reader.table(position, 4, $root.MNN.View.decode);
  1714. $.dst = reader.table(position, 6, $root.MNN.View.decode);
  1715. $.size = reader.typedArray(position, 8, Int32Array);
  1716. $.origin = reader.int32_(position, 10, 0);
  1717. return $;
  1718. }
  1719. };
  1720. $root.MNN.TensorDescribe = class TensorDescribe {
  1721. static decode(reader, position) {
  1722. const $ = new $root.MNN.TensorDescribe();
  1723. $.blob = reader.table(position, 4, $root.MNN.Blob.decode);
  1724. $.index = reader.int32_(position, 6, 0);
  1725. $.name = reader.string_(position, 8, null);
  1726. $.regions = reader.tableArray(position, 10, $root.MNN.Region.decode);
  1727. $.quantInfo = reader.table(position, 12, $root.MNN.TensorQuantInfo.decode);
  1728. return $;
  1729. }
  1730. };
  1731. $root.MNN.ForwardType = {
  1732. CPU: 0,
  1733. METAL: 1,
  1734. OPENCL: 2,
  1735. OPENGLES: 3,
  1736. VULKAN: 4
  1737. };
  1738. $root.MNN.Usage = {
  1739. INFERENCE: 0,
  1740. TRAIN: 1,
  1741. INFERENCE_STATIC: 2
  1742. };
  1743. $root.MNN.SubGraphProto = class SubGraphProto {
  1744. static decode(reader, position) {
  1745. const $ = new $root.MNN.SubGraphProto();
  1746. $.name = reader.string_(position, 4, null);
  1747. $.inputs = reader.typedArray(position, 6, Int32Array);
  1748. $.outputs = reader.typedArray(position, 8, Int32Array);
  1749. $.tensors = reader.strings_(position, 10);
  1750. $.nodes = reader.tableArray(position, 12, $root.MNN.Op.decode);
  1751. $.extraTensorDescribe = reader.tableArray(position, 14, $root.MNN.TensorDescribe.decode);
  1752. return $;
  1753. }
  1754. };
  1755. $root.MNN.TensorQuantInfo = class TensorQuantInfo {
  1756. static decode(reader, position) {
  1757. const $ = new $root.MNN.TensorQuantInfo();
  1758. $.scale = reader.float32_(position, 4, 0);
  1759. $.zero = reader.float32_(position, 6, 0);
  1760. $.min = reader.float32_(position, 8, -128);
  1761. $.max = reader.float32_(position, 10, 127);
  1762. $.type = reader.int32_(position, 12, 0);
  1763. return $;
  1764. }
  1765. };
  1766. $root.MNN.Net = class Net {
  1767. static create(reader) {
  1768. return $root.MNN.Net.decode(reader, reader.root);
  1769. }
  1770. static decode(reader, position) {
  1771. const $ = new $root.MNN.Net();
  1772. $.bizCode = reader.string_(position, 4, null);
  1773. $.extraTensorDescribe = reader.tableArray(position, 6, $root.MNN.TensorDescribe.decode);
  1774. $.extraInfo = reader.table(position, 8, $root.MNN.ExtraInfo.decode);
  1775. $.oplists = reader.tableArray(position, 10, $root.MNN.Op.decode);
  1776. $.outputName = reader.strings_(position, 12);
  1777. $.preferForwardType = reader.int8_(position, 14, 0);
  1778. $.sourceType = reader.int8_(position, 16, 0);
  1779. $.tensorName = reader.strings_(position, 18);
  1780. $.tensorNumber = reader.int32_(position, 20, 0);
  1781. $.usage = reader.int8_(position, 22, 0);
  1782. $.subgraphs = reader.tableArray(position, 24, $root.MNN.SubGraphProto.decode);
  1783. $.mnn_uuid = reader.string_(position, 26, null);
  1784. return $;
  1785. }
  1786. };