@genai-fi/nanogpt 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/README.md +352 -14
  2. package/dist/Generator.js +69 -78
  3. package/dist/{RealDiv-D4EzDsC0.js → RealDiv-DgA3z9oO.js} +32 -206
  4. package/dist/Reshape-CF6odzV4.js +16 -0
  5. package/dist/Reshape-_kILl6tK.js +81 -0
  6. package/dist/TeachableLLM.js +28 -22
  7. package/dist/Trainer.d.ts +2 -0
  8. package/dist/Trainer.js +3 -2
  9. package/dist/{axis_util-TbGYJ208.js → axis_util-BvHEw88j.js} +7 -23
  10. package/dist/backend.d.ts +2 -1
  11. package/dist/backend.js +10 -4
  12. package/dist/backend_util-D-rUb2ty.js +474 -0
  13. package/dist/backend_webgpu-B0u2ndUn.js +547 -0
  14. package/dist/binary_op_util-pKXltfxI.js +192 -0
  15. package/dist/broadcast_to-CwF7XIeu.js +30 -0
  16. package/dist/checks/appendCache.js +2 -2
  17. package/dist/checks/attentionMask.js +3 -3
  18. package/dist/checks/check.d.ts +1 -1
  19. package/dist/checks/check.js +8 -8
  20. package/dist/checks/gelu.js +2 -2
  21. package/dist/checks/index.d.ts +2 -0
  22. package/dist/checks/index.js +7 -5
  23. package/dist/checks/matMulGelu.js +6 -6
  24. package/dist/checks/normRMS.js +7 -7
  25. package/dist/checks/normRMSGrad.js +3 -3
  26. package/dist/checks/packUnpack.d.ts +1 -0
  27. package/dist/checks/packUnpack.js +18 -0
  28. package/dist/checks/qkv.js +12 -27
  29. package/dist/checks/rope.js +2 -2
  30. package/dist/checks/weights.js +18 -16
  31. package/dist/complex-CSlYz-2T.js +13 -0
  32. package/dist/complex_util-Yc1A_gV1.js +55 -0
  33. package/dist/concat-BHlIJeyT.js +19 -0
  34. package/dist/concat_util-DcJk7YHS.js +22 -0
  35. package/dist/data/docx.js +1 -1
  36. package/dist/data/parquet.js +2 -2
  37. package/dist/data/pdf.js +1 -1
  38. package/dist/data/textLoader.js +1 -1
  39. package/dist/{dataset-DlZtKmBq.js → dataset-0xP8GjwI.js} +136 -236
  40. package/dist/dropout-C1pM3f11.js +99 -0
  41. package/dist/expand_dims-BPG4fwBP.js +13 -0
  42. package/dist/exports_initializers-xuidcwI4.js +7 -0
  43. package/dist/gather-DykLGqmW.js +10 -0
  44. package/dist/{gelu-Bp_-935b.js → gelu-CNLFZWea.js} +11 -10
  45. package/dist/{gpgpu_math-CDaYiyE_.js → gpgpu_math-DDVJCn6-.js} +90 -265
  46. package/dist/{index-C4L8Cm77.js → index-CieiGp4Y.js} +14 -14
  47. package/dist/index-CjOj7j-u.js +7308 -0
  48. package/dist/{index-Tf7vU29b.js → index-Cp39cXWe.js} +3 -10
  49. package/dist/{index-Dwqa6Zy2.js → index-DvYrXKkX.js} +2 -2
  50. package/dist/index-ZyQhjEPo.js +2157 -0
  51. package/dist/{jszip.min-CjP2V1VV.js → jszip.min-Bz5-11Bk.js} +56 -57
  52. package/dist/kernel_funcs_utils-Dg_-E44D.js +308 -0
  53. package/dist/layers/BaseLayer.d.ts +1 -0
  54. package/dist/layers/BaseLayer.js +7 -6
  55. package/dist/layers/CausalSelfAttention.d.ts +0 -1
  56. package/dist/layers/CausalSelfAttention.js +56 -55
  57. package/dist/layers/MLP.js +15 -16
  58. package/dist/layers/PositionEmbedding.js +5 -14
  59. package/dist/layers/RMSNorm.js +3 -3
  60. package/dist/layers/RoPECache.d.ts +2 -0
  61. package/dist/layers/RoPECache.js +22 -17
  62. package/dist/layers/TiedEmbedding.js +22 -17
  63. package/dist/layers/TransformerBlock.js +21 -20
  64. package/dist/loader/load.js +1 -1
  65. package/dist/loader/loadTransformers.js +1 -1
  66. package/dist/loader/oldZipLoad.js +39 -33
  67. package/dist/loader/save.js +1 -1
  68. package/dist/log_sum_exp-DWI-76TI.js +41 -0
  69. package/dist/main.d.ts +8 -0
  70. package/dist/main.js +63 -52
  71. package/dist/matMul16--R5hOwDG.js +77 -0
  72. package/dist/mat_mul-DeAh4uTH.js +12 -0
  73. package/dist/mod-Gt1rMB4n.js +12 -0
  74. package/dist/models/NanoGPTV1.js +40 -31
  75. package/dist/models/model.d.ts +2 -0
  76. package/dist/models/model.js +37 -29
  77. package/dist/{mulmat_packed_gpu-BT60jmzP.js → mulmat_packed_gpu-BMFhLwta.js} +1 -17
  78. package/dist/{non_max_suppression_impl-CsEgBuMA.js → non_max_suppression_impl-B2W7YjZB.js} +0 -32
  79. package/dist/ones-CAMiP4I2.js +15 -0
  80. package/dist/ops/adamAdjust.js +1 -1
  81. package/dist/ops/adamMoments.d.ts +1 -1
  82. package/dist/ops/adamMoments.js +4 -4
  83. package/dist/ops/add16.d.ts +2 -0
  84. package/dist/ops/add16.js +9 -0
  85. package/dist/ops/appendCache.js +16 -9
  86. package/dist/ops/attentionMask.js +4 -4
  87. package/dist/ops/concat16.d.ts +2 -0
  88. package/dist/ops/concat16.js +9 -0
  89. package/dist/ops/cpu/adamAdjust.js +14 -13
  90. package/dist/ops/cpu/adamMoments.js +10 -9
  91. package/dist/ops/cpu/appendCache.js +9 -8
  92. package/dist/ops/cpu/attentionMask.js +15 -14
  93. package/dist/ops/cpu/fusedSoftmax.js +13 -12
  94. package/dist/ops/cpu/gatherSub.js +9 -24
  95. package/dist/ops/cpu/gelu.js +13 -12
  96. package/dist/ops/cpu/matMul16.d.ts +1 -0
  97. package/dist/ops/cpu/matMul16.js +16 -0
  98. package/dist/ops/cpu/matMulGelu.js +18 -16
  99. package/dist/ops/cpu/matMulMul.js +8 -7
  100. package/dist/ops/cpu/mulDropout.js +4 -3
  101. package/dist/ops/cpu/normRMS.js +11 -10
  102. package/dist/ops/cpu/qkv.js +17 -13
  103. package/dist/ops/cpu/rope.js +23 -22
  104. package/dist/ops/cpu/scatterSub.js +16 -30
  105. package/dist/ops/dot16.d.ts +2 -0
  106. package/dist/ops/dot16.js +42 -0
  107. package/dist/ops/gatherSub.js +1 -1
  108. package/dist/ops/gelu.js +2 -2
  109. package/dist/ops/grads/add16.d.ts +1 -0
  110. package/dist/ops/grads/add16.js +27 -0
  111. package/dist/ops/grads/attentionMask.js +12 -19
  112. package/dist/ops/grads/gelu.js +4 -3
  113. package/dist/ops/grads/matMul16.d.ts +2 -0
  114. package/dist/ops/grads/matMul16.js +9 -0
  115. package/dist/ops/grads/matMulGelu.js +8 -7
  116. package/dist/ops/grads/normRMS.js +8 -7
  117. package/dist/ops/grads/{fusedSoftmax.d.ts → pack16.d.ts} +1 -1
  118. package/dist/ops/grads/pack16.js +7 -0
  119. package/dist/ops/grads/qkv.d.ts +3 -1
  120. package/dist/ops/grads/qkv.js +28 -22
  121. package/dist/ops/grads/rope.d.ts +2 -1
  122. package/dist/ops/grads/rope.js +6 -13
  123. package/dist/ops/grads/softmax16.d.ts +2 -0
  124. package/dist/ops/grads/softmax16.js +26 -0
  125. package/dist/ops/grads/unpack16.d.ts +2 -0
  126. package/dist/ops/grads/unpack16.js +6 -0
  127. package/dist/ops/grads/utils.d.ts +3 -0
  128. package/dist/ops/grads/utils.js +10 -0
  129. package/dist/ops/matMul16.d.ts +15 -0
  130. package/dist/ops/matMul16.js +13 -0
  131. package/dist/ops/matMulGelu.js +1 -1
  132. package/dist/ops/matMulMul.js +1 -1
  133. package/dist/ops/mul16.d.ts +2 -0
  134. package/dist/ops/mul16.js +8 -0
  135. package/dist/ops/mulDrop.js +1 -1
  136. package/dist/ops/normRMS.js +1 -1
  137. package/dist/ops/pack16.d.ts +2 -0
  138. package/dist/ops/pack16.js +6 -0
  139. package/dist/ops/qkv.d.ts +1 -1
  140. package/dist/ops/qkv.js +8 -4
  141. package/dist/ops/reshape16.d.ts +2 -0
  142. package/dist/ops/reshape16.js +43 -0
  143. package/dist/ops/rope.d.ts +1 -1
  144. package/dist/ops/rope.js +8 -10
  145. package/dist/ops/scatterSub.js +1 -1
  146. package/dist/ops/slice16.d.ts +2 -0
  147. package/dist/ops/slice16.js +9 -0
  148. package/dist/ops/softmax16.d.ts +2 -0
  149. package/dist/ops/softmax16.js +12 -0
  150. package/dist/ops/sub16.d.ts +2 -0
  151. package/dist/ops/sub16.js +8 -0
  152. package/dist/ops/sum16.d.ts +2 -0
  153. package/dist/ops/sum16.js +13 -0
  154. package/dist/ops/transpose16.d.ts +3 -0
  155. package/dist/ops/transpose16.js +41 -0
  156. package/dist/ops/unpack16.d.ts +2 -0
  157. package/dist/ops/unpack16.js +6 -0
  158. package/dist/ops/webgl/adamAdjust.js +3 -2
  159. package/dist/ops/webgl/adamMoments.js +2 -1
  160. package/dist/ops/webgl/appendCache.js +2 -1
  161. package/dist/ops/webgl/attentionMask.js +5 -4
  162. package/dist/ops/webgl/fusedSoftmax.js +6 -4
  163. package/dist/ops/webgl/gatherSub.js +7 -6
  164. package/dist/ops/webgl/gelu.js +3 -2
  165. package/dist/ops/webgl/log.js +12 -27
  166. package/dist/ops/webgl/matMul16.d.ts +1 -0
  167. package/dist/ops/webgl/matMul16.js +37 -0
  168. package/dist/ops/webgl/matMulGelu.js +17 -15
  169. package/dist/ops/webgl/matMulMul.js +13 -12
  170. package/dist/ops/webgl/mulDropout.js +9 -8
  171. package/dist/ops/webgl/normRMS.js +8 -7
  172. package/dist/ops/webgl/qkv.js +6 -5
  173. package/dist/ops/webgl/rope.js +11 -10
  174. package/dist/ops/webgl/scatterSub.js +6 -5
  175. package/dist/ops/webgpu/adamAdjust.js +12 -10
  176. package/dist/ops/webgpu/adamMoments.js +27 -22
  177. package/dist/ops/webgpu/add16.d.ts +1 -0
  178. package/dist/ops/webgpu/add16.js +14 -0
  179. package/dist/ops/webgpu/appendCache.js +64 -17
  180. package/dist/ops/webgpu/attentionMask.js +19 -62
  181. package/dist/ops/webgpu/attentionMask32_program.d.ts +19 -0
  182. package/dist/ops/webgpu/attentionMask32_program.js +54 -0
  183. package/dist/ops/webgpu/concat16.d.ts +19 -0
  184. package/dist/ops/webgpu/concat16.js +128 -0
  185. package/dist/ops/webgpu/gatherSub.js +9 -7
  186. package/dist/ops/webgpu/gelu.js +78 -31
  187. package/dist/ops/webgpu/index.js +12 -0
  188. package/dist/ops/webgpu/matMul16.d.ts +1 -0
  189. package/dist/ops/webgpu/matMul16.js +58 -0
  190. package/dist/ops/webgpu/matMul16_program.d.ts +42 -0
  191. package/dist/ops/webgpu/matMul16_program.js +336 -0
  192. package/dist/ops/webgpu/mul16.d.ts +1 -0
  193. package/dist/ops/webgpu/mul16.js +14 -0
  194. package/dist/ops/webgpu/normRMS.js +21 -40
  195. package/dist/ops/webgpu/normRMS16_program.d.ts +9 -0
  196. package/dist/ops/webgpu/normRMS16_program.js +24 -0
  197. package/dist/ops/webgpu/normRMS32_program.d.ts +9 -0
  198. package/dist/ops/webgpu/normRMS32_program.js +24 -0
  199. package/dist/ops/webgpu/normRMSGrad.js +113 -64
  200. package/dist/ops/webgpu/pack16.d.ts +1 -0
  201. package/dist/ops/webgpu/pack16.js +19 -0
  202. package/dist/ops/webgpu/pack16_program.d.ts +19 -0
  203. package/dist/ops/webgpu/pack16_program.js +92 -0
  204. package/dist/ops/webgpu/qkv.js +20 -55
  205. package/dist/ops/webgpu/rope.js +77 -22
  206. package/dist/ops/webgpu/scatterSub.js +9 -7
  207. package/dist/ops/webgpu/slice16.d.ts +7 -0
  208. package/dist/ops/webgpu/slice16.js +71 -0
  209. package/dist/{variable-Bm2OFwGI.js → ops/webgpu/softmax16.d.ts} +2 -8
  210. package/dist/ops/webgpu/softmax16.js +23 -0
  211. package/dist/ops/webgpu/softmax16_program.d.ts +13 -0
  212. package/dist/ops/webgpu/softmax16_program.js +73 -0
  213. package/dist/ops/webgpu/softmax16_subgroup_program.d.ts +17 -0
  214. package/dist/ops/webgpu/softmax16_subgroup_program.js +75 -0
  215. package/dist/ops/webgpu/softmax16grad.d.ts +1 -0
  216. package/dist/ops/webgpu/softmax16grad.js +38 -0
  217. package/dist/ops/webgpu/sub16.d.ts +1 -0
  218. package/dist/ops/webgpu/sub16.js +14 -0
  219. package/dist/ops/webgpu/sum16.d.ts +1 -0
  220. package/dist/ops/webgpu/sum16.js +40 -0
  221. package/dist/ops/webgpu/transpose16.d.ts +1 -0
  222. package/dist/ops/webgpu/transpose16.js +35 -0
  223. package/dist/ops/webgpu/transpose16_program.d.ts +16 -0
  224. package/dist/ops/webgpu/transpose16_program.js +50 -0
  225. package/dist/ops/webgpu/transpose16_shared_program.d.ts +15 -0
  226. package/dist/ops/webgpu/transpose16_shared_program.js +71 -0
  227. package/dist/ops/webgpu/unpack16.d.ts +1 -0
  228. package/dist/ops/webgpu/unpack16.js +49 -0
  229. package/dist/ops/webgpu/utils/binary_op.d.ts +19 -0
  230. package/dist/ops/webgpu/utils/binary_op.js +79 -0
  231. package/dist/ops/webgpu/utils/deviceInfo.d.ts +7 -0
  232. package/dist/ops/webgpu/utils/deviceInfo.js +11 -0
  233. package/dist/ops/webgpu/utils/reductions.d.ts +32 -4
  234. package/dist/ops/webgpu/utils/reductions.js +236 -45
  235. package/dist/ops-CNI3TwqM.js +645 -0
  236. package/dist/pack16-CFUqumar.js +41 -0
  237. package/dist/{papaparse.min-C8l2Kvo1.js → papaparse.min-C0cScC2i.js} +2 -8
  238. package/dist/{parquet-C0Tlmv9c.js → parquet-BE8MU_ge.js} +201 -278
  239. package/dist/patches/PackedTensor.d.ts +12 -0
  240. package/dist/patches/PackedTensor.js +11 -0
  241. package/dist/patches/engine.d.ts +261 -0
  242. package/dist/patches/engine.js +10 -0
  243. package/dist/patches/tape.d.ts +12 -0
  244. package/dist/patches/tape.js +5 -0
  245. package/dist/patches/webgpu_backend.d.ts +18 -0
  246. package/dist/patches/webgpu_backend.js +57 -0
  247. package/dist/{tensor-CZr4dh61.js → patches/webgpu_base.d.ts} +5 -8
  248. package/dist/patches/webgpu_base.js +34 -0
  249. package/dist/patches/webgpu_program.d.ts +36 -0
  250. package/dist/patches/webgpu_program.js +401 -0
  251. package/dist/{pdf-kJD-f258.js → pdf-NIhmP3sq.js} +424 -428
  252. package/dist/random_width-DY6Kk2Dl.js +10051 -0
  253. package/dist/range-BMS52eQi.js +11 -0
  254. package/dist/reciprocal-CTmshQ9J.js +10 -0
  255. package/dist/{register_all_kernels-DIGpEwcf.js → register_all_kernels-Bwu1PTuU.js} +719 -9766
  256. package/dist/relu-yZ2-7WxU.js +10 -0
  257. package/dist/reshape-DevtBWtf.js +10 -0
  258. package/dist/rope-B5UUMsPi.js +32 -0
  259. package/dist/{scatter_nd_util-BQdz--Gn.js → scatter_nd_util-5EL-8VAQ.js} +1 -1
  260. package/dist/selu_util-D1w6yyTO.js +303 -0
  261. package/dist/{shared-DuP7ue-R.js → shared-BRksrJb3.js} +1 -17
  262. package/dist/shared-BuAXb4CI.js +2145 -0
  263. package/dist/sin-BGfy2HZo.js +16 -0
  264. package/dist/slice-D_gkkqZK.js +13 -0
  265. package/dist/slice_util-DtEldBfK.js +261 -0
  266. package/dist/softmax-ZHVebtR1.js +13 -0
  267. package/dist/split-DrfihRpZ.js +10 -0
  268. package/dist/squeeze-DZEpeblb.js +11 -0
  269. package/dist/stack-yOIAalTq.js +13 -0
  270. package/dist/sum-_fzj5ZTB.js +12 -0
  271. package/dist/tensor-DdQUJZlz.js +909 -0
  272. package/dist/tensor-f35l8Odg.js +8 -0
  273. package/dist/tensor1d-CeZuc-Rv.js +12 -0
  274. package/dist/tensor2d-G4Ys2GxX.js +15 -0
  275. package/dist/tensor4d-B8roDgtc.js +15 -0
  276. package/dist/tensor_util-DV-FP5Q3.js +523 -0
  277. package/dist/tfjs_backend-kNyO5L2d.js +653 -0
  278. package/dist/tile-BzyEiF-F.js +13 -0
  279. package/dist/tokeniser/CharTokeniser.js +1 -1
  280. package/dist/tokeniser/bpe.js +1 -1
  281. package/dist/training/Adam.d.ts +2 -1
  282. package/dist/training/Adam.js +12 -28
  283. package/dist/training/AdamExt.d.ts +1 -0
  284. package/dist/training/AdamExt.js +2 -2
  285. package/dist/training/DatasetBuilder.js +3 -20
  286. package/dist/training/FullTrainer.js +82 -64
  287. package/dist/training/Trainer.d.ts +11 -6
  288. package/dist/training/Trainer.js +51 -39
  289. package/dist/training/sparseCrossEntropy.js +3 -3
  290. package/dist/transpose-DKELTqhe.js +38 -0
  291. package/dist/utilities/arrayClose.js +7 -7
  292. package/dist/utilities/dummy.js +35 -27
  293. package/dist/utilities/multinomialCPU.js +2 -2
  294. package/dist/utilities/packed.d.ts +7 -0
  295. package/dist/utilities/packed.js +716 -0
  296. package/dist/utilities/performance.js +1 -1
  297. package/dist/utilities/profile.js +1 -1
  298. package/dist/utilities/safetensors.js +2 -2
  299. package/dist/utilities/sentences.d.ts +5 -0
  300. package/dist/utilities/sentences.js +41 -0
  301. package/dist/utilities/weights.js +2 -2
  302. package/dist/variable-Bhn5bHYv.js +7 -0
  303. package/dist/{webgpu_program-DkQJOJSd.js → webgpu_program-Cigz-7RF.js} +15 -44
  304. package/dist/webgpu_util-BBCnKm2X.js +65 -0
  305. package/dist/zeros-2gldETuK.js +14 -0
  306. package/package.json +4 -3
  307. package/dist/Reshape-Bowtk9BP.js +0 -127
  308. package/dist/Reshape-DUqYftGC.js +0 -30
  309. package/dist/backend_util-CJIiDoV1.js +0 -749
  310. package/dist/broadcast_to-DzlNweb8.js +0 -44
  311. package/dist/concat-B912vBbo.js +0 -33
  312. package/dist/dropout-C-csYCLj.js +0 -193
  313. package/dist/exports_initializers-B8iZMgQ0.js +0 -16
  314. package/dist/gather-Dnpgw-YQ.js +0 -25
  315. package/dist/index-BzFyqcy-.js +0 -4457
  316. package/dist/index-C1rx_Ajs.js +0 -12076
  317. package/dist/kernel_funcs_utils-DKLK0Mg3.js +0 -466
  318. package/dist/log_sum_exp-DO6z8tSE.js +0 -103
  319. package/dist/mat_mul-DzjTFx-u.js +0 -27
  320. package/dist/mod-Dobti4j4.js +0 -27
  321. package/dist/ones-tIJeHlq-.js +0 -29
  322. package/dist/ops/fusedSoftmax.d.ts +0 -2
  323. package/dist/ops/fusedSoftmax.js +0 -10
  324. package/dist/ops/grads/fusedSoftmax.js +0 -22
  325. package/dist/ops-LuCMAnmM.js +0 -1525
  326. package/dist/random_width-CXVRloNK.js +0 -13670
  327. package/dist/range-CWcz7xFA.js +0 -26
  328. package/dist/reciprocal-C4rNcM-S.js +0 -25
  329. package/dist/relu-BjCh_SYb.js +0 -25
  330. package/dist/reshape-CnIwVG1c.js +0 -25
  331. package/dist/selu_util-OtRzVwW5.js +0 -719
  332. package/dist/shared-DmRsFyaJ.js +0 -3134
  333. package/dist/sin-gpDNRxE0.js +0 -47
  334. package/dist/slice-d0Vo9XTN.js +0 -28
  335. package/dist/softmax-D7Jj3p_P.js +0 -28
  336. package/dist/split-DK2k5eHf.js +0 -25
  337. package/dist/stack-DFatutCx.js +0 -27
  338. package/dist/sum-CJ0ULhmt.js +0 -27
  339. package/dist/tensor1d-vML0r3q6.js +0 -27
  340. package/dist/tensor2d-D76QGjF3.js +0 -30
  341. package/dist/tensor4d-Df1WlVDY.js +0 -30
  342. package/dist/webgpu_util-pLEV9tks.js +0 -80
  343. package/dist/zeros-Bj5rMYA7.js +0 -52
@@ -1,22 +1,7 @@
1
- import { aD as z, ag as v, aE as oe, aF as ie, aG as ae, n as F, aH as me, aI as J, a3 as B, aJ as I, af as T, j as E, aK as H, aL as $e, aM as Y, ae as Te } from "./index-BzFyqcy-.js";
2
- import "./index-Tf7vU29b.js";
3
- import { b as Se } from "./backend_util-CJIiDoV1.js";
4
- /**
5
- * @license
6
- * Copyright 2018 Google LLC. All Rights Reserved.
7
- * Licensed under the Apache License, Version 2.0 (the "License");
8
- * you may not use this file except in compliance with the License.
9
- * You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- * =============================================================================
19
- */
1
+ import { K as z, L as oe, M as ie, N as ae, P as me, Q as J, h as $e } from "./index-ZyQhjEPo.js";
2
+ import { e as v, a as F, i as B, h as I, b as T, s as E, J as H, K as Te, G as Y } from "./tensor-DdQUJZlz.js";
3
+ import "./index-Cp39cXWe.js";
4
+ import { b as Se } from "./backend_util-D-rUb2ty.js";
20
5
  const Re = "model", Ee = ".json", Ce = ".weights.bin";
21
6
  function K(e) {
22
7
  return new Promise((t) => setTimeout(t)).then(e);
@@ -52,22 +37,6 @@ z.registerSaveRouter(we);
52
37
  function Fe(e = "model") {
53
38
  return new N(e);
54
39
  }
55
- /**
56
- * @license
57
- * Copyright 2019 Google LLC. All Rights Reserved.
58
- * Licensed under the Apache License, Version 2.0 (the "License");
59
- * you may not use this file except in compliance with the License.
60
- * You may obtain a copy of the License at
61
- *
62
- * http://www.apache.org/licenses/LICENSE-2.0
63
- *
64
- * Unless required by applicable law or agreed to in writing, software
65
- * distributed under the License is distributed on an "AS IS" BASIS,
66
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
67
- * See the License for the specific language governing permissions and
68
- * limitations under the License.
69
- * =============================================================================
70
- */
71
40
  function Z(e, t, n, r) {
72
41
  a(e), n = n ?? 0, r = r ?? 1, s(n, r);
73
42
  let o = 0;
@@ -83,22 +52,6 @@ function Z(e, t, n, r) {
83
52
  }
84
53
  return Promise.all(e.map(i));
85
54
  }
86
- /**
87
- * @license
88
- * Copyright 2018 Google LLC. All Rights Reserved.
89
- * Licensed under the Apache License, Version 2.0 (the "License");
90
- * you may not use this file except in compliance with the License.
91
- * You may obtain a copy of the License at
92
- *
93
- * http://www.apache.org/licenses/LICENSE-2.0
94
- *
95
- * Unless required by applicable law or agreed to in writing, software
96
- * distributed under the License is distributed on an "AS IS" BASIS,
97
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
98
- * See the License for the specific language governing permissions and
99
- * limitations under the License.
100
- * =============================================================================
101
- */
102
55
  async function ge(e, t) {
103
56
  t == null && (t = {});
104
57
  const n = t.fetchFunc == null ? v().platform.fetch : t.fetchFunc, r = e.map((f) => n(f, t.requestInit, { isBinary: !0 })), s = (t.onProgress == null ? await Promise.all(r) : await Z(r, t.onProgress, 0, 0.5)).map((f) => f.arrayBuffer());
@@ -124,22 +77,6 @@ function _e(e, t) {
124
77
  }
125
78
  });
126
79
  }
127
- /**
128
- * @license
129
- * Copyright 2018 Google LLC. All Rights Reserved.
130
- * Licensed under the Apache License, Version 2.0 (the "License");
131
- * you may not use this file except in compliance with the License.
132
- * You may obtain a copy of the License at
133
- *
134
- * http://www.apache.org/licenses/LICENSE-2.0
135
- *
136
- * Unless required by applicable law or agreed to in writing, software
137
- * distributed under the License is distributed on an "AS IS" BASIS,
138
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139
- * See the License for the specific language governing permissions and
140
- * limitations under the License.
141
- * =============================================================================
142
- */
143
80
  const Ae = "application/octet-stream", Ne = "application/json";
144
81
  class q {
145
82
  constructor(t, n) {
@@ -237,22 +174,6 @@ z.registerLoadRouter(ce);
237
174
  function Ue(e, t) {
238
175
  return new q(e, t);
239
176
  }
240
- /**
241
- * @license
242
- * Copyright 2018 Google LLC. All Rights Reserved.
243
- * Licensed under the Apache License, Version 2.0 (the "License");
244
- * you may not use this file except in compliance with the License.
245
- * You may obtain a copy of the License at
246
- *
247
- * http://www.apache.org/licenses/LICENSE-2.0
248
- *
249
- * Unless required by applicable law or agreed to in writing, software
250
- * distributed under the License is distributed on an "AS IS" BASIS,
251
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
252
- * See the License for the specific language governing permissions and
253
- * limitations under the License.
254
- * =============================================================================
255
- */
256
177
  function L() {
257
178
  let e, t, n, r, o, i, a, s, c, u;
258
179
  return v().getNumber("WEBGL_VERSION") === 2 ? (e = "#version 300 es", t = "in", n = "out", r = "in", o = "texture", i = "outputColor", a = "out vec4 outputColor;", s = v().getBool("WEBGL2_ISNAN_CUSTOM") ? `
@@ -314,22 +235,6 @@ function L() {
314
235
  defineRound: u
315
236
  };
316
237
  }
317
- /**
318
- * @license
319
- * Copyright 2018 Google LLC. All Rights Reserved.
320
- * Licensed under the Apache License, Version 2.0 (the "License");
321
- * you may not use this file except in compliance with the License.
322
- * You may obtain a copy of the License at
323
- *
324
- * http://www.apache.org/licenses/LICENSE-2.0
325
- *
326
- * Unless required by applicable law or agreed to in writing, software
327
- * distributed under the License is distributed on an "AS IS" BASIS,
328
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
- * See the License for the specific language governing permissions and
330
- * limitations under the License.
331
- * =============================================================================
332
- */
333
238
  function V(e, t, n = "index") {
334
239
  const r = B(t);
335
240
  return r.map((o, i) => {
@@ -351,14 +256,14 @@ function Oe(e, t) {
351
256
  o[i] = `(${o[i + 1]} * ${r[i + 1]})`;
352
257
  return o;
353
258
  }
354
- function Lt(e, t, n = "index") {
259
+ function bt(e, t, n = "index") {
355
260
  const r = e.map((i, a) => a), o = Oe(r, t);
356
261
  return o.map((i, a) => {
357
262
  const s = `int ${e[a]} = ${n} / ${o[a]}`, c = a === o.length - 1 ? `int ${e[a + 1]} = ${n} - ${e[a]} * ${o[a]}` : `index -= ${e[a]} * ${o[a]}`;
358
263
  return `${s}; ${c};`;
359
264
  }).join("");
360
265
  }
361
- function bt(e) {
266
+ function Dt(e) {
362
267
  const t = B(e).map((n) => n.toString());
363
268
  return `
364
269
  int getFlatIndex(ivec3 coords) {
@@ -366,14 +271,14 @@ function bt(e) {
366
271
  }
367
272
  `;
368
273
  }
369
- function Dt() {
274
+ function yt() {
370
275
  return `
371
276
  int getFlatIndex(ivec3 coords) {
372
277
  return coords.x * outShapeStrides[0] + coords.y * outShapeStrides[1] + coords.z;
373
278
  }
374
279
  `;
375
280
  }
376
- const yt = `
281
+ const Mt = `
377
282
  const float FLOAT_MAX = 1.70141184e38;
378
283
  const float FLOAT_MIN = 1.17549435e-38;
379
284
 
@@ -413,22 +318,6 @@ const yt = `
413
318
  return c / 255.0;
414
319
  }
415
320
  `;
416
- /**
417
- * @license
418
- * Copyright 2017 Google LLC. All Rights Reserved.
419
- * Licensed under the Apache License, Version 2.0 (the "License");
420
- * you may not use this file except in compliance with the License.
421
- * You may obtain a copy of the License at
422
- *
423
- * http://www.apache.org/licenses/LICENSE-2.0
424
- *
425
- * Unless required by applicable law or agreed to in writing, software
426
- * distributed under the License is distributed on an "AS IS" BASIS,
427
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
428
- * See the License for the specific language governing permissions and
429
- * limitations under the License.
430
- * =============================================================================
431
- */
432
321
  const { getBroadcastDims: ue } = Se;
433
322
  function Le(e, t, n) {
434
323
  const r = [];
@@ -1667,22 +1556,6 @@ function y(e, t) {
1667
1556
  function M(e, t) {
1668
1557
  return t.map((n) => e[n]).join(", ");
1669
1558
  }
1670
- /**
1671
- * @license
1672
- * Copyright 2018 Google LLC. All Rights Reserved.
1673
- * Licensed under the Apache License, Version 2.0 (the "License");
1674
- * you may not use this file except in compliance with the License.
1675
- * You may obtain a copy of the License at
1676
- *
1677
- * http://www.apache.org/licenses/LICENSE-2.0
1678
- *
1679
- * Unless required by applicable law or agreed to in writing, software
1680
- * distributed under the License is distributed on an "AS IS" BASIS,
1681
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1682
- * See the License for the specific language governing permissions and
1683
- * limitations under the License.
1684
- * =============================================================================
1685
- */
1686
1559
  const A = {}, k = {
1687
1560
  alpha: !1,
1688
1561
  antialias: !1,
@@ -1692,7 +1565,7 @@ const A = {}, k = {
1692
1565
  stencil: !1,
1693
1566
  failIfMajorPerformanceCaveat: !0
1694
1567
  };
1695
- function Mt(e, t) {
1568
+ function Bt(e, t) {
1696
1569
  A[e] = t;
1697
1570
  }
1698
1571
  function _(e, t) {
@@ -1724,22 +1597,6 @@ function vt(e, t) {
1724
1597
  n.getContext("webgl", k) || n.getContext("experimental-webgl", k)
1725
1598
  ) : n.getContext("webgl2", k);
1726
1599
  }
1727
- /**
1728
- * @license
1729
- * Copyright 2017 Google LLC. All Rights Reserved.
1730
- * Licensed under the Apache License, Version 2.0 (the "License");
1731
- * you may not use this file except in compliance with the License.
1732
- * You may obtain a copy of the License at
1733
- *
1734
- * http://www.apache.org/licenses/LICENSE-2.0
1735
- *
1736
- * Unless required by applicable law or agreed to in writing, software
1737
- * distributed under the License is distributed on an "AS IS" BASIS,
1738
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1739
- * See the License for the specific language governing permissions and
1740
- * limitations under the License.
1741
- * =============================================================================
1742
- */
1743
1600
  var ee;
1744
1601
  (function(e) {
1745
1602
  e[e.DENSE = 0] = "DENSE", e[e.SHARED_BATCH = 1] = "SHARED_BATCH";
@@ -1752,13 +1609,13 @@ var ne;
1752
1609
  (function(e) {
1753
1610
  e[e.UNPACKED_FLOAT16 = 0] = "UNPACKED_FLOAT16", e[e.UNPACKED_FLOAT32 = 1] = "UNPACKED_FLOAT32", e[e.PACKED_4X1_UNSIGNED_BYTE = 2] = "PACKED_4X1_UNSIGNED_BYTE", e[e.PACKED_2X2_FLOAT32 = 3] = "PACKED_2X2_FLOAT32", e[e.PACKED_2X2_FLOAT16 = 4] = "PACKED_2X2_FLOAT16";
1754
1611
  })(ne || (ne = {}));
1755
- function Bt(e, t) {
1612
+ function kt(e, t) {
1756
1613
  return [t, e];
1757
1614
  }
1758
- function kt(e, t) {
1615
+ function Pt(e, t) {
1759
1616
  return e * t;
1760
1617
  }
1761
- function Pt(e) {
1618
+ function Vt(e) {
1762
1619
  const t = E(e), n = Math.ceil(t / 4);
1763
1620
  return H(n);
1764
1621
  }
@@ -1768,7 +1625,7 @@ function mt(e, t) {
1768
1625
  Math.max(1, Math.ceil(e / 2))
1769
1626
  ];
1770
1627
  }
1771
- function Vt(e, t) {
1628
+ function Wt(e, t) {
1772
1629
  const [n, r] = mt(e, t);
1773
1630
  return n * r * 4;
1774
1631
  }
@@ -1788,22 +1645,6 @@ function de(e, t) {
1788
1645
  textureTypeFloat: d
1789
1646
  };
1790
1647
  }
1791
- /**
1792
- * @license
1793
- * Copyright 2017 Google LLC. All Rights Reserved.
1794
- * Licensed under the Apache License, Version 2.0 (the "License");
1795
- * you may not use this file except in compliance with the License.
1796
- * You may obtain a copy of the License at
1797
- *
1798
- * http://www.apache.org/licenses/LICENSE-2.0
1799
- *
1800
- * Unless required by applicable law or agreed to in writing, software
1801
- * distributed under the License is distributed on an "AS IS" BASIS,
1802
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1803
- * See the License for the specific language governing permissions and
1804
- * limitations under the License.
1805
- * =============================================================================
1806
- */
1807
1648
  function m(e, t) {
1808
1649
  const n = t();
1809
1650
  return v().getBool("DEBUG") && $t(e), n;
@@ -1814,7 +1655,7 @@ function $t(e) {
1814
1655
  throw new Error("WebGL Error: " + Rt(e, t));
1815
1656
  }
1816
1657
  const Tt = 596e-10, St = 65504;
1817
- function Wt(e) {
1658
+ function Xt(e) {
1818
1659
  return !!(v().getBool("WEBGL_RENDER_FLOAT32_ENABLED") || e === 0 || Tt < Math.abs(e) && Math.abs(e) < St);
1819
1660
  }
1820
1661
  function Rt(e, t) {
@@ -1837,10 +1678,10 @@ function Rt(e, t) {
1837
1678
  return `Unknown error code ${t}`;
1838
1679
  }
1839
1680
  }
1840
- function Xt(e, t) {
1681
+ function Ht(e, t) {
1841
1682
  return C(e, () => e.getExtension(t), 'Extension "' + t + '" not supported on this browser.');
1842
1683
  }
1843
- function Ht(e, t) {
1684
+ function Gt(e, t) {
1844
1685
  const n = C(e, () => e.createShader(e.VERTEX_SHADER), "Unable to create vertex WebGLShader.");
1845
1686
  if (m(e, () => e.shaderSource(n, t)), m(e, () => e.compileShader(n)), e.getShaderParameter(n, e.COMPILE_STATUS) === !1)
1846
1687
  throw console.log(e.getShaderInfoLog(n)), new Error("Failed to compile vertex shader.");
@@ -1872,29 +1713,29 @@ function wt(e, t) {
1872
1713
  `)[0]), console.log(`%c ${Y(u[0], s)}`, "border:1px solid red; background-color:#e3d2d2; color:#a61717"), console.log(l.join(`
1873
1714
  `));
1874
1715
  }
1875
- function Gt(e) {
1716
+ function zt(e) {
1876
1717
  return C(e, () => e.createProgram(), "Unable to create WebGLProgram.");
1877
1718
  }
1878
- function zt(e, t) {
1719
+ function qt(e, t) {
1879
1720
  if (m(e, () => e.linkProgram(t)), !v().get("ENGINE_COMPILE_ONLY") && e.getProgramParameter(t, e.LINK_STATUS) === !1)
1880
1721
  throw console.log(e.getProgramInfoLog(t)), new Error("Failed to link vertex and fragment shaders.");
1881
1722
  }
1882
- function qt(e, t) {
1723
+ function jt(e, t) {
1883
1724
  if (m(e, () => e.validateProgram(t)), e.getProgramParameter(t, e.VALIDATE_STATUS) === !1)
1884
1725
  throw console.log(e.getProgramInfoLog(t)), new Error("Shader program validation failed.");
1885
1726
  }
1886
- function jt(e, t) {
1727
+ function Jt(e, t) {
1887
1728
  const n = C(e, () => e.createBuffer(), "Unable to create WebGLBuffer");
1888
1729
  return m(e, () => e.bindBuffer(e.ARRAY_BUFFER, n)), m(e, () => e.bufferData(e.ARRAY_BUFFER, t, e.STATIC_DRAW)), n;
1889
1730
  }
1890
- function Jt(e, t) {
1731
+ function Yt(e, t) {
1891
1732
  const n = C(e, () => e.createBuffer(), "Unable to create WebGLBuffer");
1892
1733
  return m(e, () => e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, n)), m(e, () => e.bufferData(e.ELEMENT_ARRAY_BUFFER, t, e.STATIC_DRAW)), n;
1893
1734
  }
1894
- function Yt(e) {
1735
+ function Kt(e) {
1895
1736
  return C(e, () => e.createTexture(), "Unable to create WebGLTexture.");
1896
1737
  }
1897
- function Kt(e, t) {
1738
+ function Zt(e, t) {
1898
1739
  const n = v().getNumber("WEBGL_MAX_TEXTURE_SIZE");
1899
1740
  if (e <= 0 || t <= 0) {
1900
1741
  const r = `[${e}x${t}]`;
@@ -1905,32 +1746,32 @@ function Kt(e, t) {
1905
1746
  throw new Error("Requested texture size " + r + " greater than WebGL maximum on this browser / GPU " + o + ".");
1906
1747
  }
1907
1748
  }
1908
- function Zt(e) {
1749
+ function Qt(e) {
1909
1750
  return C(e, () => e.createFramebuffer(), "Unable to create WebGLFramebuffer.");
1910
1751
  }
1911
- function Qt(e, t, n, r, o, i, a) {
1752
+ function en(e, t, n, r, o, i, a) {
1912
1753
  const s = e.getAttribLocation(t, n);
1913
1754
  return s === -1 ? !1 : (m(e, () => e.bindBuffer(e.ARRAY_BUFFER, r)), m(e, () => e.vertexAttribPointer(s, o, e.FLOAT, !1, i, a)), m(e, () => e.enableVertexAttribArray(s)), !0);
1914
1755
  }
1915
1756
  function Ft(e, t, n) {
1916
1757
  _t(e, n), m(e, () => e.activeTexture(e.TEXTURE0 + n)), m(e, () => e.bindTexture(e.TEXTURE_2D, t));
1917
1758
  }
1918
- function en(e, t, n) {
1759
+ function tn(e, t, n) {
1919
1760
  return C(e, () => e.getUniformLocation(t, n), 'uniform "' + n + '" not present in program.');
1920
1761
  }
1921
- function tn(e, t, n) {
1762
+ function nn(e, t, n) {
1922
1763
  return e.getUniformLocation(t, n);
1923
1764
  }
1924
- function nn(e, t, n, r) {
1765
+ function rn(e, t, n, r) {
1925
1766
  m(e, () => Ft(e, t, r)), m(e, () => e.uniform1i(n, r));
1926
1767
  }
1927
- function rn(e, t, n) {
1768
+ function on(e, t, n) {
1928
1769
  m(e, () => e.bindFramebuffer(e.FRAMEBUFFER, n)), m(e, () => e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, t, 0));
1929
1770
  }
1930
- function on(e, t) {
1771
+ function an(e, t) {
1931
1772
  m(e, () => e.bindFramebuffer(e.FRAMEBUFFER, t)), m(e, () => e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, null, 0));
1932
1773
  }
1933
- function an(e) {
1774
+ function cn(e) {
1934
1775
  const t = e.checkFramebufferStatus(e.FRAMEBUFFER);
1935
1776
  if (t !== e.FRAMEBUFFER_COMPLETE)
1936
1777
  throw new Error("Error binding framebuffer: " + gt(e, t));
@@ -1973,13 +1814,13 @@ function pe(e) {
1973
1814
  e[e.length - 1]
1974
1815
  ];
1975
1816
  }
1976
- function cn(e) {
1817
+ function sn(e) {
1977
1818
  let t = [1, 1, 1];
1978
1819
  return e.length === 0 || e.length === 1 && e[0] === 1 || (t = [xe(e), ...pe(e)]), t;
1979
1820
  }
1980
- function sn(e, t = !1) {
1821
+ function un(e, t = !1) {
1981
1822
  let n = v().getNumber("WEBGL_MAX_TEXTURE_SIZE"), r = v().getNumber("WEBGL_MAX_SIZE_FOR_NARROW_TEXTURE");
1982
- r === 1 / 0 && v().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE") && (r = n / 2), t && (n = n * 2, r = r * 2, e = e.map((s, c) => c >= e.length - 2 ? $e(e[c]) : e[c]), e.length === 1 && (e = [2, e[0]])), e.length !== 2 && (e = I(e).newShape);
1823
+ r === 1 / 0 && v().getBool("WEBGL_AUTO_SQUARIFY_NARROW_TEXTURE_SHAPE") && (r = n / 2), t && (n = n * 2, r = r * 2, e = e.map((s, c) => c >= e.length - 2 ? Te(e[c]) : e[c]), e.length === 1 && (e = [2, e[0]])), e.length !== 2 && (e = I(e).newShape);
1983
1824
  let o = E(e), i = null;
1984
1825
  e.length <= 1 && o <= n ? i = [1, o] : e.length === 2 && e[0] <= n && e[1] <= n ? i = e : e.length === 3 && e[0] * e[1] <= n && e[2] <= n ? i = [e[0] * e[1], e[2]] : e.length === 3 && e[0] <= n && e[1] * e[2] <= n ? i = [e[0], e[1] * e[2]] : e.length === 4 && e[0] * e[1] * e[2] <= n && e[3] <= n ? i = [e[0] * e[1] * e[2], e[3]] : e.length === 4 && e[0] <= n && e[1] * e[2] * e[3] <= n && (i = [e[0], e[1] * e[2] * e[3]]);
1985
1826
  const a = i != null && Math.max(...i) > r && Math.min(...i) <= (t ? 2 : 1) && Math.min(...i) > 0;
@@ -1995,7 +1836,7 @@ function sn(e, t = !1) {
1995
1836
  function P(e) {
1996
1837
  return e % 2 === 0;
1997
1838
  }
1998
- function un(e, t) {
1839
+ function ln(e, t) {
1999
1840
  if (e = e.slice(-2), t = t.slice(-2), T(e, t) || !e.length || !t.length || e[0] === 0 || e[1] === 0 || t[0] === 0 || t[1] === 0)
2000
1841
  return !0;
2001
1842
  if (e.length !== t.length) {
@@ -2006,21 +1847,21 @@ function un(e, t) {
2006
1847
  return e[1] === t[1] && P(e[0]) && P(t[0]);
2007
1848
  }
2008
1849
  let W, X;
2009
- function ln(e) {
1850
+ function fn(e) {
2010
1851
  if (W == null) {
2011
1852
  const t = _(e);
2012
1853
  W = t.getParameter(t.MAX_TEXTURE_SIZE);
2013
1854
  }
2014
1855
  return W;
2015
1856
  }
2016
- function fn(e) {
1857
+ function hn(e) {
2017
1858
  if (X == null) {
2018
1859
  const t = _(e);
2019
1860
  X = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);
2020
1861
  }
2021
1862
  return Math.min(16, X);
2022
1863
  }
2023
- function hn(e) {
1864
+ function dn(e) {
2024
1865
  if (e === 0)
2025
1866
  return 0;
2026
1867
  let t;
@@ -2030,7 +1871,7 @@ function hn(e) {
2030
1871
  function g(e, t) {
2031
1872
  return e.getExtension(t) != null;
2032
1873
  }
2033
- function dn(e) {
1874
+ function xn(e) {
2034
1875
  try {
2035
1876
  if (_(e) != null)
2036
1877
  return !0;
@@ -2039,7 +1880,7 @@ function dn(e) {
2039
1880
  }
2040
1881
  return !1;
2041
1882
  }
2042
- function xn(e) {
1883
+ function pn(e) {
2043
1884
  if (e === 0)
2044
1885
  return !1;
2045
1886
  const t = _(e);
@@ -2050,7 +1891,7 @@ function xn(e) {
2050
1891
  return !1;
2051
1892
  return G(t);
2052
1893
  }
2053
- function pn(e) {
1894
+ function vn(e) {
2054
1895
  if (e === 0)
2055
1896
  return !1;
2056
1897
  const t = _(e);
@@ -2085,31 +1926,15 @@ function At(e, t) {
2085
1926
  const s = e.checkFramebufferStatus(e.FRAMEBUFFER) === e.FRAMEBUFFER_COMPLETE;
2086
1927
  return e.bindTexture(e.TEXTURE_2D, null), e.bindFramebuffer(e.FRAMEBUFFER, null), e.deleteTexture(r), e.deleteFramebuffer(a), s;
2087
1928
  }
2088
- function vn(e) {
1929
+ function mn(e) {
2089
1930
  return e !== 2 ? !1 : _(e).fenceSync != null;
2090
1931
  }
2091
- function mn(e, t) {
1932
+ function $n(e, t) {
2092
1933
  Array.isArray(e) || (e = [e]), e.forEach((n) => {
2093
1934
  n != null && F(n.dtype !== "complex64", () => `${t} does not support complex64 tensors in the WebGL backend.`);
2094
1935
  });
2095
1936
  }
2096
- /**
2097
- * @license
2098
- * Copyright 2017 Google LLC. All Rights Reserved.
2099
- * Licensed under the Apache License, Version 2.0 (the "License");
2100
- * you may not use this file except in compliance with the License.
2101
- * You may obtain a copy of the License at
2102
- *
2103
- * http://www.apache.org/licenses/LICENSE-2.0
2104
- *
2105
- * Unless required by applicable law or agreed to in writing, software
2106
- * distributed under the License is distributed on an "AS IS" BASIS,
2107
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2108
- * See the License for the specific language governing permissions and
2109
- * limitations under the License.
2110
- * =============================================================================
2111
- */
2112
- function $n(e, t, n, r) {
1937
+ function Tn(e, t, n, r) {
2113
1938
  const o = n.map((l, f) => {
2114
1939
  const d = {
2115
1940
  logicalShape: l.shape,
@@ -2189,7 +2014,7 @@ function re(e, t) {
2189
2014
  throw Error(`Binary was compiled with different texture shapes than the current args. Shape ${s} and ${c} must match`);
2190
2015
  });
2191
2016
  }
2192
- function Tn(e, t, n, r, o) {
2017
+ function Sn(e, t, n, r, o) {
2193
2018
  t.program.enableShapeUniforms || (re(t.inShapeInfos, n), re([t.outShapeInfo], [r]));
2194
2019
  const i = r.texData.texture, a = r.texData.texShape;
2195
2020
  r.texData.isPacked ? e.setOutputPackedMatrixTexture(i.texture, a[0], a[1]) : e.setOutputMatrixTexture(i.texture, a[0], a[1]), e.setProgram(t.webGLProgram), e.bindVertexArray(t.webGLProgram.vao), v().getNumber("WEBGL_VERSION") === 1 && t.infLoc !== null && e.gl.uniform1f(t.infLoc, 1 / 0), t.nanLoc !== null && e.gl.uniform1f(t.nanLoc, NaN);
@@ -2279,7 +2104,7 @@ function Tn(e, t, n, r, o) {
2279
2104
  }
2280
2105
  e.executeProgram();
2281
2106
  }
2282
- function Sn(e, t, n) {
2107
+ function Rn(e, t, n) {
2283
2108
  let r = "";
2284
2109
  t.concat(n).forEach((a) => {
2285
2110
  const s = a.texData != null && a.texData.slice != null && a.texData.slice.flatOffset > 0;
@@ -2295,7 +2120,7 @@ function Sn(e, t, n) {
2295
2120
  const O = B(l);
2296
2121
  x = `${O[0] === c[1]}_${O[O.length - 1] === c[1]}`;
2297
2122
  }
2298
- const p = a.shape.length, $ = l.length === 2 && T(a.shape, c), S = E(a.shape) === 1, R = Te(a.shape, n.shape), w = !e.packedInputs && p === n.shape.length && T(c, n.texData.texShape), ve = e.packedInputs || l.length > 2 ? "" : `${c[0] > 1}_${c[1] > 1}`;
2123
+ const p = a.shape.length, $ = l.length === 2 && T(a.shape, c), S = E(a.shape) === 1, R = $e(a.shape, n.shape), w = !e.packedInputs && p === n.shape.length && T(c, n.texData.texShape), ve = e.packedInputs || l.length > 2 ? "" : `${c[0] > 1}_${c[1] > 1}`;
2299
2124
  r += `${p}_${w}_${u ? f : ""}_${l.length}_${S}_${R}_${$}_${d}_${h}_${x}_${ve}_${s}`;
2300
2125
  } else {
2301
2126
  const c = a.isUniform ? "uniform" : a.texData.texShape;
@@ -2306,66 +2131,66 @@ function Sn(e, t, n) {
2306
2131
  let i = e.constructor.name;
2307
2132
  return i += "_" + r + "_" + o + `${v().getNumber("WEBGL_VERSION")}`, i;
2308
2133
  }
2309
- function Rn(e) {
2134
+ function En(e) {
2310
2135
  return v().getBool("WEBGL_USE_SHAPES_UNIFORMS") && e <= 4;
2311
2136
  }
2312
2137
  export {
2313
- Tn as $,
2138
+ Sn as $,
2314
2139
  mt as A,
2315
- kt as B,
2316
- Vt as C,
2140
+ Pt as B,
2141
+ Wt as C,
2317
2142
  _ as D,
2318
- yt as E,
2319
- Xt as F,
2143
+ Mt as E,
2144
+ Ht as F,
2320
2145
  g as G,
2321
- Zt as H,
2146
+ Qt as H,
2322
2147
  de as I,
2323
- on as J,
2324
- Gt as K,
2325
- zt as L,
2326
- qt as M,
2327
- en as N,
2328
- tn as O,
2148
+ an as J,
2149
+ zt as K,
2150
+ qt as L,
2151
+ jt as M,
2152
+ tn as N,
2153
+ nn as O,
2329
2154
  ee as P,
2330
- nn as Q,
2331
- an as R,
2332
- rn as S,
2155
+ rn as Q,
2156
+ cn as R,
2157
+ on as S,
2333
2158
  te as T,
2334
- Mt as U,
2159
+ Bt as U,
2335
2160
  ne as V,
2336
- cn as W,
2337
- Pt as X,
2338
- Wt as Y,
2339
- Sn as Z,
2340
- $n as _,
2341
- bt as a,
2342
- sn as a0,
2161
+ sn as W,
2162
+ Vt as X,
2163
+ Xt as Y,
2164
+ Rn as Z,
2165
+ Tn as _,
2166
+ Dt as a,
2167
+ un as a0,
2343
2168
  wt as a1,
2344
2169
  Nt as a2,
2345
- mn as a3,
2346
- Lt as b,
2170
+ $n as a3,
2171
+ bt as b,
2347
2172
  V as c,
2348
2173
  xe as d,
2349
2174
  pe as e,
2350
2175
  he as f,
2351
- Dt as g,
2352
- dn as h,
2353
- un as i,
2354
- ln as j,
2355
- fn as k,
2356
- hn as l,
2357
- xn as m,
2358
- pn as n,
2359
- vn as o,
2176
+ yt as g,
2177
+ xn as h,
2178
+ ln as i,
2179
+ fn as j,
2180
+ hn as k,
2181
+ dn as l,
2182
+ pn as m,
2183
+ vn as n,
2184
+ mn as o,
2360
2185
  L as p,
2361
2186
  se as q,
2362
- jt as r,
2363
- Jt as s,
2187
+ Jt as r,
2188
+ Yt as s,
2364
2189
  m as t,
2365
- Rn as u,
2366
- Bt as v,
2367
- Ht as w,
2368
- Qt as x,
2369
- Kt as y,
2370
- Yt as z
2190
+ En as u,
2191
+ kt as v,
2192
+ Gt as w,
2193
+ en as x,
2194
+ Zt as y,
2195
+ Kt as z
2371
2196
  };