@genai-fi/nanogpt 0.13.0 → 0.14.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 (269) hide show
  1. package/dist/Generator.js +576 -576
  2. package/dist/{RealDiv-Bh9xYk2V.js → RealDiv-B2Tyc34U.js} +21 -21
  3. package/dist/{Reshape-DUHZZR3t.js → Reshape-Bqk-z_7-.js} +3 -3
  4. package/dist/{Reshape-Bif3B22e.js → Reshape-D973Ba8R.js} +4 -4
  5. package/dist/TeachableLLM.d.ts +4 -4
  6. package/dist/TeachableLLM.js +60 -59
  7. package/dist/Trainer.d.ts +6 -4
  8. package/dist/Trainer.js +12 -9
  9. package/dist/{axis_util-BHRVWB9q.js → axis_util-RrJzDQJc.js} +1 -1
  10. package/dist/backend.js +2 -2
  11. package/dist/{backend_util-WwsVDDYb.js → backend_util-9wV3yg0r.js} +34 -34
  12. package/dist/{backend_webgpu-C67n_wxv.js → backend_webgpu-CnFoGvzK.js} +8 -8
  13. package/dist/{broadcast_to-Bifjk8mj.js → broadcast_to-hAMmZJpr.js} +2 -2
  14. package/dist/checks/appendCache.js +2 -2
  15. package/dist/checks/attentionMask.js +3 -3
  16. package/dist/checks/gelu.js +2 -2
  17. package/dist/checks/matMulGelu.js +2 -2
  18. package/dist/checks/normRMS.js +6 -6
  19. package/dist/checks/normRMSGrad.js +3 -3
  20. package/dist/checks/packUnpack.js +2 -2
  21. package/dist/checks/qkv.js +2 -2
  22. package/dist/checks/rope.js +13 -15
  23. package/dist/{complex-DHaWzRdN.js → complex-BDvCF_r9.js} +1 -1
  24. package/dist/{concat-BftwuH26.js → concat-B9WckkXa.js} +1 -1
  25. package/dist/{concat_util-B4pv30-l.js → concat_util-DVNU-Nn3.js} +1 -1
  26. package/dist/{dataset-BMe3pbsL.js → dataset-ZUdlBUXV.js} +3 -3
  27. package/dist/{expand_dims-BAYPwrNX.js → expand_dims-DoiHvcDw.js} +1 -1
  28. package/dist/{exports_initializers-CnpflqQc.js → exports_initializers-8SQOHjAF.js} +1 -1
  29. package/dist/floor-B6EO3Z6x.js +18 -0
  30. package/dist/{gather-BsgneLul.js → gather-BYhIiO5e.js} +1 -1
  31. package/dist/{gelu-BtVbXd4E.js → gelu-9_DFp2Q5.js} +1 -1
  32. package/dist/{gpgpu_math-DHr3JJdA.js → gpgpu_math-Dzx_EUJa.js} +37 -37
  33. package/dist/{index-twYeuV3_.js → index-3FfEY3tm.js} +78 -78
  34. package/dist/{index-DmKpsFhj.js → index-B8eBIyjS.js} +89 -89
  35. package/dist/{kernel_funcs_utils-BmhOJVrj.js → kernel_funcs_utils-BLvDeLPe.js} +14 -14
  36. package/dist/layers/BaseLayer.d.ts +3 -4
  37. package/dist/layers/BaseLayer.js +14 -27
  38. package/dist/layers/CausalSelfAttention.d.ts +0 -1
  39. package/dist/layers/CausalSelfAttention.js +41 -49
  40. package/dist/layers/LoRA.js +4 -4
  41. package/dist/layers/MLP.d.ts +6 -2
  42. package/dist/layers/MLP.js +21 -26
  43. package/dist/layers/PositionEmbedding.d.ts +0 -1
  44. package/dist/layers/PositionEmbedding.js +18 -23
  45. package/dist/layers/RMSNorm.d.ts +5 -1
  46. package/dist/layers/RMSNorm.js +10 -9
  47. package/dist/layers/RoPECache.js +12 -12
  48. package/dist/layers/TiedEmbedding.js +6 -6
  49. package/dist/layers/TransformerBlock.d.ts +5 -1
  50. package/dist/layers/TransformerBlock.js +19 -18
  51. package/dist/layers/WeightStore.js +2 -2
  52. package/dist/loader/loadTransformers.d.ts +1 -1
  53. package/dist/loader/loadTransformers.js +31 -24
  54. package/dist/loader/oldZipLoad.js +9 -9
  55. package/dist/loader/save.d.ts +2 -1
  56. package/dist/loader/save.js +38 -31
  57. package/dist/loader/types.d.ts +11 -6
  58. package/dist/main.d.ts +3 -1
  59. package/dist/main.js +39 -35
  60. package/dist/matMul16-Bp17gt56.js +80 -0
  61. package/dist/{matMulGelu-CoUYwB2k.js → matMulGelu-Bdxn3VPX.js} +25 -25
  62. package/dist/{mat_mul-IMBq_zT-.js → mat_mul-BUuYg3qo.js} +1 -1
  63. package/dist/{mod-wCNgNoz8.js → mod-4q-X1J5l.js} +1 -1
  64. package/dist/models/NanoGPTV1.d.ts +3 -3
  65. package/dist/models/NanoGPTV1.js +56 -37
  66. package/dist/models/NanoGPTV2.d.ts +16 -0
  67. package/dist/models/NanoGPTV2.js +87 -0
  68. package/dist/models/config.d.ts +11 -5
  69. package/dist/models/config.js +31 -10
  70. package/dist/models/factory.d.ts +1 -1
  71. package/dist/models/factory.js +6 -3
  72. package/dist/models/model.d.ts +2 -2
  73. package/dist/models/model.js +9 -9
  74. package/dist/{not_equal-DXJHGhGS.js → not_equal-BO_DB61m.js} +23 -23
  75. package/dist/{ones-Cxqz-1RS.js → ones-aGZXepq3.js} +3 -3
  76. package/dist/ops/adamAdjust.d.ts +1 -1
  77. package/dist/ops/adamAdjust.js +4 -4
  78. package/dist/ops/adamMoments.d.ts +2 -2
  79. package/dist/ops/adamMoments.js +2 -2
  80. package/dist/ops/add16.js +1 -1
  81. package/dist/ops/appendCache.js +3 -3
  82. package/dist/ops/attentionMask.js +1 -1
  83. package/dist/ops/concat16.js +2 -2
  84. package/dist/ops/cpu/adamAdjust.js +5 -5
  85. package/dist/ops/cpu/adamMoments.js +5 -5
  86. package/dist/ops/cpu/appendCache.js +6 -6
  87. package/dist/ops/cpu/attentionMask.js +10 -10
  88. package/dist/ops/cpu/fusedSoftmax.js +7 -7
  89. package/dist/ops/cpu/gatherSub.js +6 -6
  90. package/dist/ops/cpu/gelu.js +1 -1
  91. package/dist/ops/cpu/matMul16.js +2 -2
  92. package/dist/ops/cpu/matMulGelu.js +3 -3
  93. package/dist/ops/cpu/matMulMul.js +6 -6
  94. package/dist/ops/cpu/mulDropout.js +5 -5
  95. package/dist/ops/cpu/normRMS.js +5 -5
  96. package/dist/ops/cpu/qkv.js +3 -3
  97. package/dist/ops/cpu/rope.js +5 -5
  98. package/dist/ops/cpu/scatterSub.js +7 -7
  99. package/dist/ops/dot16.js +2 -2
  100. package/dist/ops/gatherSub.js +1 -1
  101. package/dist/ops/gelu.js +2 -2
  102. package/dist/ops/globalNorm.d.ts +2 -0
  103. package/dist/ops/globalNorm.js +13 -0
  104. package/dist/ops/grads/add16.js +1 -1
  105. package/dist/ops/grads/attentionMask.js +2 -2
  106. package/dist/ops/grads/gelu.js +2 -2
  107. package/dist/ops/grads/matMul16.js +5 -4
  108. package/dist/ops/grads/matMulGelu.js +5 -5
  109. package/dist/ops/grads/normRMS.d.ts +1 -0
  110. package/dist/ops/grads/normRMS.js +23 -10
  111. package/dist/ops/grads/pack16.js +3 -3
  112. package/dist/ops/grads/qkv.js +9 -9
  113. package/dist/ops/grads/rope.js +2 -2
  114. package/dist/ops/grads/softmax16.js +1 -1
  115. package/dist/ops/grads/unpack16.js +2 -2
  116. package/dist/ops/matMul16.d.ts +1 -1
  117. package/dist/ops/matMul16.js +3 -3
  118. package/dist/ops/matMulGelu.js +2 -2
  119. package/dist/ops/matMulMul.js +1 -1
  120. package/dist/ops/mul16.js +1 -1
  121. package/dist/ops/mulDrop.js +1 -1
  122. package/dist/ops/normRMS.d.ts +1 -1
  123. package/dist/ops/normRMS.js +3 -3
  124. package/dist/ops/pack16.js +2 -2
  125. package/dist/ops/qkv.js +1 -1
  126. package/dist/ops/reshape16.js +8 -8
  127. package/dist/ops/rope.js +2 -2
  128. package/dist/ops/scatterSub.js +1 -1
  129. package/dist/ops/slice16.js +2 -2
  130. package/dist/ops/softmax16.js +1 -1
  131. package/dist/ops/sub16.js +3 -3
  132. package/dist/ops/sum16.js +2 -2
  133. package/dist/ops/transpose16.js +6 -6
  134. package/dist/ops/unpack16.js +2 -2
  135. package/dist/ops/webgl/adamAdjust.js +17 -18
  136. package/dist/ops/webgl/adamMoments.js +1 -1
  137. package/dist/ops/webgl/appendCache.js +1 -1
  138. package/dist/ops/webgl/attentionMask.js +1 -1
  139. package/dist/ops/webgl/fusedSoftmax.js +7 -7
  140. package/dist/ops/webgl/gatherSub.js +1 -1
  141. package/dist/ops/webgl/gelu.js +2 -2
  142. package/dist/ops/webgl/log.js +5 -5
  143. package/dist/ops/webgl/matMul16.js +30 -21
  144. package/dist/ops/webgl/matMulGelu.js +4 -4
  145. package/dist/ops/webgl/matMulMul.js +2 -2
  146. package/dist/ops/webgl/mulDropout.js +1 -1
  147. package/dist/ops/webgl/normRMS.js +35 -28
  148. package/dist/ops/webgl/qkv.js +1 -1
  149. package/dist/ops/webgl/rope.js +1 -1
  150. package/dist/ops/webgl/scatterSub.js +1 -1
  151. package/dist/ops/webgpu/adamAdjust.js +23 -20
  152. package/dist/ops/webgpu/adamMoments.js +18 -19
  153. package/dist/ops/webgpu/add16.js +6 -6
  154. package/dist/ops/webgpu/appendCache.js +3 -3
  155. package/dist/ops/webgpu/attentionMask.js +2 -2
  156. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  157. package/dist/ops/webgpu/clipScale.d.ts +1 -0
  158. package/dist/ops/webgpu/clipScale.js +56 -0
  159. package/dist/ops/webgpu/concat16.js +12 -12
  160. package/dist/ops/webgpu/gatherSub.js +3 -3
  161. package/dist/ops/webgpu/gelu.js +8 -8
  162. package/dist/ops/webgpu/index.js +2 -0
  163. package/dist/ops/webgpu/matMul16.js +51 -42
  164. package/dist/ops/webgpu/matMul16_program.d.ts +2 -2
  165. package/dist/ops/webgpu/matMul16_program.js +15 -7
  166. package/dist/ops/webgpu/mul16.js +8 -8
  167. package/dist/ops/webgpu/norm2.d.ts +1 -0
  168. package/dist/ops/webgpu/norm2.js +63 -0
  169. package/dist/ops/webgpu/normRMS.js +23 -17
  170. package/dist/ops/webgpu/normRMS16_program.d.ts +2 -1
  171. package/dist/ops/webgpu/normRMS16_program.js +8 -7
  172. package/dist/ops/webgpu/normRMS32_program.d.ts +2 -1
  173. package/dist/ops/webgpu/normRMS32_program.js +8 -7
  174. package/dist/ops/webgpu/normRMSGrad.js +164 -55
  175. package/dist/ops/webgpu/pack16.js +6 -6
  176. package/dist/ops/webgpu/pack16_program.js +2 -2
  177. package/dist/ops/webgpu/qkv.js +4 -4
  178. package/dist/ops/webgpu/rope.js +3 -3
  179. package/dist/ops/webgpu/scatterSub.js +3 -3
  180. package/dist/ops/webgpu/slice16.js +4 -4
  181. package/dist/ops/webgpu/softmax16.js +2 -2
  182. package/dist/ops/webgpu/softmax16_program.js +2 -2
  183. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  184. package/dist/ops/webgpu/softmax16grad.js +1 -1
  185. package/dist/ops/webgpu/sub16.js +5 -5
  186. package/dist/ops/webgpu/sum16.js +3 -3
  187. package/dist/ops/webgpu/transpose16.js +6 -6
  188. package/dist/ops/webgpu/transpose16_program.js +2 -2
  189. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  190. package/dist/ops/webgpu/unpack16.js +5 -5
  191. package/dist/ops/webgpu/utils/binary_op.js +10 -10
  192. package/dist/ops/webgpu/utils/reductions.d.ts +6 -1
  193. package/dist/ops/webgpu/utils/reductions.js +56 -38
  194. package/dist/{ops-CK-zEAOi.js → ops-BLDakU_V.js} +30 -30
  195. package/dist/{pack16--wBZRF6e.js → pack16-F9gxcBrq.js} +6 -6
  196. package/dist/patches/webgpu_backend.js +9 -9
  197. package/dist/patches/webgpu_base.js +1 -1
  198. package/dist/patches/webgpu_program.js +2 -2
  199. package/dist/{random_normal-CzXrZTrF.js → random_normal-dxcPUb9x.js} +1 -1
  200. package/dist/{random_width-dPGM2S8E.js → random_width-DSeITIFc.js} +162 -165
  201. package/dist/{range-BGIYZ9W1.js → range-BvA7g6TS.js} +1 -1
  202. package/dist/{readers-C_41Nuv3.js → readers-lNVRVUDO.js} +2 -2
  203. package/dist/{relu-NsVS0zG3.js → relu-DyGjd4UV.js} +1 -1
  204. package/dist/{reshape-C5l1dyBS.js → reshape-3ugLpT-p.js} +1 -1
  205. package/dist/{resize_nearest_neighbor-B5eJurfr.js → resize_nearest_neighbor-DBPfHMkZ.js} +41 -41
  206. package/dist/{rope-D4uclsO_.js → rope-D5BJXlc7.js} +1 -1
  207. package/dist/{scatter_nd_util-BGx2xTV9.js → scatter_nd_util-6lhBuxGa.js} +1 -1
  208. package/dist/{selu_util-D-1DRWiG.js → selu_util-emNhirms.js} +5 -5
  209. package/dist/{shared-CGPl8HF1.js → shared-DeC0UJkK.js} +35 -35
  210. package/dist/{shared-Bcb0d2u4.js → shared-Wn4Lkf40.js} +1 -1
  211. package/dist/{slice-ESQF8QqJ.js → slice-C1VU5kjs.js} +1 -1
  212. package/dist/{slice_util-BDUbSScY.js → slice_util-5UIO9Akz.js} +1 -1
  213. package/dist/{softmax-DpG1TdjZ.js → softmax-BSXRSMAA.js} +1 -1
  214. package/dist/{split-Bf4VCGWz.js → split-Z_OF59mV.js} +1 -1
  215. package/dist/{squeeze-BoXfWYPq.js → squeeze-DuB_IYFY.js} +2 -2
  216. package/dist/{stack-tOlTq0D8.js → stack-CdjLGyjr.js} +1 -1
  217. package/dist/{step-BKoz1z1b.js → step-CA-PdcE1.js} +1 -1
  218. package/dist/{sum-CgGUPVhu.js → sum-CX6lFpfv.js} +1 -1
  219. package/dist/{tensor-CO6h2H2F.js → tensor-BLWBtdey.js} +1 -1
  220. package/dist/{tensor1d-BJ_lylKX.js → tensor1d-Dp80hTtj.js} +1 -1
  221. package/dist/{tensor2d-C9fH5XJR.js → tensor2d-DryAvP1o.js} +1 -1
  222. package/dist/{tensor4d-BQx_iMD-.js → tensor4d-BR5YioKH.js} +1 -1
  223. package/dist/tfjs_backend-BuO7pU2h.js +674 -0
  224. package/dist/{tile-B3btDHXu.js → tile-CB7Cg2Cm.js} +1 -1
  225. package/dist/training/{Adam.d.ts → AdamW.d.ts} +20 -6
  226. package/dist/training/AdamW.js +97 -0
  227. package/dist/training/BasicTrainer.d.ts +8 -9
  228. package/dist/training/BasicTrainer.js +98 -79
  229. package/dist/training/DatasetBuilder.js +3 -3
  230. package/dist/training/Evaluator.d.ts +8 -3
  231. package/dist/training/Evaluator.js +41 -17
  232. package/dist/training/LRScheduler.d.ts +14 -0
  233. package/dist/training/LRScheduler.js +24 -0
  234. package/dist/training/PreTrainer.d.ts +2 -3
  235. package/dist/training/PreTrainer.js +14 -24
  236. package/dist/training/SFTDatasetBuilder.d.ts +5 -1
  237. package/dist/training/SFTDatasetBuilder.js +34 -30
  238. package/dist/training/SFTTrainer.d.ts +2 -3
  239. package/dist/training/SFTTrainer.js +14 -23
  240. package/dist/training/loss.d.ts +1 -1
  241. package/dist/training/loss.js +4 -4
  242. package/dist/training/sparseCrossEntropy.d.ts +2 -2
  243. package/dist/training/sparseCrossEntropy.js +35 -31
  244. package/dist/training/types.d.ts +6 -1
  245. package/dist/training/validation.js +10 -10
  246. package/dist/{transpose-CU5bO8WU.js → transpose-COw0-lqd.js} +2 -2
  247. package/dist/{unsorted_segment_sum-Bmy800Yn.js → unsorted_segment_sum-C23hrdi0.js} +22 -22
  248. package/dist/utilities/dummy.js +2 -2
  249. package/dist/utilities/multinomialCPU.js +2 -2
  250. package/dist/utilities/packed.js +1 -1
  251. package/dist/utilities/performance.js +1 -1
  252. package/dist/utilities/profile.js +1 -1
  253. package/dist/utilities/safetensors.js +2 -2
  254. package/dist/utilities/sentences.js +5 -5
  255. package/dist/utilities/weights.js +2 -2
  256. package/dist/{variable-CSO68Vcn.js → variable-lnPOlwsK.js} +1 -1
  257. package/dist/{webgpu_program-Snw7BVNc.js → webgpu_program-CuMK2hhh.js} +1 -1
  258. package/dist/{webgpu_util-DSTZn_gU.js → webgpu_util-DWXgz54K.js} +1 -1
  259. package/dist/{zeros-BhOPXbkT.js → zeros-BJogAj4Z.js} +2 -2
  260. package/dist/{zeros_like-DkwhY6XC.js → zeros_like-WQK7VrX-.js} +89 -90
  261. package/package.json +1 -1
  262. package/dist/clip_by_value-Bbo7Ph3o.js +0 -12
  263. package/dist/dropout-5KhWueCy.js +0 -36
  264. package/dist/floor-CAyQGy4W.js +0 -9
  265. package/dist/matMul16-CH8D42Kx.js +0 -76
  266. package/dist/tfjs_backend-DsxmcO2N.js +0 -645
  267. package/dist/training/Adam.js +0 -74
  268. package/dist/training/AdamExt.d.ts +0 -24
  269. package/dist/training/AdamExt.js +0 -44
package/dist/Generator.js CHANGED
@@ -1,40 +1,40 @@
1
1
  import { E as Ui } from "./index-DvYrXKkX.js";
2
- import { o as Hi, q as Xi, E as Ki, dn as Ss, am as pe, aa as _, ar as oo, as as ao, e as Oe, aZ as Dt, ax as ro, ay as io, at as ji, au as Ft, aC as Ge, ad as co, aF as ws, aG as qi, U as G, ae as _e, aH as Yi, H as Ns, aI as Rs, R as Qi, ah as Zi, x as te, D as lo, _ as Ne, a8 as ee, bd as uo, c9 as Ts, ca as Es, cQ as po, bo as ho, af as ue, Q as Ye, bp as fo, bq as mo, cb as go, cc as Ds, cd as Fs, ce as Ps, cf as Os, cg as As, br as xo, ab as nt, cA as Co, cR as bo, cS as Io, bu as ko, bt as yo, bf as $o, dg as vo, C as _s, cU as So, an as wo, z as No, bv as Ro, c4 as $e, cF as To, bw as Eo, cB as Do, cV as Fo, cC as Po, bx as Ls, by as Vs, bh as Oo, bz as Ao, ak as Qe, V as Ji, bA as _o, cD as Lo, ch as Vo, bB as Wo, cH as Mo, cI as Bo, dh as Go, ci as zo, bZ as ns, bT as St, bW as Ws, cW as kn, dv as ut, dw as Uo, cX as yn, di as ec, N as tc, bg as Ho, cY as Xo, bD as Ms, A as Ko, aW as jo, aU as mt, cr as qo, de as Yo, df as Qo, bi as Zo, cG as Jo, dk as ea, aj as ta, G as sa, cs as na, cj as Bs, ck as Gs, cl as zs, dl as oa, b5 as Us, b6 as Hs, bF as Xs, cn as Ks, cm as aa, c_ as ra, aL as sc, bG as ia, cE as ca, c$ as la, d0 as ua, dm as da, aO as pa, a_ as ha, co as fa, bS as ma, M as js, I as ga, bk as xa, bm as Ca, bl as ba, bH as Ia, d5 as ka, bI as ya, P as $a, a6 as va, bJ as Sa, d1 as qs, dx as wa, dy as Na, dz as Ra, Z as Ta, cp as Ys, bb as Ea, d2 as Da, bc as Fa, d3 as Pa, bL as Oa, bj as Aa, b8 as Qs, ai as _a, dp as La, aK as Va, bN as Zs, cq as Js, bO as en, bP as tn, bE as sn, bK as Wa, dA as Ma, dB as Ba, dq as Ga, dr as za, ds as Ua, J as Ha, d4 as Xa, aJ as nn, ct as Ka, dt as ja, dC as qa, dD as Ya, cu as on, bs as an, du as Qa, T as Za, cv as Ja, bn as er, a5 as rn, cw as tr, ba as sr, bQ as nr, f as or, dE as ar, dF as $n, av as vn, aw as nc, t as rr, a as oc, dG as ac, dH as rc, c2 as ic, aq as cc, bR as lc, bX as uc, S as dc, bY as pc, aP as hc, ap as fc, bU as mc, bV as gc, b_ as xc, aR as ir, bC as Cc, aM as bc, b$ as Ic, F as kc, c0 as yc, dj as $c, b1 as vc, b2 as Sc, b3 as wc, b4 as Nc, aN as Rc, c1 as Tc, b7 as Ec, c7 as Dc, ao as Fc, c3 as Pc, aV as cr, bM as Oc, aE as Ac, c5 as _c, b9 as Lc, c6 as Vc, k as Wc } from "./index-twYeuV3_.js";
3
- import { n as Mc } from "./random_width-dPGM2S8E.js";
4
- import { t as Bc } from "./zeros_like-DkwhY6XC.js";
2
+ import { o as Hi, q as Xi, E as Ki, dn as Ss, am as pe, a8 as _, ar as oo, as as ao, e as Oe, a_ as Dt, ax as ro, ay as io, at as ji, au as Ft, aD as Ge, ab as co, aG as ws, aH as qi, N as G, ac as _e, aI as Yi, D as Ns, aJ as Rs, R as Qi, af as Zi, x as te, B as lo, Y as Ne, a6 as ee, bd as uo, c9 as Ts, ca as Es, cQ as po, bo as ho, ad as ue, L as Ye, bp as fo, bq as mo, cb as go, cc as Ds, cd as Fs, ce as Ps, cf as Os, cg as As, br as xo, a9 as nt, cA as Co, cR as bo, cS as Io, bu as yo, bt as ko, bf as $o, dg as vo, aj as _s, cU as So, an as wo, C as No, bv as Ro, c4 as $e, cF as To, bw as Eo, cB as Do, cV as Fo, cC as Po, bx as Ls, by as Vs, bh as Oo, bz as Ao, ai as Qe, Q as Ji, bA as _o, cD as Lo, ch as Vo, bB as Wo, cH as Mo, cI as Bo, dh as Go, ci as zo, bZ as ns, bT as St, bW as Ws, cW as yn, dv as ut, dw as Uo, cX as kn, di as ec, K as tc, bg as Ho, cY as Xo, bD as Ms, z as Ko, aX as jo, aV as mt, cr as qo, de as Yo, df as Qo, bi as Zo, cG as Jo, dk as ea, ah as ta, G as sa, cs as na, cj as Bs, ck as Gs, cl as zs, dl as oa, b5 as Us, b6 as Hs, bF as Xs, cn as Ks, cm as aa, c_ as ra, aM as sc, bG as ia, cE as ca, c$ as la, d0 as ua, dm as da, aP as pa, a$ as ha, co as fa, bS as ma, M as js, F as ga, bk as xa, bm as Ca, bl as ba, bH as Ia, d5 as ya, bI as ka, P as $a, a4 as va, bJ as Sa, d1 as qs, dx as wa, dy as Na, dz as Ra, X as Ta, cp as Ys, bb as Ea, d2 as Da, bc as Fa, d3 as Pa, bL as Oa, bj as Aa, b8 as Qs, ag as _a, dp as La, aL as Va, bN as Zs, cq as Js, bO as en, bP as tn, bE as sn, bK as Wa, dA as Ma, dB as Ba, dq as Ga, dr as za, ds as Ua, H as Ha, d4 as Xa, aK as nn, ct as Ka, dt as ja, dC as qa, dD as Ya, cu as on, bs as an, du as Qa, T as Za, cv as Ja, bn as er, a3 as rn, cw as tr, ba as sr, bQ as nr, c as or, dE as ar, dF as $n, av as vn, aw as nc, t as rr, a as oc, dG as ac, dH as rc, c2 as ic, aq as cc, bR as lc, bX as uc, S as dc, bY as pc, aQ as hc, ap as fc, bU as mc, bV as gc, b_ as xc, aS as ir, bC as Cc, aN as bc, b$ as Ic, ak as yc, c0 as kc, dj as $c, b1 as vc, b2 as Sc, b3 as wc, b4 as Nc, aO as Rc, c1 as Tc, b7 as Ec, c7 as Dc, ao as Fc, c3 as Pc, aW as cr, bM as Oc, aF as Ac, c5 as _c, b9 as Lc, c6 as Vc, k as Wc } from "./index-3FfEY3tm.js";
3
+ import { n as Mc } from "./random_width-DSeITIFc.js";
4
+ import { t as Bc } from "./zeros_like-WQK7VrX-.js";
5
5
  import "./index-Cp39cXWe.js";
6
- import "./dataset-BMe3pbsL.js";
7
- import { a as j, u as ae, c as ot, i as at, b as Gc, d as wt, t as Re, e as gt, f as dt, g as lr, r as Nt, h as Ae, j as zc, k as Uc, l as cn, z as Hc, m as ln, n as ur, o as Xc, p as Kc, q as jc, v as qc, w as Yc, x as Qc, y as Zc, A as Jc, B as el, C as tl, D as lt, E as sl, F as nl, G as dr, H as ol, I as al, J as rl, K as il, L as cl, M as ll, N as ul, O as dl, P as pl, Q as hl, R as fl, S as ml, T as gl, U as xl, V as Cl, W as bl, X as Il, Y as kl, Z as yl, _ as $l, $ as vl, a0 as Sl, a1 as wl, a2 as Nl, a3 as Rl, a4 as Tl, a5 as El, a6 as Dl, a7 as Fl, a8 as Pl, a9 as Ol, aa as Al, ab as _l, ac as Ll, ad as Vl, ae as Wl, af as Ml, ag as Bl, ah as Gl, ai as zl } from "./shared-CGPl8HF1.js";
6
+ import "./dataset-ZUdlBUXV.js";
7
+ import { a as j, u as ae, c as ot, i as at, b as Gc, d as wt, t as Re, e as gt, f as dt, g as lr, r as Nt, h as Ae, j as zc, k as Uc, l as cn, z as Hc, m as ln, n as ur, o as Xc, p as Kc, q as jc, v as qc, w as Yc, x as Qc, y as Zc, A as Jc, B as el, C as tl, D as lt, E as sl, F as nl, G as dr, H as ol, I as al, J as rl, K as il, L as cl, M as ll, N as ul, O as dl, P as pl, Q as hl, R as fl, S as ml, T as gl, U as xl, V as Cl, W as bl, X as Il, Y as yl, Z as kl, _ as $l, $ as vl, a0 as Sl, a1 as wl, a2 as Nl, a3 as Rl, a4 as Tl, a5 as El, a6 as Dl, a7 as Fl, a8 as Pl, a9 as Ol, aa as Al, ab as _l, ac as Ll, ad as Vl, ae as Wl, af as Ml, ag as Bl, ah as Gl, ai as zl } from "./shared-DeC0UJkK.js";
8
8
  import { m as pt, g as pr, s as Ul, c as Hl, b as Xl, d as Kl, a as jl, e as ql } from "./complex_util-Yc1A_gV1.js";
9
- import { a as ge, b as xe, d as ye, c as ve, e as Te, g as os } from "./axis_util-BHRVWB9q.js";
10
- import { k as Ze, h as Le, i as Je, j as rt, b as Se, d as xt, g as as } from "./step-BKoz1z1b.js";
11
- import { z as rs, A as is, B as cs, C as hr, D as fr, F as mr, G as gr, H as xr, I as Cr, J as br, y as Ir, x as kr, w as yr, u as $r, t as vr, E as Sr, K as wr, L as Nr, M as Rr, N as Tr, c as Er, f as Yl, O as Ql, P as Zl } from "./backend_util-WwsVDDYb.js";
12
- import { a as Dr, c as Ue } from "./concat_util-B4pv30-l.js";
9
+ import { a as ge, b as xe, d as ke, c as ve, e as Te, g as os } from "./axis_util-RrJzDQJc.js";
10
+ import { k as Ze, h as Le, i as Je, j as rt, b as Se, d as xt, g as as } from "./step-CA-PdcE1.js";
11
+ import { z as rs, A as is, B as cs, C as hr, D as fr, F as mr, G as gr, H as xr, I as Cr, J as br, y as Ir, x as yr, w as kr, u as $r, t as vr, E as Sr, K as wr, L as Nr, M as Rr, N as Tr, c as Er, f as Yl, O as Ql, P as Zl } from "./backend_util-9wV3yg0r.js";
12
+ import { a as Dr, c as Ue } from "./concat_util-DVNU-Nn3.js";
13
13
  import { s as Jl } from "./index-CieiGp4Y.js";
14
14
  import { n as Fr, b as Pr, a as Or } from "./non_max_suppression_impl-B2W7YjZB.js";
15
- import { c as Ct } from "./scatter_nd_util-BGx2xTV9.js";
16
- import { S as Ar, a as _r } from "./selu_util-D-1DRWiG.js";
17
- import { b as Lr, d as Vr, p as eu, a as tu, i as su, c as nu } from "./slice_util-BDUbSScY.js";
18
- import { h as Sn, j as ou, k as au, l as ru, m as iu, n as cu, o as lu, P as un, p as Ve, u as Pe, q as Wr, c as Mr, T as De, E as Br, g as Gr, a as zr, r as uu, s as du, t as Y, v as Pt, w as pu, x as wn, y as hu, z as fu, A as Ot, B as mu, C as gu, D as bs, F as Gt, G as zt, H as xu, I as Cu, J as Nn, K as bu, L as Iu, M as fs, N as ku, O as yu, Q as $u, R as Ut, S as ms, U as vu, f as he, V as be, W as Ht, X as Xt, Y as Su, d as Rn, e as Tn, i as Ur, Z as wu, _ as Nu, $ as Ru, a0 as Tu, a1 as Eu, a2 as Du, a3 as At } from "./gpgpu_math-DHr3JJdA.js";
19
- import { s as Hr, a as Fu, t as Xr, b as Pu, c as Ou, d as Kr, e as Au, n as _u, f as Lu, g as Vu, h as Wu, i as Mu, j as Bu, k as Gu, l as zu, o as Uu, p as Hu, q as Xu, r as Ku, u as ju, v as qu, w as Yu, x as Qu, y as Zu, z as Ju, A as ed, B as td, C as sd, D as nd, E as od, F as ad, G as rd, H as id, I as cd, J as ld, K as ud, L as dd, M as jr, N as pd, O as hd, P as fd, Q as md, R as gd, S as xd, T as Cd, U as bd, V as Id, W as kd } from "./shared-Bcb0d2u4.js";
20
- import { a as ke, c as yd, U as st, d as qe, e as ze, A as En, f as bt, B as dn, h as pn, m as Rt, u as se, C as We, b as Ce, i as Fe, j as hn, k as it, l as It, n as $d, o as vd, p as Sd, q as wd } from "./kernel_funcs_utils-BmhOJVrj.js";
21
- import { R as Nd, r as U, a as Rd } from "./Reshape-Bif3B22e.js";
22
- import { M as qr } from "./matMulGelu-CoUYwB2k.js";
23
- import { t as Yr, s as fn, a as _t, m as Td, r as Ed, b as Dd, c as Fd, d as Pd } from "./RealDiv-Bh9xYk2V.js";
24
- import { z as Od } from "./zeros-BhOPXbkT.js";
15
+ import { c as Ct } from "./scatter_nd_util-6lhBuxGa.js";
16
+ import { S as Ar, a as _r } from "./selu_util-emNhirms.js";
17
+ import { b as Lr, d as Vr, p as eu, a as tu, i as su, c as nu } from "./slice_util-5UIO9Akz.js";
18
+ import { h as Sn, j as ou, k as au, l as ru, m as iu, n as cu, o as lu, P as un, p as Ve, u as Pe, q as Wr, c as Mr, T as De, E as Br, g as Gr, a as zr, r as uu, s as du, t as Y, v as Pt, w as pu, x as wn, y as hu, z as fu, A as Ot, B as mu, C as gu, D as bs, F as Gt, G as zt, H as xu, I as Cu, J as Nn, K as bu, L as Iu, M as fs, N as yu, O as ku, Q as $u, R as Ut, S as ms, U as vu, f as he, V as be, W as Ht, X as Xt, Y as Su, d as Rn, e as Tn, i as Ur, Z as wu, _ as Nu, $ as Ru, a0 as Tu, a1 as Eu, a2 as Du, a3 as At } from "./gpgpu_math-Dzx_EUJa.js";
19
+ import { s as Hr, a as Fu, t as Xr, b as Pu, c as Ou, d as Kr, e as Au, n as _u, f as Lu, g as Vu, h as Wu, i as Mu, j as Bu, k as Gu, l as zu, o as Uu, p as Hu, q as Xu, r as Ku, u as ju, v as qu, w as Yu, x as Qu, y as Zu, z as Ju, A as ed, B as td, C as sd, D as nd, E as od, F as ad, G as rd, H as id, I as cd, J as ld, K as ud, L as dd, M as jr, N as pd, O as hd, P as fd, Q as md, R as gd, S as xd, T as Cd, U as bd, V as Id, W as yd } from "./shared-Wn4Lkf40.js";
20
+ import { a as ye, c as kd, U as st, d as qe, e as ze, A as En, f as bt, B as dn, h as pn, m as Rt, u as se, C as We, b as Ce, i as Fe, j as hn, k as it, l as It, n as $d, o as vd, p as Sd, q as wd } from "./kernel_funcs_utils-BLvDeLPe.js";
21
+ import { R as Nd, r as U, a as Rd } from "./Reshape-D973Ba8R.js";
22
+ import { M as qr } from "./matMulGelu-Bdxn3VPX.js";
23
+ import { t as Yr, s as fn, a as _t, m as Td, r as Ed, b as Dd, c as Fd, d as Pd } from "./RealDiv-B2Tyc34U.js";
24
+ import { z as Od } from "./zeros-BJogAj4Z.js";
25
25
  import "./ops/cpu/attentionMask.js";
26
26
  import "./ops/webgl/attentionMask.js";
27
27
  import "./ops/grads/attentionMask.js";
28
28
  import "./ops/cpu/rope.js";
29
29
  import "./ops/webgl/rope.js";
30
- import "./rope-D4uclsO_.js";
30
+ import "./rope-D5BJXlc7.js";
31
31
  import "./ops/cpu/appendCache.js";
32
32
  import "./ops/webgl/appendCache.js";
33
33
  import "./ops/grads/softmax16.js";
34
- import "./matMul16-CH8D42Kx.js";
34
+ import "./matMul16-Bp17gt56.js";
35
35
  import "./ops/webgl/matMul16.js";
36
36
  import "./ops/cpu/matMul16.js";
37
- import "./pack16--wBZRF6e.js";
37
+ import "./pack16-F9gxcBrq.js";
38
38
  import "./ops/transpose16.js";
39
39
  import "./ops/reshape16.js";
40
40
  import "./ops/cpu/qkv.js";
@@ -62,17 +62,17 @@ import "./ops/cpu/matMulGelu.js";
62
62
  import "./ops/grads/matMulGelu.js";
63
63
  import "./ops/cpu/gelu.js";
64
64
  import "./ops/webgl/gelu.js";
65
- import "./gelu-BtVbXd4E.js";
65
+ import "./gelu-9_DFp2Q5.js";
66
66
  import "./ops/webgl/log.js";
67
67
  import "./checks/normRMS.js";
68
68
  import "./checks/normRMSGrad.js";
69
69
  import Wd from "./utilities/multinomialCPU.js";
70
- import { r as Dn } from "./reshape-C5l1dyBS.js";
71
- import { t as Kt } from "./tensor2d-C9fH5XJR.js";
72
- import { z as Md } from "./unsorted_segment_sum-Bmy800Yn.js";
73
- import { s as gs } from "./softmax-DpG1TdjZ.js";
74
- import { g as Bd } from "./gather-BsgneLul.js";
75
- import { c as Gd } from "./concat-BftwuH26.js";
70
+ import { r as Dn } from "./reshape-3ugLpT-p.js";
71
+ import { t as Kt } from "./tensor2d-DryAvP1o.js";
72
+ import { z as Md } from "./unsorted_segment_sum-C23hrdi0.js";
73
+ import { s as gs } from "./softmax-BSXRSMAA.js";
74
+ import { g as Bd } from "./gather-BYhIiO5e.js";
75
+ import { c as Gd } from "./concat-B9WckkXa.js";
76
76
  function zd(a, t, e, n = !1) {
77
77
  const s = Xi(a, "logits", "multinomial"), o = s.size, r = s.rank;
78
78
  if (o < 2)
@@ -316,7 +316,7 @@ function ni(a) {
316
316
  j([s, o], "matMul");
317
317
  const i = s.shape.length, l = o.shape.length, u = r ? s.shape[i - 2] : s.shape[i - 1], p = c ? o.shape[l - 1] : o.shape[l - 2], d = r ? s.shape[i - 1] : s.shape[i - 2], h = c ? o.shape[l - 2] : o.shape[l - 1], f = s.shape.slice(0, -2), m = o.shape.slice(0, -2), x = G(f), g = G(m), I = Ne(s.shape.slice(0, -2), o.shape.slice(0, -2)).concat([d, h]);
318
318
  te(u === p, () => `Error in matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${s.shape} and ${o.shape} and transposeA=${r} and transposeB=${c} must match.`);
319
- const b = r ? [x, u, d] : [x, d, u], k = c ? [g, h, p] : [g, p, h], y = ce({ inputs: { x: s }, backend: e, attrs: { shape: b } }), $ = ce({ inputs: { x: o }, backend: e, attrs: { shape: k } }), v = r ? y.shape[1] : y.shape[2], w = r ? y.shape[2] : y.shape[1], S = c ? $.shape[1] : $.shape[2], E = Math.max(x, g), P = e.data.get(y.dataId).values, D = e.data.get($.dataId).values, F = ee(y.shape), R = ee($.shape), [T, A, N] = r ? [F[0], 1, F[1]] : [F[0], F[1], 1], [O, V, L] = c ? [1, R[1], R[0]] : [R[1], 1, R[0]], B = w * S, W = pe([E, w, S], y.dtype), z = W.values, M = e.blockSize;
319
+ const b = r ? [x, u, d] : [x, d, u], y = c ? [g, h, p] : [g, p, h], k = ce({ inputs: { x: s }, backend: e, attrs: { shape: b } }), $ = ce({ inputs: { x: o }, backend: e, attrs: { shape: y } }), v = r ? k.shape[1] : k.shape[2], w = r ? k.shape[2] : k.shape[1], S = c ? $.shape[1] : $.shape[2], E = Math.max(x, g), P = e.data.get(k.dataId).values, D = e.data.get($.dataId).values, F = ee(k.shape), R = ee($.shape), [T, A, N] = r ? [F[0], 1, F[1]] : [F[0], F[1], 1], [O, V, L] = c ? [1, R[1], R[0]] : [R[1], 1, R[0]], B = w * S, W = pe([E, w, S], k.dtype), z = W.values, M = e.blockSize;
320
320
  for (let H = 0; H < E; H++) {
321
321
  const K = H % x, Q = H % g;
322
322
  for (let q = 0; q < w; q += M) {
@@ -344,7 +344,7 @@ function ni(a) {
344
344
  }
345
345
  }
346
346
  }
347
- return e.disposeIntermediateTensorInfo(y), e.disposeIntermediateTensorInfo($), e.makeTensorInfo(I, W.dtype, W.values);
347
+ return e.disposeIntermediateTensorInfo(k), e.disposeIntermediateTensorInfo($), e.makeTensorInfo(I, W.dtype, W.values);
348
348
  }
349
349
  const Jd = {
350
350
  kernelName: lo,
@@ -398,14 +398,14 @@ function cp(a) {
398
398
  let i = c;
399
399
  const l = ge(i, s.shape.length);
400
400
  let u = s;
401
- l != null && (u = Re({ inputs: { x: s }, backend: e, attrs: { perm: l } }), i = xe(i.length, s.shape.length)), ye("all", i, u.shape.length);
401
+ l != null && (u = Re({ inputs: { x: s }, backend: e, attrs: { perm: l } }), i = xe(i.length, s.shape.length)), ke("all", i, u.shape.length);
402
402
  const [p, d] = ve(u.shape, i), h = G(d), f = Ye(G(p), u.dtype), m = e.data.get(u.dataId).values;
403
403
  for (let g = 0; g < f.length; ++g) {
404
404
  const C = g * h;
405
405
  let I = m[C];
406
406
  for (let b = 0; b < h; ++b) {
407
- const k = m[C + b];
408
- I = I && k;
407
+ const y = m[C + b];
408
+ I = I && y;
409
409
  }
410
410
  f[g] = I;
411
411
  }
@@ -429,14 +429,14 @@ function up(a) {
429
429
  let i = c;
430
430
  const l = ge(i, s.shape.length);
431
431
  let u = s;
432
- l != null && (u = Re({ inputs: { x: s }, backend: e, attrs: { perm: l } }), i = xe(i.length, s.shape.length)), ye("any", i, u.shape.length);
432
+ l != null && (u = Re({ inputs: { x: s }, backend: e, attrs: { perm: l } }), i = xe(i.length, s.shape.length)), ke("any", i, u.shape.length);
433
433
  const [p, d] = ve(u.shape, i), h = G(d), f = Ye(G(p), u.dtype), m = e.data.get(u.dataId).values;
434
434
  for (let g = 0; g < f.length; ++g) {
435
435
  const C = g * h;
436
436
  let I = m[C];
437
437
  for (let b = 0; b < h; ++b) {
438
- const k = m[C + b];
439
- I = I || k;
438
+ const y = m[C + b];
439
+ I = I || y;
440
440
  }
441
441
  f[g] = I;
442
442
  }
@@ -460,14 +460,14 @@ function pp(a) {
460
460
  const c = ge(r, s.shape.length);
461
461
  let i = s;
462
462
  const l = [];
463
- c != null && (i = Re({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), r = [r[0]], ye("argMax", r, i.shape.length);
463
+ c != null && (i = Re({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), r = [r[0]], ke("argMax", r, i.shape.length);
464
464
  const [u, p] = ve(i.shape, r), d = G(u), h = Ye(d, "int32"), f = G(p), m = e.data.get(i.dataId).values;
465
465
  for (let x = 0; x < h.length; ++x) {
466
466
  const g = x * f;
467
467
  let C = m[g], I = 0;
468
468
  for (let b = 0; b < f; ++b) {
469
- const k = m[g + b];
470
- k > C && (C = k, I = b);
469
+ const y = m[g + b];
470
+ y > C && (C = y, I = b);
471
471
  }
472
472
  h[x] = I;
473
473
  }
@@ -485,14 +485,14 @@ function fp(a) {
485
485
  const c = ge(r, s.shape.length);
486
486
  let i = s;
487
487
  const l = [];
488
- c != null && (i = Re({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), r = [r[0]], ye("argMin", r, i.shape.length);
488
+ c != null && (i = Re({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), r = [r[0]], ke("argMin", r, i.shape.length);
489
489
  const [u, p] = ve(i.shape, r), d = G(u), h = Ye(d, "int32"), f = G(p), m = e.data.get(i.dataId).values;
490
490
  for (let x = 0; x < h.length; ++x) {
491
491
  const g = x * f;
492
492
  let C = m[g], I = 0;
493
493
  for (let b = 0; b < f; ++b) {
494
- const k = m[g + b];
495
- k < C && (C = k, I = b);
494
+ const y = m[g + b];
495
+ y < C && (C = y, I = b);
496
496
  }
497
497
  h[x] = I;
498
498
  }
@@ -513,12 +513,12 @@ const Cp = ae(Fs, (a) => Math.asinh(a)), bp = {
513
513
  backendName: "cpu",
514
514
  kernelFunc: Cp
515
515
  };
516
- const Ip = ae(Ps, (a) => Math.atan(a)), kp = {
516
+ const Ip = ae(Ps, (a) => Math.atan(a)), yp = {
517
517
  kernelName: Ps,
518
518
  backendName: "cpu",
519
519
  kernelFunc: Ip
520
520
  };
521
- const yp = ot((a, t) => Math.atan2(a, t)), $p = gt(Os, yp), vp = {
521
+ const kp = ot((a, t) => Math.atan2(a, t)), $p = gt(Os, kp), vp = {
522
522
  kernelName: Os,
523
523
  backendName: "cpu",
524
524
  kernelFunc: $p
@@ -531,15 +531,15 @@ const Sp = ae(As, (a) => Math.atanh(a)), wp = {
531
531
  function mn(a, t, e, n, s, o) {
532
532
  const r = s.strideHeight, c = s.strideWidth, i = s.dilationHeight, l = s.dilationWidth, u = s.effectiveFilterHeight, p = s.effectiveFilterWidth, d = s.padInfo.top, h = s.padInfo.left, f = o === "max" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, m = pe(s.outShape, e), x = m.values, g = s.outShape[1] * s.outShape[2] * s.outShape[3], C = s.outShape[2] * s.outShape[3], I = s.outShape[3];
533
533
  for (let b = 0; b < s.batchSize; ++b) {
534
- const k = b * g, y = b * n[0];
534
+ const y = b * g, k = b * n[0];
535
535
  for (let $ = 0; $ < s.inChannels; ++$)
536
536
  for (let v = 0; v < s.outHeight; ++v) {
537
- const w = v * r - d, S = Math.max(0, w), E = Math.min(s.inHeight, u + w), P = k + v * C;
537
+ const w = v * r - d, S = Math.max(0, w), E = Math.min(s.inHeight, u + w), P = y + v * C;
538
538
  for (let D = 0; D < s.outWidth; ++D) {
539
539
  const F = D * c - h, R = Math.max(0, F), T = Math.min(s.inWidth, p + F);
540
540
  let A = f, N = 0, O = 0;
541
541
  for (let L = S; L < E; L += i) {
542
- const B = y + L * n[1];
542
+ const B = k + L * n[1];
543
543
  for (let W = R; W < T; W += l) {
544
544
  const z = B + W * n[2], M = a[z + $];
545
545
  o === "max" && M > A ? A = M : o === "avg" && (N += M, O++);
@@ -563,37 +563,37 @@ function oi(a, t, e, n, s = !1, o = !1) {
563
563
  let b = I;
564
564
  for (; b < 0; )
565
565
  b += l;
566
- const k = Math.min(n.inHeight, p + I);
567
- for (let y = 0; y < n.outWidth; ++y) {
568
- const $ = y * i - f;
566
+ const y = Math.min(n.inHeight, p + I);
567
+ for (let k = 0; k < n.outWidth; ++k) {
568
+ const $ = k * i - f;
569
569
  let v = $;
570
570
  for (; v < 0; )
571
571
  v += u;
572
572
  const w = Math.min(n.inWidth, d + $);
573
573
  let S = Number.NEGATIVE_INFINITY, E = -1;
574
- for (let P = b; P < k; P += l) {
574
+ for (let P = b; P < y; P += l) {
575
575
  const D = P - I;
576
576
  for (let F = v; F < w; F += u) {
577
577
  const R = F - $, T = m.get(x, P, F, g);
578
578
  T > S && (S = T, s ? E = o ? ((x * n.inHeight + P) * n.inWidth + F) * n.inChannels + g : (P * n.inWidth + F) * n.inChannels + g : E = D * d + R);
579
579
  }
580
580
  }
581
- r.set(E, x, C, y, g);
581
+ r.set(E, x, C, k, g);
582
582
  }
583
583
  }
584
584
  return r;
585
585
  }
586
586
  function ai(a, t, e, n, s, o) {
587
- const r = s.strideDepth, c = s.strideHeight, i = s.strideWidth, l = s.dilationDepth, u = s.dilationHeight, p = s.dilationWidth, d = s.effectiveFilterDepth, h = s.effectiveFilterHeight, f = s.effectiveFilterWidth, m = s.padInfo.front, x = s.padInfo.top, g = s.padInfo.left, C = o === "max" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, I = pe(s.outShape, e), b = I.values, k = s.outShape[1] * s.outShape[2] * s.outShape[3] * s.outShape[4], y = s.outShape[2] * s.outShape[3] * s.outShape[4], $ = s.outShape[3] * s.outShape[4], v = s.outShape[4];
587
+ const r = s.strideDepth, c = s.strideHeight, i = s.strideWidth, l = s.dilationDepth, u = s.dilationHeight, p = s.dilationWidth, d = s.effectiveFilterDepth, h = s.effectiveFilterHeight, f = s.effectiveFilterWidth, m = s.padInfo.front, x = s.padInfo.top, g = s.padInfo.left, C = o === "max" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, I = pe(s.outShape, e), b = I.values, y = s.outShape[1] * s.outShape[2] * s.outShape[3] * s.outShape[4], k = s.outShape[2] * s.outShape[3] * s.outShape[4], $ = s.outShape[3] * s.outShape[4], v = s.outShape[4];
588
588
  for (let w = 0; w < s.batchSize; ++w) {
589
- const S = w * k, E = w * n[0];
589
+ const S = w * y, E = w * n[0];
590
590
  for (let P = 0; P < s.inChannels; ++P)
591
591
  for (let D = 0; D < s.outDepth; ++D) {
592
592
  const F = D * r - m;
593
593
  let R = F;
594
594
  for (; R < 0; )
595
595
  R += l;
596
- const T = Math.min(s.inDepth, d + F), A = S + D * y;
596
+ const T = Math.min(s.inDepth, d + F), A = S + D * k;
597
597
  for (let N = 0; N < s.outHeight; ++N) {
598
598
  const O = N * c - x;
599
599
  let V = O;
@@ -640,12 +640,12 @@ function Np(a, t) {
640
640
  for (; I < 0; )
641
641
  I += r;
642
642
  const b = Math.min(t.inDepth, l + C);
643
- for (let k = 0; k < t.outHeight; ++k) {
644
- const y = k * s - h;
645
- let $ = y;
643
+ for (let y = 0; y < t.outHeight; ++y) {
644
+ const k = y * s - h;
645
+ let $ = k;
646
646
  for (; $ < 0; )
647
647
  $ += c;
648
- const v = Math.min(t.inHeight, u + y);
648
+ const v = Math.min(t.inHeight, u + k);
649
649
  for (let w = 0; w < t.outWidth; ++w) {
650
650
  const S = w * o - f;
651
651
  let E = S;
@@ -656,14 +656,14 @@ function Np(a, t) {
656
656
  for (let R = I; R < b; R += r) {
657
657
  const T = R - C;
658
658
  for (let A = $; A < v; A += c) {
659
- const N = A - y;
659
+ const N = A - k;
660
660
  for (let O = E; O < P; O += i) {
661
661
  const V = O - S, L = a.get(m, R, A, O, x);
662
662
  L >= D && (D = L, F = T * u * p + N * u + V);
663
663
  }
664
664
  }
665
665
  }
666
- e.set(F, m, g, k, w, x);
666
+ e.set(F, m, g, y, w, x);
667
667
  }
668
668
  }
669
669
  }
@@ -703,7 +703,7 @@ const Dp = {
703
703
  function Fp(a) {
704
704
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, input: o } = t, { filterSize: r, strides: c, pad: i, dimRoundingMode: l } = n;
705
705
  j([s, o], "avgPool3DGrad");
706
- const u = Je(o.shape, r, c, 1, i, l), p = u.strideDepth, d = u.strideHeight, h = u.strideWidth, f = u.filterDepth, m = u.filterHeight, x = u.filterWidth, g = u.dilationDepth, C = u.dilationHeight, I = u.dilationWidth, b = u.effectiveFilterDepth, k = u.effectiveFilterHeight, y = u.effectiveFilterWidth, $ = b - 1 - u.padInfo.front, v = y - 1 - u.padInfo.left, w = k - 1 - u.padInfo.top, S = pe(o.shape, "float32"), E = 1 / (f * m * x), P = e.bufferSync(s);
706
+ const u = Je(o.shape, r, c, 1, i, l), p = u.strideDepth, d = u.strideHeight, h = u.strideWidth, f = u.filterDepth, m = u.filterHeight, x = u.filterWidth, g = u.dilationDepth, C = u.dilationHeight, I = u.dilationWidth, b = u.effectiveFilterDepth, y = u.effectiveFilterHeight, k = u.effectiveFilterWidth, $ = b - 1 - u.padInfo.front, v = k - 1 - u.padInfo.left, w = y - 1 - u.padInfo.top, S = pe(o.shape, "float32"), E = 1 / (f * m * x), P = e.bufferSync(s);
707
707
  for (let D = 0; D < u.batchSize; ++D)
708
708
  for (let F = 0; F < u.inChannels; ++F)
709
709
  for (let R = 0; R < u.inDepth; ++R)
@@ -714,10 +714,10 @@ function Fp(a) {
714
714
  for (let B = 0; B < b; B += g) {
715
715
  const W = (N + B) / p;
716
716
  if (!(W < 0 || W >= u.outDepth || Math.floor(W) !== W))
717
- for (let z = 0; z < k; z += C) {
717
+ for (let z = 0; z < y; z += C) {
718
718
  const M = (O + z) / d;
719
719
  if (!(M < 0 || M >= u.outHeight || Math.floor(M) !== M))
720
- for (let H = 0; H < y; H += I) {
720
+ for (let H = 0; H < k; H += I) {
721
721
  const K = (V + H) / h;
722
722
  if (K < 0 || K >= u.outWidth || Math.floor(K) !== K)
723
723
  continue;
@@ -738,7 +738,7 @@ const Pp = {
738
738
  function Op(a) {
739
739
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, input: o } = t, r = o;
740
740
  j([s, o], "avgPoolGrad");
741
- const { filterSize: c, strides: i, pad: l } = n, u = Le(r.shape, c, i, 1, l), p = u.strideHeight, d = u.strideWidth, h = u.filterHeight, f = u.filterWidth, m = u.dilationHeight, x = u.dilationWidth, g = u.effectiveFilterHeight, C = u.effectiveFilterWidth, I = C - 1 - u.padInfo.left, b = g - 1 - u.padInfo.top, k = pe(r.shape, "float32"), y = 1 / (h * f), $ = e.data.get(s.dataId).values, v = pe(s.shape, "float32", $);
741
+ const { filterSize: c, strides: i, pad: l } = n, u = Le(r.shape, c, i, 1, l), p = u.strideHeight, d = u.strideWidth, h = u.filterHeight, f = u.filterWidth, m = u.dilationHeight, x = u.dilationWidth, g = u.effectiveFilterHeight, C = u.effectiveFilterWidth, I = C - 1 - u.padInfo.left, b = g - 1 - u.padInfo.top, y = pe(r.shape, "float32"), k = 1 / (h * f), $ = e.data.get(s.dataId).values, v = pe(s.shape, "float32", $);
742
742
  for (let w = 0; w < u.batchSize; ++w)
743
743
  for (let S = 0; S < u.inChannels; ++S)
744
744
  for (let E = 0; E < u.inHeight; ++E)
@@ -756,9 +756,9 @@ function Op(a) {
756
756
  R += V;
757
757
  }
758
758
  }
759
- k.set(R * y, w, E, P, S);
759
+ y.set(R * k, w, E, P, S);
760
760
  }
761
- return e.makeTensorInfo(k.shape, k.dtype, k.values);
761
+ return e.makeTensorInfo(y.shape, y.dtype, y.values);
762
762
  }
763
763
  const Ap = {
764
764
  kernelName: Io,
@@ -771,13 +771,13 @@ function _p(a) {
771
771
  let { varianceEpsilon: l } = n;
772
772
  l == null && (l = 1e-3);
773
773
  const u = e.data.get(s.dataId).values, p = e.data.get(c.dataId).values, d = e.data.get(i.dataId).values, h = o ? e.data.get(o.dataId).values : new Float32Array([1]), f = r ? e.data.get(r.dataId).values : new Float32Array([0]), m = new Float32Array(u.length), x = f.length, g = h.length, C = d.length, I = p.length;
774
- let b = 0, k = 0, y = 0, $ = 0;
774
+ let b = 0, y = 0, k = 0, $ = 0;
775
775
  for (let v = 0; v < u.length; ++v)
776
- m[v] = f[b++] + (u[v] - p[k++]) * h[y++] / Math.sqrt(d[$++] + l), b >= x && (b = 0), k >= I && (k = 0), y >= g && (y = 0), $ >= C && ($ = 0);
776
+ m[v] = f[b++] + (u[v] - p[y++]) * h[k++] / Math.sqrt(d[$++] + l), b >= x && (b = 0), y >= I && (y = 0), k >= g && (k = 0), $ >= C && ($ = 0);
777
777
  return e.makeTensorInfo(s.shape, s.dtype, m);
778
778
  }
779
779
  const Lp = {
780
- kernelName: ko,
780
+ kernelName: yo,
781
781
  backendName: "cpu",
782
782
  kernelFunc: _p
783
783
  };
@@ -792,7 +792,7 @@ function Vp(a) {
792
792
  return e.disposeIntermediateTensorInfo(h), e.disposeIntermediateTensorInfo(f), e.disposeIntermediateTensorInfo(m), x;
793
793
  }
794
794
  const Wp = {
795
- kernelName: yo,
795
+ kernelName: ko,
796
796
  backendName: "cpu",
797
797
  kernelFunc: Vp
798
798
  };
@@ -876,7 +876,7 @@ const qp = {
876
876
  function ri(a) {
877
877
  const { inputs: t, backend: e, attrs: n } = a, { x: s, filter: o } = t, { strides: r, pad: c, dataFormat: i, dilations: l, dimRoundingMode: u } = n;
878
878
  j([s, o], "conv2d");
879
- const p = rt(i), d = Se(s.shape, o.shape, r, l, c, u, !1, p), h = d.filterHeight, f = d.filterWidth, m = d.dilationHeight, x = d.dilationWidth, g = d.padInfo.left, C = d.padInfo.top, I = d.dataFormat === "channelsLast", b = new $e(d.outShape, s.dtype), k = ee(s.shape), y = ee(o.shape), $ = k[0], v = I ? k[1] : k[2], w = I ? k[2] : 1, S = I ? 1 : k[1], E = b.strides[0], P = I ? b.strides[1] : b.strides[2], D = I ? b.strides[2] : 1, F = I ? 1 : b.strides[1], R = e.data.get(s.dataId).values, T = e.data.get(o.dataId).values, A = b.values;
879
+ const p = rt(i), d = Se(s.shape, o.shape, r, l, c, u, !1, p), h = d.filterHeight, f = d.filterWidth, m = d.dilationHeight, x = d.dilationWidth, g = d.padInfo.left, C = d.padInfo.top, I = d.dataFormat === "channelsLast", b = new $e(d.outShape, s.dtype), y = ee(s.shape), k = ee(o.shape), $ = y[0], v = I ? y[1] : y[2], w = I ? y[2] : 1, S = I ? 1 : y[1], E = b.strides[0], P = I ? b.strides[1] : b.strides[2], D = I ? b.strides[2] : 1, F = I ? 1 : b.strides[1], R = e.data.get(s.dataId).values, T = e.data.get(o.dataId).values, A = b.values;
880
880
  for (let N = 0; N < d.batchSize; ++N) {
881
881
  const O = N * $, V = N * E;
882
882
  for (let L = 0; L < d.outHeight; ++L) {
@@ -885,14 +885,14 @@ function ri(a) {
885
885
  const M = W + z * m;
886
886
  if (M < 0 || M >= d.inHeight)
887
887
  continue;
888
- const H = z * y[0], K = O + M * v;
888
+ const H = z * k[0], K = O + M * v;
889
889
  for (let Q = 0; Q < d.outWidth; ++Q) {
890
890
  const q = B + Q * D, Z = Q * d.strideWidth - g;
891
891
  for (let J = 0; J < f; ++J) {
892
892
  const ne = Z + J * x;
893
893
  if (ne < 0 || ne >= d.inWidth)
894
894
  continue;
895
- const re = H + J * y[1], fe = K + ne * w;
895
+ const re = H + J * k[1], fe = K + ne * w;
896
896
  let ie = re;
897
897
  for (let oe = 0; oe < d.inChannels; ++oe) {
898
898
  const de = R[fe + oe * S];
@@ -915,7 +915,7 @@ const Yp = {
915
915
  function Qp(a) {
916
916
  const { inputs: t, backend: e, attrs: n } = a, { x: s, dy: o } = t, { strides: r, pad: c, dataFormat: i, dimRoundingMode: l, filterShape: u } = n;
917
917
  j([s, o], "conv2dBackpropFilter");
918
- const p = rt(i), d = Se(s.shape, u, r, 1, c, l, !1, p), { strideHeight: h, strideWidth: f, filterHeight: m, filterWidth: x } = d, g = d.dataFormat === "channelsLast", C = new $e(d.filterShape, "float32"), I = d.padInfo.left, b = d.padInfo.top, k = e.data.get(s.dataId).values, y = e.data.get(o.dataId).values, $ = new $e(s.shape, s.dtype, k), v = new $e(o.shape, o.dtype, y);
918
+ const p = rt(i), d = Se(s.shape, u, r, 1, c, l, !1, p), { strideHeight: h, strideWidth: f, filterHeight: m, filterWidth: x } = d, g = d.dataFormat === "channelsLast", C = new $e(d.filterShape, "float32"), I = d.padInfo.left, b = d.padInfo.top, y = e.data.get(s.dataId).values, k = e.data.get(o.dataId).values, $ = new $e(s.shape, s.dtype, y), v = new $e(o.shape, o.dtype, k);
919
919
  for (let w = 0; w < m; ++w) {
920
920
  const S = Math.max(0, Math.ceil((b - w) / h)), E = Math.min(d.outHeight, (d.inHeight + b - w) / h);
921
921
  for (let P = 0; P < x; ++P) {
@@ -947,10 +947,10 @@ function Jp(a) {
947
947
  j([s, o], "conv2dBackpropInput");
948
948
  const p = ee(o.shape), d = ee(s.shape);
949
949
  let h = rt(l);
950
- const f = Se(r, o.shape, c, 1, i, u, !1, h), m = new $e(f.inShape, "float32"), x = m.values, g = e.data.get(s.dataId).values, C = e.data.get(o.dataId).values, [I, b, k] = p, { batchSize: y, filterHeight: $, filterWidth: v, inChannels: w, inHeight: S, inWidth: E, outChannels: P, outHeight: D, outWidth: F, strideHeight: R, strideWidth: T } = f;
950
+ const f = Se(r, o.shape, c, 1, i, u, !1, h), m = new $e(f.inShape, "float32"), x = m.values, g = e.data.get(s.dataId).values, C = e.data.get(o.dataId).values, [I, b, y] = p, { batchSize: k, filterHeight: $, filterWidth: v, inChannels: w, inHeight: S, inWidth: E, outChannels: P, outHeight: D, outWidth: F, strideHeight: R, strideWidth: T } = f;
951
951
  h = f.dataFormat;
952
952
  const A = $ - 1 - f.padInfo.top, N = v - 1 - f.padInfo.left, O = h === "channelsLast", V = m.strides[0], L = O ? m.strides[1] : m.strides[2], B = O ? m.strides[2] : 1, W = O ? 1 : m.strides[1], z = d[0], M = O ? d[1] : d[2], H = O ? d[2] : 1, K = O ? 1 : d[1];
953
- for (let Q = 0; Q < y; ++Q)
953
+ for (let Q = 0; Q < k; ++Q)
954
954
  for (let q = 0; q < w; ++q)
955
955
  for (let Z = 0; Z < S; ++Z) {
956
956
  const J = Z - A, ne = Math.max(0, Math.ceil(J / R)), re = Math.min(D, ($ + J) / R);
@@ -960,7 +960,7 @@ function Jp(a) {
960
960
  for (let me = ne; me < re; ++me) {
961
961
  const He = me * R - J;
962
962
  for (let we = oe; we < de; ++we) {
963
- const et = we * T - ie, Ee = z * Q + M * me + H * we, Be = I * ($ - 1 - He) + b * (v - 1 - et) + k * q;
963
+ const et = we * T - ie, Ee = z * Q + M * me + H * we, Be = I * ($ - 1 - He) + b * (v - 1 - et) + y * q;
964
964
  for (let Xe = 0; Xe < P; ++Xe) {
965
965
  const Ke = g[Ee + K * Xe], je = C[Be + Xe];
966
966
  le += Ke * je;
@@ -981,7 +981,7 @@ const eh = {
981
981
  function th(a) {
982
982
  const { inputs: t, backend: e, attrs: n } = a, { x: s, filter: o } = t, { strides: r, pad: c, dilations: i } = n;
983
983
  j([s, o], "conv3d");
984
- const l = xt(s.shape, o.shape, r, i, c), { filterDepth: u, filterHeight: p, filterWidth: d, dilationDepth: h, dilationHeight: f, dilationWidth: m, padInfo: x } = l, g = x.front, C = x.left, I = x.top, b = new $e(l.outShape, s.dtype), k = e.data.get(s.dataId).values, y = e.data.get(o.dataId).values, $ = b.values, v = ee(s.shape), w = ee(o.shape);
984
+ const l = xt(s.shape, o.shape, r, i, c), { filterDepth: u, filterHeight: p, filterWidth: d, dilationDepth: h, dilationHeight: f, dilationWidth: m, padInfo: x } = l, g = x.front, C = x.left, I = x.top, b = new $e(l.outShape, s.dtype), y = e.data.get(s.dataId).values, k = e.data.get(o.dataId).values, $ = b.values, v = ee(s.shape), w = ee(o.shape);
985
985
  for (let S = 0; S < l.batchSize; ++S) {
986
986
  const E = S * v[0], P = S * b.strides[0];
987
987
  for (let D = 0; D < l.outDepth; ++D) {
@@ -1007,9 +1007,9 @@ function th(a) {
1007
1007
  const ne = M + Z * w[2], re = H + J * l.inChannels;
1008
1008
  let fe = ne;
1009
1009
  for (let ie = 0; ie < l.inChannels; ++ie) {
1010
- const oe = k[re + ie];
1010
+ const oe = y[re + ie];
1011
1011
  for (let de = 0; de < l.outChannels; ++de)
1012
- $[Q + de] += oe * y[fe + de];
1012
+ $[Q + de] += oe * k[fe + de];
1013
1013
  fe += l.outChannels;
1014
1014
  }
1015
1015
  }
@@ -1029,13 +1029,13 @@ const sh = {
1029
1029
  function nh(a) {
1030
1030
  const { inputs: t, backend: e, attrs: n } = a, { x: s, dy: o } = t, { strides: r, pad: c, filterShape: i } = n;
1031
1031
  j([s, o], "conv3dBackpropFilterV2");
1032
- const l = ee(s.shape), u = ee(o.shape), p = xt(s.shape, i, r, 1, c), d = p.strideDepth, h = p.strideHeight, f = p.strideWidth, m = p.filterDepth, x = p.filterHeight, g = p.filterWidth, C = new $e(p.filterShape, "float32"), I = C.values, [b, k, y, $] = C.strides, v = e.data.get(o.dataId).values, [w, S, E, P] = u, D = e.data.get(s.dataId).values, [F, R, T, A] = l, N = p.padInfo.front, O = p.padInfo.left, V = p.padInfo.top;
1032
+ const l = ee(s.shape), u = ee(o.shape), p = xt(s.shape, i, r, 1, c), d = p.strideDepth, h = p.strideHeight, f = p.strideWidth, m = p.filterDepth, x = p.filterHeight, g = p.filterWidth, C = new $e(p.filterShape, "float32"), I = C.values, [b, y, k, $] = C.strides, v = e.data.get(o.dataId).values, [w, S, E, P] = u, D = e.data.get(s.dataId).values, [F, R, T, A] = l, N = p.padInfo.front, O = p.padInfo.left, V = p.padInfo.top;
1033
1033
  for (let L = 0; L < m; ++L) {
1034
1034
  const B = Math.max(0, Math.ceil((N - L) / d)), W = Math.min(p.outDepth, (p.inDepth + N - L) / d), z = L * b;
1035
1035
  for (let M = 0; M < x; ++M) {
1036
- const H = Math.max(0, Math.ceil((V - M) / h)), K = Math.min(p.outHeight, (p.inHeight + V - M) / h), Q = M * k + z;
1036
+ const H = Math.max(0, Math.ceil((V - M) / h)), K = Math.min(p.outHeight, (p.inHeight + V - M) / h), Q = M * y + z;
1037
1037
  for (let q = 0; q < g; ++q) {
1038
- const Z = Math.max(0, Math.ceil((O - q) / f)), J = Math.min(p.outWidth, (p.inWidth + O - q) / f), ne = q * y + Q;
1038
+ const Z = Math.max(0, Math.ceil((O - q) / f)), J = Math.min(p.outWidth, (p.inWidth + O - q) / f), ne = q * k + Q;
1039
1039
  for (let re = 0; re < p.inChannels; ++re) {
1040
1040
  const fe = re * $ + ne;
1041
1041
  for (let ie = 0; ie < p.outChannels; ++ie) {
@@ -1069,7 +1069,7 @@ const oh = {
1069
1069
  function ah(a) {
1070
1070
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, filter: o } = t, { pad: r, strides: c, inputShape: i } = n;
1071
1071
  j([s], "conv3dBackpropInputV2");
1072
- const l = ee(s.shape), u = ee(o.shape), p = xt(i, o.shape, c, 1, r), d = new $e(p.inShape, "float32"), h = d.values, [f, m, x, g] = d.strides, C = e.data.get(s.dataId).values, [I, b, k, y] = l, $ = e.data.get(o.dataId).values, [v, w, S, E] = u, { batchSize: P, filterDepth: D, filterHeight: F, filterWidth: R, inChannels: T, inDepth: A, inHeight: N, inWidth: O, outChannels: V, outDepth: L, outHeight: B, outWidth: W, strideDepth: z, strideHeight: M, strideWidth: H } = p, K = D - 1 - p.padInfo.front, Q = F - 1 - p.padInfo.top, q = R - 1 - p.padInfo.left;
1072
+ const l = ee(s.shape), u = ee(o.shape), p = xt(i, o.shape, c, 1, r), d = new $e(p.inShape, "float32"), h = d.values, [f, m, x, g] = d.strides, C = e.data.get(s.dataId).values, [I, b, y, k] = l, $ = e.data.get(o.dataId).values, [v, w, S, E] = u, { batchSize: P, filterDepth: D, filterHeight: F, filterWidth: R, inChannels: T, inDepth: A, inHeight: N, inWidth: O, outChannels: V, outDepth: L, outHeight: B, outWidth: W, strideDepth: z, strideHeight: M, strideWidth: H } = p, K = D - 1 - p.padInfo.front, Q = F - 1 - p.padInfo.top, q = R - 1 - p.padInfo.left;
1073
1073
  for (let Z = 0; Z < P; ++Z)
1074
1074
  for (let J = 0; J < T; ++J)
1075
1075
  for (let ne = 0; ne < A; ++ne) {
@@ -1083,8 +1083,8 @@ function ah(a) {
1083
1083
  const Xe = Be * z - re;
1084
1084
  for (let Ke = le; Ke < Me; ++Ke) {
1085
1085
  const je = Ke * M - de;
1086
- for (let yt = we; yt < et; ++yt) {
1087
- const ps = yt * H - He, hs = I * Z + b * Be + k * Ke + y * yt, Bi = v * (D - 1 - Xe) + w * (F - 1 - je) + S * (R - 1 - ps) + E * J;
1086
+ for (let kt = we; kt < et; ++kt) {
1087
+ const ps = kt * H - He, hs = I * Z + b * Be + y * Ke + k * kt, Bi = v * (D - 1 - Xe) + w * (F - 1 - je) + S * (R - 1 - ps) + E * J;
1088
1088
  for (let Bt = 0; Bt < V; ++Bt) {
1089
1089
  const Gi = C[hs + Bt], zi = $[Bi + Bt];
1090
1090
  Ee += Gi * zi;
@@ -1114,7 +1114,7 @@ const lh = ae(Vs, (a) => Math.cosh(a)), uh = {
1114
1114
  kernelFunc: lh
1115
1115
  };
1116
1116
  function dh(a) {
1117
- const { inputs: t, backend: e, attrs: n } = a, { image: s, boxes: o, boxInd: r } = t, { cropSize: c, method: i, extrapolationValue: l } = n, [u, p, d, h] = s.shape, f = o.shape[0], [m, x] = c, g = pe([f, m, x, h], "float32"), C = e.data.get(o.dataId).values, I = e.data.get(r.dataId).values, b = e.data.get(s.dataId).values, k = ee(s.shape), y = ee(g.shape);
1117
+ const { inputs: t, backend: e, attrs: n } = a, { image: s, boxes: o, boxInd: r } = t, { cropSize: c, method: i, extrapolationValue: l } = n, [u, p, d, h] = s.shape, f = o.shape[0], [m, x] = c, g = pe([f, m, x, h], "float32"), C = e.data.get(o.dataId).values, I = e.data.get(r.dataId).values, b = e.data.get(s.dataId).values, y = ee(s.shape), k = ee(g.shape);
1118
1118
  for (let $ = 0; $ < f; $++) {
1119
1119
  const v = $ * 4, w = C[v], S = C[v + 1], E = C[v + 2], P = C[v + 3], D = I[$];
1120
1120
  if (D >= u)
@@ -1125,7 +1125,7 @@ function dh(a) {
1125
1125
  if (A < 0 || A > p - 1) {
1126
1126
  for (let N = 0; N < x; N++)
1127
1127
  for (let O = 0; O < h; O++) {
1128
- const V = O + N * y[2] + T * y[1] + $ * y[0];
1128
+ const V = O + N * k[2] + T * k[1] + $ * k[0];
1129
1129
  g.values[V] = l;
1130
1130
  }
1131
1131
  continue;
@@ -1136,22 +1136,22 @@ function dh(a) {
1136
1136
  const B = x > 1 ? S * (d - 1) + L * R : 0.5 * (S + P) * (d - 1);
1137
1137
  if (B < 0 || B > d - 1) {
1138
1138
  for (let H = 0; H < h; H++) {
1139
- const K = H + L * y[2] + T * y[1] + $ * y[0];
1139
+ const K = H + L * k[2] + T * k[1] + $ * k[0];
1140
1140
  g.values[K] = l;
1141
1141
  }
1142
1142
  continue;
1143
1143
  }
1144
1144
  const W = Math.floor(B), z = Math.ceil(B), M = B - W;
1145
1145
  for (let H = 0; H < h; H++) {
1146
- let K = H + W * k[2] + N * k[1] + D * k[0];
1146
+ let K = H + W * y[2] + N * y[1] + D * y[0];
1147
1147
  const Q = b[K];
1148
- K = H + z * k[2] + N * k[1] + D * k[0];
1148
+ K = H + z * y[2] + N * y[1] + D * y[0];
1149
1149
  const q = b[K];
1150
- K = H + W * k[2] + O * k[1] + D * k[0];
1150
+ K = H + W * y[2] + O * y[1] + D * y[0];
1151
1151
  const Z = b[K];
1152
- K = H + z * k[2] + O * k[1] + D * k[0];
1152
+ K = H + z * y[2] + O * y[1] + D * y[0];
1153
1153
  const J = b[K], ne = Q + (q - Q) * M, re = Z + (J - Z) * M;
1154
- K = H + L * y[2] + T * y[1] + $ * y[0], g.values[K] = ne + (re - ne) * V;
1154
+ K = H + L * k[2] + T * k[1] + $ * k[0], g.values[K] = ne + (re - ne) * V;
1155
1155
  }
1156
1156
  }
1157
1157
  } else
@@ -1159,14 +1159,14 @@ function dh(a) {
1159
1159
  const O = x > 1 ? S * (d - 1) + N * R : 0.5 * (S + P) * (d - 1);
1160
1160
  if (O < 0 || O > d - 1) {
1161
1161
  for (let B = 0; B < h; B++) {
1162
- const W = B + N * y[2] + T * y[1] + $ * y[0];
1162
+ const W = B + N * k[2] + T * k[1] + $ * k[0];
1163
1163
  g.values[W] = l;
1164
1164
  }
1165
1165
  continue;
1166
1166
  }
1167
1167
  const V = Math.round(O), L = Math.round(A);
1168
1168
  for (let B = 0; B < h; B++) {
1169
- const W = B + V * k[2] + L * k[1] + D * k[0], z = B + N * y[2] + T * y[1] + $ * y[0];
1169
+ const W = B + V * y[2] + L * y[1] + D * y[0], z = B + N * k[2] + T * k[1] + $ * k[0];
1170
1170
  g.values[z] = b[W];
1171
1171
  }
1172
1172
  }
@@ -1267,10 +1267,10 @@ function bh(a) {
1267
1267
  for (let g = 0; g < c; ++g)
1268
1268
  for (let C = 0; C < p; ++C) {
1269
1269
  const I = Math.floor(C / o), b = C % o;
1270
- for (let k = 0; k < d; ++k) {
1271
- const y = Math.floor(k / o), $ = k % o, v = (b * o + $) * h;
1270
+ for (let y = 0; y < d; ++y) {
1271
+ const k = Math.floor(y / o), $ = y % o, v = (b * o + $) * h;
1272
1272
  for (let w = 0; w < h; ++w) {
1273
- const E = w + v + u * (y + l * (I + i * g));
1273
+ const E = w + v + u * (k + l * (I + i * g));
1274
1274
  m[x++] = f[E];
1275
1275
  }
1276
1276
  }
@@ -1297,18 +1297,18 @@ function ii(a) {
1297
1297
  l,
1298
1298
  !0
1299
1299
  /* depthwise */
1300
- ), { filterHeight: f, filterWidth: m, dilationHeight: x, dilationWidth: g, padInfo: C } = h, I = C.left, b = C.top, k = h.outChannels / h.inChannels, y = new $e(h.outShape, s.dtype), $ = e.data.get(s.dataId).values, v = e.data.get(o.dataId).values, w = y.values;
1300
+ ), { filterHeight: f, filterWidth: m, dilationHeight: x, dilationWidth: g, padInfo: C } = h, I = C.left, b = C.top, y = h.outChannels / h.inChannels, k = new $e(h.outShape, s.dtype), $ = e.data.get(s.dataId).values, v = e.data.get(o.dataId).values, w = k.values;
1301
1301
  for (let S = 0; S < h.batchSize; ++S) {
1302
- const E = S * u[0], P = S * y.strides[0];
1302
+ const E = S * u[0], P = S * k.strides[0];
1303
1303
  for (let D = 0; D < h.outHeight; ++D) {
1304
- const F = P + D * y.strides[1], R = D * h.strideHeight - b;
1304
+ const F = P + D * k.strides[1], R = D * h.strideHeight - b;
1305
1305
  for (let T = 0; T < f; ++T) {
1306
1306
  const A = R + T * x;
1307
1307
  if (A < 0 || A >= h.inHeight)
1308
1308
  continue;
1309
1309
  const N = T * p[0], O = E + A * u[1];
1310
1310
  for (let V = 0; V < h.outWidth; ++V) {
1311
- const L = F + V * y.strides[2], B = V * h.strideWidth - I;
1311
+ const L = F + V * k.strides[2], B = V * h.strideWidth - I;
1312
1312
  for (let W = 0; W < m; ++W) {
1313
1313
  const z = B + W * g;
1314
1314
  if (z < 0 || z >= h.inWidth)
@@ -1317,23 +1317,23 @@ function ii(a) {
1317
1317
  let K = L, Q = M;
1318
1318
  for (let q = 0; q < h.inChannels; ++q) {
1319
1319
  const Z = $[H + q];
1320
- for (let J = 0; J < k; ++J)
1320
+ for (let J = 0; J < y; ++J)
1321
1321
  w[K + J] += Z * v[Q + J];
1322
- K += k, Q += k;
1322
+ K += y, Q += y;
1323
1323
  }
1324
1324
  }
1325
1325
  }
1326
1326
  }
1327
1327
  }
1328
1328
  }
1329
- return e.makeTensorInfo(y.shape, y.dtype, y.values);
1329
+ return e.makeTensorInfo(k.shape, k.dtype, k.values);
1330
1330
  }
1331
- const kh = {
1331
+ const yh = {
1332
1332
  kernelName: Wo,
1333
1333
  backendName: "cpu",
1334
1334
  kernelFunc: ii
1335
1335
  };
1336
- function yh(a) {
1336
+ function kh(a) {
1337
1337
  const { inputs: t, backend: e, attrs: n } = a, { x: s, dy: o } = t, { strides: r, dilations: c, pad: i, dimRoundingMode: l, filterShape: u } = n;
1338
1338
  j([s, o], "depthwiseConv2dNativeBackpropFilter");
1339
1339
  const p = Se(
@@ -1345,7 +1345,7 @@ function yh(a) {
1345
1345
  l,
1346
1346
  !0
1347
1347
  /* depthwise */
1348
- ), { strideHeight: d, strideWidth: h, filterHeight: f, filterWidth: m } = p, x = new $e(p.filterShape, "float32"), g = p.padInfo.left, C = p.padInfo.top, I = p.outChannels / p.inChannels, b = e.data.get(s.dataId).values, k = new $e(s.shape, s.dtype, b), y = e.data.get(o.dataId).values, $ = new $e(o.shape, o.dtype, y);
1348
+ ), { strideHeight: d, strideWidth: h, filterHeight: f, filterWidth: m } = p, x = new $e(p.filterShape, "float32"), g = p.padInfo.left, C = p.padInfo.top, I = p.outChannels / p.inChannels, b = e.data.get(s.dataId).values, y = new $e(s.shape, s.dtype, b), k = e.data.get(o.dataId).values, $ = new $e(o.shape, o.dtype, k);
1349
1349
  for (let v = 0; v < f; ++v) {
1350
1350
  const w = Math.max(0, Math.ceil((C - v) / d)), S = Math.min(p.outHeight, (p.inHeight + C - v) / d);
1351
1351
  for (let E = 0; E < m; ++E) {
@@ -1358,7 +1358,7 @@ function yh(a) {
1358
1358
  const V = v + O * d - C;
1359
1359
  for (let L = P; L < D; ++L) {
1360
1360
  const B = E + L * h - g;
1361
- A += k.get(N, V, B, R) * $.get(N, O, L, F);
1361
+ A += y.get(N, V, B, R) * $.get(N, O, L, F);
1362
1362
  }
1363
1363
  }
1364
1364
  x.set(A, v, E, R, T);
@@ -1370,7 +1370,7 @@ function yh(a) {
1370
1370
  const $h = {
1371
1371
  kernelName: Mo,
1372
1372
  backendName: "cpu",
1373
- kernelFunc: yh
1373
+ kernelFunc: kh
1374
1374
  };
1375
1375
  function vh(a) {
1376
1376
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, filter: o } = t, { strides: r, dilations: c, pad: i, dimRoundingMode: l, inputShape: u } = n;
@@ -1384,7 +1384,7 @@ function vh(a) {
1384
1384
  l,
1385
1385
  !0
1386
1386
  /* depthwise */
1387
- ), f = new $e(h.inShape, "float32"), m = f.values, [x, g, C] = f.strides, I = e.data.get(s.dataId).values, [b, k, y] = p, $ = e.data.get(o.dataId).values, [v, w, S] = d, { batchSize: E, filterHeight: P, filterWidth: D, inChannels: F, inHeight: R, inWidth: T, outChannels: A, outHeight: N, outWidth: O, strideHeight: V, strideWidth: L } = h, B = P - 1 - h.padInfo.top, W = D - 1 - h.padInfo.left, z = A / F;
1387
+ ), f = new $e(h.inShape, "float32"), m = f.values, [x, g, C] = f.strides, I = e.data.get(s.dataId).values, [b, y, k] = p, $ = e.data.get(o.dataId).values, [v, w, S] = d, { batchSize: E, filterHeight: P, filterWidth: D, inChannels: F, inHeight: R, inWidth: T, outChannels: A, outHeight: N, outWidth: O, strideHeight: V, strideWidth: L } = h, B = P - 1 - h.padInfo.top, W = D - 1 - h.padInfo.left, z = A / F;
1388
1388
  for (let M = 0; M < E; ++M)
1389
1389
  for (let H = 0; H < F; ++H)
1390
1390
  for (let K = 0; K < R; ++K) {
@@ -1395,7 +1395,7 @@ function vh(a) {
1395
1395
  for (let oe = q; oe < Z; ++oe) {
1396
1396
  const de = oe * V - Q;
1397
1397
  for (let le = re; le < fe; ++le) {
1398
- const Me = le * L - ne, me = b * M + k * oe + y * le, He = v * (P - 1 - de) + w * (D - 1 - Me) + S * H;
1398
+ const Me = le * L - ne, me = b * M + y * oe + k * le, He = v * (P - 1 - de) + w * (D - 1 - Me) + S * H;
1399
1399
  for (let we = 0; we < z; ++we) {
1400
1400
  const et = H * z + we, Ee = I[me + et], Be = $[He + we];
1401
1401
  ie += Ee * Be;
@@ -1428,15 +1428,15 @@ const Rh = {
1428
1428
  kernelName: zo,
1429
1429
  backendName: "cpu",
1430
1430
  kernelFunc: ({ inputs: a, backend: t, attrs: e }) => {
1431
- const { x: n, filter: s } = a, { strides: o, pad: r, dilations: c } = e, i = t, l = i.data.get(n.dataId).values, u = n.shape.length, p = i.data.get(s.dataId).values, d = s.shape.length, { batchSize: h, inHeight: f, inWidth: m, inChannels: x, outHeight: g, outWidth: C, padInfo: I, strideHeight: b, strideWidth: k, filterHeight: y, filterWidth: $, dilationHeight: v, dilationWidth: w, outShape: S } = as(n.shape, s.shape, o, r, "NHWC", c), E = G(S), P = S.length, D = ns(n.dtype, E);
1431
+ const { x: n, filter: s } = a, { strides: o, pad: r, dilations: c } = e, i = t, l = i.data.get(n.dataId).values, u = n.shape.length, p = i.data.get(s.dataId).values, d = s.shape.length, { batchSize: h, inHeight: f, inWidth: m, inChannels: x, outHeight: g, outWidth: C, padInfo: I, strideHeight: b, strideWidth: y, filterHeight: k, filterWidth: $, dilationHeight: v, dilationWidth: w, outShape: S } = as(n.shape, s.shape, o, r, "NHWC", c), E = G(S), P = S.length, D = ns(n.dtype, E);
1432
1432
  for (let R = 0; R < h; ++R)
1433
1433
  for (let T = 0; T < g; ++T) {
1434
1434
  const A = T * b - I.top;
1435
1435
  for (let N = 0; N < C; ++N) {
1436
- const O = N * k - I.left;
1436
+ const O = N * y - I.left;
1437
1437
  for (let V = 0; V < x; ++V) {
1438
1438
  let L = Number.MIN_SAFE_INTEGER;
1439
- for (let W = 0; W < y; ++W) {
1439
+ for (let W = 0; W < k; ++W) {
1440
1440
  const z = A + W * v;
1441
1441
  if (z >= 0 && z < f)
1442
1442
  for (let M = 0; M < $; ++M) {
@@ -1456,11 +1456,11 @@ const Rh = {
1456
1456
  }
1457
1457
  };
1458
1458
  const Th = {
1459
- kernelName: kn,
1459
+ kernelName: yn,
1460
1460
  backendName: "cpu",
1461
1461
  kernelFunc: ({ inputs: a, backend: t, attrs: e }) => {
1462
- const { x: n, filter: s, dy: o } = a, { strides: r, pad: c, dilations: i } = e, l = t, u = ut(n.shape, l.data.get(n.dataId).values), p = ut(s.shape, l.data.get(s.dataId).values), { batchSize: d, inHeight: h, inWidth: f, inChannels: m, outHeight: x, outWidth: g, padInfo: C, strideHeight: I, strideWidth: b, filterHeight: k, filterWidth: y, dilationHeight: $, dilationWidth: v, outShape: w } = as(n.shape, s.shape, r, c, "NHWC", i);
1463
- te(o.rank === w.length, () => `Error in ${kn}, dy must have the same rank as output ${w.length}, but got ${o.rank}`);
1462
+ const { x: n, filter: s, dy: o } = a, { strides: r, pad: c, dilations: i } = e, l = t, u = ut(n.shape, l.data.get(n.dataId).values), p = ut(s.shape, l.data.get(s.dataId).values), { batchSize: d, inHeight: h, inWidth: f, inChannels: m, outHeight: x, outWidth: g, padInfo: C, strideHeight: I, strideWidth: b, filterHeight: y, filterWidth: k, dilationHeight: $, dilationWidth: v, outShape: w } = as(n.shape, s.shape, r, c, "NHWC", i);
1463
+ te(o.rank === w.length, () => `Error in ${yn}, dy must have the same rank as output ${w.length}, but got ${o.rank}`);
1464
1464
  const S = ut(w, l.data.get(o.dataId).values), E = Uo(s.shape, s.dtype);
1465
1465
  for (let D = 0; D < d; ++D)
1466
1466
  for (let F = 0; F < x; ++F) {
@@ -1469,10 +1469,10 @@ const Th = {
1469
1469
  const A = T * b - C.left;
1470
1470
  for (let N = 0; N < m; ++N) {
1471
1471
  let O = Number.MIN_SAFE_INTEGER, V = 0, L = 0;
1472
- for (let B = 0; B < k; ++B) {
1472
+ for (let B = 0; B < y; ++B) {
1473
1473
  const W = R + B * $;
1474
1474
  if (W >= 0 && W < h)
1475
- for (let z = 0; z < y; ++z) {
1475
+ for (let z = 0; z < k; ++z) {
1476
1476
  const M = A + z * v;
1477
1477
  if (M >= 0 && M < f) {
1478
1478
  const H = u[D][W][M][N] + p[B][z][N];
@@ -1488,11 +1488,11 @@ const Th = {
1488
1488
  }
1489
1489
  };
1490
1490
  const Eh = {
1491
- kernelName: yn,
1491
+ kernelName: kn,
1492
1492
  backendName: "cpu",
1493
1493
  kernelFunc: ({ inputs: a, backend: t, attrs: e }) => {
1494
- const { x: n, filter: s, dy: o } = a, { strides: r, pad: c, dilations: i } = e, l = t, u = ut(n.shape, l.data.get(n.dataId).values), p = ut(s.shape, l.data.get(s.dataId).values), { batchSize: d, inHeight: h, inWidth: f, inChannels: m, outHeight: x, outWidth: g, padInfo: C, strideHeight: I, strideWidth: b, filterHeight: k, filterWidth: y, dilationHeight: $, dilationWidth: v, outShape: w } = as(n.shape, s.shape, r, c, "NHWC", i);
1495
- te(o.rank === w.length, () => `Error in ${yn}, dy must have the same rank as output ${w.length}, but got ${o.rank}`);
1494
+ const { x: n, filter: s, dy: o } = a, { strides: r, pad: c, dilations: i } = e, l = t, u = ut(n.shape, l.data.get(n.dataId).values), p = ut(s.shape, l.data.get(s.dataId).values), { batchSize: d, inHeight: h, inWidth: f, inChannels: m, outHeight: x, outWidth: g, padInfo: C, strideHeight: I, strideWidth: b, filterHeight: y, filterWidth: k, dilationHeight: $, dilationWidth: v, outShape: w } = as(n.shape, s.shape, r, c, "NHWC", i);
1495
+ te(o.rank === w.length, () => `Error in ${kn}, dy must have the same rank as output ${w.length}, but got ${o.rank}`);
1496
1496
  const S = ut(w, l.data.get(o.dataId).values), E = Uo(n.shape, n.dtype);
1497
1497
  for (let D = 0; D < d; ++D)
1498
1498
  for (let F = 0; F < x; ++F) {
@@ -1501,10 +1501,10 @@ const Eh = {
1501
1501
  const A = T * b - C.left;
1502
1502
  for (let N = 0; N < m; ++N) {
1503
1503
  let O = Number.MIN_SAFE_INTEGER, V = R < 0 ? 0 : R, L = A < 0 ? 0 : A;
1504
- for (let B = 0; B < k; ++B) {
1504
+ for (let B = 0; B < y; ++B) {
1505
1505
  const W = R + B * $;
1506
1506
  if (W >= 0 && W < h)
1507
- for (let z = 0; z < y; ++z) {
1507
+ for (let z = 0; z < k; ++z) {
1508
1508
  const M = A + z * v;
1509
1509
  if (M >= 0 && M < f) {
1510
1510
  const H = u[D][W][M][N] + p[B][z][N];
@@ -1529,17 +1529,17 @@ function Dh(a) {
1529
1529
  const [d, h] = s.shape.slice(0, 2), f = s.shape.length === 2 ? 1 : s.shape[2], m = e.data.get(s.dataId).values, x = s.dtype === "float32" ? 255 : 1, g = new Uint8ClampedArray(h * d * 4);
1530
1530
  for (let I = 0; I < d * h; ++I) {
1531
1531
  const b = [0, 0, 0, 255 * l];
1532
- for (let y = 0; y < f; y++) {
1533
- const $ = m[I * f + y];
1532
+ for (let k = 0; k < f; k++) {
1533
+ const $ = m[I * f + k];
1534
1534
  if (s.dtype === "float32") {
1535
1535
  if ($ < 0 || $ > 1)
1536
1536
  throw new Error(`Tensor values for a float32 Tensor must be in the range [0 - 1] but encountered ${$}.`);
1537
1537
  } else if (s.dtype === "int32" && ($ < 0 || $ > 255))
1538
1538
  throw new Error(`Tensor values for a int32 Tensor must be in the range [0 - 255] but encountered ${$}.`);
1539
- f === 1 ? (b[0] = $ * x, b[1] = $ * x, b[2] = $ * x) : b[y] = $ * x;
1539
+ f === 1 ? (b[0] = $ * x, b[1] = $ * x, b[2] = $ * x) : b[k] = $ * x;
1540
1540
  }
1541
- const k = I * 4;
1542
- g[k + 0] = Math.round(b[0]), g[k + 1] = Math.round(b[1]), g[k + 2] = Math.round(b[2]), g[k + 3] = Math.round(b[3]);
1541
+ const y = I * 4;
1542
+ g[y + 0] = Math.round(b[0]), g[y + 1] = Math.round(b[1]), g[y + 2] = Math.round(b[2]), g[y + 3] = Math.round(b[3]);
1543
1543
  }
1544
1544
  o.width = h, o.height = d;
1545
1545
  const C = new ImageData(g, h, d);
@@ -1557,20 +1557,20 @@ function Lt(a) {
1557
1557
  s.dtype === "bool" ? c = cn({ inputs: { x: s }, backend: e, attrs: { dtype: "int32" } }) : c = at({ inputs: { x: s }, backend: e });
1558
1558
  const i = c.shape.length, l = ue(o, c.shape), u = ge(l, i);
1559
1559
  let p = l, d = c;
1560
- u != null && (d = Re({ inputs: { x: c }, backend: e, attrs: { perm: u } }), p = xe(p.length, i)), ye("sum", p, d.shape.length);
1560
+ u != null && (d = Re({ inputs: { x: c }, backend: e, attrs: { perm: u } }), p = xe(p.length, i)), ke("sum", p, d.shape.length);
1561
1561
  const [h, f] = ve(d.shape, p), m = Qe(d.dtype, "int32");
1562
1562
  let x = Hc(e, h, m);
1563
1563
  const g = G(f), C = e.data.get(x.dataId).values, I = e.data.get(d.dataId).values;
1564
1564
  for (let b = 0; b < C.length; ++b) {
1565
- const k = b * g;
1566
- let y = 0;
1565
+ const y = b * g;
1566
+ let k = 0;
1567
1567
  for (let $ = 0; $ < g; ++$)
1568
- y += I[k + $];
1569
- C[b] = y;
1568
+ k += I[y + $];
1569
+ C[b] = k;
1570
1570
  }
1571
1571
  if (r) {
1572
- const b = Te(x.shape, l), k = x;
1573
- x = ce({ inputs: { x }, backend: e, attrs: { shape: b } }), e.disposeIntermediateTensorInfo(k);
1572
+ const b = Te(x.shape, l), y = x;
1573
+ x = ce({ inputs: { x }, backend: e, attrs: { shape: b } }), e.disposeIntermediateTensorInfo(y);
1574
1574
  }
1575
1575
  return e.disposeIntermediateTensorInfo(c), u != null && e.disposeIntermediateTensorInfo(d), x;
1576
1576
  }
@@ -1591,8 +1591,8 @@ function Oh(a) {
1591
1591
  let I;
1592
1592
  br(g) ? I = o[x] : (I = Re({ inputs: { x: o[x] }, backend: e, attrs: { perm: g } }), f.push(I));
1593
1593
  const b = I.shape.slice();
1594
- for (let k = 0; k < C.length; ++k)
1595
- b.splice(C[k], 0, 1);
1594
+ for (let y = 0; y < C.length; ++y)
1595
+ b.splice(C[y], 0, 1);
1596
1596
  nt(I.shape, b) || (I = ce({ inputs: { x: I }, backend: e, attrs: { shape: b } }), f.push(I)), d === null ? d = I : (d = ln({ inputs: { a: I, b: d }, backend: e }), f.push(d));
1597
1597
  }
1598
1598
  m < p - 1 && (l[m] >= 0 && (d = Lt({
@@ -1628,7 +1628,7 @@ const Lh = {
1628
1628
  backendName: "cpu",
1629
1629
  kernelFunc: _h
1630
1630
  };
1631
- const Vh = Sr, Wh = vr, Mh = $r, Bh = yr, Gh = kr, zh = Ir, Uh = ae(Ms, (a) => {
1631
+ const Vh = Sr, Wh = vr, Mh = $r, Bh = kr, Gh = yr, zh = Ir, Uh = ae(Ms, (a) => {
1632
1632
  const t = Math.sign(a), e = Math.abs(a), n = 1 / (1 + Vh * e);
1633
1633
  return t * (1 - ((((zh * n + Gh) * n + Bh) * n + Mh) * n + Wh) * n * Math.exp(-e * e));
1634
1634
  }), Hh = {
@@ -1662,9 +1662,9 @@ function ci(a, t, e) {
1662
1662
  inputs: { x: i },
1663
1663
  backend: e,
1664
1664
  attrs: { begin: [x, 0], size: [1, o] }
1665
- }), I = Ae({ inputs: { real: g, imag: C }, backend: e }), { real: b, imag: k } = jh(I, t, e), y = pt(b, k);
1665
+ }), I = Ae({ inputs: { real: g, imag: C }, backend: e }), { real: b, imag: y } = jh(I, t, e), k = pt(b, y);
1666
1666
  for (let $ = 0; $ < o; $++) {
1667
- const v = pr(y, $);
1667
+ const v = pr(k, $);
1668
1668
  p[x * o + $] = v.real, d[x * o + $] = v.imag;
1669
1669
  }
1670
1670
  e.disposeIntermediateTensorInfo(g), e.disposeIntermediateTensorInfo(C), e.disposeIntermediateTensorInfo(I);
@@ -1675,7 +1675,7 @@ function ci(a, t, e) {
1675
1675
  function jh(a, t, e) {
1676
1676
  const n = G(a.shape), s = e.data.get(a.dataId), o = e.data.get(s.complexTensorInfos.real.dataId).values, r = e.data.get(s.complexTensorInfos.imag.dataId).values;
1677
1677
  if (qh(n)) {
1678
- const c = ks(o, r, n, t, e), i = [a.shape[0], a.shape[1]];
1678
+ const c = ys(o, r, n, t, e), i = [a.shape[0], a.shape[1]];
1679
1679
  if (t) {
1680
1680
  const l = e.makeTensorInfo(i, "float32", c.real), u = e.makeTensorInfo(i, "float32", c.imag), p = e.makeTensorInfo([], "float32", mt(n, "float32")), d = at({ inputs: { x: p }, backend: e }), h = Is.kernelFunc({ inputs: { a: l, b: p }, backend: e }), f = Is.kernelFunc({ inputs: { a: u, b: d }, backend: e }), m = e.data.get(h.dataId).values, x = e.data.get(f.dataId).values;
1681
1681
  return e.disposeIntermediateTensorInfo(l), e.disposeIntermediateTensorInfo(u), e.disposeIntermediateTensorInfo(p), e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), e.disposeIntermediateTensorInfo(f), { real: m, imag: x };
@@ -1689,13 +1689,13 @@ function jh(a, t, e) {
1689
1689
  function qh(a) {
1690
1690
  return (a & a - 1) === 0;
1691
1691
  }
1692
- function ks(a, t, e, n, s) {
1692
+ function ys(a, t, e, n, s) {
1693
1693
  if (e === 1)
1694
1694
  return { real: a, imag: t };
1695
- const o = pt(a, t), r = e / 2, c = Hl(o), i = c.real, l = c.imag, u = [i.length], p = s.makeTensorInfo(u, "float32", i), d = s.makeTensorInfo(u, "float32", l), h = Ae({ inputs: { real: p, imag: d }, backend: s }), f = Xl(o), m = f.real, x = f.imag, g = [m.length], C = s.makeTensorInfo(g, "float32", m), I = s.makeTensorInfo(g, "float32", x), b = Ae({ inputs: { real: C, imag: I }, backend: s }), k = ks(i, l, r, n, s), y = k.real, $ = k.imag, v = [y.length], w = s.makeTensorInfo(v, "float32", y), S = s.makeTensorInfo(v, "float32", $), E = Ae({
1695
+ const o = pt(a, t), r = e / 2, c = Hl(o), i = c.real, l = c.imag, u = [i.length], p = s.makeTensorInfo(u, "float32", i), d = s.makeTensorInfo(u, "float32", l), h = Ae({ inputs: { real: p, imag: d }, backend: s }), f = Xl(o), m = f.real, x = f.imag, g = [m.length], C = s.makeTensorInfo(g, "float32", m), I = s.makeTensorInfo(g, "float32", x), b = Ae({ inputs: { real: C, imag: I }, backend: s }), y = ys(i, l, r, n, s), k = y.real, $ = y.imag, v = [k.length], w = s.makeTensorInfo(v, "float32", k), S = s.makeTensorInfo(v, "float32", $), E = Ae({
1696
1696
  inputs: { real: w, imag: S },
1697
1697
  backend: s
1698
- }), P = ks(m, x, r, n, s), D = P.real, F = P.imag, R = [D.length], T = s.makeTensorInfo(R, "float32", D), A = s.makeTensorInfo(R, "float32", F), N = Ae({ inputs: { real: T, imag: A }, backend: s }), O = Kl(e, n), V = [O.real.length], L = s.makeTensorInfo(V, "float32", O.real), B = s.makeTensorInfo(V, "float32", O.imag), W = Ae({ inputs: { real: L, imag: B }, backend: s }), z = ln({ inputs: { a: W, b: N }, backend: s }), M = wt({
1698
+ }), P = ys(m, x, r, n, s), D = P.real, F = P.imag, R = [D.length], T = s.makeTensorInfo(R, "float32", D), A = s.makeTensorInfo(R, "float32", F), N = Ae({ inputs: { real: T, imag: A }, backend: s }), O = Kl(e, n), V = [O.real.length], L = s.makeTensorInfo(V, "float32", O.real), B = s.makeTensorInfo(V, "float32", O.imag), W = Ae({ inputs: { real: L, imag: B }, backend: s }), z = ln({ inputs: { a: W, b: N }, backend: s }), M = wt({
1699
1699
  inputs: { a: E, b: z },
1700
1700
  backend: s
1701
1701
  }), H = ur({
@@ -1762,12 +1762,12 @@ const tf = {
1762
1762
  const g = x * l;
1763
1763
  for (let C = 0; C < l; C++) {
1764
1764
  const I = Math.round(i - x - 1), b = h + m + g + C;
1765
- let k = u[b];
1765
+ let y = u[b];
1766
1766
  if (I >= 0 && I < i) {
1767
- const y = I * l, $ = h + m + y + C;
1768
- k = u[$];
1767
+ const k = I * l, $ = h + m + k + C;
1768
+ y = u[$];
1769
1769
  }
1770
- o[b] = k;
1770
+ o[b] = y;
1771
1771
  }
1772
1772
  }
1773
1773
  }
@@ -1850,8 +1850,8 @@ function lf(a) {
1850
1850
  j([s, o], "gatherV2");
1851
1851
  const i = ue(r, s.shape)[0], l = e.data.get(o.dataId).values, u = s.shape[i];
1852
1852
  for (let b = 0; b < l.length; ++b) {
1853
- const k = l[b];
1854
- te(k <= u - 1 && k >= 0, () => `GatherV2: the index value ${k} is not in [0, ${u - 1}]`);
1853
+ const y = l[b];
1854
+ te(y <= u - 1 && y >= 0, () => `GatherV2: the index value ${y} is not in [0, ${u - 1}]`);
1855
1855
  }
1856
1856
  let p = c;
1857
1857
  c == null && (p = 0);
@@ -1920,10 +1920,10 @@ const If = {
1920
1920
  backendName: "cpu",
1921
1921
  kernelFunc: bf
1922
1922
  };
1923
- const kf = ae(Us, (a) => Math.log1p(a)), yf = {
1923
+ const yf = ae(Us, (a) => Math.log1p(a)), kf = {
1924
1924
  kernelName: Us,
1925
1925
  backendName: "cpu",
1926
- kernelFunc: kf
1926
+ kernelFunc: yf
1927
1927
  };
1928
1928
  const $f = ot((a, t) => a && t), vf = gt(Hs, $f, null, "bool"), Sf = {
1929
1929
  kernelName: Hs,
@@ -1971,14 +1971,14 @@ function Pf(a) {
1971
1971
  j(r, "LRNGrad");
1972
1972
  const p = G(r.shape), d = r.shape[3], h = e.data.get(r.dataId).values, f = e.data.get(s.dataId).values, m = e.data.get(o.dataId).values, x = new Float32Array(p), g = p;
1973
1973
  for (let C = 0; C < g; C++) {
1974
- const I = C % d, b = C - I + Math.max(0, I - c), k = C - I + Math.min(d, I + c + 1);
1975
- let y = 0;
1976
- for (let $ = b; $ < k; $++)
1977
- y += Math.pow(f[$], 2);
1978
- y = l * y + i;
1979
- for (let $ = b; $ < k; $++) {
1980
- let v = -2 * l * u * f[$] * m[C] / y;
1981
- C === $ && (v += Math.pow(y, -u)), v *= h[C], x[$] += v;
1974
+ const I = C % d, b = C - I + Math.max(0, I - c), y = C - I + Math.min(d, I + c + 1);
1975
+ let k = 0;
1976
+ for (let $ = b; $ < y; $++)
1977
+ k += Math.pow(f[$], 2);
1978
+ k = l * k + i;
1979
+ for (let $ = b; $ < y; $++) {
1980
+ let v = -2 * l * u * f[$] * m[C] / k;
1981
+ C === $ && (v += Math.pow(k, -u)), v *= h[C], x[$] += v;
1982
1982
  }
1983
1983
  }
1984
1984
  return e.makeTensorInfo(r.shape, s.dtype, x);
@@ -1997,11 +1997,11 @@ function li(a) {
1997
1997
  let h = c.data.get(s.dataId).values;
1998
1998
  if (d != null) {
1999
1999
  const b = new Array(l);
2000
- for (let k = 0; k < b.length; k++)
2001
- b[k] = i[d[k]];
2000
+ for (let y = 0; y < b.length; y++)
2001
+ b[y] = i[d[y]];
2002
2002
  h = qc(h, i, s.dtype, d, b), p = xe(p.length, l), i = b;
2003
2003
  }
2004
- j(s, "max"), ye("max", p, l);
2004
+ j(s, "max"), ke("max", p, l);
2005
2005
  const [f, m] = ve(i, p), x = G(m), g = Yc(h, x, f, s.dtype), C = c.write(g, f, s.dtype);
2006
2006
  let I = f;
2007
2007
  return r && (I = Te(f, u)), { dataId: C, shape: I, dtype: s.dtype };
@@ -2045,13 +2045,13 @@ const Wf = {
2045
2045
  function Mf(a) {
2046
2046
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, input: o } = t, { filterSize: r, strides: c, pad: i, dimRoundingMode: l } = n;
2047
2047
  j([s, o], "maxPool3DGrad");
2048
- const u = Je(o.shape, r, c, 1, i, l), p = e.bufferSync(o), d = Np(p, u), h = u.strideDepth, f = u.strideHeight, m = u.strideWidth, x = u.dilationDepth, g = u.dilationHeight, C = u.dilationWidth, I = u.effectiveFilterDepth, b = u.effectiveFilterHeight, k = u.effectiveFilterWidth, y = I - 1 - u.padInfo.front, $ = k - 1 - u.padInfo.left, v = b - 1 - u.padInfo.top, w = pe(o.shape, "float32"), S = e.bufferSync(s);
2048
+ const u = Je(o.shape, r, c, 1, i, l), p = e.bufferSync(o), d = Np(p, u), h = u.strideDepth, f = u.strideHeight, m = u.strideWidth, x = u.dilationDepth, g = u.dilationHeight, C = u.dilationWidth, I = u.effectiveFilterDepth, b = u.effectiveFilterHeight, y = u.effectiveFilterWidth, k = I - 1 - u.padInfo.front, $ = y - 1 - u.padInfo.left, v = b - 1 - u.padInfo.top, w = pe(o.shape, "float32"), S = e.bufferSync(s);
2049
2049
  for (let E = 0; E < u.batchSize; ++E)
2050
2050
  for (let P = 0; P < u.inChannels; ++P)
2051
2051
  for (let D = 0; D < u.inDepth; ++D)
2052
2052
  for (let F = 0; F < u.inHeight; ++F)
2053
2053
  for (let R = 0; R < u.inWidth; ++R) {
2054
- const T = D - y, A = F - v, N = R - $;
2054
+ const T = D - k, A = F - v, N = R - $;
2055
2055
  let O = 0;
2056
2056
  for (let V = 0; V < I; V += x) {
2057
2057
  const L = (T + V) / h;
@@ -2059,11 +2059,11 @@ function Mf(a) {
2059
2059
  for (let B = 0; B < b; B += g) {
2060
2060
  const W = (A + B) / f;
2061
2061
  if (!(W < 0 || W >= u.outHeight || Math.floor(W) !== W))
2062
- for (let z = 0; z < k; z += C) {
2062
+ for (let z = 0; z < y; z += C) {
2063
2063
  const M = (N + z) / m;
2064
2064
  if (M < 0 || M >= u.outWidth || Math.floor(M) !== M)
2065
2065
  continue;
2066
- const H = I * b * k - 1 - d.get(E, L, W, M, P), K = V * b * k + B * k + z, Q = H === K ? 1 : 0;
2066
+ const H = I * b * y - 1 - d.get(E, L, W, M, P), K = V * b * y + B * y + z, Q = H === K ? 1 : 0;
2067
2067
  if (Q === 0)
2068
2068
  continue;
2069
2069
  const q = S.get(E, L, W, M, P);
@@ -2083,12 +2083,12 @@ const Bf = {
2083
2083
  function Gf(a) {
2084
2084
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, input: o, output: r } = t, c = o;
2085
2085
  j([o, r], "maxPoolGrad");
2086
- const { filterSize: i, strides: l, pad: u, dimRoundingMode: p } = n, d = Le(c.shape, i, l, 1, u, p), h = e.data.get(c.dataId).values, f = pe(d.outShape, c.dtype, oi(h, c.shape, c.dtype, d).values), m = d.strideHeight, x = d.strideWidth, g = d.dilationHeight, C = d.dilationWidth, I = d.effectiveFilterHeight, b = d.effectiveFilterWidth, k = b - 1 - d.padInfo.left, y = I - 1 - d.padInfo.top, $ = pe(c.shape, "float32"), v = e.data.get(s.dataId).values, w = pe(s.shape, "float32", v);
2086
+ const { filterSize: i, strides: l, pad: u, dimRoundingMode: p } = n, d = Le(c.shape, i, l, 1, u, p), h = e.data.get(c.dataId).values, f = pe(d.outShape, c.dtype, oi(h, c.shape, c.dtype, d).values), m = d.strideHeight, x = d.strideWidth, g = d.dilationHeight, C = d.dilationWidth, I = d.effectiveFilterHeight, b = d.effectiveFilterWidth, y = b - 1 - d.padInfo.left, k = I - 1 - d.padInfo.top, $ = pe(c.shape, "float32"), v = e.data.get(s.dataId).values, w = pe(s.shape, "float32", v);
2087
2087
  for (let S = 0; S < d.batchSize; ++S)
2088
2088
  for (let E = 0; E < d.inChannels; ++E)
2089
2089
  for (let P = 0; P < d.inHeight; ++P)
2090
2090
  for (let D = 0; D < d.inWidth; ++D) {
2091
- const F = P - y, R = D - k;
2091
+ const F = P - k, R = D - y;
2092
2092
  let T = 0;
2093
2093
  for (let A = 0; A < I; A += g) {
2094
2094
  const N = (F + A) / m;
@@ -2152,14 +2152,14 @@ function jf(a) {
2152
2152
  let i = c;
2153
2153
  const l = ge(i, s.shape.length);
2154
2154
  let u = s;
2155
- l != null && (u = Re({ inputs: { x: s }, backend: e, attrs: { perm: l } }), i = xe(i.length, s.shape.length)), ye("min", i, u.shape.length);
2155
+ l != null && (u = Re({ inputs: { x: s }, backend: e, attrs: { perm: l } }), i = xe(i.length, s.shape.length)), ke("min", i, u.shape.length);
2156
2156
  const [p, d] = ve(u.shape, i), h = G(d), f = Ye(G(p), u.dtype), m = e.data.get(u.dataId).values;
2157
2157
  for (let g = 0; g < f.length; ++g) {
2158
2158
  const C = g * h;
2159
2159
  let I = m[C];
2160
2160
  for (let b = 0; b < h; ++b) {
2161
- const k = m[C + b];
2162
- (Number.isNaN(k) || k < I) && (I = k);
2161
+ const y = m[C + b];
2162
+ (Number.isNaN(y) || y < I) && (I = y);
2163
2163
  }
2164
2164
  f[g] = I;
2165
2165
  }
@@ -2185,11 +2185,11 @@ function Yf(a) {
2185
2185
  ), i = o.map((I) => I[0]), l = o.map((I, b) => I[0] + s.shape[b]), u = r === "reflect" ? 0 : 1, p = e.data.get(s.dataId).values, d = s.shape.length, h = ee(s.shape), f = G(c), m = c.length, x = ee(c), g = _e(s.dtype, f);
2186
2186
  for (let I = 0; I < f; I++) {
2187
2187
  let b = ma(I, m, x);
2188
- for (let y = 0; y < m; y++)
2189
- b[y] < i[y] ? b[y] = i[y] * 2 - b[y] - u : b[y] >= l[y] && (b[y] = (l[y] - 1) * 2 - b[y] + u);
2190
- b = b.map((y, $) => y - i[$]);
2191
- const k = St(b, d, h);
2192
- g[I] = p[k];
2188
+ for (let k = 0; k < m; k++)
2189
+ b[k] < i[k] ? b[k] = i[k] * 2 - b[k] - u : b[k] >= l[k] && (b[k] = (l[k] - 1) * 2 - b[k] + u);
2190
+ b = b.map((k, $) => k - i[$]);
2191
+ const y = St(b, d, h);
2192
+ g[I] = p[y];
2193
2193
  }
2194
2194
  return { dataId: e.write(g, c, s.dtype), shape: c, dtype: s.dtype };
2195
2195
  }
@@ -2236,9 +2236,9 @@ function sm(a) {
2236
2236
  for (let I = 0; I < o; ++I) {
2237
2237
  const b = g();
2238
2238
  h[C + I] = x.length;
2239
- for (let k = 0; k < x.length; k++)
2240
- if (b < x[k]) {
2241
- h[C + I] = k;
2239
+ for (let y = 0; y < x.length; y++)
2240
+ if (b < x[y]) {
2241
+ h[C + I] = y;
2242
2242
  break;
2243
2243
  }
2244
2244
  }
@@ -2318,7 +2318,7 @@ function Jt(a) {
2318
2318
  return xn({ backend: e, attrs: { shape: n.shape, value: 0, dtype: n.dtype } });
2319
2319
  }
2320
2320
  const mm = {
2321
- kernelName: ka,
2321
+ kernelName: ya,
2322
2322
  backendName: "cpu",
2323
2323
  kernelFunc: Jt
2324
2324
  };
@@ -2333,7 +2333,7 @@ function di(a) {
2333
2333
  return xn({ backend: e, attrs: { shape: n.shape, value: 1, dtype: n.dtype } });
2334
2334
  }
2335
2335
  const gm = {
2336
- kernelName: ya,
2336
+ kernelName: ka,
2337
2337
  backendName: "cpu",
2338
2338
  kernelFunc: di
2339
2339
  };
@@ -2365,8 +2365,8 @@ function Cm(a) {
2365
2365
  ), i = o.map((C) => C[0]), l = e.data.get(s.dataId).values, u = G(s.shape), p = s.shape.length, d = ee(s.shape), h = G(c), f = c.length, m = ee(c), x = _e(s.dtype, h);
2366
2366
  r !== 0 && x.fill(r);
2367
2367
  for (let C = 0; C < u; C++) {
2368
- const b = ma(C, p, d).map((y, $) => y + i[$]), k = St(b, f, m);
2369
- x[k] = l[C];
2368
+ const b = ma(C, p, d).map((k, $) => k + i[$]), y = St(b, f, m);
2369
+ x[y] = l[C];
2370
2370
  }
2371
2371
  return { dataId: e.write(x, c, s.dtype), shape: c, dtype: s.dtype };
2372
2372
  }
@@ -2375,19 +2375,19 @@ const hi = {
2375
2375
  backendName: "cpu",
2376
2376
  kernelFunc: Cm
2377
2377
  };
2378
- const bm = ot((a, t) => Math.pow(a, t)), Im = gt(qs, bm), km = {
2378
+ const bm = ot((a, t) => Math.pow(a, t)), Im = gt(qs, bm), ym = {
2379
2379
  kernelName: qs,
2380
2380
  backendName: "cpu",
2381
2381
  kernelFunc: Im
2382
2382
  };
2383
- function ym(a) {
2383
+ function km(a) {
2384
2384
  const { inputs: t, backend: e, attrs: n } = a, { paramsNestedSplits: s, paramsDenseValues: o, indices: r } = t, { outputRaggedRank: c } = n, i = s.map((g) => e.data.get(g.dataId).values), l = s.map((g) => g.shape), u = e.data.get(o.dataId).values, p = e.data.get(r.dataId).values, [d, h, f] = Zc(i, l, u, o.shape, o.dtype, p, r.shape), m = d.map((g) => e.makeTensorInfo([g.length], "int32", g)), x = e.makeTensorInfo(f, o.dtype, h);
2385
2385
  return m.concat([x]);
2386
2386
  }
2387
2387
  const $m = {
2388
2388
  kernelName: wa,
2389
2389
  backendName: "cpu",
2390
- kernelFunc: ym
2390
+ kernelFunc: km
2391
2391
  };
2392
2392
  function vm(a) {
2393
2393
  const { inputs: t, backend: e } = a, { starts: n, limits: s, deltas: o } = t, r = e.data.get(n.dataId).values, c = e.data.get(s.dataId).values, i = e.data.get(o.dataId).values, [l, u] = Jc(r, n.shape, n.dtype, c, s.shape, i, o.shape), p = e.makeTensorInfo([l.length], "int32", l), d = e.makeTensorInfo([u.length], n.dtype, u);
@@ -2432,15 +2432,15 @@ function Fm(a) {
2432
2432
  o && u > 1 ? u - 1 : u
2433
2433
  ];
2434
2434
  let I = 0;
2435
- const b = g[0] / C[0], k = g[1] / C[1];
2436
- for (let y = 0; y < p; y++)
2435
+ const b = g[0] / C[0], y = g[1] / C[1];
2436
+ for (let k = 0; k < p; k++)
2437
2437
  for (let $ = 0; $ < l; $++) {
2438
2438
  let v;
2439
2439
  r ? v = b * ($ + 0.5) - 0.5 : v = b * $;
2440
- const w = Math.max(0, Math.floor(v)), S = v - w, E = Math.min(d - 1, Math.ceil(v)), P = y * i[0] + w * i[1], D = y * i[0] + E * i[1];
2440
+ const w = Math.max(0, Math.floor(v)), S = v - w, E = Math.min(d - 1, Math.ceil(v)), P = k * i[0] + w * i[1], D = k * i[0] + E * i[1];
2441
2441
  for (let F = 0; F < u; F++) {
2442
2442
  let R;
2443
- r ? R = k * (F + 0.5) - 0.5 : R = k * F;
2443
+ r ? R = y * (F + 0.5) - 0.5 : R = y * F;
2444
2444
  const T = Math.max(0, Math.floor(R)), A = R - T, N = Math.min(h - 1, Math.ceil(R)), O = P + T * i[2], V = D + T * i[2], L = P + N * i[2], B = D + N * i[2];
2445
2445
  for (let W = 0; W < f; W++) {
2446
2446
  const z = m[O + W], M = m[V + W], H = m[L + W], K = m[B + W], Q = z + (H - z) * A, q = M + (K - M) * A, Z = Q + (q - Q) * S;
@@ -2466,10 +2466,10 @@ function Om(a) {
2466
2466
  r && h > 1 ? h - 1 : h
2467
2467
  ], g = m[0] / x[0], C = m[1] / x[1], I = e.data.get(o.dataId).values;
2468
2468
  let b = 0;
2469
- for (let k = 0; k < i; k++) {
2470
- const y = k * c[0];
2469
+ for (let y = 0; y < i; y++) {
2470
+ const k = y * c[0];
2471
2471
  for (let $ = 0; $ < d; $++) {
2472
- const v = $ * g, w = Math.floor(v), S = Math.min(Math.ceil(v), l - 1), E = y + w * c[1], P = y + S * c[1], D = v - w, F = 1 - D;
2472
+ const v = $ * g, w = Math.floor(v), S = Math.min(Math.ceil(v), l - 1), E = k + w * c[1], P = k + S * c[1], D = v - w, F = 1 - D;
2473
2473
  for (let R = 0; R < h; R++) {
2474
2474
  const T = R * C, A = Math.floor(T), N = Math.min(Math.ceil(T), u - 1), O = T - A, V = 1 - O, L = E + A * c[2], B = E + N * c[2], W = P + A * c[2], z = P + N * c[2], M = F * V, H = F * O, K = D * V, Q = D * O;
2475
2475
  for (let q = 0; q < p; q++) {
@@ -2496,9 +2496,9 @@ function _m(a) {
2496
2496
  o && l > 1 ? l - 1 : l,
2497
2497
  o && u > 1 ? u - 1 : u
2498
2498
  ], I = g[0] / C[0], b = g[1] / C[1];
2499
- let k = 0;
2500
- for (let y = 0; y < p; y++) {
2501
- const $ = y * i[0];
2499
+ let y = 0;
2500
+ for (let k = 0; k < p; k++) {
2501
+ const $ = k * i[0];
2502
2502
  for (let v = 0; v < l; v++) {
2503
2503
  const w = r ? I * (v + 0.5) : I * v;
2504
2504
  let S = Math.min(d - 1, o ? Math.round(w) : Math.floor(w));
@@ -2511,7 +2511,7 @@ function _m(a) {
2511
2511
  const R = E + F * i[2];
2512
2512
  for (let T = 0; T < f; T++) {
2513
2513
  const A = m[R + T];
2514
- x[k++] = A;
2514
+ x[y++] = A;
2515
2515
  }
2516
2516
  }
2517
2517
  }
@@ -2532,13 +2532,13 @@ function Vm(a) {
2532
2532
  ], C = [
2533
2533
  r && h > 1 ? h - 1 : h,
2534
2534
  r && f > 1 ? f - 1 : f
2535
- ], I = g[0] / C[0], b = g[1] / C[1], k = 1 / I, y = 1 / b, $ = Math.ceil(k) * 2 + 2, v = Math.ceil(y) * 2 + 2;
2535
+ ], I = g[0] / C[0], b = g[1] / C[1], y = 1 / I, k = 1 / b, $ = Math.ceil(y) * 2 + 2, v = Math.ceil(k) * 2 + 2;
2536
2536
  for (let w = 0; w < l; w++) {
2537
2537
  const S = w * c[0];
2538
2538
  for (let E = 0; E < u; E++) {
2539
- const P = S + E * c[1], D = Math.floor(E * k), F = Math.floor(D - $ / 2);
2539
+ const P = S + E * c[1], D = Math.floor(E * y), F = Math.floor(D - $ / 2);
2540
2540
  for (let R = 0; R < p; R++) {
2541
- const T = P + R * c[2], A = Math.floor(R * y), N = Math.floor(A - v / 2);
2541
+ const T = P + R * c[2], A = Math.floor(R * k), N = Math.floor(A - v / 2);
2542
2542
  for (let O = 0; O < d; O++) {
2543
2543
  let V = 0;
2544
2544
  for (let L = 0; L < $; L++) {
@@ -2591,21 +2591,21 @@ const Gm = {
2591
2591
  kernelFunc: ({ inputs: a, attrs: t, backend: e }) => {
2592
2592
  const { image: n } = a, { radians: s, fillValue: o, center: r } = t, c = e, i = _e(n.dtype, G(n.shape)), [l, u, p, d] = n.shape, [h, f] = Rr(r, u, p), m = 255, x = Math.sin(s), g = Math.cos(s), C = c.data.get(n.dataId).values;
2593
2593
  for (let b = 0; b < l; b++) {
2594
- const k = b * p * u * d;
2595
- for (let y = 0; y < u; y++) {
2596
- const $ = y * (p * d);
2594
+ const y = b * p * u * d;
2595
+ for (let k = 0; k < u; k++) {
2596
+ const $ = k * (p * d);
2597
2597
  for (let v = 0; v < p; v++) {
2598
2598
  const w = v * d;
2599
2599
  for (let S = 0; S < d; S++) {
2600
- const E = [l, y, v, S], P = E[2], D = E[1];
2600
+ const E = [l, k, v, S], P = E[2], D = E[1];
2601
2601
  let F = (P - h) * g - (D - f) * x, R = (P - h) * x + (D - f) * g;
2602
2602
  F = Math.round(F + h), R = Math.round(R + f);
2603
2603
  let T = o;
2604
2604
  if (typeof o != "number" && (S === 3 ? T = m : T = o[S]), F >= 0 && F < p && R >= 0 && R < u) {
2605
- const N = R * (p * d), O = F * d, V = k + N + O + S;
2605
+ const N = R * (p * d), O = F * d, V = y + N + O + S;
2606
2606
  T = C[V];
2607
2607
  }
2608
- const A = k + $ + w + S;
2608
+ const A = y + $ + w + S;
2609
2609
  i[A] = T;
2610
2610
  }
2611
2611
  }
@@ -2711,14 +2711,14 @@ function hg(a) {
2711
2711
  j([s], "spaceToBatchND");
2712
2712
  const c = G(o), i = [[0, 0]];
2713
2713
  i.push(...r);
2714
- for (let y = 1 + o.length; y < s.shape.length; ++y)
2714
+ for (let k = 1 + o.length; k < s.shape.length; ++k)
2715
2715
  i.push([0, 0]);
2716
2716
  const l = hi.kernelFunc({
2717
2717
  inputs: { x: s },
2718
2718
  backend: e,
2719
2719
  attrs: { paddings: i, constantValue: 0 }
2720
- }), u = rs(l.shape, o, c, !1), p = is(u.length, o.length, !1), d = cs(l.shape, o, c, !1), m = ce({ inputs: { x: l }, backend: e, attrs: { shape: u } }), C = Re({ inputs: { x: m }, backend: e, attrs: { perm: p } }), k = ce({ inputs: { x: C }, backend: e, attrs: { shape: d } });
2721
- return e.disposeIntermediateTensorInfo(l), e.disposeIntermediateTensorInfo(m), e.disposeIntermediateTensorInfo(C), k;
2720
+ }), u = rs(l.shape, o, c, !1), p = is(u.length, o.length, !1), d = cs(l.shape, o, c, !1), m = ce({ inputs: { x: l }, backend: e, attrs: { shape: u } }), C = Re({ inputs: { x: m }, backend: e, attrs: { perm: p } }), y = ce({ inputs: { x: C }, backend: e, attrs: { shape: d } });
2721
+ return e.disposeIntermediateTensorInfo(l), e.disposeIntermediateTensorInfo(m), e.disposeIntermediateTensorInfo(C), y;
2722
2722
  }
2723
2723
  const fg = {
2724
2724
  kernelName: Wa,
@@ -2793,7 +2793,7 @@ const Ig = {
2793
2793
  backendName: "cpu",
2794
2794
  kernelFunc: bg
2795
2795
  };
2796
- function kg(a) {
2796
+ function yg(a) {
2797
2797
  const { inputs: t, backend: e } = a, { data: n, indices: s, segmentIds: o } = t;
2798
2798
  if (n.shape.length < 1)
2799
2799
  throw new Error("Data should be at least 1 dimensional but received scalar");
@@ -2808,10 +2808,10 @@ function kg(a) {
2808
2808
  const r = e.data.get(n.dataId).values, c = e.data.get(s.dataId).values, i = e.data.get(o.dataId).values, [l, u] = dr(r, n.shape, n.dtype, c, i);
2809
2809
  return e.makeTensorInfo(u, n.dtype, l);
2810
2810
  }
2811
- const yg = {
2811
+ const kg = {
2812
2812
  kernelName: za,
2813
2813
  backendName: "cpu",
2814
- kernelFunc: kg
2814
+ kernelFunc: yg
2815
2815
  };
2816
2816
  function $g(a) {
2817
2817
  const { inputs: t, backend: e, attrs: n } = a, { sparseIndices: s, sparseValues: o, defaultValue: r } = t, { outputShape: c } = n, { sliceRank: i, numUpdates: l, sliceSize: u, strides: p, outputSize: d } = Ct(o, s, c), h = !1, f = e.bufferSync(s);
@@ -2887,18 +2887,18 @@ function Eg(a) {
2887
2887
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { begin: o, end: r, strides: c, beginMask: i, endMask: l, ellipsisMask: u, newAxisMask: p, shrinkAxisMask: d } = n;
2888
2888
  j(s, "stridedSlice");
2889
2889
  const { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } = Lr(s.shape, o, r, c, i, l, u, p, d);
2890
- let k;
2890
+ let y;
2891
2891
  if (m)
2892
- k = ce({ inputs: { x: s }, backend: e, attrs: { shape: f } });
2892
+ y = ce({ inputs: { x: s }, backend: e, attrs: { shape: f } });
2893
2893
  else if (x || g) {
2894
2894
  te(s.shape.length >= 1, () => `Input must have rank at least 1, got: ${s.shape.length}`);
2895
- const y = Vr(C, I, b), $ = dt({ inputs: { x: s }, backend: e, attrs: { begin: C, size: y } });
2896
- k = ce({ inputs: { x: $ }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo($);
2895
+ const k = Vr(C, I, b), $ = dt({ inputs: { x: s }, backend: e, attrs: { begin: C, size: k } });
2896
+ y = ce({ inputs: { x: $ }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo($);
2897
2897
  } else {
2898
- const y = e.bufferSync(s), $ = ol(h, y, b, C);
2899
- k = e.makeTensorInfo(f, $.dtype, $.values);
2898
+ const k = e.bufferSync(s), $ = ol(h, k, b, C);
2899
+ y = e.makeTensorInfo(f, $.dtype, $.values);
2900
2900
  }
2901
- return k;
2901
+ return y;
2902
2902
  }
2903
2903
  const Dg = {
2904
2904
  kernelName: Ka,
@@ -2996,7 +2996,7 @@ const Kg = {
2996
2996
  kernelFunc: Xg
2997
2997
  };
2998
2998
  function jg(a) {
2999
- const { inputs: t, attrs: e, backend: n } = a, { image: s, transforms: o } = t, { interpolation: r, fillMode: c, fillValue: i, outputShape: l } = e, [u, p, d, h] = s.shape, [f, m] = l ?? [p, d], x = [u, f, m, h], g = ee(s.shape), C = g[0], I = g[1], b = g[2], k = ee(x), y = k[0], $ = k[1], v = k[2], w = _e(s.dtype, G(x));
2999
+ const { inputs: t, attrs: e, backend: n } = a, { image: s, transforms: o } = t, { interpolation: r, fillMode: c, fillValue: i, outputShape: l } = e, [u, p, d, h] = s.shape, [f, m] = l ?? [p, d], x = [u, f, m, h], g = ee(s.shape), C = g[0], I = g[1], b = g[2], y = ee(x), k = y[0], $ = y[1], v = y[2], w = _e(s.dtype, G(x));
3000
3000
  w.fill(i);
3001
3001
  const S = n.data.get(s.dataId).values, E = n.data.get(o.dataId).values;
3002
3002
  for (let D = 0; D < u; ++D) {
@@ -3019,7 +3019,7 @@ function jg(a) {
3019
3019
  default:
3020
3020
  throw new Error(`Error in Transform: Expect 'nearest' or 'bilinear', but got ${r}`);
3021
3021
  }
3022
- const z = D * y + R * $ + T * v + A;
3022
+ const z = D * k + R * $ + T * v + A;
3023
3023
  w[z] = N;
3024
3024
  }
3025
3025
  return n.makeTensorInfo(x, s.dtype, w);
@@ -3168,7 +3168,7 @@ const cx = [
3168
3168
  mp,
3169
3169
  xp,
3170
3170
  bp,
3171
- kp,
3171
+ yp,
3172
3172
  vp,
3173
3173
  wp,
3174
3174
  Tp,
@@ -3200,7 +3200,7 @@ const cx = [
3200
3200
  gh,
3201
3201
  Ch,
3202
3202
  Ih,
3203
- kh,
3203
+ yh,
3204
3204
  $h,
3205
3205
  Sh,
3206
3206
  Nh,
@@ -3219,8 +3219,8 @@ const cx = [
3219
3219
  Zh,
3220
3220
  Jh,
3221
3221
  tf,
3222
- kl,
3223
3222
  yl,
3223
+ kl,
3224
3224
  nf,
3225
3225
  af,
3226
3226
  cf,
@@ -3238,7 +3238,7 @@ const cx = [
3238
3238
  Nl,
3239
3239
  If,
3240
3240
  Rl,
3241
- yf,
3241
+ kf,
3242
3242
  Sf,
3243
3243
  Nf,
3244
3244
  Ef,
@@ -3267,7 +3267,7 @@ const cx = [
3267
3267
  gm,
3268
3268
  xm,
3269
3269
  hi,
3270
- km,
3270
+ ym,
3271
3271
  qd,
3272
3272
  Ol,
3273
3273
  $m,
@@ -3303,7 +3303,7 @@ const cx = [
3303
3303
  gg,
3304
3304
  Cg,
3305
3305
  Ig,
3306
- yg,
3306
+ kg,
3307
3307
  vg,
3308
3308
  wg,
3309
3309
  Wl,
@@ -3620,14 +3620,14 @@ function Ix(a, t, e, n) {
3620
3620
  function xi(a) {
3621
3621
  return a.internalFormatPackedFloat;
3622
3622
  }
3623
- function kx(a, t, e, n) {
3623
+ function yx(a, t, e, n) {
3624
3624
  const [s, o] = Ot(t, e);
3625
3625
  return Vt(a, s, o, xi(n), a.RGBA, a.FLOAT);
3626
3626
  }
3627
3627
  function Ci(a) {
3628
3628
  return a.internalFormatPackedHalfFloat;
3629
3629
  }
3630
- function yx(a, t, e, n) {
3630
+ function kx(a, t, e, n) {
3631
3631
  const [s, o] = Ot(t, e);
3632
3632
  return Vt(a, s, o, Ci(n), a.RGBA, n.textureTypeHalfFloat);
3633
3633
  }
@@ -3723,10 +3723,10 @@ class xs {
3723
3723
  this.throwIfDisposed(), vx(this.gl, t, e, n, s, this.textureConfig);
3724
3724
  }
3725
3725
  createFloat16PackedMatrixTexture(t, e) {
3726
- return this.throwIfDisposed(), yx(this.gl, t, e, this.textureConfig);
3726
+ return this.throwIfDisposed(), kx(this.gl, t, e, this.textureConfig);
3727
3727
  }
3728
3728
  createPackedMatrixTexture(t, e) {
3729
- return this.throwIfDisposed(), kx(this.gl, t, e, this.textureConfig);
3729
+ return this.throwIfDisposed(), yx(this.gl, t, e, this.textureConfig);
3730
3730
  }
3731
3731
  deleteMatrixTexture(t) {
3732
3732
  this.throwIfDisposed(), this.outputTexture === t && (Nn(this.gl, this.framebuffer), this.outputTexture = null), Y(this.gl, () => this.gl.deleteTexture(t));
@@ -3784,7 +3784,7 @@ class xs {
3784
3784
  this.throwIfDisposed(), this.program = t, this.program != null && this.debug && fs(this.gl, this.program), Y(this.gl, () => this.gl.useProgram(t));
3785
3785
  }
3786
3786
  getUniformLocation(t, e, n = !0) {
3787
- return this.throwIfDisposed(), n ? ku(this.gl, t, e) : yu(this.gl, t, e);
3787
+ return this.throwIfDisposed(), n ? yu(this.gl, t, e) : ku(this.gl, t, e);
3788
3788
  }
3789
3789
  getAttributeLocation(t, e) {
3790
3790
  return this.throwIfDisposed(), Y(this.gl, () => this.gl.getAttribLocation(t, e));
@@ -3940,7 +3940,7 @@ class Fx {
3940
3940
  }
3941
3941
  `;
3942
3942
  else {
3943
- const e = ke("rc", this.rank), n = he(this.rank), s = this.getOutOfBoundsCondition(e), o = this.getSetup(e), r = this.getOutput(e);
3943
+ const e = ye("rc", this.rank), n = he(this.rank), s = this.getOutOfBoundsCondition(e), o = this.getSetup(e), r = this.getOutput(e);
3944
3944
  this.userCode = `
3945
3945
  void main() {
3946
3946
  ${n} rc = getOutputCoords();
@@ -4122,7 +4122,7 @@ function Mn(a, t, e) {
4122
4122
  class Lx {
4123
4123
  constructor(t) {
4124
4124
  this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !1, this.outputShape = t, this.enableShapeUniforms = Pe(this.outputShape.length);
4125
- const e = t.length, n = ke("rc", e), s = he(e), o = yd(e, n), r = n.slice(-2), c = e <= 1 ? "rc" : `vec2(${r.join(",")})`;
4125
+ const e = t.length, n = ye("rc", e), s = he(e), o = kd(e, n), r = n.slice(-2), c = e <= 1 ? "rc" : `vec2(${r.join(",")})`;
4126
4126
  this.userCode = `
4127
4127
  void main() {
4128
4128
  ${s} rc = getOutputCoords();
@@ -4577,8 +4577,8 @@ class us extends oo {
4577
4577
  (i || !x) && ([f, m] = Ot(p[0], p[1])), i ? h = new fx(d, x) : h = new Ln(d, x);
4578
4578
  const g = x ? [m, f] : p, C = this.makeTensorInfo(g, s), I = this.texData.get(C.dataId);
4579
4579
  x ? I.usage = De.PIXELS : I.usage = De.UPLOAD, I.texShape = g, this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(C.dataId), f, m, o);
4580
- const b = [[m, f]], y = this.runWebGLProgram(h, [C], s, b, !0), $ = this.texData.get(y.dataId);
4581
- e.texShape = $.texShape, e.isPacked = $.isPacked, e.usage = $.usage, _().get("ENGINE_COMPILE_ONLY") ? this.disposeData(y.dataId) : (e.texture = $.texture, e.values = null, this.texData.delete(y.dataId)), this.disposeIntermediateTensorInfo(C), l && (this.uploadWaitMs += Ge() - u);
4580
+ const b = [[m, f]], k = this.runWebGLProgram(h, [C], s, b, !0), $ = this.texData.get(k.dataId);
4581
+ e.texShape = $.texShape, e.isPacked = $.isPacked, e.usage = $.usage, _().get("ENGINE_COMPILE_ONLY") ? this.disposeData(k.dataId) : (e.texture = $.texture, e.values = null, this.texData.delete(k.dataId)), this.disposeIntermediateTensorInfo(C), l && (this.uploadWaitMs += Ge() - u);
4582
4582
  } else {
4583
4583
  const d = this.acquireTexture(p, c, s, i);
4584
4584
  e.texture = d;
@@ -4753,7 +4753,7 @@ const bi = 1e3;
4753
4753
  function es({ a, b: t, transposeA: e, transposeB: n, backend: s, bias: o = null, preluActivationWeights: r = null, leakyreluAlpha: c = 0, activation: i = null }) {
4754
4754
  const l = a.shape.length, u = t.shape.length, p = e ? a.shape[l - 2] : a.shape[l - 1], d = n ? t.shape[u - 1] : t.shape[u - 2], h = e ? a.shape[l - 1] : a.shape[l - 2], f = n ? t.shape[u - 2] : t.shape[u - 1], m = a.shape.slice(0, -2), x = t.shape.slice(0, -2), g = G(m), C = G(x), b = Ne(a.shape.slice(0, -2), t.shape.slice(0, -2)).concat([h, f]);
4755
4755
  te(p === d, () => `Error in matMul: inner shapes (${p}) and (${d}) of Tensors with shapes ${a.shape} and ${t.shape} and transposeA=${e} and transposeB=${n} must match.`);
4756
- const k = e ? [g, p, h] : [g, h, p], y = n ? [C, f, d] : [C, d, f], $ = U({ inputs: { x: a }, backend: s, attrs: { shape: k } }), v = U({ inputs: { x: t }, backend: s, attrs: { shape: y } }), w = [$, v], S = Math.max(g, C), E = e ? $.shape[1] : $.shape[2], P = o != null, D = r != null, F = i === "leakyrelu", R = i != null ? Rt(i, !0) : null, T = P || D || F || R != null;
4756
+ const y = e ? [g, p, h] : [g, h, p], k = n ? [C, f, d] : [C, d, f], $ = U({ inputs: { x: a }, backend: s, attrs: { shape: y } }), v = U({ inputs: { x: t }, backend: s, attrs: { shape: k } }), w = [$, v], S = Math.max(g, C), E = e ? $.shape[1] : $.shape[2], P = o != null, D = r != null, F = i === "leakyrelu", R = i != null ? Rt(i, !0) : null, T = P || D || F || R != null;
4757
4757
  let A;
4758
4758
  if ((h === 1 || f === 1) && E > bi && T === !1) {
4759
4759
  let O = $, V = v;
@@ -4775,7 +4775,7 @@ function es({ a, b: t, transposeA: e, transposeB: n, backend: s, bias: o = null,
4775
4775
  const H = Cn({ inputs: { a: W, b: M }, backend: s });
4776
4776
  A = fn({ inputs: { x: H }, backend: s, attrs: { axis: z, keepDims: !0 } }), w.push(H);
4777
4777
  } else {
4778
- const O = Qe(a.dtype, t.dtype), V = new qr(k, y, [S, h, f], e, n, P, R, D, F), L = [$, v];
4778
+ const O = Qe(a.dtype, t.dtype), V = new qr(y, k, [S, h, f], e, n, P, R, D, F), L = [$, v];
4779
4779
  if (o != null && L.push(o), D && L.push(r), F) {
4780
4780
  const B = s.makeTensorInfo([], "float32", mt(c, "float32"));
4781
4781
  L.push(B), w.push(B);
@@ -4908,7 +4908,7 @@ function lC(a) {
4908
4908
  let l = i;
4909
4909
  const u = ge(l, c);
4910
4910
  let p = s;
4911
- u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), l = xe(l.length, c)), ye("all", l, c);
4911
+ u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), l = xe(l.length, c)), ke("all", l, c);
4912
4912
  const [d, h] = ve(p.shape, l), f = G(h), m = U({ inputs: { x: p }, backend: e, attrs: { shape: [-1, f] } }), x = _t(m, m.dtype, "all", e);
4913
4913
  let g;
4914
4914
  if (r) {
@@ -4928,7 +4928,7 @@ function dC(a) {
4928
4928
  let l = i;
4929
4929
  const u = ge(l, c);
4930
4930
  let p = s;
4931
- u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), l = xe(l.length, c)), ye("any", l, c);
4931
+ u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), l = xe(l.length, c)), ke("any", l, c);
4932
4932
  const [d, h] = ve(p.shape, l), f = G(h), m = U({ inputs: { x: p }, backend: e, attrs: { shape: [-1, f] } }), x = _t(m, m.dtype, "any", e);
4933
4933
  let g;
4934
4934
  if (r) {
@@ -4977,7 +4977,7 @@ class fC {
4977
4977
  this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0, te(t.length > 2, () => `Packed arg${n.charAt(0).toUpperCase() + n.slice(1)} supports only inputs with rank above 2.`);
4978
4978
  const o = t[t.length - 1], r = Math.ceil(o / e);
4979
4979
  this.outputShape = t.slice(0, -1), r > 1 && this.outputShape.push(r), s || this.variableNames.push("bestIndicesA");
4980
- const c = this.outputShape, i = c.length, l = he(i), u = ke("coords", i);
4980
+ const c = this.outputShape, i = c.length, l = he(i), u = ye("coords", i);
4981
4981
  let p, d;
4982
4982
  if (r === 1) {
4983
4983
  d = i + 1;
@@ -5001,11 +5001,11 @@ class fC {
5001
5001
  --${u[i - 1]};
5002
5002
  ${l} sourceLocB = coords;
5003
5003
  --${u[i - 2]};`;
5004
- const h = ["x", "y", "z", "w", "u", "v"].slice(0, d), f = "." + h[d - 1], m = h.map((v) => "int " + v), x = ke("sourceLocR", d - 1).concat("inIdx.r"), g = ke("sourceLocG", d - 1).concat("inIdx.g"), C = ke("sourceLocB", d - 1).concat("inIdx.b"), I = ke("sourceLocA", d - 1).concat("inIdx.a"), b = n === "max" ? "greaterThan" : "lessThan", k = s ? "" : `
5004
+ const h = ["x", "y", "z", "w", "u", "v"].slice(0, d), f = "." + h[d - 1], m = h.map((v) => "int " + v), x = ye("sourceLocR", d - 1).concat("inIdx.r"), g = ye("sourceLocG", d - 1).concat("inIdx.g"), C = ye("sourceLocB", d - 1).concat("inIdx.b"), I = ye("sourceLocA", d - 1).concat("inIdx.a"), b = n === "max" ? "greaterThan" : "lessThan", y = s ? "" : `
5005
5005
  inIdx = round(vec4(getBestIndicesAChannel(${x.join()}),
5006
5006
  getBestIndicesAChannel(${g.join()}),
5007
5007
  getBestIndicesAChannel(${C.join()}),
5008
- getBestIndicesAChannel(${I.join()})));`, y = `vec4(
5008
+ getBestIndicesAChannel(${I.join()})));`, k = `vec4(
5009
5009
  getAChannel(${x.join()}),
5010
5010
  hasNextCol ? getAChannel(${g.join()}) : 0.,
5011
5011
  hasNextRow ? getAChannel(${C.join()}) : 0.,
@@ -5029,12 +5029,12 @@ class fC {
5029
5029
  sourceLocB${f}, sourceLocA${f}) * ${e};
5030
5030
  ivec4 inIdx = srcIdx;
5031
5031
  vec4 bestIndex = vec4(inIdx);
5032
- vec4 bestValue = ${y};
5032
+ vec4 bestValue = ${k};
5033
5033
 
5034
5034
  for (int i = 0; i < ${e}; i++) {
5035
5035
  inIdx = srcIdx;
5036
- ${k}
5037
- vec4 candidate = ${y};
5036
+ ${y}
5037
+ vec4 candidate = ${k};
5038
5038
  bvec4 nan = isnan(candidate);
5039
5039
  bvec4 replace = bvec4(
5040
5040
  vec4(${b}(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));
@@ -5062,17 +5062,17 @@ function Ii(a, t, e, n = null) {
5062
5062
  const p = Ii(a, t, e, u);
5063
5063
  return a.disposeIntermediateTensorInfo(u), p;
5064
5064
  }
5065
- function ki(a, t, e, n = null) {
5065
+ function yi(a, t, e, n = null) {
5066
5066
  const s = n != null ? n.shape : t.shape, o = s[s.length - 1], r = Er(o), c = new fC(s, r, e, n == null), i = n == null ? [t] : [t, n], l = a.runWebGLProgram(c, i, "int32");
5067
5067
  if (l.shape.length === t.shape.length) {
5068
- const u = ki(a, t, e, l);
5068
+ const u = yi(a, t, e, l);
5069
5069
  return a.disposeIntermediateTensorInfo(l), u;
5070
5070
  }
5071
5071
  return l;
5072
5072
  }
5073
- function yi(a, t, e, n) {
5073
+ function ki(a, t, e, n) {
5074
5074
  const s = [e];
5075
- if (ye("arg" + n.charAt(0).toUpperCase() + n.slice(1), s, t.shape.length), !_().getBool("WEBGL_PACK_REDUCE") || t.shape.length <= 2) {
5075
+ if (ke("arg" + n.charAt(0).toUpperCase() + n.slice(1), s, t.shape.length), !_().getBool("WEBGL_PACK_REDUCE") || t.shape.length <= 2) {
5076
5076
  const o = [], r = a.texData.get(t.dataId), c = r !== null && r.isPacked;
5077
5077
  let i = t;
5078
5078
  c && (i = a.unpackTensor(t), o.push(i));
@@ -5083,7 +5083,7 @@ function yi(a, t, e, n) {
5083
5083
  const f = U({ inputs: { x: h }, backend: a, attrs: { shape: l } });
5084
5084
  return o.forEach((m) => a.disposeIntermediateTensorInfo(m)), f;
5085
5085
  }
5086
- return ki(a, t, n);
5086
+ return yi(a, t, n);
5087
5087
  }
5088
5088
  function mC(a) {
5089
5089
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { axis: o } = n;
@@ -5091,8 +5091,8 @@ function mC(a) {
5091
5091
  const c = ge(r, s.shape.length);
5092
5092
  let i = s;
5093
5093
  const l = [];
5094
- c != null && (i = Ie({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), ye("argMax", [r[0]], i.shape.length);
5095
- const u = yi(e, i, r[0], "max");
5094
+ c != null && (i = Ie({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), ke("argMax", [r[0]], i.shape.length);
5095
+ const u = ki(e, i, r[0], "max");
5096
5096
  return l.forEach((p) => e.disposeIntermediateTensorInfo(p)), u;
5097
5097
  }
5098
5098
  const gC = {
@@ -5106,8 +5106,8 @@ function xC(a) {
5106
5106
  const c = ge(r, s.shape.length);
5107
5107
  let i = s;
5108
5108
  const l = [];
5109
- c != null && (i = Ie({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), ye("argMin", [r[0]], i.shape.length);
5110
- const u = yi(e, i, r[0], "min");
5109
+ c != null && (i = Ie({ inputs: { x: s }, backend: e, attrs: { perm: c } }), l.push(i), r = xe(r.length, i.shape.length)), ke("argMin", [r[0]], i.shape.length);
5110
+ const u = ki(e, i, r[0], "min");
5111
5111
  return l.forEach((p) => e.disposeIntermediateTensorInfo(p)), u;
5112
5112
  }
5113
5113
  const CC = {
@@ -5120,12 +5120,12 @@ const bC = We + `
5120
5120
  return NAN;
5121
5121
  }
5122
5122
  return asin(x);
5123
- `, IC = se({ opSnippet: bC }), kC = {
5123
+ `, IC = se({ opSnippet: bC }), yC = {
5124
5124
  kernelName: Ds,
5125
5125
  backendName: "webgl",
5126
5126
  kernelFunc: IC
5127
5127
  };
5128
- const yC = We + "return log(x + sqrt(x * x + 1.0));", $C = se({ opSnippet: yC }), vC = {
5128
+ const kC = We + "return log(x + sqrt(x * x + 1.0));", $C = se({ opSnippet: kC }), vC = {
5129
5129
  kernelName: Fs,
5130
5130
  backendName: "webgl",
5131
5131
  kernelFunc: $C
@@ -5224,7 +5224,7 @@ class Tt {
5224
5224
  const I = "max";
5225
5225
  let b = `${e}(${e}(${e}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;
5226
5226
  e === "avg" && (b = "avgValue / max(count, 1.0)");
5227
- const k = Math.floor(r / 4) * 4, y = r % 4, $ = `
5227
+ const y = Math.floor(r / 4) * 4, k = r % 4, $ = `
5228
5228
  if (${m}) {
5229
5229
  avgValue += dot(values, ones);
5230
5230
  } else {
@@ -5270,7 +5270,7 @@ class Tt {
5270
5270
  continue;
5271
5271
  }
5272
5272
 
5273
- for (int wC = 0; wC < ${k}; wC += 4) {
5273
+ for (int wC = 0; wC < ${y}; wC += 4) {
5274
5274
  int xC = xCCorner + wC * ${u};
5275
5275
 
5276
5276
  vec4 values = vec4(
@@ -5283,8 +5283,8 @@ class Tt {
5283
5283
  ${$}
5284
5284
  }
5285
5285
 
5286
- int xC = xCCorner + ${k};
5287
- if (${y === 1}) {
5286
+ int xC = xCCorner + ${y};
5287
+ if (${k === 1}) {
5288
5288
  vec4 values = vec4(
5289
5289
  getValue(batch, xR, xC, d),
5290
5290
  initializationValue,
@@ -5293,7 +5293,7 @@ class Tt {
5293
5293
  );
5294
5294
 
5295
5295
  ${$}
5296
- } else if (${y === 2}) {
5296
+ } else if (${k === 2}) {
5297
5297
  vec4 values = vec4(
5298
5298
  getValue(batch, xR, xC, d),
5299
5299
  getValue(batch, xR, xC + ${u}, d),
@@ -5302,7 +5302,7 @@ class Tt {
5302
5302
  );
5303
5303
 
5304
5304
  ${$}
5305
- } else if (${y === 3}) {
5305
+ } else if (${k === 3}) {
5306
5306
  vec4 values = vec4(
5307
5307
  getValue(batch, xR, xC, d),
5308
5308
  getValue(batch, xR, xC + ${u}, d),
@@ -5392,14 +5392,14 @@ class bn {
5392
5392
  `;
5393
5393
  return;
5394
5394
  }
5395
- const k = "max";
5396
- let y = `${e}(${e}(${e}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;
5397
- e === "avg" && (y = "avgValue / max(count, 1.0)");
5395
+ const y = "max";
5396
+ let k = `${e}(${e}(${e}(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])`;
5397
+ e === "avg" && (k = "avgValue / max(count, 1.0)");
5398
5398
  const $ = Math.floor(r / 4) * 4, v = r % 4, w = `
5399
5399
  if (${I}) {
5400
5400
  avgValue += dot(values, ones);
5401
5401
  } else {
5402
- minMaxValue = ${k}(values, minMaxValue);
5402
+ minMaxValue = ${y}(values, minMaxValue);
5403
5403
  }
5404
5404
  `;
5405
5405
  this.userCode = `
@@ -5495,7 +5495,7 @@ class bn {
5495
5495
  }
5496
5496
  }
5497
5497
  }
5498
- setOutput(${y});
5498
+ setOutput(${k});
5499
5499
  }
5500
5500
  `;
5501
5501
  }
@@ -5720,7 +5720,7 @@ const qC = ({ inputs: a, backend: t, attrs: e }) => {
5720
5720
  const d = _().getBool("WEBGL_PACK_NORMALIZATION") ? new jC(n.shape, s.shape, o.shape, u, p, i) : new KC(n.shape, s.shape, o.shape, u, p, i);
5721
5721
  return t.runWebGLProgram(d, l, l[0].dtype);
5722
5722
  }, YC = {
5723
- kernelName: ko,
5723
+ kernelName: yo,
5724
5724
  backendName: "webgl",
5725
5725
  kernelFunc: qC
5726
5726
  };
@@ -5731,7 +5731,7 @@ class QC {
5731
5731
  this.customUniforms = [{ name: "start", arrayIndex: this.rank, type: "int" }];
5732
5732
  const n = ZC(this.rank);
5733
5733
  let s;
5734
- const o = t.map((r, c) => `sourceLoc.${ys[c]} = start[${c}] + coords.${ys[c]};`);
5734
+ const o = t.map((r, c) => `sourceLoc.${ks[c]} = start[${c}] + coords.${ks[c]};`);
5735
5735
  s = `
5736
5736
  ${e} sourceLoc;
5737
5737
  ${e} coords = getOutputCoords();
@@ -5745,18 +5745,18 @@ class QC {
5745
5745
  `;
5746
5746
  }
5747
5747
  }
5748
- const ys = ["x", "y", "z", "w", "u", "v"];
5748
+ const ks = ["x", "y", "z", "w", "u", "v"];
5749
5749
  function ZC(a) {
5750
5750
  if (a === 1)
5751
5751
  return "sourceLoc";
5752
5752
  if (a <= 6)
5753
- return ys.slice(0, a).map((t) => "sourceLoc." + t).join(",");
5753
+ return ks.slice(0, a).map((t) => "sourceLoc." + t).join(",");
5754
5754
  throw Error(`Slicing for rank ${a} is not yet supported`);
5755
5755
  }
5756
5756
  class JC {
5757
5757
  constructor(t) {
5758
5758
  this.variableNames = ["source"], this.packedInputs = !0, this.packedOutput = !0, this.outputShape = t, this.rank = t.length, this.customUniforms = [{ name: "start", arrayIndex: this.rank, type: "int" }];
5759
- const e = he(this.rank), n = ke("coords", this.rank), s = ke("sourceLoc", this.rank), o = this.rank === 1 ? "sourceLoc" : `vec2(${s.slice(-2).join()})`, r = `getChannel(getSource(${s.join()}), ${o})`, c = `
5759
+ const e = he(this.rank), n = ye("coords", this.rank), s = ye("sourceLoc", this.rank), o = this.rank === 1 ? "sourceLoc" : `vec2(${s.slice(-2).join()})`, r = `getChannel(getSource(${s.join()}), ${o})`, c = `
5760
5760
  result.x = ${r};
5761
5761
  if (++${n[this.rank - 1]} < ${t[this.rank - 1]}) {
5762
5762
  ++${s[this.rank - 1]};
@@ -5801,7 +5801,7 @@ function eb(a, t, e, n) {
5801
5801
  const i = n.dataRefCount.get(r.slice.origDataId) || 1;
5802
5802
  return n.dataRefCount.set(r.slice.origDataId, i + 1), o;
5803
5803
  }
5804
- function kt(a) {
5804
+ function yt(a) {
5805
5805
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { begin: o, size: r } = n, [c, i] = eu(s, o, r);
5806
5806
  if (tu(s, c, i), G(i) === 0)
5807
5807
  return e.makeTensorInfo(i, s.dtype, []);
@@ -5819,7 +5819,7 @@ function kt(a) {
5819
5819
  const tb = {
5820
5820
  kernelName: dc,
5821
5821
  backendName: "webgl",
5822
- kernelFunc: kt
5822
+ kernelFunc: yt
5823
5823
  };
5824
5824
  const sb = (a) => {
5825
5825
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { blockShape: o, crops: r } = n;
@@ -5828,14 +5828,14 @@ const sb = (a) => {
5828
5828
  inputs: { x: m },
5829
5829
  backend: e,
5830
5830
  attrs: { shape: u }
5831
- }), g = kt({
5831
+ }), g = yt({
5832
5832
  inputs: { x },
5833
5833
  backend: e,
5834
5834
  attrs: { begin: p, size: d }
5835
5835
  });
5836
5836
  return h.push(f), h.push(m), h.push(x), h.forEach((C) => e.disposeIntermediateTensorInfo(C)), g;
5837
5837
  }, nb = {
5838
- kernelName: yo,
5838
+ kernelName: ko,
5839
5839
  backendName: "webgl",
5840
5840
  kernelFunc: sb
5841
5841
  };
@@ -5956,7 +5956,7 @@ class Ib {
5956
5956
  `;
5957
5957
  }
5958
5958
  }
5959
- class kb {
5959
+ class yb {
5960
5960
  constructor(t) {
5961
5961
  this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0, this.customUniforms = [
5962
5962
  { name: "minVal", type: "float" },
@@ -5975,17 +5975,17 @@ class kb {
5975
5975
  `;
5976
5976
  }
5977
5977
  }
5978
- function yb(a) {
5978
+ function kb(a) {
5979
5979
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { clipValueMin: o, clipValueMax: r } = n;
5980
5980
  let c;
5981
- _().getBool("WEBGL_PACK_CLIP") ? c = new kb(s.shape) : c = new Ib(s.shape);
5981
+ _().getBool("WEBGL_PACK_CLIP") ? c = new yb(s.shape) : c = new Ib(s.shape);
5982
5982
  const i = [[o], [r]];
5983
5983
  return e.runWebGLProgram(c, [s], s.dtype, i);
5984
5984
  }
5985
5985
  const $b = {
5986
5986
  kernelName: _s,
5987
5987
  backendName: "webgl",
5988
- kernelFunc: yb
5988
+ kernelFunc: kb
5989
5989
  };
5990
5990
  class vb {
5991
5991
  constructor(t) {
@@ -6057,7 +6057,7 @@ class Nb {
6057
6057
  class Rb {
6058
6058
  constructor(t, e) {
6059
6059
  this.packedInputs = !0, this.packedOutput = !0, this.outputShape = [], this.outputShape = Ue(t, e);
6060
- const n = this.outputShape, s = n.length, o = he(s), r = ke("coords", s), c = ["x", "y", "z", "w", "u", "v"].slice(0, s);
6060
+ const n = this.outputShape, s = n.length, o = he(s), r = ye("coords", s), c = ["x", "y", "z", "w", "u", "v"].slice(0, s);
6061
6061
  this.variableNames = t.map((m, x) => `T${x}`);
6062
6062
  const i = new Array(t.length - 1);
6063
6063
  i[0] = t[0][e];
@@ -6132,8 +6132,8 @@ function vt(a, t, e) {
6132
6132
  let s = e.shouldExecuteOnCPU(a);
6133
6133
  if (n === "string" && (s = !0), s) {
6134
6134
  const h = a.map((b) => {
6135
- const y = [-1, G(b.shape.slice(t))];
6136
- return U({ inputs: { x: b }, backend: e, attrs: { shape: y } });
6135
+ const k = [-1, G(b.shape.slice(t))];
6136
+ return U({ inputs: { x: b }, backend: e, attrs: { shape: k } });
6137
6137
  }), f = h.map((b) => ({ vals: e.readSync(b.dataId), shape: b.shape })), m = Ue(
6138
6138
  h.map((b) => b.shape),
6139
6139
  1
@@ -6193,7 +6193,7 @@ class Si {
6193
6193
  constructor(t, e = !1, n = null, s = !1, o = !1) {
6194
6194
  this.variableNames = ["x", "W"], this.outputShape = t.outShape;
6195
6195
  const r = t.padInfo.top, c = t.padInfo.left, i = t.strideHeight, l = t.strideWidth, u = t.dilationHeight, p = t.dilationWidth, d = t.filterHeight, h = t.filterWidth, f = Math.floor(t.inChannels / 4) * 4, m = t.inChannels % 4, x = t.dataFormat === "channelsLast", g = x ? 1 : 2, C = x ? 2 : 3, I = x ? 3 : 1;
6196
- let b = "", k = "";
6196
+ let b = "", y = "";
6197
6197
  n && (s ? b = `float activation(float a) {
6198
6198
  float b = getPreluActivationWeightsAtOutCoords();
6199
6199
  ${n}
@@ -6204,8 +6204,8 @@ class Si {
6204
6204
  float activation(float x) {
6205
6205
  ${n}
6206
6206
  }
6207
- `, k = "result = activation(result);");
6208
- const y = e ? "result += getBiasAtOutCoords();" : "";
6207
+ `, y = "result = activation(result);");
6208
+ const k = e ? "result += getBiasAtOutCoords();" : "";
6209
6209
  e && this.variableNames.push("bias"), s && this.variableNames.push("preluActivationWeights"), o && this.variableNames.push("leakyreluAlpha"), this.userCode = `
6210
6210
  ${b}
6211
6211
 
@@ -6326,8 +6326,8 @@ class Si {
6326
6326
  }
6327
6327
 
6328
6328
  float result = dotProd;
6329
- ${y}
6330
6329
  ${k}
6330
+ ${y}
6331
6331
  setOutput(result);
6332
6332
  }
6333
6333
  `;
@@ -6755,12 +6755,12 @@ function Ni({ x: a, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
6755
6755
  b != null && (s = U({ inputs: { x: s }, backend: n, attrs: { shape: b } }), g.push(s));
6756
6756
  }
6757
6757
  if (!((p === 1 || d === 1) && u > bi) && l.isPacked && h && l.texture != null && i[2] % 2 !== 0 && nt(l.shape.slice(-3), i.slice(-3))) {
6758
- const b = i[0] * i[1] * (i[2] + 1), k = {
6758
+ const b = i[0] * i[1] * (i[2] + 1), y = {
6759
6759
  dataId: a.dataId,
6760
6760
  shape: [1, b, e.inChannels],
6761
6761
  dtype: a.dtype
6762
- }, y = l.shape;
6763
- l.shape = l.shape.slice(), l.shape[l.shape.length - 2]++, te(Ur(l.shape, k.shape), () => `packed reshape ${l.shape} to ${k.shape} isn't free`);
6762
+ }, k = l.shape;
6763
+ l.shape = l.shape.slice(), l.shape[l.shape.length - 2]++, te(Ur(l.shape, y.shape), () => `packed reshape ${l.shape} to ${y.shape} isn't free`);
6764
6764
  const $ = U({
6765
6765
  inputs: { x: t },
6766
6766
  backend: n,
@@ -6768,7 +6768,7 @@ function Ni({ x: a, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
6768
6768
  });
6769
6769
  g.push($);
6770
6770
  const v = es({
6771
- a: k,
6771
+ a: y,
6772
6772
  b: $,
6773
6773
  backend: n,
6774
6774
  transposeA: f,
@@ -6778,21 +6778,21 @@ function Ni({ x: a, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
6778
6778
  preluActivationWeights: o,
6779
6779
  leakyreluAlpha: r
6780
6780
  }), w = n.texData.get(v.dataId);
6781
- te(w.isPacked, () => "batchMatMul result is expected to be packed"), l.shape = y, w.shape = e.outShape, x = Fe({ inputs: { x: v }, backend: n }), x.shape = e.outShape, g.push(v);
6781
+ te(w.isPacked, () => "batchMatMul result is expected to be packed"), l.shape = k, w.shape = e.outShape, x = Fe({ inputs: { x: v }, backend: n }), x.shape = e.outShape, g.push(v);
6782
6782
  } else {
6783
- const b = e.outHeight * e.outWidth, k = U({
6783
+ const b = e.outHeight * e.outWidth, y = U({
6784
6784
  inputs: { x: a },
6785
6785
  backend: n,
6786
6786
  attrs: {
6787
6787
  shape: h ? [e.batchSize, b, e.inChannels] : [e.batchSize, e.inChannels, b]
6788
6788
  }
6789
- }), y = U({
6789
+ }), k = U({
6790
6790
  inputs: { x: t },
6791
6791
  backend: n,
6792
6792
  attrs: { shape: [1, e.inChannels, e.outChannels] }
6793
6793
  }), $ = es({
6794
- a: h ? k : y,
6795
- b: h ? y : k,
6794
+ a: h ? y : k,
6795
+ b: h ? k : y,
6796
6796
  transposeA: !h,
6797
6797
  transposeB: m,
6798
6798
  backend: n,
@@ -6801,7 +6801,7 @@ function Ni({ x: a, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
6801
6801
  preluActivationWeights: o,
6802
6802
  leakyreluAlpha: r
6803
6803
  });
6804
- x = U({ inputs: { x: $ }, backend: n, attrs: { shape: e.outShape } }), g.push(k), g.push(y), g.push($);
6804
+ x = U({ inputs: { x: $ }, backend: n, attrs: { shape: e.outShape } }), g.push(y), g.push(k), g.push($);
6805
6805
  }
6806
6806
  for (const b of g)
6807
6807
  n.disposeIntermediateTensorInfo(b);
@@ -6821,13 +6821,13 @@ function Ri({ x: a, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
6821
6821
  const N = ts(s.shape, f);
6822
6822
  N != null && (s = U({ inputs: { x: s }, backend: n, attrs: { shape: N } }), b.push(s));
6823
6823
  }
6824
- const k = U({
6824
+ const y = U({
6825
6825
  inputs: { x: t },
6826
6826
  backend: n,
6827
6827
  attrs: { shape: [1, m, G(t.shape) / m] }
6828
6828
  });
6829
- b.push(k);
6830
- const y = new Pb(g, e), $ = [
6829
+ b.push(y);
6830
+ const k = new Pb(g, e), $ = [
6831
6831
  a.shape,
6832
6832
  [e.padInfo.top, e.padInfo.left],
6833
6833
  [e.strideHeight, e.strideWidth],
@@ -6835,9 +6835,9 @@ function Ri({ x: a, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
6835
6835
  [e.inChannels],
6836
6836
  [e.filterWidth * e.inChannels],
6837
6837
  [e.outWidth]
6838
- ], v = n.runWebGLProgram(y, [a], "float32", $), w = U({ inputs: { x: v }, backend: n, attrs: { shape: g } });
6838
+ ], v = n.runWebGLProgram(k, [a], "float32", $), w = U({ inputs: { x: v }, backend: n, attrs: { shape: g } });
6839
6839
  b.push(v), b.push(w);
6840
- const S = s != null, E = o != null, P = c === "leakyrelu", D = c ? Rt(c, !0) : null, F = new qr(f ? w.shape : k.shape, f ? k.shape : w.shape, f ? [e.batchSize, x, e.outChannels] : [e.batchSize, e.outChannels, x], C, I, S, D, E, P), R = f ? [w, k] : [k, w];
6840
+ const S = s != null, E = o != null, P = c === "leakyrelu", D = c ? Rt(c, !0) : null, F = new qr(f ? w.shape : y.shape, f ? y.shape : w.shape, f ? [e.batchSize, x, e.outChannels] : [e.batchSize, e.outChannels, x], C, I, S, D, E, P), R = f ? [w, y] : [y, w];
6841
6841
  if (s && R.push(s), E && R.push(o), P) {
6842
6842
  const N = n.makeTensorInfo([], "float32", mt(r, "float32"));
6843
6843
  R.push(N), b.push(N);
@@ -7261,7 +7261,7 @@ class o1 {
7261
7261
  "0.0",
7262
7262
  "0.0",
7263
7263
  `0.5 * (y1+y2) * ${f}`
7264
- ], [I, b, k] = d > 1 ? [
7264
+ ], [I, b, y] = d > 1 ? [
7265
7265
  `${(i - 1) / (d - 1)}`,
7266
7266
  "(x2-x1) * width_ratio",
7267
7267
  `x1*${m} + float(x)*(width_scale)`
@@ -7300,7 +7300,7 @@ class o1 {
7300
7300
  setOutput(float(${o}));
7301
7301
  return;
7302
7302
  }
7303
- float in_x = ${k};
7303
+ float in_x = ${y};
7304
7304
  if( in_x < 0.0 || in_x > ${m} ) {
7305
7305
  setOutput(float(${o}));
7306
7306
  return;
@@ -7921,12 +7921,12 @@ function I1(a) {
7921
7921
  ), d = new C1(p);
7922
7922
  return e.runWebGLProgram(d, [s, o], "float32");
7923
7923
  }
7924
- const k1 = {
7924
+ const y1 = {
7925
7925
  kernelName: Mo,
7926
7926
  backendName: "webgl",
7927
7927
  kernelFunc: I1
7928
7928
  };
7929
- function y1(a) {
7929
+ function k1(a) {
7930
7930
  const { inputs: t, backend: e, attrs: n } = a, { dy: s, filter: o } = t, { strides: r, dilations: c, pad: i, dimRoundingMode: l, inputShape: u } = n, p = Se(
7931
7931
  u,
7932
7932
  o.shape,
@@ -7942,7 +7942,7 @@ function y1(a) {
7942
7942
  const $1 = {
7943
7943
  kernelName: Bo,
7944
7944
  backendName: "webgl",
7945
- kernelFunc: y1
7945
+ kernelFunc: k1
7946
7946
  };
7947
7947
  class v1 {
7948
7948
  constructor(t) {
@@ -8034,8 +8034,8 @@ function E1(a) {
8034
8034
  let I;
8035
8035
  br(g) ? I = o[x] : (I = Ie({ inputs: { x: o[x] }, backend: e, attrs: { perm: g } }), f.push(I));
8036
8036
  const b = I.shape.slice();
8037
- for (let k = 0; k < C.length; ++k)
8038
- b.splice(C[k], 0, 1);
8037
+ for (let y = 0; y < C.length; ++y)
8038
+ b.splice(C[y], 0, 1);
8039
8039
  nt(I.shape, b) || (I = U({ inputs: { x: I }, backend: e, attrs: { shape: b } }), f.push(I)), d === null ? d = I : (d = Cn({ inputs: { a: I, b: d }, backend: e }), f.push(d));
8040
8040
  }
8041
8041
  m < p - 1 && (l[m] >= 0 && (d = fn({
@@ -8100,8 +8100,8 @@ const U1 = `
8100
8100
  float p = ${Sr};
8101
8101
  float a1 = ${vr};
8102
8102
  float a2 = ${$r};
8103
- float a3 = ${yr};
8104
- float a4 = ${kr};
8103
+ float a3 = ${kr};
8104
+ float a4 = ${yr};
8105
8105
  float a5 = ${Ir};
8106
8106
 
8107
8107
  float sign = sign(x);
@@ -8280,7 +8280,7 @@ const o0 = {
8280
8280
  }
8281
8281
  };
8282
8282
  const Jn = "return floor(x);", a0 = se({ opSnippet: Jn, packedOpSnippet: Jn, cpuKernelImpl: Uu }), r0 = {
8283
- kernelName: kc,
8283
+ kernelName: yc,
8284
8284
  backendName: "webgl",
8285
8285
  kernelFunc: a0
8286
8286
  };
@@ -8316,7 +8316,7 @@ const i0 = `
8316
8316
  }
8317
8317
  return vec4(result);
8318
8318
  `, l0 = Ce({ opSnippet: i0, packedOpSnippet: c0, dtype: "int32" }), u0 = {
8319
- kernelName: yc,
8319
+ kernelName: kc,
8320
8320
  backendName: "webgl",
8321
8321
  kernelFunc: l0
8322
8322
  };
@@ -8415,7 +8415,7 @@ function f0(a) {
8415
8415
  function m0(a) {
8416
8416
  const { inputs: t, backend: e, attrs: n } = a, { x: s, filter: o, bias: r, preluActivationWeights: c } = t, { strides: i, pad: l, dataFormat: u, dilations: p, dimRoundingMode: d, activation: h, leakyreluAlpha: f } = n, m = rt(u), x = Se(s.shape, o.shape, i, p, l, d, !1, m);
8417
8417
  let g;
8418
- const C = [], I = r != null, b = c != null, k = h === "leakyrelu", y = () => {
8418
+ const C = [], I = r != null, b = c != null, y = h === "leakyrelu", k = () => {
8419
8419
  const v = [s, o], w = (S, E) => {
8420
8420
  if (E === "NCHW" && S.shape.length === 1 && S.shape[0] !== 1) {
8421
8421
  const P = U({
@@ -8427,7 +8427,7 @@ function m0(a) {
8427
8427
  }
8428
8428
  return S;
8429
8429
  };
8430
- if (I && v.push(w(r, u)), b && v.push(w(c, u)), k) {
8430
+ if (I && v.push(w(r, u)), b && v.push(w(c, u)), y) {
8431
8431
  const S = e.makeTensorInfo([], "float32", mt(f, "float32"));
8432
8432
  v.push(S), C.push(S);
8433
8433
  }
@@ -8445,12 +8445,12 @@ function m0(a) {
8445
8445
  leakyreluAlpha: f
8446
8446
  });
8447
8447
  else if (x.strideWidth <= 2 && m === "channelsLast" && _().getBool("WEBGL_EXP_CONV")) {
8448
- const v = h ? Rt(h, !0) : null, w = new wi(x, I, v, b, k), S = [
8448
+ const v = h ? Rt(h, !0) : null, w = new wi(x, I, v, b, y), S = [
8449
8449
  [x.padInfo.top, x.padInfo.left],
8450
8450
  [x.strideHeight, x.strideWidth],
8451
8451
  [x.dilationHeight, x.dilationWidth],
8452
8452
  [x.inHeight, x.inWidth]
8453
- ], E = y();
8453
+ ], E = k();
8454
8454
  g = e.runWebGLProgram(w, E, "float32", S);
8455
8455
  } else if (_().getBool("WEBGL_CONV_IM2COL"))
8456
8456
  g = Ri({
@@ -8464,7 +8464,7 @@ function m0(a) {
8464
8464
  leakyreluAlpha: f
8465
8465
  });
8466
8466
  else {
8467
- const v = h ? Rt(h, !1) : null, w = new Si(x, I, v, b, k), S = y();
8467
+ const v = h ? Rt(h, !1) : null, w = new Si(x, I, v, b, y), S = k();
8468
8468
  g = e.runWebGLProgram(w, S, "float32");
8469
8469
  }
8470
8470
  const $ = U({ inputs: { x: g }, backend: e, attrs: { shape: x.outShape } });
@@ -8488,13 +8488,13 @@ function x0(a) {
8488
8488
  p,
8489
8489
  !0
8490
8490
  /* depthwise */
8491
- ), g = _().getBool("WEBGL_PACK_DEPTHWISECONV") && x.strideWidth <= 2 && x.outChannels / x.inChannels === 1, C = d ? Rt(d, g) : null, I = [s, o], b = r != null, k = c != null, y = d === "leakyrelu";
8492
- if (b && I.push(r), k && I.push(c), y) {
8491
+ ), g = _().getBool("WEBGL_PACK_DEPTHWISECONV") && x.strideWidth <= 2 && x.outChannels / x.inChannels === 1, C = d ? Rt(d, g) : null, I = [s, o], b = r != null, y = c != null, k = d === "leakyrelu";
8492
+ if (b && I.push(r), y && I.push(c), k) {
8493
8493
  const S = e.makeTensorInfo([], "float32", mt(h, "float32"));
8494
8494
  I.push(S), f.push(S);
8495
8495
  }
8496
8496
  let $;
8497
- g ? $ = new Di(x, b, C, k, y) : $ = new Ei(x, b, C, k, y);
8497
+ g ? $ = new Di(x, b, C, y, k) : $ = new Ei(x, b, C, y, k);
8498
8498
  const v = [
8499
8499
  [x.padInfo.top, x.padInfo.left],
8500
8500
  [x.strideHeight, x.strideWidth],
@@ -8546,12 +8546,12 @@ function I0(a) {
8546
8546
  const f = new b0(r, p, [l, u], n.shape), m = e.runWebGLProgram(f, [h, d], h.dtype), x = U({ inputs: { x: m }, backend: e, attrs: { shape: i } });
8547
8547
  return e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), e.disposeIntermediateTensorInfo(m), x;
8548
8548
  }
8549
- const k0 = {
8549
+ const y0 = {
8550
8550
  kernelName: ta,
8551
8551
  backendName: "webgl",
8552
8552
  kernelFunc: I0
8553
8553
  };
8554
- class y0 {
8554
+ class k0 {
8555
8555
  constructor(t, e) {
8556
8556
  this.variableNames = ["A", "indices"], this.outputShape = e, this.rank = e.length;
8557
8557
  const n = he(this.rank), s = $0(t);
@@ -8576,8 +8576,8 @@ function Oi(a) {
8576
8576
  if (_().get("DEBUG")) {
8577
8577
  const C = e.readSync(o.dataId), I = s.shape[i];
8578
8578
  for (let b = 0; b < C.length; ++b) {
8579
- const k = C[b];
8580
- te(k <= I - 1 && k >= 0, () => `GatherV2: the index value ${k} is not in [0, ${I - 1}]`);
8579
+ const y = C[b];
8580
+ te(y <= I - 1 && y >= 0, () => `GatherV2: the index value ${y} is not in [0, ${I - 1}]`);
8581
8581
  }
8582
8582
  }
8583
8583
  const l = Nr(s, o, i, c), u = G(o.shape), p = [], d = U({
@@ -8605,9 +8605,9 @@ function Oi(a) {
8605
8605
  ];
8606
8606
  if (e.shouldExecuteOnCPU([s, o]) || s.dtype === "string") {
8607
8607
  const C = e.bufferSync(h), I = e.bufferSync(d), b = Xu(I, C, f);
8608
- return p.forEach((k) => e.disposeIntermediateTensorInfo(k)), e.makeTensorInfo(l.outputShape, b.dtype, b.values);
8608
+ return p.forEach((y) => e.disposeIntermediateTensorInfo(y)), e.makeTensorInfo(l.outputShape, b.dtype, b.values);
8609
8609
  }
8610
- const m = new y0(d.shape, f), x = e.runWebGLProgram(m, [d, h], d.dtype);
8610
+ const m = new k0(d.shape, f), x = e.runWebGLProgram(m, [d, h], d.dtype);
8611
8611
  p.push(x);
8612
8612
  const g = U({ inputs: { x }, backend: e, attrs: { shape: l.outputShape } });
8613
8613
  return p.forEach((C) => e.disposeIntermediateTensorInfo(C)), g;
@@ -8852,12 +8852,12 @@ class bI {
8852
8852
  const II = (a) => {
8853
8853
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { depthRadius: o, bias: r, alpha: c, beta: i } = n, l = _().getBool("WEBGL_PACK_NORMALIZATION") ? new bI(s.shape, o, r, c, i) : new CI(s.shape, o, r, c, i);
8854
8854
  return e.runWebGLProgram(l, [s], s.dtype);
8855
- }, kI = {
8855
+ }, yI = {
8856
8856
  kernelName: aa,
8857
8857
  backendName: "webgl",
8858
8858
  kernelFunc: II
8859
8859
  };
8860
- class yI {
8860
+ class kI {
8861
8861
  constructor(t, e, n, s, o) {
8862
8862
  this.variableNames = ["inputImage", "outputImage", "dy"], this.outputShape = [], this.outputShape = t, this.depth = t[3], this.depthRadius = e, this.bias = n, this.alpha = s, this.beta = o, this.userCode = `
8863
8863
  void main() {
@@ -8918,7 +8918,7 @@ class yI {
8918
8918
  }
8919
8919
  }
8920
8920
  const $I = (a) => {
8921
- const { inputs: t, backend: e, attrs: n } = a, { x: s, y: o, dy: r } = t, { depthRadius: c, bias: i, alpha: l, beta: u } = n, p = new yI(s.shape, c, i, l, u);
8921
+ const { inputs: t, backend: e, attrs: n } = a, { x: s, y: o, dy: r } = t, { depthRadius: c, bias: i, alpha: l, beta: u } = n, p = new kI(s.shape, c, i, l, u);
8922
8922
  return e.runWebGLProgram(p, [s, o, r], s.dtype);
8923
8923
  }, vI = {
8924
8924
  kernelName: ra,
@@ -9150,18 +9150,18 @@ const GI = {
9150
9150
  let f = n;
9151
9151
  if (p) {
9152
9152
  if (d) {
9153
- const b = r.texData.get(f.dataId).values, k = new Array(c);
9154
- for (let v = 0; v < k.length; v++)
9155
- k[v] = n.shape[u[v]];
9156
- const y = Xr(b, n.shape, n.dtype, u, k);
9157
- f = r.makeTensorInfo(k, n.dtype);
9153
+ const b = r.texData.get(f.dataId).values, y = new Array(c);
9154
+ for (let v = 0; v < y.length; v++)
9155
+ y[v] = n.shape[u[v]];
9156
+ const k = Xr(b, n.shape, n.dtype, u, y);
9157
+ f = r.makeTensorInfo(y, n.dtype);
9158
9158
  const $ = r.texData.get(f.dataId);
9159
- $.values = y;
9159
+ $.values = k;
9160
9160
  } else
9161
9161
  f = Yr(n, u, r);
9162
9162
  h.push(f), l = xe(l.length, c);
9163
9163
  }
9164
- ye("sum", l, c);
9164
+ ke("sum", l, c);
9165
9165
  const [m, x] = ve(f.shape, l);
9166
9166
  let g = m;
9167
9167
  s && (g = Te(m, i));
@@ -9176,7 +9176,7 @@ function zI(a) {
9176
9176
  let l = i;
9177
9177
  const u = ge(l, c);
9178
9178
  let p = s;
9179
- u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), l = xe(l.length, s.shape.length)), ye("min", l, c);
9179
+ u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), l = xe(l.length, s.shape.length)), ke("min", l, c);
9180
9180
  const [d, h] = ve(p.shape, l), f = G(h), m = U({ inputs: { x: p }, backend: e, attrs: { shape: [-1, f] } }), x = _t(m, m.dtype, "min", e);
9181
9181
  let g;
9182
9182
  if (r) {
@@ -9258,7 +9258,7 @@ class YI {
9258
9258
  (f, m) => f[0] + t[m] + f[1]
9259
9259
  /* afterPad */
9260
9260
  );
9261
- const s = t.length, o = he(s), r = e.map((f) => f[0]).join(","), c = e.map((f, m) => f[0] + t[m]).join(","), i = ke("rc", s), l = ke("source", s), u = `${i[s - 1]} < ${this.outputShape[s - 1]}`, p = s === 1 ? "source" : `vec2(${l.slice(-2).join()})`, d = n === "reflect" ? 0 : 1;
9261
+ const s = t.length, o = he(s), r = e.map((f) => f[0]).join(","), c = e.map((f, m) => f[0] + t[m]).join(","), i = ye("rc", s), l = ye("source", s), u = `${i[s - 1]} < ${this.outputShape[s - 1]}`, p = s === 1 ? "source" : `vec2(${l.slice(-2).join()})`, d = n === "reflect" ? 0 : 1;
9262
9262
  let h = "";
9263
9263
  if (s === 1) {
9264
9264
  const f = `
@@ -9335,20 +9335,20 @@ const QI = ({ inputs: a, backend: t, attrs: e }) => {
9335
9335
  kernelFunc: QI
9336
9336
  };
9337
9337
  const JI = `if (b == 0.0) return NAN;
9338
- return mod(a, b);`, ek = `
9338
+ return mod(a, b);`, ey = `
9339
9339
  vec4 result = mod(a, b);
9340
9340
  bvec4 isNaN = equal(b, vec4(0.0));
9341
9341
  ` + it + `
9342
9342
  return result;
9343
- `, tk = Ce({
9343
+ `, ty = Ce({
9344
9344
  opSnippet: JI,
9345
- packedOpSnippet: ek
9346
- }), sk = {
9345
+ packedOpSnippet: ey
9346
+ }), sy = {
9347
9347
  kernelName: js,
9348
9348
  backendName: "webgl",
9349
- kernelFunc: tk
9349
+ kernelFunc: ty
9350
9350
  };
9351
- class nk {
9351
+ class ny {
9352
9352
  constructor(t, e, n) {
9353
9353
  this.variableNames = ["probs"], this.customUniforms = [{ name: "seed", type: "float" }], this.outputShape = [t, n], this.userCode = `
9354
9354
  void main() {
@@ -9378,7 +9378,7 @@ const eo = "return a - b;", Ai = Ce({
9378
9378
  packedOpSnippet: eo,
9379
9379
  supportsComplex: !0,
9380
9380
  cpuKernelImpl: td
9381
- }), ok = {
9381
+ }), oy = {
9382
9382
  kernelName: Dc,
9383
9383
  backendName: "webgl",
9384
9384
  kernelFunc: Ai
@@ -9391,23 +9391,23 @@ function _i(a) {
9391
9391
  }), i = Te(c.shape, r), l = U({ inputs: { x: c }, backend: e, attrs: { shape: i } }), u = Ai({ inputs: { a: s, b: l }, backend: e }), p = Fi({ inputs: { x: u }, backend: e }), d = fn({ inputs: { x: p }, backend: e, attrs: { axis: r, keepDims: !1 } }), h = U({ inputs: { x: d }, backend: e, attrs: { shape: i } }), f = Ed({ inputs: { a: p, b: h }, backend: e });
9392
9392
  return e.disposeIntermediateTensorInfo(c), e.disposeIntermediateTensorInfo(l), e.disposeIntermediateTensorInfo(u), e.disposeIntermediateTensorInfo(p), e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), f;
9393
9393
  }
9394
- const ak = {
9394
+ const ay = {
9395
9395
  kernelName: ga,
9396
9396
  backendName: "webgl",
9397
9397
  kernelFunc: _i
9398
9398
  };
9399
- function rk(a) {
9400
- const { inputs: t, backend: e, attrs: n } = a, { logits: s } = t, { numSamples: o, seed: r, normalized: c } = n, i = c ? s : _i({ inputs: { logits: s }, backend: e, attrs: { dim: s.shape.length - 1 } }), l = i.shape[0], u = i.shape[1], p = new nk(l, u, o), d = [[r]], h = e.runWebGLProgram(p, [i], "int32", d);
9399
+ function ry(a) {
9400
+ const { inputs: t, backend: e, attrs: n } = a, { logits: s } = t, { numSamples: o, seed: r, normalized: c } = n, i = c ? s : _i({ inputs: { logits: s }, backend: e, attrs: { dim: s.shape.length - 1 } }), l = i.shape[0], u = i.shape[1], p = new ny(l, u, o), d = [[r]], h = e.runWebGLProgram(p, [i], "int32", d);
9401
9401
  return c || e.disposeIntermediateTensorInfo(i), h;
9402
9402
  }
9403
- const ik = {
9403
+ const iy = {
9404
9404
  kernelName: Ss,
9405
9405
  backendName: "webgl",
9406
- kernelFunc: rk
9406
+ kernelFunc: ry
9407
9407
  };
9408
- const ck = We + `
9408
+ const cy = We + `
9409
9409
  return -x;
9410
- `, lk = `
9410
+ `, ly = `
9411
9411
  vec4 result = -x;
9412
9412
  bvec4 isNaN = isnan(x);
9413
9413
 
@@ -9418,60 +9418,60 @@ const ck = We + `
9418
9418
 
9419
9419
  return result;
9420
9420
  `;
9421
- function uk(a) {
9421
+ function uy(a) {
9422
9422
  const { inputs: t, backend: e } = a, { x: n } = t;
9423
9423
  if (e.shouldExecuteOnCPU([n])) {
9424
9424
  const o = e.texData.get(n.dataId), [r, c] = sd(o.values, n.shape, n.dtype);
9425
9425
  return e.makeTensorInfo(c, n.dtype, r);
9426
9426
  }
9427
9427
  let s;
9428
- return _().getBool("WEBGL_PACK_UNARY_OPERATIONS") ? s = new st(n.shape, lk) : s = new ze(n.shape, ck), e.runWebGLProgram(s, [n], n.dtype);
9428
+ return _().getBool("WEBGL_PACK_UNARY_OPERATIONS") ? s = new st(n.shape, ly) : s = new ze(n.shape, cy), e.runWebGLProgram(s, [n], n.dtype);
9429
9429
  }
9430
- const dk = {
9430
+ const dy = {
9431
9431
  kernelName: Fc,
9432
9432
  backendName: "webgl",
9433
- kernelFunc: uk
9433
+ kernelFunc: uy
9434
9434
  };
9435
- const pk = Fr;
9436
- function hk(a) {
9435
+ const py = Fr;
9436
+ function hy(a) {
9437
9437
  Dt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
9438
- const { inputs: t, backend: e, attrs: n } = a, { boxes: s, scores: o } = t, { maxOutputSize: r, iouThreshold: c, scoreThreshold: i } = n, l = e.readSync(s.dataId), u = e.readSync(o.dataId), { selectedIndices: p } = pk(l, u, r, c, i);
9438
+ const { inputs: t, backend: e, attrs: n } = a, { boxes: s, scores: o } = t, { maxOutputSize: r, iouThreshold: c, scoreThreshold: i } = n, l = e.readSync(s.dataId), u = e.readSync(o.dataId), { selectedIndices: p } = py(l, u, r, c, i);
9439
9439
  return e.makeTensorInfo([p.length], "int32", new Int32Array(p));
9440
9440
  }
9441
- const fk = {
9441
+ const fy = {
9442
9442
  kernelName: xa,
9443
9443
  backendName: "webgl",
9444
- kernelFunc: hk
9444
+ kernelFunc: hy
9445
9445
  };
9446
- const mk = Pr;
9447
- function gk(a) {
9446
+ const my = Pr;
9447
+ function gy(a) {
9448
9448
  Dt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
9449
- const { inputs: t, backend: e, attrs: n } = a, { boxes: s, scores: o } = t, { maxOutputSize: r, iouThreshold: c, scoreThreshold: i, padToMaxOutputSize: l } = n, u = e.readSync(s.dataId), p = e.readSync(o.dataId), { selectedIndices: d, validOutputs: h } = mk(u, p, r, c, i, l);
9449
+ const { inputs: t, backend: e, attrs: n } = a, { boxes: s, scores: o } = t, { maxOutputSize: r, iouThreshold: c, scoreThreshold: i, padToMaxOutputSize: l } = n, u = e.readSync(s.dataId), p = e.readSync(o.dataId), { selectedIndices: d, validOutputs: h } = my(u, p, r, c, i, l);
9450
9450
  return [
9451
9451
  e.makeTensorInfo([d.length], "int32", new Int32Array(d)),
9452
9452
  e.makeTensorInfo([], "int32", new Int32Array([h]))
9453
9453
  ];
9454
9454
  }
9455
- const xk = {
9455
+ const xy = {
9456
9456
  kernelName: Ca,
9457
9457
  backendName: "webgl",
9458
- kernelFunc: gk
9458
+ kernelFunc: gy
9459
9459
  };
9460
- const Ck = Or;
9461
- function bk(a) {
9460
+ const Cy = Or;
9461
+ function by(a) {
9462
9462
  Dt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
9463
- const { inputs: t, backend: e, attrs: n } = a, { boxes: s, scores: o } = t, { maxOutputSize: r, iouThreshold: c, scoreThreshold: i, softNmsSigma: l } = n, u = e.readSync(s.dataId), p = e.readSync(o.dataId), d = r, h = c, f = i, m = l, { selectedIndices: x, selectedScores: g } = Ck(u, p, d, h, f, m);
9463
+ const { inputs: t, backend: e, attrs: n } = a, { boxes: s, scores: o } = t, { maxOutputSize: r, iouThreshold: c, scoreThreshold: i, softNmsSigma: l } = n, u = e.readSync(s.dataId), p = e.readSync(o.dataId), d = r, h = c, f = i, m = l, { selectedIndices: x, selectedScores: g } = Cy(u, p, d, h, f, m);
9464
9464
  return [
9465
9465
  e.makeTensorInfo([x.length], "int32", new Int32Array(x)),
9466
9466
  e.makeTensorInfo([g.length], "float32", new Float32Array(g))
9467
9467
  ];
9468
9468
  }
9469
- const Ik = {
9469
+ const Iy = {
9470
9470
  kernelName: ba,
9471
9471
  backendName: "webgl",
9472
- kernelFunc: bk
9472
+ kernelFunc: by
9473
9473
  };
9474
- class kk {
9474
+ class yy {
9475
9475
  constructor(t, e, n, s) {
9476
9476
  this.variableNames = ["indices"], this.outputShape = [t, e], this.userCode = `
9477
9477
  void main() {
@@ -9483,15 +9483,15 @@ class kk {
9483
9483
  `;
9484
9484
  }
9485
9485
  }
9486
- const yk = (a) => {
9487
- const { inputs: t, backend: e, attrs: n } = a, { indices: s } = t, { dtype: o, depth: r, onValue: c, offValue: i } = n, l = G(s.shape), u = new kk(l, r, c, i), p = U({ inputs: { x: s }, backend: e, attrs: { shape: [l] } }), d = e.runWebGLProgram(u, [p], o);
9486
+ const ky = (a) => {
9487
+ const { inputs: t, backend: e, attrs: n } = a, { indices: s } = t, { dtype: o, depth: r, onValue: c, offValue: i } = n, l = G(s.shape), u = new yy(l, r, c, i), p = U({ inputs: { x: s }, backend: e, attrs: { shape: [l] } }), d = e.runWebGLProgram(u, [p], o);
9488
9488
  e.disposeIntermediateTensorInfo(p);
9489
9489
  const h = [...s.shape, r], f = U({ inputs: { x: d }, backend: e, attrs: { shape: h } });
9490
9490
  return e.disposeIntermediateTensorInfo(d), f;
9491
- }, $k = {
9491
+ }, $y = {
9492
9492
  kernelName: Ia,
9493
9493
  backendName: "webgl",
9494
- kernelFunc: yk
9494
+ kernelFunc: ky
9495
9495
  };
9496
9496
  function ss(a) {
9497
9497
  const { inputs: t, backend: e } = a, { x: n } = t;
@@ -9508,8 +9508,8 @@ function ss(a) {
9508
9508
  backend: e
9509
9509
  });
9510
9510
  }
9511
- const vk = {
9512
- kernelName: ka,
9511
+ const vy = {
9512
+ kernelName: ya,
9513
9513
  backendName: "webgl",
9514
9514
  kernelFunc: ss
9515
9515
  };
@@ -9523,12 +9523,12 @@ function Li(a) {
9523
9523
  } else
9524
9524
  return Mt({ attrs: { shape: n.shape, dtype: n.dtype, value: 1 }, backend: e });
9525
9525
  }
9526
- const Sk = {
9527
- kernelName: ya,
9526
+ const Sy = {
9527
+ kernelName: ka,
9528
9528
  backendName: "webgl",
9529
9529
  kernelFunc: Li
9530
9530
  };
9531
- function wk(a) {
9531
+ function wy(a) {
9532
9532
  const { inputs: t, backend: e, attrs: n } = a, { axis: s } = n;
9533
9533
  if (t.length === 1)
9534
9534
  return vs({ inputs: { input: t[0] }, backend: e, attrs: { dim: s } });
@@ -9542,12 +9542,12 @@ function wk(a) {
9542
9542
  }), l = vi({ inputs: i, backend: e, attrs: { axis: s } });
9543
9543
  return c.forEach((u) => e.disposeIntermediateTensorInfo(u)), l;
9544
9544
  }
9545
- const Nk = {
9545
+ const Ny = {
9546
9546
  kernelName: $a,
9547
9547
  backendName: "webgl",
9548
- kernelFunc: wk
9548
+ kernelFunc: wy
9549
9549
  };
9550
- class Rk {
9550
+ class Ry {
9551
9551
  constructor(t, e, n) {
9552
9552
  this.variableNames = ["x"], this.customUniforms = [{ name: "value", type: "float" }], this.outputShape = e.map(
9553
9553
  (l, u) => l[0] + t[u] + l[1]
@@ -9586,13 +9586,13 @@ class Rk {
9586
9586
  `;
9587
9587
  }
9588
9588
  }
9589
- class Tk {
9589
+ class Ty {
9590
9590
  constructor(t, e, n) {
9591
9591
  this.variableNames = ["x"], this.packedInputs = !0, this.packedOutput = !0, this.customUniforms = [{ name: "value", type: "float" }], this.outputShape = e.map(
9592
9592
  (m, x) => m[0] + t[x] + m[1]
9593
9593
  /* afterPad */
9594
9594
  );
9595
- const s = t.length, o = he(s), r = e.map((m) => m[0]).join(","), c = e.map((m, x) => m[0] + t[x]).join(","), i = ke("rc", s), l = ke("source", s), u = `${i[s - 1]} < ${this.outputShape[s - 1]}`, p = s === 1 ? "source" : `vec2(${l.slice(-2).join()})`, d = [
9595
+ const s = t.length, o = he(s), r = e.map((m) => m[0]).join(","), c = e.map((m, x) => m[0] + t[x]).join(","), i = ye("rc", s), l = ye("source", s), u = `${i[s - 1]} < ${this.outputShape[s - 1]}`, p = s === 1 ? "source" : `vec2(${l.slice(-2).join()})`, d = [
9596
9596
  `${o} rc = outputLoc;`,
9597
9597
  `${i[s - 1]} += 1;
9598
9598
  if(${u}) {
@@ -9640,14 +9640,14 @@ const Vi = (a) => {
9640
9640
  attrs: { shape: l, value: r, dtype: s.dtype }
9641
9641
  });
9642
9642
  }
9643
- const c = _().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new Tk(s.shape, o, r) : new Rk(s.shape, o, r), i = [[r]];
9643
+ const c = _().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new Ty(s.shape, o, r) : new Ry(s.shape, o, r), i = [[r]];
9644
9644
  return e.runWebGLProgram(c, [s], s.dtype, i);
9645
- }, Ek = {
9645
+ }, Ey = {
9646
9646
  kernelName: Sa,
9647
9647
  backendName: "webgl",
9648
9648
  kernelFunc: Vi
9649
9649
  };
9650
- const Dk = `
9650
+ const Dy = `
9651
9651
  if(a < 0.0 && floor(b) < b){
9652
9652
  return NAN;
9653
9653
  }
@@ -9656,7 +9656,7 @@ const Dk = `
9656
9656
  }
9657
9657
  return (round(mod(b, 2.0)) != 1) ?
9658
9658
  pow(abs(a), b) : sign(a) * pow(abs(a), b);
9659
- `, Fk = `
9659
+ `, Fy = `
9660
9660
  // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.
9661
9661
  vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));
9662
9662
  vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);
@@ -9674,17 +9674,17 @@ const Dk = `
9674
9674
  bvec4 isNaN = bvec4(isNaN1.x && isNaN2.x, isNaN1.y && isNaN2.y, isNaN1.z && isNaN2.z, isNaN1.w && isNaN2.w);
9675
9675
  ` + it + `
9676
9676
  return result;
9677
- `, Pk = Ce({ opSnippet: Dk, packedOpSnippet: Fk }), Ok = {
9677
+ `, Py = Ce({ opSnippet: Dy, packedOpSnippet: Fy }), Oy = {
9678
9678
  kernelName: qs,
9679
9679
  backendName: "webgl",
9680
- kernelFunc: Pk
9680
+ kernelFunc: Py
9681
9681
  };
9682
- function Ak(a) {
9682
+ function Ay(a) {
9683
9683
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { axis: o, keepDims: r } = n, c = s.shape.length, i = [], l = ue(o, s.shape);
9684
9684
  let u = l;
9685
9685
  const p = ge(u, c);
9686
9686
  let d = s;
9687
- p != null && (d = Ie({ inputs: { x: s }, backend: e, attrs: { perm: p } }), u = xe(u.length, c), i.push(d)), ye("prod", u, c);
9687
+ p != null && (d = Ie({ inputs: { x: s }, backend: e, attrs: { perm: p } }), u = xe(u.length, c), i.push(d)), ke("prod", u, c);
9688
9688
  let h;
9689
9689
  if (e.shouldExecuteOnCPU([d])) {
9690
9690
  const f = e.texData.get(d.dataId).values, { outVals: m, outShape: x, outDtype: g } = nd(d.shape, d.dtype, f, u);
@@ -9700,54 +9700,54 @@ function Ak(a) {
9700
9700
  }
9701
9701
  return i.forEach((f) => e.disposeIntermediateTensorInfo(f)), h;
9702
9702
  }
9703
- const _k = {
9703
+ const _y = {
9704
9704
  kernelName: Pc,
9705
9705
  backendName: "webgl",
9706
- kernelFunc: Ak
9706
+ kernelFunc: Ay
9707
9707
  };
9708
- function Lk(a) {
9708
+ function Ly(a) {
9709
9709
  const { inputs: t, backend: e, attrs: n } = a, { paramsNestedSplits: s, paramsDenseValues: o, indices: r } = t, { outputRaggedRank: c } = n, i = s.map((g) => e.readSync(g.dataId)), l = s.map((g) => g.shape), u = e.readSync(o.dataId), p = e.readSync(r.dataId), [d, h, f] = od(i, l, u, o.shape, o.dtype, p, r.shape, c), m = d.map((g) => e.makeTensorInfo([g.length], "int32", g)), x = e.makeTensorInfo(f, o.dtype, h);
9710
9710
  return m.concat([x]);
9711
9711
  }
9712
- const Vk = {
9712
+ const Vy = {
9713
9713
  kernelName: wa,
9714
9714
  backendName: "webgl",
9715
- kernelFunc: Lk
9715
+ kernelFunc: Ly
9716
9716
  };
9717
- function Wk(a) {
9717
+ function Wy(a) {
9718
9718
  const { inputs: t, backend: e } = a, { starts: n, limits: s, deltas: o } = t, r = e.readSync(n.dataId), c = e.readSync(s.dataId), i = e.readSync(o.dataId), [l, u] = ad(r, n.shape, n.dtype, c, s.shape, i, o.shape), p = e.makeTensorInfo([l.length], "int32", l), d = e.makeTensorInfo([u.length], n.dtype, u);
9719
9719
  return [p, d];
9720
9720
  }
9721
- const Mk = {
9721
+ const My = {
9722
9722
  kernelName: Na,
9723
9723
  backendName: "webgl",
9724
- kernelFunc: Wk
9724
+ kernelFunc: Wy
9725
9725
  };
9726
- function Bk(a) {
9726
+ function By(a) {
9727
9727
  const { inputs: t, backend: e, attrs: n } = a, { shape: s, values: o, defaultValue: r, rowPartitionTensors: c } = t, { rowPartitionTypes: i } = n, l = e.readSync(s.dataId), u = e.readSync(o.dataId), p = e.readSync(r.dataId), d = c.map((x) => e.readSync(x.dataId)), h = c.map((x) => x.shape), [f, m] = rd(l, s.shape, u, o.shape, o.dtype, p, r.shape, d, h, i);
9728
9728
  return e.makeTensorInfo(f, o.dtype, m);
9729
9729
  }
9730
- const Gk = {
9730
+ const Gy = {
9731
9731
  kernelName: Ra,
9732
9732
  backendName: "webgl",
9733
- kernelFunc: Bk
9733
+ kernelFunc: By
9734
9734
  };
9735
9735
  const Wi = (a) => {
9736
9736
  const { backend: t, attrs: e } = a, { start: n, stop: s, step: o, dtype: r } = e, c = id(n, s, o, r);
9737
9737
  return t.makeTensorInfo([c.length], r, c);
9738
- }, zk = {
9738
+ }, zy = {
9739
9739
  kernelName: Ta,
9740
9740
  backendName: "webgl",
9741
9741
  kernelFunc: Wi
9742
9742
  };
9743
- const Uk = "return 1.0 / x;", Hk = se({ opSnippet: Uk }), Xk = {
9743
+ const Uy = "return 1.0 / x;", Hy = se({ opSnippet: Uy }), Xy = {
9744
9744
  kernelName: Ys,
9745
9745
  backendName: "webgl",
9746
- kernelFunc: Hk
9746
+ kernelFunc: Hy
9747
9747
  };
9748
- const Kk = We + `
9748
+ const Ky = We + `
9749
9749
  return (x < 0.0) ? 0.0 : x;
9750
- `, jk = `
9750
+ `, jy = `
9751
9751
  vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));
9752
9752
  bvec4 isNaN = isnan(x);
9753
9753
 
@@ -9757,14 +9757,14 @@ const Kk = We + `
9757
9757
  result.a = isNaN.a ? x.a : result.a;
9758
9758
 
9759
9759
  return result;
9760
- `, qk = se({ opSnippet: Kk, packedOpSnippet: jk }), Yk = {
9760
+ `, qy = se({ opSnippet: Ky, packedOpSnippet: jy }), Yy = {
9761
9761
  kernelName: Ns,
9762
9762
  backendName: "webgl",
9763
- kernelFunc: qk
9763
+ kernelFunc: qy
9764
9764
  };
9765
- const Qk = We + `
9765
+ const Qy = We + `
9766
9766
  return (x < 0.0) ? 0.0 : min(6.0, x);
9767
- `, Zk = `
9767
+ `, Zy = `
9768
9768
  vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));
9769
9769
  bvec4 isNaN = isnan(x);
9770
9770
 
@@ -9774,12 +9774,12 @@ const Qk = We + `
9774
9774
  result.a = isNaN.a ? x.a : result.a;
9775
9775
 
9776
9776
  return result;
9777
- `, Jk = se({ opSnippet: Qk, packedOpSnippet: Zk }), ey = {
9777
+ `, Jy = se({ opSnippet: Qy, packedOpSnippet: Zy }), ek = {
9778
9778
  kernelName: Rs,
9779
9779
  backendName: "webgl",
9780
- kernelFunc: Jk
9780
+ kernelFunc: Jy
9781
9781
  };
9782
- class ty {
9782
+ class tk {
9783
9783
  constructor(t, e, n, s, o) {
9784
9784
  this.variableNames = ["A"], this.outputShape = [];
9785
9785
  const [r, c, i, l] = t;
@@ -9828,7 +9828,7 @@ class ty {
9828
9828
  `;
9829
9829
  }
9830
9830
  }
9831
- class sy {
9831
+ class sk {
9832
9832
  constructor(t, e, n, s, o) {
9833
9833
  this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0, this.outputShape = [];
9834
9834
  const [r, c, i, l] = t;
@@ -9921,16 +9921,16 @@ class sy {
9921
9921
  `;
9922
9922
  }
9923
9923
  }
9924
- function ny(a) {
9925
- const { inputs: t, backend: e, attrs: n } = a, { images: s } = t, { alignCorners: o, halfPixelCenters: r, size: c } = n, [i, l] = c, u = _().getBool("WEBGL_PACK_IMAGE_OPERATIONS") ? new sy(s.shape, i, l, o, r) : new ty(s.shape, i, l, o, r);
9924
+ function nk(a) {
9925
+ const { inputs: t, backend: e, attrs: n } = a, { images: s } = t, { alignCorners: o, halfPixelCenters: r, size: c } = n, [i, l] = c, u = _().getBool("WEBGL_PACK_IMAGE_OPERATIONS") ? new sk(s.shape, i, l, o, r) : new tk(s.shape, i, l, o, r);
9926
9926
  return e.runWebGLProgram(u, [s], "float32");
9927
9927
  }
9928
- const oy = {
9928
+ const ok = {
9929
9929
  kernelName: Ea,
9930
9930
  backendName: "webgl",
9931
- kernelFunc: ny
9931
+ kernelFunc: nk
9932
9932
  };
9933
- class ay {
9933
+ class ak {
9934
9934
  constructor(t, e, n) {
9935
9935
  this.variableNames = ["dy"], this.outputShape = [], this.outputShape = e;
9936
9936
  const [, s, o] = e, [, r, c] = t, i = [
@@ -10024,16 +10024,16 @@ class ay {
10024
10024
  `;
10025
10025
  }
10026
10026
  }
10027
- function ry(a) {
10028
- const { inputs: t, backend: e, attrs: n } = a, { images: s, dy: o } = t, { alignCorners: r } = n, c = new ay(o.shape, s.shape, r);
10027
+ function rk(a) {
10028
+ const { inputs: t, backend: e, attrs: n } = a, { images: s, dy: o } = t, { alignCorners: r } = n, c = new ak(o.shape, s.shape, r);
10029
10029
  return e.runWebGLProgram(c, [o], o.dtype);
10030
10030
  }
10031
- const iy = {
10031
+ const ik = {
10032
10032
  kernelName: Da,
10033
10033
  backendName: "webgl",
10034
- kernelFunc: ry
10034
+ kernelFunc: rk
10035
10035
  };
10036
- class cy {
10036
+ class ck {
10037
10037
  constructor(t, e, n, s, o) {
10038
10038
  this.variableNames = ["A"], this.outputShape = [];
10039
10039
  const [r, c, i, l] = t;
@@ -10071,7 +10071,7 @@ class cy {
10071
10071
  `;
10072
10072
  }
10073
10073
  }
10074
- class ly {
10074
+ class lk {
10075
10075
  constructor(t, e, n, s, o) {
10076
10076
  this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !0, this.outputShape = [];
10077
10077
  const [r, c, i, l] = t;
@@ -10128,16 +10128,16 @@ class ly {
10128
10128
  `;
10129
10129
  }
10130
10130
  }
10131
- function uy(a) {
10132
- const { inputs: t, backend: e, attrs: n } = a, { images: s } = t, { alignCorners: o, halfPixelCenters: r, size: c } = n, [i, l] = c, u = _().getBool("WEBGL_PACK_IMAGE_OPERATIONS") ? new ly(s.shape, i, l, o, r) : new cy(s.shape, i, l, o, r);
10131
+ function uk(a) {
10132
+ const { inputs: t, backend: e, attrs: n } = a, { images: s } = t, { alignCorners: o, halfPixelCenters: r, size: c } = n, [i, l] = c, u = _().getBool("WEBGL_PACK_IMAGE_OPERATIONS") ? new lk(s.shape, i, l, o, r) : new ck(s.shape, i, l, o, r);
10133
10133
  return e.runWebGLProgram(u, [s], s.dtype);
10134
10134
  }
10135
- const dy = {
10135
+ const dk = {
10136
10136
  kernelName: Fa,
10137
10137
  backendName: "webgl",
10138
- kernelFunc: uy
10138
+ kernelFunc: uk
10139
10139
  };
10140
- class py {
10140
+ class pk {
10141
10141
  constructor(t, e, n) {
10142
10142
  this.variableNames = ["dy"], this.outputShape = [], this.outputShape = e;
10143
10143
  const [, s, o] = e, [, r, c] = t, i = [
@@ -10220,16 +10220,16 @@ class py {
10220
10220
  `;
10221
10221
  }
10222
10222
  }
10223
- function hy(a) {
10224
- const { inputs: t, backend: e, attrs: n } = a, { images: s, dy: o } = t, { alignCorners: r } = n, c = new py(o.shape, s.shape, r);
10223
+ function hk(a) {
10224
+ const { inputs: t, backend: e, attrs: n } = a, { images: s, dy: o } = t, { alignCorners: r } = n, c = new pk(o.shape, s.shape, r);
10225
10225
  return e.runWebGLProgram(c, [o], o.dtype);
10226
10226
  }
10227
- const fy = {
10227
+ const fk = {
10228
10228
  kernelName: Pa,
10229
10229
  backendName: "webgl",
10230
- kernelFunc: hy
10230
+ kernelFunc: hk
10231
10231
  };
10232
- class my {
10232
+ class mk {
10233
10233
  constructor(t, e) {
10234
10234
  this.variableNames = ["x"];
10235
10235
  const n = t.length;
@@ -10253,14 +10253,14 @@ class my {
10253
10253
  `;
10254
10254
  }
10255
10255
  }
10256
- class gy {
10256
+ class gk {
10257
10257
  constructor(t, e) {
10258
10258
  this.variableNames = ["x"], this.packedInputs = !0, this.packedOutput = !0;
10259
10259
  const n = t.length;
10260
10260
  if (n > 4)
10261
10261
  throw new Error(`WebGL backend: Reverse of rank-${n} tensor is not yet supported`);
10262
10262
  this.outputShape = t;
10263
- const s = ke("rc", n), o = `${s[n - 1]} + 1 < ${this.outputShape[n - 1]}`, r = `${s[n - 2]} + 1 < ${this.outputShape[n - 2]}`, c = he(n);
10263
+ const s = ye("rc", n), o = `${s[n - 1]} + 1 < ${this.outputShape[n - 1]}`, r = `${s[n - 2]} + 1 < ${this.outputShape[n - 2]}`, c = he(n);
10264
10264
  n === 1 ? this.userCode = `
10265
10265
  void main(){
10266
10266
  int rc = getOutputCoords();
@@ -10311,19 +10311,19 @@ class gy {
10311
10311
  }
10312
10312
  }
10313
10313
  }
10314
- function xy(a) {
10314
+ function xk(a) {
10315
10315
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { dims: o } = n, r = s.shape.length, c = ue(o, s.shape);
10316
10316
  if (r === 0)
10317
10317
  return Fe({ inputs: { x: s }, backend: e });
10318
- const i = _().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new gy(s.shape, c) : new my(s.shape, c);
10318
+ const i = _().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new gk(s.shape, c) : new mk(s.shape, c);
10319
10319
  return e.runWebGLProgram(i, [s], s.dtype);
10320
10320
  }
10321
- const Cy = {
10321
+ const Ck = {
10322
10322
  kernelName: Oa,
10323
10323
  backendName: "webgl",
10324
- kernelFunc: xy
10324
+ kernelFunc: xk
10325
10325
  };
10326
- class by {
10326
+ class bk {
10327
10327
  constructor(t, e) {
10328
10328
  this.variableNames = ["Image"], this.outputShape = [], this.customUniforms = [{ name: "params", type: "vec4" }];
10329
10329
  const n = t[1], s = t[2];
@@ -10351,15 +10351,15 @@ class by {
10351
10351
  `;
10352
10352
  }
10353
10353
  }
10354
- const Iy = {
10354
+ const Ik = {
10355
10355
  kernelName: Aa,
10356
10356
  backendName: "webgl",
10357
10357
  kernelFunc: ({ inputs: a, attrs: t, backend: e }) => {
10358
- const { image: n } = a, { radians: s, fillValue: o, center: r } = t, c = e, i = new by(n.shape, o), [l, u] = Rr(r, n.shape[1], n.shape[2]), p = [[l, u, Math.sin(s), Math.cos(s)]];
10358
+ const { image: n } = a, { radians: s, fillValue: o, center: r } = t, c = e, i = new bk(n.shape, o), [l, u] = Rr(r, n.shape[1], n.shape[2]), p = [[l, u, Math.sin(s), Math.cos(s)]];
10359
10359
  return c.runWebGLProgram(i, [n], n.dtype, p);
10360
10360
  }
10361
10361
  };
10362
- const ky = `
10362
+ const yk = `
10363
10363
  // OpenGL ES does not support round function.
10364
10364
  // The algorithm is based on banker's rounding.
10365
10365
  float base = floor(x);
@@ -10374,15 +10374,15 @@ const ky = `
10374
10374
  return base + 1.0;
10375
10375
  }
10376
10376
  }
10377
- `, yy = se({ opSnippet: ky }), $y = {
10377
+ `, kk = se({ opSnippet: yk }), $k = {
10378
10378
  kernelName: Qs,
10379
10379
  backendName: "webgl",
10380
- kernelFunc: yy
10380
+ kernelFunc: kk
10381
10381
  };
10382
- const vy = "return inversesqrt(x);", Sy = se({ opSnippet: vy, cpuKernelImpl: cd }), wy = {
10382
+ const vk = "return inversesqrt(x);", Sk = se({ opSnippet: vk, cpuKernelImpl: cd }), wk = {
10383
10383
  kernelName: Oc,
10384
10384
  backendName: "webgl",
10385
- kernelFunc: Sy
10385
+ kernelFunc: Sk
10386
10386
  };
10387
10387
  class In {
10388
10388
  constructor(t, e, n, s, o, r, c = !0, i = !1) {
@@ -10420,7 +10420,7 @@ class In {
10420
10420
  `;
10421
10421
  }
10422
10422
  }
10423
- class Ny {
10423
+ class Nk {
10424
10424
  constructor(t, e, n, s, o, r, c = !0, i = !1) {
10425
10425
  this.variableNames = ["updates", "indices", "defaultValue"], this.packedInputs = !0, this.packedOutput = !0, this.outputShape = r;
10426
10426
  const l = he(o.length), u = he(r.length);
@@ -10473,22 +10473,22 @@ class Ny {
10473
10473
  `;
10474
10474
  }
10475
10475
  }
10476
- function Ry(a) {
10476
+ function Rk(a) {
10477
10477
  const { inputs: t, backend: e, attrs: n } = a, { indices: s, updates: o } = t, { shape: r } = n, { sliceRank: c, numUpdates: i, sliceSize: l, strides: u, outputSize: p } = Ct(o, s, r), d = [p / l, l];
10478
10478
  if (p === 0)
10479
10479
  return e.makeTensorInfo(r, s.dtype);
10480
10480
  const h = U({ inputs: { x: s }, backend: e, attrs: { shape: [i, c] } }), f = U({ inputs: { x: o }, backend: e, attrs: { shape: [i, l] } }), m = e.makeTensorInfo([], "float32", new Float32Array([0]));
10481
10481
  let x;
10482
- _().getBool("WEBGL_PACK") ? x = new Ny(i, c, h.shape.length, f.shape.length, u, d) : x = new In(i, c, h.shape.length, f.shape.length, u, d);
10482
+ _().getBool("WEBGL_PACK") ? x = new Nk(i, c, h.shape.length, f.shape.length, u, d) : x = new In(i, c, h.shape.length, f.shape.length, u, d);
10483
10483
  const g = e.runWebGLProgram(x, [f, h, m], f.dtype), C = U({ inputs: { x: g }, backend: e, attrs: { shape: r } });
10484
10484
  return e.disposeIntermediateTensorInfo(h), e.disposeIntermediateTensorInfo(f), e.disposeIntermediateTensorInfo(g), e.disposeIntermediateTensorInfo(m), C;
10485
10485
  }
10486
- const Ty = {
10486
+ const Tk = {
10487
10487
  kernelName: _a,
10488
10488
  backendName: "webgl",
10489
- kernelFunc: Ry
10489
+ kernelFunc: Rk
10490
10490
  };
10491
- class Ey {
10491
+ class Ek {
10492
10492
  constructor(t, e, n, s) {
10493
10493
  this.variableNames = ["sortedSequence", "values"], this.customUniforms = [{ name: "numInputs", type: "int" }], this.outputShape = [t, n];
10494
10494
  const o = "while (left < right) {", r = `for (int i = 0; i < ${Math.ceil(Math.log2(e + 1))}; ++i) { if (left >= right) break;`, c = _().getNumber("WEBGL_VERSION") === 2 ? o : r, i = s === "left" ? "<" : "<=";
@@ -10520,16 +10520,16 @@ class Ey {
10520
10520
  `;
10521
10521
  }
10522
10522
  }
10523
- function Dy(a) {
10524
- const { inputs: t, backend: e, attrs: n } = a, { sortedSequence: s, values: o } = t, { side: r } = n, c = new Ey(s.shape[0], s.shape[1], o.shape[1], r), i = [[s.shape[1]]];
10523
+ function Dk(a) {
10524
+ const { inputs: t, backend: e, attrs: n } = a, { sortedSequence: s, values: o } = t, { side: r } = n, c = new Ek(s.shape[0], s.shape[1], o.shape[1], r), i = [[s.shape[1]]];
10525
10525
  return e.runWebGLProgram(c, [s, o], "int32", i);
10526
10526
  }
10527
- const Fy = {
10527
+ const Fk = {
10528
10528
  kernelName: La,
10529
10529
  backendName: "webgl",
10530
- kernelFunc: Dy
10530
+ kernelFunc: Dk
10531
10531
  };
10532
- class Py {
10532
+ class Pk {
10533
10533
  constructor(t, e, n) {
10534
10534
  this.variableNames = ["c", "a", "b"], this.outputShape = e;
10535
10535
  let s, o;
@@ -10557,29 +10557,29 @@ class Py {
10557
10557
  `;
10558
10558
  }
10559
10559
  }
10560
- function Oy(a) {
10561
- const { inputs: t, backend: e } = a, { condition: n, t: s, e: o } = t, r = new Py(n.shape.length, s.shape, s.shape.length);
10560
+ function Ok(a) {
10561
+ const { inputs: t, backend: e } = a, { condition: n, t: s, e: o } = t, r = new Pk(n.shape.length, s.shape, s.shape.length);
10562
10562
  return e.runWebGLProgram(r, [n, s, o], Qe(s.dtype, o.dtype));
10563
10563
  }
10564
- const Ay = {
10564
+ const Ak = {
10565
10565
  kernelName: Va,
10566
10566
  backendName: "webgl",
10567
- kernelFunc: Oy
10567
+ kernelFunc: Ok
10568
10568
  };
10569
- const _y = `
10569
+ const _k = `
10570
10570
  // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
10571
10571
  // see: https://arxiv.org/abs/1706.02515
10572
10572
  float scaleAlpha = ${_r};
10573
10573
  float scale = ${Ar};
10574
10574
  return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
10575
- `, Ly = se({ opSnippet: _y }), Vy = {
10575
+ `, Lk = se({ opSnippet: _k }), Vk = {
10576
10576
  kernelName: Zs,
10577
10577
  backendName: "webgl",
10578
- kernelFunc: Ly
10578
+ kernelFunc: Lk
10579
10579
  };
10580
- const Wy = It + `
10580
+ const Wk = It + `
10581
10581
  return 1.0 / (1.0 + exp(-1.0 * x));
10582
- `, My = `
10582
+ `, Mk = `
10583
10583
  vec4 result = 1.0 / (1.0 + exp(-1.0 * x));
10584
10584
  bvec4 isNaN = isnan(x);
10585
10585
 
@@ -10589,44 +10589,44 @@ const Wy = It + `
10589
10589
  result.a = isNaN.a ? x.a : result.a;
10590
10590
 
10591
10591
  return result;
10592
- `, By = se({
10593
- opSnippet: Wy,
10594
- packedOpSnippet: My,
10592
+ `, Bk = se({
10593
+ opSnippet: Wk,
10594
+ packedOpSnippet: Mk,
10595
10595
  cpuKernelImpl: ld
10596
- }), Gy = {
10596
+ }), Gk = {
10597
10597
  kernelName: Ac,
10598
10598
  backendName: "webgl",
10599
- kernelFunc: By
10599
+ kernelFunc: Bk
10600
10600
  };
10601
- const zy = `
10601
+ const zk = `
10602
10602
  if (isnan(x)) { return 0.0; }
10603
10603
  return sign(x);
10604
- `, Uy = se({ opSnippet: zy }), Hy = {
10604
+ `, Uk = se({ opSnippet: zk }), Hk = {
10605
10605
  kernelName: Js,
10606
10606
  backendName: "webgl",
10607
- kernelFunc: Uy
10607
+ kernelFunc: Uk
10608
10608
  };
10609
- const Xy = It + `
10609
+ const Xk = It + `
10610
10610
  return sin(x);
10611
- `, Ky = `
10611
+ `, Kk = `
10612
10612
  vec4 result = sin(x);
10613
10613
  bvec4 isNaN = isnan(x);
10614
10614
  ${it}
10615
10615
  return result;
10616
- `, jy = se({ opSnippet: Xy, packedOpSnippet: Ky }), qy = {
10616
+ `, jk = se({ opSnippet: Xk, packedOpSnippet: Kk }), qk = {
10617
10617
  kernelName: en,
10618
10618
  backendName: "webgl",
10619
- kernelFunc: jy
10619
+ kernelFunc: jk
10620
10620
  };
10621
- const Yy = `
10621
+ const Yk = `
10622
10622
  float e2x = exp(x);
10623
10623
  return (e2x - 1.0 / e2x) / 2.0;
10624
- `, Qy = se({ opSnippet: Yy }), Zy = {
10624
+ `, Qk = se({ opSnippet: Yk }), Zk = {
10625
10625
  kernelName: tn,
10626
10626
  backendName: "webgl",
10627
- kernelFunc: Qy
10627
+ kernelFunc: Qk
10628
10628
  };
10629
- const Jy = `
10629
+ const Jk = `
10630
10630
  float epsilon = 1.1920928955078125e-7;
10631
10631
  float threshold = log(epsilon) + 2.0;
10632
10632
 
@@ -10646,7 +10646,7 @@ const Jy = `
10646
10646
  result = log(exp_x + 1.0);
10647
10647
  }
10648
10648
  return result;
10649
- `, e$ = se({ opSnippet: Jy }), t$ = {
10649
+ `, e$ = se({ opSnippet: Jk }), t$ = {
10650
10650
  kernelName: sn,
10651
10651
  backendName: "webgl",
10652
10652
  kernelFunc: e$
@@ -10774,7 +10774,7 @@ function f$(a) {
10774
10774
  return i.map((d) => {
10775
10775
  const h = [...p];
10776
10776
  h[c] = d;
10777
- const f = kt({ inputs: { x: s }, backend: e, attrs: { begin: u, size: h } });
10777
+ const f = yt({ inputs: { x: s }, backend: e, attrs: { begin: u, size: h } });
10778
10778
  return u[c] += d, f;
10779
10779
  });
10780
10780
  }
@@ -10793,10 +10793,10 @@ const C$ = "return x * x;", b$ = se({ opSnippet: C$ }), I$ = {
10793
10793
  backendName: "webgl",
10794
10794
  kernelFunc: b$
10795
10795
  };
10796
- const so = "return (a - b) * (a - b);", k$ = Ce({ opSnippet: so, packedOpSnippet: so }), y$ = {
10796
+ const so = "return (a - b) * (a - b);", y$ = Ce({ opSnippet: so, packedOpSnippet: so }), k$ = {
10797
10797
  kernelName: Lc,
10798
10798
  backendName: "webgl",
10799
- kernelFunc: k$
10799
+ kernelFunc: y$
10800
10800
  };
10801
10801
  function $$(a) {
10802
10802
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t;
@@ -10845,22 +10845,22 @@ class N$ {
10845
10845
  }
10846
10846
  function R$(a) {
10847
10847
  const { inputs: t, backend: e, attrs: n } = a, { x: s } = t, { begin: o, end: r, strides: c, beginMask: i, endMask: l, ellipsisMask: u, newAxisMask: p, shrinkAxisMask: d } = n, { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } = Lr(s.shape, o, r, c, i, l, u, p, d);
10848
- let k;
10848
+ let y;
10849
10849
  if (m)
10850
- k = U({ inputs: { x: s }, backend: e, attrs: { shape: f } });
10850
+ y = U({ inputs: { x: s }, backend: e, attrs: { shape: f } });
10851
10851
  else if (x || g) {
10852
10852
  te(s.shape.length >= 1, () => `Input must have rank at least 1, got: ${s.shape.length}`);
10853
- const $ = Vr(C, I, b), v = kt({ inputs: { x: s }, backend: e, attrs: { begin: C, size: $ } });
10854
- k = U({ inputs: { x: v }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo(v);
10853
+ const $ = Vr(C, I, b), v = yt({ inputs: { x: s }, backend: e, attrs: { begin: C, size: $ } });
10854
+ y = U({ inputs: { x: v }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo(v);
10855
10855
  } else if (e.shouldExecuteOnCPU([s])) {
10856
10856
  const v = e.readSync(s.dataId), w = pe(s.shape, s.dtype, v), S = md(h, w, b, C);
10857
- k = e.makeTensorInfo(f, s.dtype, S.values);
10857
+ y = e.makeTensorInfo(f, s.dtype, S.values);
10858
10858
  } else {
10859
10859
  const v = new N$(C, b, h);
10860
- k = e.runWebGLProgram(v, [s], s.dtype);
10860
+ y = e.runWebGLProgram(v, [s], s.dtype);
10861
10861
  }
10862
- const y = U({ inputs: { x: k }, backend: e, attrs: { shape: f } });
10863
- return e.disposeIntermediateTensorInfo(k), y;
10862
+ const k = U({ inputs: { x: y }, backend: e, attrs: { shape: f } });
10863
+ return e.disposeIntermediateTensorInfo(y), k;
10864
10864
  }
10865
10865
  const T$ = {
10866
10866
  kernelName: Ka,
@@ -11112,28 +11112,28 @@ function q$(a) {
11112
11112
  d && tt(e, h);
11113
11113
  const g = no(o), C = no(u);
11114
11114
  let I = null;
11115
- const b = () => I === null ? [x, x] : [x, I], k = (S, E, P) => {
11115
+ const b = () => I === null ? [x, x] : [x, I], y = (S, E, P) => {
11116
11116
  const D = b(), F = new K$(P), T = [[u], [I === null ? 1 : 0], [Number.NEGATIVE_INFINITY], [S], [E]], A = I;
11117
11117
  I = e.runWebGLProgram(F, D, "int32", T), tt(e, A);
11118
11118
  };
11119
11119
  for (let S = 1; S < g; S *= 2) {
11120
11120
  const E = S * 2;
11121
11121
  for (let P = S; P >= 1; P /= 2)
11122
- k(E, P, [m, C]);
11122
+ y(E, P, [m, C]);
11123
11123
  }
11124
11124
  for (let S = C; S > g; S /= 2) {
11125
11125
  const E = b(), P = new j$([m, S / 2]), F = [[u], [I === null ? 1 : 0], [g]], R = I;
11126
11126
  I = e.runWebGLProgram(P, E, "int32", F), tt(e, R);
11127
11127
  const T = g / 2, A = T * 2;
11128
11128
  for (let N = T; N >= 1; N /= 2)
11129
- k(A, N, I.shape);
11129
+ y(A, N, I.shape);
11130
11130
  }
11131
- let y = I;
11132
- I = kt({ inputs: { x: I }, backend: e, attrs: { begin: 0, size: [m, o] } }), tt(e, y);
11131
+ let k = I;
11132
+ I = yt({ inputs: { x: I }, backend: e, attrs: { begin: 0, size: [m, o] } }), tt(e, k);
11133
11133
  let $ = Oi({ inputs: { x, indices: I }, backend: e, attrs: { axis: 1, batchDims: 1 } });
11134
11134
  tt(e, x);
11135
11135
  const v = l.slice(0, -1);
11136
- v.push(o), y = I, I = U({ inputs: { x: I }, attrs: { shape: v }, backend: e }), tt(e, y);
11136
+ v.push(o), k = I, I = U({ inputs: { x: I }, attrs: { shape: v }, backend: e }), tt(e, k);
11137
11137
  const w = $;
11138
11138
  return $ = U({ inputs: { x: $ }, attrs: { shape: v }, backend: e }), tt(e, w), [$, I];
11139
11139
  }
@@ -11296,7 +11296,7 @@ const J$ = {
11296
11296
  function ev(a) {
11297
11297
  const { inputs: t, attrs: e, backend: n } = a, { axis: s } = e, { x: o } = t;
11298
11298
  At(o, "unique"), console.warn("WARNING: ", "UI might be locked temporarily as data is being downloaded");
11299
- const r = n.readSync(o.dataId), { outputValues: c, outputShape: i, indices: l } = kd(r, s, o.shape, o.dtype);
11299
+ const r = n.readSync(o.dataId), { outputValues: c, outputShape: i, indices: l } = yd(r, s, o.shape, o.dtype);
11300
11300
  return [
11301
11301
  n.makeTensorInfo(i, o.dtype, c),
11302
11302
  n.makeTensorInfo([l.length], "int32", l)
@@ -11320,7 +11320,7 @@ function sv(a) {
11320
11320
  const f = new Array(i);
11321
11321
  for (let m = 0; m < f.length; m++) {
11322
11322
  d[o] = m;
11323
- const x = kt({ inputs: { x: r }, backend: e, attrs: { begin: d, size: h } }), g = U({ inputs: { x }, backend: e, attrs: { shape: l } });
11323
+ const x = yt({ inputs: { x: r }, backend: e, attrs: { begin: d, size: h } }), g = U({ inputs: { x }, backend: e, attrs: { shape: l } });
11324
11324
  f[m] = g, p.push(x);
11325
11325
  }
11326
11326
  return p.forEach((m) => e.disposeIntermediateTensorInfo(m)), f;
@@ -11456,8 +11456,8 @@ function av(a) {
11456
11456
  u != null && (p = Ie({ inputs: { x: s }, backend: e, attrs: { perm: u } }), i.push(p), l = xe(1, c)[0]);
11457
11457
  const d = Ql(p.shape, l, r), h = G([p.shape[l]]), f = U({ inputs: { x: p }, backend: e, attrs: { shape: [-1, h] } });
11458
11458
  i.push(f);
11459
- const m = cr(s.dtype), x = (b, k, y, $, v) => {
11460
- const w = b.shape[0], S = b.shape[1], E = Zl(S, v), P = { windowSize: E, inSize: S, batchSize: w, numSegments: v }, D = new ov(P, k), F = e.compileAndRun(D, [b, y], $);
11459
+ const m = cr(s.dtype), x = (b, y, k, $, v) => {
11460
+ const w = b.shape[0], S = b.shape[1], E = Zl(S, v), P = { windowSize: E, inSize: S, batchSize: w, numSegments: v }, D = new ov(P, y), F = e.compileAndRun(D, [b, k], $);
11461
11461
  if (i.push(F), F.shape[1] === v)
11462
11462
  return F;
11463
11463
  const R = Wi({
@@ -11468,7 +11468,7 @@ function av(a) {
11468
11468
  backend: e,
11469
11469
  attrs: { reps: [S / E] }
11470
11470
  });
11471
- return i.push(R), i.push(T), x(F, k, T, $, v);
11471
+ return i.push(R), i.push(T), x(F, y, T, $, v);
11472
11472
  }, g = x(f, "unsortedSegmentSum", o, m, r), C = U({ inputs: { x: g }, backend: e, attrs: { shape: d } });
11473
11473
  let I = C;
11474
11474
  if (u != null) {
@@ -11494,7 +11494,7 @@ const iv = [
11494
11494
  pC,
11495
11495
  gC,
11496
11496
  CC,
11497
- kC,
11497
+ yC,
11498
11498
  vC,
11499
11499
  NC,
11500
11500
  DC,
@@ -11529,7 +11529,7 @@ const iv = [
11529
11529
  p1,
11530
11530
  m1,
11531
11531
  x1,
11532
- k1,
11532
+ y1,
11533
11533
  $1,
11534
11534
  w1,
11535
11535
  T1,
@@ -11549,7 +11549,7 @@ const iv = [
11549
11549
  h0,
11550
11550
  g0,
11551
11551
  C0,
11552
- k0,
11552
+ y0,
11553
11553
  v0,
11554
11554
  R0,
11555
11555
  F0,
@@ -11568,7 +11568,7 @@ const iv = [
11568
11568
  uI,
11569
11569
  hI,
11570
11570
  xI,
11571
- kI,
11571
+ yI,
11572
11572
  vI,
11573
11573
  Dd,
11574
11574
  RI,
@@ -11581,49 +11581,49 @@ const iv = [
11581
11581
  UI,
11582
11582
  jI,
11583
11583
  ZI,
11584
- sk,
11585
- ik,
11586
- Xx,
11587
- dk,
11588
- fk,
11589
- xk,
11590
- Ik,
11591
- hb,
11592
- $k,
11593
- Sk,
11594
- Nk,
11595
- Ek,
11596
- Ok,
11597
- wd,
11598
- _k,
11599
- Vk,
11600
- Mk,
11601
- Gk,
11602
- zk,
11603
- fb,
11604
- Fd,
11605
- Xk,
11606
- Yk,
11607
- ey,
11608
- Rd,
11609
- oy,
11584
+ sy,
11610
11585
  iy,
11586
+ Xx,
11611
11587
  dy,
11612
11588
  fy,
11613
- Cy,
11589
+ xy,
11614
11590
  Iy,
11591
+ hb,
11615
11592
  $y,
11616
- wy,
11617
- Ty,
11618
- Fy,
11619
- Ay,
11593
+ Sy,
11594
+ Ny,
11595
+ Ey,
11596
+ Oy,
11597
+ wd,
11598
+ _y,
11620
11599
  Vy,
11600
+ My,
11621
11601
  Gy,
11622
- Hy,
11623
- qy,
11624
- Zy,
11602
+ zy,
11603
+ fb,
11604
+ Fd,
11605
+ Xy,
11606
+ Yy,
11607
+ ek,
11608
+ Rd,
11609
+ ok,
11610
+ ik,
11611
+ dk,
11612
+ fk,
11613
+ Ck,
11614
+ Ik,
11615
+ $k,
11616
+ wk,
11617
+ Tk,
11618
+ Fk,
11619
+ Ak,
11620
+ Vk,
11621
+ Gk,
11622
+ Hk,
11623
+ qk,
11624
+ Zk,
11625
11625
  tb,
11626
- ak,
11626
+ ay,
11627
11627
  t$,
11628
11628
  n$,
11629
11629
  a$,
@@ -11634,14 +11634,14 @@ const iv = [
11634
11634
  m$,
11635
11635
  x$,
11636
11636
  I$,
11637
- y$,
11637
+ k$,
11638
11638
  v$,
11639
11639
  w$,
11640
11640
  T$,
11641
11641
  D$,
11642
11642
  P$,
11643
11643
  A$,
11644
- ok,
11644
+ oy,
11645
11645
  Pd,
11646
11646
  V$,
11647
11647
  B$,
@@ -11653,7 +11653,7 @@ const iv = [
11653
11653
  tv,
11654
11654
  nv,
11655
11655
  rv,
11656
- vk
11656
+ vy
11657
11657
  ];
11658
11658
  for (const a of iv)
11659
11659
  or(a);
@@ -11729,20 +11729,20 @@ class FS extends Ui {
11729
11729
  ), C = c ? this.model.config.blockSize - g.shape[1] : 0, I = C > 0 ? Md(g, [
11730
11730
  [0, 0],
11731
11731
  [0, C]
11732
- ]) : g, b = this.model.forward(i, I), k = b.shape[1] - 1 - C, y = b.slice([0, k, 0], [b.shape[0], 1, b.shape[2]]);
11732
+ ]) : g, b = this.model.forward(i, I), y = b.shape[1] - 1 - C, k = b.slice([0, y, 0], [b.shape[0], 1, b.shape[2]]);
11733
11733
  let $;
11734
11734
  if (n?.targets) {
11735
11735
  const w = n.targets.shift();
11736
11736
  if (w !== void 0) {
11737
- const S = Kt([[w]], [1, 1], "int32"), E = Ld(y, S);
11737
+ const S = Kt([[w]], [1, 1], "int32"), E = Ld(k, S);
11738
11738
  $ = E.mean(), S.dispose(), E.dispose();
11739
11739
  }
11740
11740
  }
11741
11741
  return i.attentionScores?.attentionOut && i.attentionScores.attentionOut.forEach((w, S) => {
11742
11742
  w.shape[1] !== 1 && (i.attentionScores.attentionOut[S] = Wc(
11743
- w.slice([0, k, 0], [w.shape[0], 1, w.shape[2]])
11743
+ w.slice([0, y, 0], [w.shape[0], 1, w.shape[2]])
11744
11744
  ), w.dispose());
11745
- }), b.dispose(), [y.div(s).squeeze([1]), $];
11745
+ }), b.dispose(), [k.div(s).squeeze([1]), $];
11746
11746
  });
11747
11747
  let p, d;
11748
11748
  if (r) {
@@ -11761,18 +11761,18 @@ class FS extends Ui {
11761
11761
  const x = (n?.embeddings === "all" ? i.embeddings : i.embeddings.filter((C) => C.name.startsWith("block_output_"))).map(async (C) => {
11762
11762
  const I = C.tensor.shape[1], b = C.tensor.slice([0, I - 1, 0], [C.tensor.shape[0], 1, C.tensor.shape[2]]);
11763
11763
  C.tensor.dispose();
11764
- const k = b.squeeze([1]);
11764
+ const y = b.squeeze([1]);
11765
11765
  if (b.dispose(), n?.embeddings === "softmax") {
11766
- const y = this.model.project(k);
11767
- k.dispose();
11768
- const $ = gs(y, -1);
11769
- return y.dispose(), { name: C.name, tensor: await $.array() };
11766
+ const k = this.model.project(y);
11767
+ y.dispose();
11768
+ const $ = gs(k, -1);
11769
+ return k.dispose(), { name: C.name, tensor: await $.array() };
11770
11770
  } else if (n?.embeddings === "logits") {
11771
- const y = this.model.project(k);
11772
- return k.dispose(), { name: C.name, tensor: await y.array() };
11771
+ const k = this.model.project(y);
11772
+ return y.dispose(), { name: C.name, tensor: await k.array() };
11773
11773
  } else {
11774
- const y = await k.array();
11775
- return k.dispose(), { name: C.name, tensor: y };
11774
+ const k = await y.array();
11775
+ return y.dispose(), { name: C.name, tensor: k };
11776
11776
  }
11777
11777
  }), g = await Promise.all(x);
11778
11778
  this.embeddingsData.push(g);
@@ -11830,7 +11830,7 @@ class FS extends Ui {
11830
11830
  this.reset();
11831
11831
  }
11832
11832
  initialise(t, e) {
11833
- if (this.cache && e?.noCache && this.reset(), this.initialPrompt = t || null, this.lastToken === -1 ? (this.outputConversation = (this.initialPrompt || []).slice(), console.log("Setting conversation in generator.", t)) : t && t.length > this.outputConversation.length && (this.outputConversation = (this.initialPrompt || []).slice(), this.resetCache()), !this.cache && !e?.noCache && this.model.config.useRope) {
11833
+ if (this.cache && e?.noCache && this.reset(), this.initialPrompt = t || null, this.lastToken === -1 ? (this.outputConversation = (this.initialPrompt || []).slice(), console.log("Setting conversation in generator.", t)) : t && t.length > this.outputConversation.length && (this.outputConversation = (this.initialPrompt || []).slice(), this.resetCache()), !this.cache && !e?.noCache && (this.model.config.modelType !== "GenAI_NanoGPT_v1" || this.model.config.useRope)) {
11834
11834
  const s = new Array(this.model.config.nLayer);
11835
11835
  for (let o = 0; o < this.model.config.nLayer; o++)
11836
11836
  s[o] = { k: void 0, v: void 0, length: 0, cumulativeLength: 0 };