@genai-fi/nanogpt 1.5.0 → 1.6.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 (319) hide show
  1. package/dist/{DatasetBuilder-DU1G1OKX.js → DatasetBuilder-DRDW8tcM.js} +85 -86
  2. package/dist/Generator-BcR_14Cj.js +316 -0
  3. package/dist/{RealDiv-CSnvtN2E.js → RealDiv-Cl8k3YTx.js} +54 -62
  4. package/dist/{Reshape-BlylqwWy.js → Reshape-CKxKPKqi.js} +9 -12
  5. package/dist/Reshape-H5zZRgr9.js +16 -0
  6. package/dist/RoPECache-dYscFINl.js +722 -0
  7. package/dist/TeachableLLM.js +29 -34
  8. package/dist/api/beamer.js +5 -6
  9. package/dist/api/responses.js +11 -12
  10. package/dist/api/training.js +12 -14
  11. package/dist/axis_util-rF9RnwKE.js +37 -0
  12. package/dist/backend.js +5 -6
  13. package/dist/{backend_util-DAV0I34P.js → backend_util-Cpp0Gwlp.js} +180 -185
  14. package/dist/{binary_op_util-CrYk9LXL.js → binary_op_util-WY9YIl0q.js} +3 -7
  15. package/dist/broadcast_to-CGvLNiQ0.js +20 -0
  16. package/dist/checks/appendCache.js +7 -7
  17. package/dist/checks/attentionMask.js +9 -8
  18. package/dist/checks/check.js +1 -2
  19. package/dist/checks/gelu.js +6 -6
  20. package/dist/checks/index.js +24 -25
  21. package/dist/checks/matMulGelu.js +7 -7
  22. package/dist/checks/normRMS.js +14 -12
  23. package/dist/checks/normRMSGrad.js +9 -8
  24. package/dist/checks/packUnpack.js +7 -7
  25. package/dist/checks/qkv.js +1 -34
  26. package/dist/checks/rope.js +6 -6
  27. package/dist/checks/weights.js +1 -2
  28. package/dist/clip_by_value-D-UX9am5.js +13 -0
  29. package/dist/complex-Cl904TqN.js +13 -0
  30. package/dist/{complex_util-CkazZsaH.js → complex_util-BBlPAm-s.js} +1 -2
  31. package/dist/concat-Oip5acVY.js +14 -0
  32. package/dist/{concat_util-CWzvQQlK.js → concat_util-CY45Hf4F.js} +2 -3
  33. package/dist/data/docx.js +3 -4
  34. package/dist/data/pdf.js +11 -14
  35. package/dist/data/stream.js +1 -2
  36. package/dist/data/textLoader.js +16 -15
  37. package/dist/data-CV_i_H6B.js +11 -0
  38. package/dist/data.js +5 -12
  39. package/dist/dist-CMMLi-qO.js +2675 -0
  40. package/dist/{dist-BGVm64AY.js → dist-DeVH1nGn.js} +1465 -1573
  41. package/dist/{dist-CwK5S7Ls.js → dist-DyL7qSLJ.js} +2664 -2400
  42. package/dist/dropout16-CA31Ud5a.js +20 -0
  43. package/dist/dropout_util-SiFMbFXz.js +22 -0
  44. package/dist/{eventemitter3-D_qV3Lof.js → eventemitter3-wmfmOP_f.js} +2 -3
  45. package/dist/expand_dims-Dh3Fulyn.js +10 -0
  46. package/dist/floor-BwjmUb7X.js +8 -0
  47. package/dist/gather-B5Z1RFt5.js +14 -0
  48. package/dist/gatherSub-CRUfUzBa.js +22 -0
  49. package/dist/gelu-Xx9-ohH9.js +25 -0
  50. package/dist/{gpgpu_math-20tPK8LM.js → gpgpu_math-48m8q3jI.js} +265 -286
  51. package/dist/inference/Beamer.js +34 -27
  52. package/dist/inference/Generator.js +1 -273
  53. package/dist/inference/tokenisePrompt.js +5 -4
  54. package/dist/inference/types.d.ts +6 -0
  55. package/dist/inference/utilities.js +1 -2
  56. package/dist/{jszip.min-DKa1Rjyn.js → jszip.min-Btv48m44.js} +68 -64
  57. package/dist/{kernel_funcs_utils-ql8Y8qPn.js → kernel_funcs_utils-BYRpSfV_.js} +39 -42
  58. package/dist/layers/BaseLayer.js +9 -10
  59. package/dist/layers/GQA.js +45 -44
  60. package/dist/layers/HeadLayer.js +13 -13
  61. package/dist/layers/LoRA.js +17 -20
  62. package/dist/layers/MHA.d.ts +2 -2
  63. package/dist/layers/MHA.js +46 -45
  64. package/dist/layers/MLP.js +22 -21
  65. package/dist/layers/PositionEmbedding.js +14 -13
  66. package/dist/layers/RMSNorm.js +14 -13
  67. package/dist/layers/RoPECache.js +1 -338
  68. package/dist/layers/TiedEmbedding.js +15 -14
  69. package/dist/layers/TransformerBlock.d.ts +3 -9
  70. package/dist/layers/TransformerBlock.js +29 -30
  71. package/dist/layers/WeightStore.js +4 -5
  72. package/dist/layers-CFqEip3s.js +13 -0
  73. package/dist/layers.js +3 -11
  74. package/dist/loader/load.js +27 -24
  75. package/dist/loader/loadHF.js +3 -3
  76. package/dist/loader/loadTransformers.js +5 -6
  77. package/dist/loader/loadZipMeta.js +1 -2
  78. package/dist/loader/newZipLoad.js +1 -2
  79. package/dist/loader/oldZipLoad.js +8 -9
  80. package/dist/loader/save.js +15 -16
  81. package/dist/main.js +3281 -3463
  82. package/dist/{matMul16-CO1QhsRt.js → matMul16-tE26fnhf.js} +29 -27
  83. package/dist/{matMulGelu-CBoqTZM7.js → matMulGelu-ASUWlKqu.js} +33 -33
  84. package/dist/mat_mul-R9_DWmIT.js +16 -0
  85. package/dist/models/Llama.js +48 -49
  86. package/dist/models/NanoGPTV1.js +53 -54
  87. package/dist/models/NanoGPTV2.js +48 -49
  88. package/dist/models/Qwen3.js +48 -49
  89. package/dist/models/config.js +3 -8
  90. package/dist/models/factory.js +7 -8
  91. package/dist/models/model.d.ts +5 -7
  92. package/dist/models/model.js +1 -2
  93. package/dist/models-DyBpJJwM.js +13 -0
  94. package/dist/models.js +6 -14
  95. package/dist/mul16-C7sqgqik.js +41 -0
  96. package/dist/non_max_suppression_impl-B0H318rb.js +72 -0
  97. package/dist/not_equal-Bu3O8rh_.js +67 -0
  98. package/dist/one_hot-TEMPumJj.js +14 -0
  99. package/dist/ones-DpPXWa6A.js +13 -0
  100. package/dist/ops/adamAdjust.js +2 -3
  101. package/dist/ops/adamMoments.js +2 -3
  102. package/dist/ops/add16.js +2 -3
  103. package/dist/ops/appendCache.js +9 -8
  104. package/dist/ops/attentionMask.d.ts +1 -1
  105. package/dist/ops/attentionMask.js +8 -5
  106. package/dist/ops/concat16.js +5 -5
  107. package/dist/ops/cpu/adamAdjust.js +7 -8
  108. package/dist/ops/cpu/adamMoments.js +5 -5
  109. package/dist/ops/cpu/appendCache.js +3 -3
  110. package/dist/ops/cpu/attentionMask.js +12 -8
  111. package/dist/ops/cpu/fusedSoftmax.js +3 -3
  112. package/dist/ops/cpu/gatherSub.js +1 -12
  113. package/dist/ops/cpu/gelu.js +12 -13
  114. package/dist/ops/cpu/matMul16.js +7 -7
  115. package/dist/ops/cpu/matMulGelu.js +21 -18
  116. package/dist/ops/cpu/matMulMul.js +8 -9
  117. package/dist/ops/cpu/mulDropout.js +8 -9
  118. package/dist/ops/cpu/normRMS.js +12 -13
  119. package/dist/ops/cpu/qkv.js +14 -13
  120. package/dist/ops/cpu/rope.js +11 -8
  121. package/dist/ops/cpu/scatterSub.js +1 -12
  122. package/dist/ops/dot16.js +16 -17
  123. package/dist/ops/dropout.js +9 -8
  124. package/dist/ops/dropout16.js +1 -22
  125. package/dist/ops/gatherSub.js +3 -4
  126. package/dist/ops/gelu.js +1 -2
  127. package/dist/ops/globalNorm.js +10 -10
  128. package/dist/ops/grads/add16.js +16 -17
  129. package/dist/ops/grads/attentionMask.js +6 -7
  130. package/dist/ops/grads/dropout16.js +1 -1
  131. package/dist/ops/grads/gelu.js +1 -2
  132. package/dist/ops/grads/matMul16.js +1 -2
  133. package/dist/ops/grads/matMulGelu.js +6 -7
  134. package/dist/ops/grads/mul16.js +1 -1
  135. package/dist/ops/grads/normRMS.js +8 -9
  136. package/dist/ops/grads/pack16.js +1 -2
  137. package/dist/ops/grads/qkv.js +10 -10
  138. package/dist/ops/grads/rope.js +1 -2
  139. package/dist/ops/grads/silu.js +1 -2
  140. package/dist/ops/grads/softmax16.js +6 -7
  141. package/dist/ops/grads/unpack16.js +1 -2
  142. package/dist/ops/grads/utils.js +1 -2
  143. package/dist/ops/matMul16.d.ts +1 -1
  144. package/dist/ops/matMul16.js +1 -2
  145. package/dist/ops/matMulGelu.js +3 -4
  146. package/dist/ops/matMulMul.js +2 -3
  147. package/dist/ops/mul16.js +1 -43
  148. package/dist/ops/mulDrop.js +2 -3
  149. package/dist/ops/normRMS.js +2 -3
  150. package/dist/ops/pack16.js +1 -2
  151. package/dist/ops/qkv.js +2 -3
  152. package/dist/ops/reshape16.js +11 -11
  153. package/dist/ops/rope.js +1 -2
  154. package/dist/ops/scatterSub.js +3 -4
  155. package/dist/ops/silu.js +1 -2
  156. package/dist/ops/slice16.js +5 -5
  157. package/dist/ops/softmax16.js +3 -4
  158. package/dist/ops/sub16.js +3 -4
  159. package/dist/ops/sum16.js +3 -3
  160. package/dist/ops/transpose16.js +16 -15
  161. package/dist/ops/unpack16.js +1 -2
  162. package/dist/ops/webgl/adamAdjust.js +8 -9
  163. package/dist/ops/webgl/adamMoments.js +2 -3
  164. package/dist/ops/webgl/appendCache.js +2 -3
  165. package/dist/ops/webgl/attentionMask.js +2 -3
  166. package/dist/ops/webgl/dropout16.js +2 -3
  167. package/dist/ops/webgl/fusedSoftmax.js +13 -13
  168. package/dist/ops/webgl/gatherSub.js +2 -3
  169. package/dist/ops/webgl/gelu.js +11 -12
  170. package/dist/ops/webgl/log.js +10 -10
  171. package/dist/ops/webgl/matMul16.js +31 -24
  172. package/dist/ops/webgl/matMulGelu.js +1 -2
  173. package/dist/ops/webgl/matMulMul.js +3 -4
  174. package/dist/ops/webgl/mulDropout.js +2 -3
  175. package/dist/ops/webgl/normRMS.js +11 -10
  176. package/dist/ops/webgl/qkv.js +2 -3
  177. package/dist/ops/webgl/rope.js +4 -5
  178. package/dist/ops/webgl/scatterSub.js +2 -3
  179. package/dist/ops/webgpu/adamAdjust.js +13 -14
  180. package/dist/ops/webgpu/adamMoments.js +13 -14
  181. package/dist/ops/webgpu/add16.js +3 -4
  182. package/dist/ops/webgpu/appendCache.js +20 -21
  183. package/dist/ops/webgpu/attentionMask.js +18 -19
  184. package/dist/ops/webgpu/attentionMask32_program.js +7 -8
  185. package/dist/ops/webgpu/clipScale.js +11 -12
  186. package/dist/ops/webgpu/concat16.js +17 -18
  187. package/dist/ops/webgpu/dropout16.js +6 -7
  188. package/dist/ops/webgpu/gatherSub.js +11 -12
  189. package/dist/ops/webgpu/gelu.js +10 -11
  190. package/dist/ops/webgpu/index.js +17 -17
  191. package/dist/ops/webgpu/matMul16.js +74 -63
  192. package/dist/ops/webgpu/matMul16_program.d.ts +2 -1
  193. package/dist/ops/webgpu/matMul16_program.js +29 -21
  194. package/dist/ops/webgpu/mul16.js +3 -4
  195. package/dist/ops/webgpu/norm2.js +9 -10
  196. package/dist/ops/webgpu/normRMS.js +9 -10
  197. package/dist/ops/webgpu/normRMS16_program.js +1 -2
  198. package/dist/ops/webgpu/normRMS32_program.js +1 -2
  199. package/dist/ops/webgpu/normRMSGrad.js +30 -30
  200. package/dist/ops/webgpu/pack16.js +2 -3
  201. package/dist/ops/webgpu/pack16_program.js +3 -4
  202. package/dist/ops/webgpu/qkv.js +10 -11
  203. package/dist/ops/webgpu/rope.js +26 -27
  204. package/dist/ops/webgpu/scatterSub.js +12 -13
  205. package/dist/ops/webgpu/silu.js +10 -11
  206. package/dist/ops/webgpu/slice16.js +17 -18
  207. package/dist/ops/webgpu/softmax16.js +9 -9
  208. package/dist/ops/webgpu/softmax16_program.js +9 -10
  209. package/dist/ops/webgpu/softmax16_subgroup_program.js +11 -12
  210. package/dist/ops/webgpu/softmax16grad.js +8 -9
  211. package/dist/ops/webgpu/sub16.js +3 -4
  212. package/dist/ops/webgpu/sum16.js +16 -15
  213. package/dist/ops/webgpu/transpose16.js +13 -12
  214. package/dist/ops/webgpu/transpose16_program.js +3 -4
  215. package/dist/ops/webgpu/transpose16_shared_program.js +17 -18
  216. package/dist/ops/webgpu/unpack16.js +8 -9
  217. package/dist/ops/webgpu/utils/binary_op.js +20 -21
  218. package/dist/ops/webgpu/utils/deviceInfo.js +1 -2
  219. package/dist/ops/webgpu/utils/reductions.js +21 -20
  220. package/dist/ops-Be5ACU5R.js +13 -0
  221. package/dist/ops-C1UpdEYM.js +509 -0
  222. package/dist/{pack16-BhuXNUS7.js → pack16-BHO4t1-M.js} +14 -17
  223. package/dist/pad-Dy-1IP3A.js +13 -0
  224. package/dist/patches/webgpu_backend.js +18 -19
  225. package/dist/patches/webgpu_base.js +2 -3
  226. package/dist/patches/webgpu_program.js +21 -22
  227. package/dist/{pdf-Bzuk68Vy.js → pdf-CbnQ75VG.js} +380 -701
  228. package/dist/{picomatch-BO4HbNfo.js → picomatch--TW6gyBJ.js} +229 -291
  229. package/dist/qkv-BQfNPucX.js +42 -0
  230. package/dist/rand_util-_vCY93Uw.js +44 -0
  231. package/dist/random_normal-DUIT8kyC.js +11 -0
  232. package/dist/range-CYvQC3fW.js +13 -0
  233. package/dist/relu-C4XULT8A.js +8 -0
  234. package/dist/reshape-DJb1jgMt.js +8 -0
  235. package/dist/resize_nearest_neighbor-DAqcTYUe.js +188 -0
  236. package/dist/{chunk-CWhphoD1.js → rolldown-runtime-CwxnZyOB.js} +4 -5
  237. package/dist/{rope-BPu_uooz.js → rope-JjBVufF_.js} +6 -8
  238. package/dist/scatterSub-BOnqk-uY.js +27 -0
  239. package/dist/scatter_nd_util-BepMCpLY.js +34 -0
  240. package/dist/seedrandom-SHEGFK6H.js +282 -0
  241. package/dist/selu_util-DeOTf-sc.js +27 -0
  242. package/dist/shared-BIDMUBCs.js +1864 -0
  243. package/dist/{shared-CfTzpULd.js → shared-CX_iPI5K.js} +2 -3
  244. package/dist/silu-DsAE2cJ5.js +23 -0
  245. package/dist/slice-Dlb1FlzG.js +13 -0
  246. package/dist/{slice_util-Dve4TkDn.js → slice_util-BVgPRoij.js} +3 -4
  247. package/dist/softmax-Dpav_dWw.js +10 -0
  248. package/dist/split-DYnT8chz.js +11 -0
  249. package/dist/squeeze-B3XYGAlg.js +9 -0
  250. package/dist/stack-Dbbt9mIk.js +10 -0
  251. package/dist/step-DA-5DNu9.js +348 -0
  252. package/dist/{stream-BpAwcvHz.js → stream-BBe2apn4.js} +68 -88
  253. package/dist/sum-C8qNbFNp.js +13 -0
  254. package/dist/tensor-ALxWZfmz.js +7 -0
  255. package/dist/tensor1d-BHgkkhTE.js +9 -0
  256. package/dist/tensor2d-ARItvqVn.js +10 -0
  257. package/dist/tensor4d-D1zRBipJ.js +10 -0
  258. package/dist/tfjs_backend-CsXOum0h.js +685 -0
  259. package/dist/tile-DfyQ0KX-.js +10 -0
  260. package/dist/tokenise-DbS2Ea-T.js +14 -0
  261. package/dist/tokenise.js +6 -15
  262. package/dist/tokeniser/BaseTokeniser.js +5 -9
  263. package/dist/tokeniser/CharTokeniser.js +1 -2
  264. package/dist/tokeniser/bpe.js +19 -20
  265. package/dist/topk-BrU2pkrR.js +19 -0
  266. package/dist/training/AdamW.js +35 -31
  267. package/dist/training/BasicTrainer.js +56 -56
  268. package/dist/training/DatasetBuilder.js +1 -2
  269. package/dist/training/Evaluator.js +4 -4
  270. package/dist/training/LRScheduler.js +1 -2
  271. package/dist/training/PreTrainer.js +7 -8
  272. package/dist/training/SFTTrainer.js +7 -8
  273. package/dist/training/configure.js +16 -15
  274. package/dist/training/factory.js +1 -2
  275. package/dist/training/loss.js +1 -2
  276. package/dist/training/orthoGrad.js +2 -3
  277. package/dist/training/prepareData.js +18 -17
  278. package/dist/training/sparseCrossEntropy.js +38 -32
  279. package/dist/training/tasks/TokenStore.js +21 -22
  280. package/dist/training/tasks/tokenStream.js +1 -2
  281. package/dist/training/validateOptions.js +1 -2
  282. package/dist/training/validation.js +1 -2
  283. package/dist/transpose-BC-M_OoT.js +34 -0
  284. package/dist/unsorted_segment_sum-BelC7R-q.js +408 -0
  285. package/dist/utilities/arrayClose.js +5 -4
  286. package/dist/utilities/arrayShape.js +1 -2
  287. package/dist/utilities/datasetID.js +1 -2
  288. package/dist/utilities/dummy.js +15 -15
  289. package/dist/utilities/float16.js +10 -10
  290. package/dist/utilities/maxHeap.js +1 -2
  291. package/dist/utilities/multinomialCPU.d.ts +1 -2
  292. package/dist/utilities/multinomialCPU.js +6 -8
  293. package/dist/utilities/packed.js +2 -3
  294. package/dist/utilities/parameters.js +3 -4
  295. package/dist/utilities/performance.js +2 -3
  296. package/dist/utilities/profile.js +3 -4
  297. package/dist/utilities/random.js +1 -2
  298. package/dist/utilities/safetensors.js +14 -14
  299. package/dist/utilities/sentences.js +16 -13
  300. package/dist/utilities/tokenParse.js +1 -2
  301. package/dist/utilities/tokens.js +5 -6
  302. package/dist/utilities/topP.d.ts +1 -0
  303. package/dist/utilities/topP.js +20 -13
  304. package/dist/utilities/waitForModel.js +1 -2
  305. package/dist/utilities/weights.js +4 -4
  306. package/dist/utilities/yielder.js +1 -2
  307. package/dist/{v4-BK7K-jy_.js → v4-YCkfo8OR.js} +4 -7
  308. package/dist/{webgpu-IAn9VotJ.js → webgpu-BHX-uBym.js} +156 -163
  309. package/dist/{webgpu_program-B0PokuRJ.js → webgpu_program-DvkFqRlR.js} +28 -29
  310. package/dist/{webgpu_util-DfODg6XI.js → webgpu_util-5QTyovaf.js} +2 -3
  311. package/dist/zeros-hxKGkRfl.js +12 -0
  312. package/package.json +3 -3
  313. package/dist/Reshape-CwxdaU8n.js +0 -17
  314. package/dist/dist-Da20xy8E.js +0 -6375
  315. package/dist/gelu-B6637MKa.js +0 -27
  316. package/dist/selu_util-B_AFEfoz.js +0 -24
  317. package/dist/shared-24EoeHJl.js +0 -1314
  318. package/dist/silu-B6bvCgJ7.js +0 -25
  319. package/dist/tfjs_backend-h5weiy1O.js +0 -614
@@ -0,0 +1,408 @@
1
+ import { Ar as e, Br as t, C as n, Dt as r, En as i, Lr as a, N as o, Ni as s, Nr as c, O as l, Pt as u, Q as d, Qt as f, Ur as p, Wr as m, Xt as h, Yn as g, Z as _, an as v, cn as ee, dr as te, in as y, m as b, mi as x, nn as S, oi as C, p as w, qn as ne, rt as T, st as re, vn as ie, yi as E, zt as D } from "./dist-CMMLi-qO.js";
2
+ import { g as O, h as k, s as A } from "./step-DA-5DNu9.js";
3
+ import { t as j } from "./reshape-DJb1jgMt.js";
4
+ import { a as M, i as N, o as P } from "./not_equal-Bu3O8rh_.js";
5
+ import { t as F } from "./sum-C8qNbFNp.js";
6
+ // node_modules/@tensorflow/tfjs-core/dist/ops/all.js
7
+ function I(e, t = null, n = !1) {
8
+ let r = { x: d(e, "x", "all", "bool") }, i = {
9
+ axis: t,
10
+ keepDims: n
11
+ };
12
+ return T.runKernel("All", r, i);
13
+ }
14
+ var L = /* @__PURE__ */ _({ all_: I });
15
+ // node_modules/@tensorflow/tfjs-core/dist/ops/any.js
16
+ function R(e, t = null, n = !1) {
17
+ let r = { x: d(e, "x", "any", "bool") }, i = {
18
+ axis: t,
19
+ keepDims: n
20
+ };
21
+ return T.runKernel("Any", r, i);
22
+ }
23
+ var z = /* @__PURE__ */ _({ any_: R });
24
+ // node_modules/@tensorflow/tfjs-core/dist/ops/arg_max.js
25
+ function B(e, t = 0) {
26
+ let n = { x: d(e, "x", "argMax") }, i = { axis: t };
27
+ return T.runKernel(r, n, i);
28
+ }
29
+ var V = /* @__PURE__ */ _({ argMax_: B });
30
+ // node_modules/@tensorflow/tfjs-core/dist/ops/avg_pool.js
31
+ function H(e, t, n, r, i) {
32
+ let a = d(e, "x", "avgPool", "float32");
33
+ E(k(n, 1), () => `Error in avgPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`);
34
+ let s = a, c = !1;
35
+ a.rank === 3 && (c = !0, s = j(a, [
36
+ 1,
37
+ a.shape[0],
38
+ a.shape[1],
39
+ a.shape[2]
40
+ ])), E(s.rank === 4, () => `Error in avgPool: x must be rank 4 but got rank ${s.rank}.`), A("avgPool", r, i);
41
+ let l = { x: s }, f = {
42
+ filterSize: t,
43
+ strides: n,
44
+ pad: r,
45
+ dimRoundingMode: i
46
+ }, p = T.runKernel(u, l, f);
47
+ return p = o(p, a.dtype), c ? j(p, [
48
+ p.shape[1],
49
+ p.shape[2],
50
+ p.shape[3]
51
+ ]) : p;
52
+ }
53
+ var U = /* @__PURE__ */ _({ avgPool_: H });
54
+ // node_modules/@tensorflow/tfjs-core/dist/ops/tanh.js
55
+ function W(e) {
56
+ let t = { x: d(e, "x", "tanh", "float32") };
57
+ return T.runKernel(C, t);
58
+ }
59
+ var G = /* @__PURE__ */ _({ tanh_: W });
60
+ // node_modules/@tensorflow/tfjs-core/dist/ops/batch_to_space_nd.js
61
+ function K(e, t, n) {
62
+ let r = d(e, "x", "batchToSpaceND"), i = t.reduce((e, t) => e * t);
63
+ E(r.rank >= 1 + t.length, () => `input rank is ${r.rank} but should be > than blockShape.length ${t.length}`), E(n.length === t.length, () => `crops.length is ${n.length} but should be equal to blockShape.length ${t.length}`), E(r.shape[0] % i === 0, () => `input tensor batch is ${r.shape[0]} but is not divisible by the product of the elements of blockShape ${t.join(" * ")} === ${i}`);
64
+ let a = { x: r }, o = {
65
+ blockShape: t,
66
+ crops: n
67
+ };
68
+ return T.runKernel(D, a, o);
69
+ }
70
+ var q = /* @__PURE__ */ _({ batchToSpaceND_: K });
71
+ // node_modules/@tensorflow/tfjs-core/dist/ops/batchnorm_util.js
72
+ function J(e) {
73
+ let t;
74
+ return t = e.rank === 0 || e.rank === 1 ? j(e, [
75
+ 1,
76
+ 1,
77
+ 1,
78
+ e.size
79
+ ]) : e.rank === 2 ? j(e, [
80
+ 1,
81
+ 1,
82
+ e.shape[0],
83
+ e.shape[1]
84
+ ]) : e.rank === 3 ? j(e, [
85
+ 1,
86
+ e.shape[0],
87
+ e.shape[1],
88
+ e.shape[2]
89
+ ]) : e, t;
90
+ }
91
+ // node_modules/@tensorflow/tfjs-core/dist/ops/batchnorm.js
92
+ function Y(e, t, n, r, a, o) {
93
+ o ??= .001;
94
+ let s = d(e, "x", "batchNorm"), c = d(t, "mean", "batchNorm"), l = d(n, "variance", "batchNorm"), u;
95
+ a != null && (u = d(a, "scale", "batchNorm"));
96
+ let f;
97
+ r != null && (f = d(r, "offset", "batchNorm")), E(c.rank === l.rank, () => "Batch normalization gradient requires mean and variance to have equal ranks."), E(f == null || c.rank === f.rank, () => "Batch normalization gradient requires mean and offset to have equal ranks."), E(u == null || c.rank === u.rank, () => "Batch normalization gradient requires mean and scale to have equal ranks.");
98
+ let p = {
99
+ x: J(s),
100
+ scale: u,
101
+ offset: f,
102
+ mean: c,
103
+ variance: l
104
+ }, m = { varianceEpsilon: o }, h = T.runKernel(i, p, m);
105
+ return j(h, s.shape);
106
+ }
107
+ var ae = /* @__PURE__ */ _({ batchNorm_: Y });
108
+ // node_modules/@tensorflow/tfjs-core/dist/ops/conv2d.js
109
+ function oe(e, t, n, r, i = "NHWC", a = [1, 1], o) {
110
+ let s = d(e, "x", "conv2d", "float32"), c = d(t, "filter", "conv2d", "float32"), l = s, u = !1;
111
+ s.rank === 3 && (u = !0, l = j(s, [
112
+ 1,
113
+ s.shape[0],
114
+ s.shape[1],
115
+ s.shape[2]
116
+ ])), E(l.rank === 4, () => `Error in conv2d: input must be rank 4, but got rank ${l.rank}.`), E(c.rank === 4, () => `Error in conv2d: filter must be rank 4, but got rank ${c.rank}.`), A("conv2d", r, o);
117
+ let f = i === "NHWC" ? l.shape[3] : l.shape[1];
118
+ E(f === c.shape[2], () => `Error in conv2d: depth of input (${f}) must match input depth for filter ${c.shape[2]}.`), E(k(n, a), () => `Error in conv2D: Either strides or dilations must be 1. Got strides ${n} and dilations '${a}'`), E(O(a), () => "Error in conv2D: Dilated rates should be larger than 0."), E(O(n), () => "Error in conv2D: Strides should be larger than 0.");
119
+ let p = {
120
+ x: l,
121
+ filter: c
122
+ }, m = {
123
+ strides: n,
124
+ pad: r,
125
+ dataFormat: i,
126
+ dilations: a,
127
+ dimRoundingMode: o
128
+ }, g = T.runKernel(h, p, m);
129
+ return u ? j(g, [
130
+ g.shape[1],
131
+ g.shape[2],
132
+ g.shape[3]
133
+ ]) : g;
134
+ }
135
+ var X = /* @__PURE__ */ _({ conv2d_: oe });
136
+ // node_modules/@tensorflow/tfjs-core/dist/ops/conv1d.js
137
+ function se(e, t, n, r, i = "NWC", a = 1, o) {
138
+ let s = d(e, "x", "conv1d"), c = d(t, "filter", "conv1d"), l = s, u = !1;
139
+ s.rank === 2 && (u = !0, l = j(s, [
140
+ 1,
141
+ s.shape[0],
142
+ s.shape[1]
143
+ ])), E(l.rank === 3, () => `Error in conv1d: input must be rank 3, but got rank ${l.rank}.`), E(c.rank === 3, () => `Error in conv1d: filter must be rank 3, but got rank ${c.rank}.`), A("conv1d", r, o), E(l.shape[2] === c.shape[1], () => `Error in conv1d: depth of input (${l.shape[2]}) must match input depth for filter ${c.shape[1]}.`), E(k(n, a), () => `Error in conv1D: Either stride or dilation must be 1. Got stride ${n} and dilation '${a}'`), E(O(a), () => "Error in conv1D: Dilated rates should be larger than 0."), E(O(n), () => "Error in conv1D: Stride should be larger than 0."), E(i === "NWC", () => `Error in conv1d: got dataFormat of ${i} but only NWC is currently supported.`);
144
+ let f = j(c, [
145
+ 1,
146
+ c.shape[0],
147
+ c.shape[1],
148
+ c.shape[2]
149
+ ]), p = X(j(l, [
150
+ l.shape[0],
151
+ 1,
152
+ l.shape[1],
153
+ l.shape[2]
154
+ ]), f, [1, n], r, "NHWC", [1, a], o);
155
+ return u ? j(p, [p.shape[2], p.shape[3]]) : j(p, [
156
+ p.shape[0],
157
+ p.shape[2],
158
+ p.shape[3]
159
+ ]);
160
+ }
161
+ var ce = /* @__PURE__ */ _({ conv1d_: se });
162
+ // node_modules/@tensorflow/tfjs-core/dist/ops/conv2d_backprop_input.js
163
+ function le(e, t, n, r, i, a = "NHWC", o) {
164
+ E(e.length === t.rank, () => `Length of inShape (${e.length}) and rank of dy (${t.rank}) must match`);
165
+ let s = e, c = t, l = !1;
166
+ t.rank === 3 && (l = !0, c = j(t, [
167
+ 1,
168
+ t.shape[0],
169
+ t.shape[1],
170
+ t.shape[2]
171
+ ]), s = [
172
+ 1,
173
+ e[0],
174
+ e[1],
175
+ e[2]
176
+ ]), E(s.length === 4, () => `Error in conv2dDerInput: inShape must be length 4, but got length ${s.length}.`), E(c.rank === 4, () => `Error in conv2dDerInput: dy must be rank 4, but got rank ${c.rank}`), E(n.rank === 4, () => `Error in conv2dDerInput: filter must be rank 4, but got rank ${n.rank}`);
177
+ let u = a === "NHWC" ? s[3] : s[1], d = a === "NHWC" ? c.shape[3] : c.shape[1];
178
+ E(u === n.shape[2], () => `Error in conv2dDerInput: depth of input (${u}) must match input depth for filter ${n.shape[2]}.`), E(d === n.shape[3], () => `Error in conv2dDerInput: depth of output (${d}) must match output depth for filter ${n.shape[3]}.`), A("conv2dDerInput", i, o);
179
+ let p = {
180
+ dy: c,
181
+ filter: n
182
+ }, m = {
183
+ strides: r,
184
+ pad: i,
185
+ dataFormat: a,
186
+ dimRoundingMode: o,
187
+ inputShape: s
188
+ }, h = T.runKernel(f, p, m);
189
+ return l ? j(h, [
190
+ h.shape[1],
191
+ h.shape[2],
192
+ h.shape[3]
193
+ ]) : h;
194
+ }
195
+ var Z = /* @__PURE__ */ _({ conv2DBackpropInput_: le });
196
+ // node_modules/@tensorflow/tfjs-core/dist/ops/conv2d_transpose.js
197
+ function ue(e, t, n, r, i, a) {
198
+ return Z(n, d(e, "x", "conv2dTranspose"), d(t, "filter", "conv2dTranspose"), r, i, "NHWC", a);
199
+ }
200
+ var de = /* @__PURE__ */ _({ conv2dTranspose_: ue });
201
+ // node_modules/@tensorflow/tfjs-core/dist/ops/cos.js
202
+ function fe(e) {
203
+ let t = { x: d(e, "x", "cos", "float32") };
204
+ return T.runKernel("Cos", t);
205
+ }
206
+ var pe = /* @__PURE__ */ _({ cos_: fe });
207
+ // node_modules/@tensorflow/tfjs-core/dist/ops/cosh.js
208
+ function me(e) {
209
+ let t = { x: d(e, "x", "cosh", "float32") };
210
+ return T.runKernel(S, t);
211
+ }
212
+ var he = /* @__PURE__ */ _({ cosh_: me });
213
+ // node_modules/@tensorflow/tfjs-core/dist/ops/cumprod.js
214
+ function ge(e, t = 0, n = !1, r = !1) {
215
+ let i = { x: d(e, "x", "cumprod") }, a = {
216
+ axis: t,
217
+ exclusive: n,
218
+ reverse: r
219
+ };
220
+ return T.runKernel(y, i, a);
221
+ }
222
+ var _e = /* @__PURE__ */ _({ cumprod_: ge });
223
+ // node_modules/@tensorflow/tfjs-core/dist/ops/cumsum.js
224
+ function ve(e, t = 0, n = !1, r = !1) {
225
+ let i = { x: d(e, "x", "cumsum") }, a = {
226
+ axis: t,
227
+ exclusive: n,
228
+ reverse: r
229
+ };
230
+ return T.runKernel(v, i, a);
231
+ }
232
+ var ye = /* @__PURE__ */ _({ cumsum_: ve });
233
+ // node_modules/@tensorflow/tfjs-core/dist/ops/depthwise_conv2d.js
234
+ function be(e, t, n, r, i = "NHWC", a = [1, 1], o) {
235
+ let s = d(e, "x", "depthwiseConv2d", "float32"), c = d(t, "filter", "depthwiseConv2d", "float32"), l = s, u = !1;
236
+ s.rank === 3 && (u = !0, l = j(s, [
237
+ 1,
238
+ s.shape[0],
239
+ s.shape[1],
240
+ s.shape[2]
241
+ ])), E(l.rank === 4, () => `Error in depthwiseConv2d: input must be rank 4, but got rank ${l.rank}.`), E(c.rank === 4, () => `Error in depthwiseConv2d: filter must be rank 4, but got rank ${c.rank}.`);
242
+ let f = i === "NHWC" ? l.shape[3] : l.shape[1];
243
+ E(f === c.shape[2], () => `Error in depthwiseConv2d: number of input channels (${f}) must match the inChannels dimension in filter ${c.shape[2]}.`), A("depthwiseConv2d", r, o);
244
+ let p = {
245
+ x: l,
246
+ filter: c
247
+ }, m = {
248
+ strides: n,
249
+ pad: r,
250
+ dataFormat: i,
251
+ dilations: a,
252
+ dimRoundingMode: o
253
+ }, h = T.runKernel(ee, p, m);
254
+ return u ? j(h, [
255
+ h.shape[1],
256
+ h.shape[2],
257
+ h.shape[3]
258
+ ]) : h;
259
+ }
260
+ var Q = /* @__PURE__ */ _({ depthwiseConv2d_: be });
261
+ // node_modules/@tensorflow/tfjs-core/dist/ops/equal.js
262
+ function xe(e, t) {
263
+ let r = d(e, "a", "equal", "string_or_numeric"), i = d(t, "b", "equal", "string_or_numeric");
264
+ [r, i] = re(r, i), n(r.shape, i.shape);
265
+ let a = {
266
+ a: r,
267
+ b: i
268
+ };
269
+ return T.runKernel(ie, a);
270
+ }
271
+ var Se = /* @__PURE__ */ _({ equal_: xe });
272
+ // node_modules/@tensorflow/tfjs-core/dist/ops/erf.js
273
+ function Ce(e) {
274
+ let t = d(e, "x", "erf");
275
+ E(t.dtype === "int32" || t.dtype === "float32", () => "Input dtype must be `int32` or `float32`."), t.dtype === "int32" && (t = o(t, "float32"));
276
+ let n = { x: t };
277
+ return T.runKernel("Erf", n);
278
+ }
279
+ var we = /* @__PURE__ */ _({ erf_: Ce });
280
+ // node_modules/@tensorflow/tfjs-core/dist/ops/softplus.js
281
+ function Te(e) {
282
+ let t = { x: d(e, "x", "softplus") };
283
+ return T.runKernel(p, t);
284
+ }
285
+ var Ee = /* @__PURE__ */ _({ softplus_: Te });
286
+ // node_modules/@tensorflow/tfjs-core/dist/ops/log_softmax.js
287
+ function De(e, t = -1) {
288
+ let n = d(e, "logits", "logSoftmax");
289
+ if (t === -1 && (t = n.rank - 1), t !== n.rank - 1) throw Error(`Log Softmax along a non-last dimension is not yet supported. Logits was rank ${n.rank} and axis was ${t}`);
290
+ return b((e, n) => {
291
+ let r = P(e, t, !0), i = w(e, r), a = w(o(i, "float32"), N(F(M(i), t, !0)));
292
+ return n([a]), {
293
+ value: a,
294
+ gradFunc: (e, n) => {
295
+ let [r] = n, i = M(r);
296
+ return w(e, l(F(e, t, !0), i));
297
+ }
298
+ };
299
+ })(n);
300
+ }
301
+ var Oe = /* @__PURE__ */ _({ logSoftmax_: De });
302
+ // node_modules/@tensorflow/tfjs-core/dist/ops/logical_not.js
303
+ function ke(e) {
304
+ let t = { x: d(e, "x", "logicalNot", "bool") };
305
+ return T.runKernel(ne, t);
306
+ }
307
+ var Ae = /* @__PURE__ */ _({ logicalNot_: ke });
308
+ // node_modules/@tensorflow/tfjs-core/dist/ops/max_pool.js
309
+ function je(e, t, n, r, i) {
310
+ let a = d(e, "x", "maxPool"), o = a, s = !1;
311
+ a.rank === 3 && (s = !0, o = j(a, [
312
+ 1,
313
+ a.shape[0],
314
+ a.shape[1],
315
+ a.shape[2]
316
+ ])), E(o.rank === 4, () => `Error in maxPool: input must be rank 4 but got rank ${o.rank}.`), E(k(n, 1), () => `Error in maxPool: Either strides or dilations must be 1. Got strides ${n} and dilations '1'`), A("maxPool", r, i);
317
+ let c = { x: o }, l = {
318
+ filterSize: t,
319
+ strides: n,
320
+ pad: r,
321
+ dimRoundingMode: i
322
+ }, u = T.runKernel(g, c, l);
323
+ return s ? j(u, [
324
+ u.shape[1],
325
+ u.shape[2],
326
+ u.shape[3]
327
+ ]) : u;
328
+ }
329
+ var Me = /* @__PURE__ */ _({ maxPool_: je });
330
+ // node_modules/@tensorflow/tfjs-core/dist/ops/ones_like.js
331
+ function Ne(e) {
332
+ let t = { x: d(e, "x", "onesLike") };
333
+ return T.runKernel(te, t);
334
+ }
335
+ var Pe = /* @__PURE__ */ _({ onesLike_: Ne });
336
+ // node_modules/@tensorflow/tfjs-core/dist/ops/space_to_batch_nd.js
337
+ function Fe(e, t, n) {
338
+ let r = d(e, "x", "spaceToBatchND");
339
+ E(r.rank >= 1 + t.length, () => `input rank ${r.rank} should be > than [blockShape] ${t.length}`), E(n.length === t.length, () => `paddings.shape[0] ${n.length} must be equal to [blockShape] ${t.length}`), E(r.shape.reduce((e, r, i) => i > 0 && i <= t.length ? e && (r + n[i - 1][0] + n[i - 1][1]) % t[i - 1] === 0 : e, !0), () => `input spatial dimensions ${r.shape.slice(1)} with paddings ${n.toString()} must be divisible by blockShapes ${t.toString()}`);
340
+ let i = { x: r }, a = {
341
+ blockShape: t,
342
+ paddings: n
343
+ };
344
+ return T.runKernel(m, i, a);
345
+ }
346
+ var Ie = /* @__PURE__ */ _({ spaceToBatchND_: Fe });
347
+ // node_modules/@tensorflow/tfjs-core/dist/ops/reverse.js
348
+ function Le(t, n) {
349
+ let r = { x: d(t, "x", "reverse") }, i = { dims: n };
350
+ return T.runKernel(e, r, i);
351
+ }
352
+ var Re = /* @__PURE__ */ _({ reverse_: Le });
353
+ // node_modules/@tensorflow/tfjs-core/dist/ops/rsqrt.js
354
+ function ze(e) {
355
+ let t = { x: d(e, "x", "rsqrt", "float32") };
356
+ return T.runKernel(c, t);
357
+ }
358
+ var Be = /* @__PURE__ */ _({ rsqrt_: ze });
359
+ // node_modules/@tensorflow/tfjs-core/dist/ops/selu.js
360
+ function Ve(e) {
361
+ let t = { x: d(e, "x", "selu") };
362
+ return T.runKernel(a, t);
363
+ }
364
+ var $ = /* @__PURE__ */ _({ selu_: Ve });
365
+ // node_modules/@tensorflow/tfjs-core/dist/ops/separable_conv2d.js
366
+ function He(e, t, n, r, i, a = [1, 1], o = "NHWC") {
367
+ let s = d(e, "x", "separableConv2d"), c = d(t, "depthwiseFilter", "separableConv2d"), l = d(n, "pointwiseFilter", "separableConv2d"), u = s, f = !1;
368
+ if (s.rank === 3 && (f = !0, u = j(s, [
369
+ 1,
370
+ s.shape[0],
371
+ s.shape[1],
372
+ s.shape[2]
373
+ ])), o === "NCHW") throw Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");
374
+ E(u.rank === 4, () => `Error in separableConv2d: input must be rank 4, but got rank ${u.rank}.`), E(c.rank === 4, () => `Error in separableConv2d: depthwise filter must be rank 4, but got rank ${c.rank}.`), E(l.rank === 4, () => `Error in separableConv2d: pointwise filter must be rank 4, but got rank ${c.rank}.`), E(l.shape[0] === 1, () => `Error in separableConv2d: the first dimension of pointwise filter must be 1, but got ${l.shape[0]}.`), E(l.shape[1] === 1, () => `Error in separableConv2d: the second dimension of pointwise filter must be 1, but got ${l.shape[1]}.`);
375
+ let p = c.shape[2], m = c.shape[3];
376
+ E(l.shape[2] === p * m, () => `Error in separableConv2d: the third dimension of pointwise filter must be ${p * m}, but got ${l.shape[2]}.`);
377
+ let h = X(Q(u, c, r, i, o, a), l, 1, "valid", o);
378
+ return f ? j(h, [
379
+ h.shape[1],
380
+ h.shape[2],
381
+ h.shape[3]
382
+ ]) : h;
383
+ }
384
+ var Ue = /* @__PURE__ */ _({ separableConv2d_: He });
385
+ // node_modules/@tensorflow/tfjs-core/dist/ops/sin.js
386
+ function We(e) {
387
+ let t = { x: d(e, "x", "sin", "float32") };
388
+ return T.runKernel("Sin", t);
389
+ }
390
+ var Ge = /* @__PURE__ */ _({ sin_: We });
391
+ // node_modules/@tensorflow/tfjs-core/dist/ops/sinh.js
392
+ function Ke(e) {
393
+ let n = { x: d(e, "x", "sinh") };
394
+ return T.runKernel(t, n);
395
+ }
396
+ var qe = /* @__PURE__ */ _({ sinh_: Ke });
397
+ // node_modules/@tensorflow/tfjs-core/dist/ops/unsorted_segment_sum.js
398
+ function Je(e, t, n) {
399
+ let r = d(e, "x", "unsortedSegmentSum"), i = d(t, "segmentIds", "unsortedSegmentSum", "int32");
400
+ E(s(n), () => "numSegments must be of dtype int");
401
+ let a = {
402
+ x: r,
403
+ segmentIds: i
404
+ }, o = { numSegments: n };
405
+ return T.runKernel(x, a, o);
406
+ }
407
+ var Ye = /* @__PURE__ */ _({ unsortedSegmentSum_: Je });
408
+ export { z as A, ce as C, G as D, q as E, U as O, Z as S, ae as T, ye as _, $ as a, pe as b, Ie as c, Ae as d, Oe as f, Q as g, Se as h, Ue as i, L as j, V as k, Pe as l, we as m, qe as n, Be as o, Ee as p, Ge as r, Re as s, Ye as t, Me as u, _e as v, X as w, de as x, he as y };
@@ -1,16 +1,18 @@
1
- //#region lib/utilities/arrayClose.ts
1
+ // lib/utilities/arrayClose.ts
2
2
  function e(t, n) {
3
3
  let r = 0;
4
4
  if ((Array.isArray(t) || t instanceof Float32Array) && (Array.isArray(n) || n instanceof Float32Array)) {
5
5
  if (t.length !== n.length) return Infinity;
6
6
  for (let i = 0; i < t.length; ++i) r = Math.max(r, e(t[i], n[i]));
7
7
  return r;
8
- } else if (typeof t == "number" && typeof n == "number") {
8
+ }
9
+ if (typeof t == "number" && typeof n == "number") {
9
10
  if (isNaN(t) && isNaN(n)) return 0;
10
11
  if (!isFinite(t) || !isFinite(n)) return t === n ? 0 : Infinity;
11
12
  let e = Math.abs(t - n);
12
13
  return r = Math.max(r, e), r;
13
- } else return Infinity;
14
+ }
15
+ return Infinity;
14
16
  }
15
17
  function t(e, t, n = .99) {
16
18
  let r = [];
@@ -24,5 +26,4 @@ function t(e, t, n = .99) {
24
26
  }
25
27
  return !i(e, t) || r.length === 0 ? Infinity : (r.sort((e, t) => e - t), r[Math.min(r.length - 1, Math.floor(n * r.length))]);
26
28
  }
27
- //#endregion
28
29
  export { e as arraysClose, t as arraysClosePercentile };
@@ -1,8 +1,7 @@
1
- //#region lib/utilities/arrayShape.ts
1
+ // lib/utilities/arrayShape.ts
2
2
  function e(e) {
3
3
  let t = [], n = e;
4
4
  for (; Array.isArray(n);) t.push(n.length), n = n[n.length - 1];
5
5
  return t;
6
6
  }
7
- //#endregion
8
7
  export { e as default };
@@ -1,4 +1,4 @@
1
- //#region lib/utilities/datasetID.ts
1
+ // lib/utilities/datasetID.ts
2
2
  function e(e) {
3
3
  let t = e.map((e) => String(e.id)).sort(), n = 2166136261, r = 2654435769, i = (e) => {
4
4
  n ^= e & 255, n = Math.imul(n, 16777619), r ^= e & 255, r = Math.imul(r, 2246822507);
@@ -14,5 +14,4 @@ function e(e) {
14
14
  for (let e of t) a(e);
15
15
  return "dataset__" + (n >>> 0).toString(36) + "_" + (r >>> 0).toString(36);
16
16
  }
17
- //#endregion
18
17
  export { e as default };
@@ -1,26 +1,27 @@
1
- import { ii as e, kt as t, qt as n, si as r } from "../dist-Da20xy8E.js";
2
- //#region lib/utilities/dummy.ts
1
+ import { G as e, H as t, _ as n } from "../dist-CMMLi-qO.js";
2
+ import { t as r } from "../zeros-hxKGkRfl.js";
3
+ // lib/utilities/dummy.ts
3
4
  async function i(e) {
4
- let n = t([1, e.config.blockSize], "int32"), r = e.forward({ training: !1 }, n);
5
- await r.data(), r.dispose(), n.dispose();
5
+ let t = r([1, e.config.blockSize], "int32"), n = e.forward({ training: !1 }, t);
6
+ await n.data(), n.dispose(), t.dispose();
6
7
  }
7
8
  async function a(a) {
8
- let o = r(), s = o.numBytesInGPUAllocated ?? o.numBytesAllocatedInGPU ?? o.numBytes;
9
+ let o = e(), s = o.numBytesInGPUAllocated ?? o.numBytesAllocatedInGPU ?? o.numBytes;
9
10
  await i(a);
10
- let c = t([1, a.config.blockSize], "int32"), l = {
11
+ let c = r([1, a.config.blockSize], "int32"), l = {
11
12
  perBatch: 0,
12
13
  tapeSize: 0,
13
14
  gradients: a.getNumParams() * 4
14
15
  };
15
16
  try {
16
- let { value: t, grads: i } = n(() => {
17
- let t = a.forward({ training: !0 }, c), n = e().state.activeTape, r = 0;
17
+ let { value: r, grads: i } = n(() => {
18
+ let e = a.forward({ training: !0 }, c), n = t().state.activeTape, r = 0;
18
19
  if (n) for (let e of n) r += e.saved?.reduce((e, t) => e + t.size * 4, 0) || 0;
19
20
  l.tapeSize = r;
20
- let i = t.mean();
21
- return t.dispose(), i;
22
- }), o = r();
23
- l.perBatch = (o.numBytesInGPUAllocated ?? o.numBytesAllocatedInGPU ?? o.numBytes) - s - l.gradients, await t.data(), t.dispose();
21
+ let i = e.mean();
22
+ return e.dispose(), i;
23
+ }), o = e();
24
+ l.perBatch = (o.numBytesInGPUAllocated ?? o.numBytesAllocatedInGPU ?? o.numBytes) - s - l.gradients, await r.data(), r.dispose();
24
25
  for (let e in i) i[e].dispose();
25
26
  c.dispose();
26
27
  } catch (e) {
@@ -29,8 +30,7 @@ async function a(a) {
29
30
  return l;
30
31
  }
31
32
  function o(e) {
32
- let n = t([1, e.config.blockSize], "int32");
33
- e.forward({ training: !1 }, n).dispose(), n.dispose();
33
+ let t = r([1, e.config.blockSize], "int32");
34
+ e.forward({ training: !1 }, t).dispose(), t.dispose();
34
35
  }
35
- //#endregion
36
36
  export { o as dummyPass, i as dummyPassAsync, a as dummyPassTrainAsync };
@@ -1,4 +1,4 @@
1
- //#region lib/utilities/float16.ts
1
+ // lib/utilities/float16.ts
2
2
  function e(e) {
3
3
  if (typeof Float16Array < "u") {
4
4
  let t = new Float16Array(e);
@@ -23,24 +23,24 @@ function r(e) {
23
23
  return n === 0 ? t * r * 2 ** -24 : n === 31 ? r ? NaN : t * Infinity : t * (1 + r / 1024) * 2 ** (n - 15);
24
24
  }
25
25
  function i(e) {
26
- let t = new Uint16Array(e.length), n = new Float32Array(1), r = new Uint32Array(n.buffer);
26
+ let t = new Uint16Array(e.length), n = /* @__PURE__ */ new Float32Array(1), r = new Uint32Array(n.buffer);
27
27
  for (let i = 0; i < e.length; i++) {
28
28
  n[0] = e[i];
29
29
  let a = r[0], o = a >>> 16 & 32768, s = (a >>> 23 & 255) - 127 + 15, c = a & 8388607;
30
30
  if ((a >>> 23 & 255) == 255) t[i] = o | 31744 | (c ? 512 : 0);
31
31
  else if (s >= 31) t[i] = o | 31744;
32
- else if (s <= 0) if (s < -10) t[i] = o;
33
- else {
34
- c |= 8388608;
35
- let e = 14 - s, n = c >>> e;
36
- c >>> e - 1 & 1 && (c & (1 << e - 1) - 1 || n & 1) && n++, t[i] = o | n;
37
- }
38
- else {
32
+ else if (s <= 0) {
33
+ if (s < -10) t[i] = o;
34
+ else {
35
+ c |= 8388608;
36
+ let e = 14 - s, n = c >>> e;
37
+ c >>> e - 1 & 1 && (c & (1 << e - 1) - 1 || n & 1) && n++, t[i] = o | n;
38
+ }
39
+ } else {
39
40
  let e = s << 10 | c >>> 13;
40
41
  c & 4096 && (c & 4095 || e & 1) && (e++, (e & 31744) == 31744 && (e = o | 31744)), t[i] = o | e;
41
42
  }
42
43
  }
43
44
  return t;
44
45
  }
45
- //#endregion
46
46
  export { t as loadFloat16FromBuffer, i as manualFloat16Array, e as toFloat16Array };
@@ -1,4 +1,4 @@
1
- //#region lib/utilities/maxHeap.ts
1
+ // lib/utilities/maxHeap.ts
2
2
  var e = class {
3
3
  fn;
4
4
  heap = [];
@@ -51,5 +51,4 @@ var e = class {
51
51
  }
52
52
  }
53
53
  };
54
- //#endregion
55
54
  export { e as default };
@@ -1,2 +1 @@
1
- import { Tensor2D } from '@tensorflow/tfjs-core';
2
- export default function multinomialCPU(probs: number[], randomNumber?: number): Tensor2D;
1
+ export default function multinomialCPU(probs: number[], randomNumber?: number): number;
@@ -1,9 +1,7 @@
1
- import { I as e } from "../dist-Da20xy8E.js";
2
- //#region lib/utilities/multinomialCPU.ts
3
- function t(t, n) {
4
- let r = 0, i = n ?? Math.random();
5
- for (let n = 0; n < t.length; n++) if (r += t[n], i < r) return e([[n]], [1, 1], "int32");
6
- return e([[t.length - 1]], [1, 1], "int32");
1
+ // lib/utilities/multinomialCPU.ts
2
+ function e(e, t) {
3
+ let n = 0, r = t ?? Math.random();
4
+ for (let t = 0; t < e.length; t++) if (n += e[t], r < n) return t;
5
+ return e.length - 1;
7
6
  }
8
- //#endregion
9
- export { t as default };
7
+ export { e as default };
@@ -1,5 +1,5 @@
1
- import { ii as e } from "../dist-Da20xy8E.js";
2
- //#region lib/utilities/packed.ts
1
+ import { H as e } from "../dist-CMMLi-qO.js";
2
+ // lib/utilities/packed.ts
3
3
  function t() {
4
4
  return e().backendName === "webgpu";
5
5
  }
@@ -9,5 +9,4 @@ function n(e) {
9
9
  function r(e) {
10
10
  return n(e);
11
11
  }
12
- //#endregion
13
12
  export { n as isPackableTensor, r as isPackedTensor, t as packingSupported };
@@ -1,5 +1,5 @@
1
1
  import { swigluHidden as e } from "../layers/MLP.js";
2
- //#region lib/utilities/parameters.ts
2
+ // lib/utilities/parameters.ts
3
3
  var t = 4;
4
4
  function n(t) {
5
5
  let n;
@@ -33,8 +33,8 @@ function o(e, n) {
33
33
  function s(e, t) {
34
34
  return {
35
35
  numParams: i(e),
36
- modelMemoryMB: a(e) / (1024 * 1024),
37
- trainingMemoryMB: o(e, t) / (1024 * 1024)
36
+ modelMemoryMB: a(e) / 1048576,
37
+ trainingMemoryMB: o(e, t) / 1048576
38
38
  };
39
39
  }
40
40
  function c(e) {
@@ -50,5 +50,4 @@ function c(e) {
50
50
  if (!Number.isInteger(e.blockSize)) throw Error("blockSize_integer");
51
51
  if (!Number.isInteger(e.vocabSize)) throw Error("vocabSize_integer");
52
52
  }
53
- //#endregion
54
53
  export { r as estimateLayerParameters, a as estimateMemoryUsage, i as estimateParameterCount, s as estimateResources, o as estimateTrainingMemoryUsage, c as validateConfig };
@@ -1,5 +1,5 @@
1
- import { di as e } from "../dist-Da20xy8E.js";
2
- //#region lib/utilities/performance.ts
1
+ import { Y as e } from "../dist-CMMLi-qO.js";
2
+ // lib/utilities/performance.ts
3
3
  async function t(t, n = 10, r = !1) {
4
4
  for (let n = 0; n < 100; n++) {
5
5
  let i = r ? await t() : e(t);
@@ -12,5 +12,4 @@ async function t(t, n = 10, r = !1) {
12
12
  }
13
13
  return (performance.now() - i) / n;
14
14
  }
15
- //#endregion
16
15
  export { t as default };
@@ -1,6 +1,6 @@
1
- import { si as e } from "../dist-Da20xy8E.js";
2
- //#region lib/utilities/profile.ts
3
- var t = 1024 * 1024, n = class {
1
+ import { G as e } from "../dist-CMMLi-qO.js";
2
+ // lib/utilities/profile.ts
3
+ var t = 1048576, n = class {
4
4
  log = /* @__PURE__ */ new Map();
5
5
  maxMemory = 0;
6
6
  maxLabel;
@@ -29,5 +29,4 @@ var t = 1024 * 1024, n = class {
29
29
  this.maxLabel && console.log(`Peak Memory Usage: ${(this.maxMemory / t).toFixed(2)} MB at "${this.maxLabel}"`), console.log(`Overall Peak Memory Usage: ${(this.peakMemory / t).toFixed(2)} MB`);
30
30
  }
31
31
  };
32
- //#endregion
33
32
  export { n as default };
@@ -1,4 +1,4 @@
1
- //#region lib/utilities/random.ts
1
+ // lib/utilities/random.ts
2
2
  function e(e) {
3
3
  let t = 1779033703 ^ e.length;
4
4
  for (let n = 0; n < e.length; n++) t = Math.imul(t ^ e.charCodeAt(n), 3432918353), t = t << 13 | t >>> 19;
@@ -15,5 +15,4 @@ function t(e) {
15
15
  function n(n) {
16
16
  return t(typeof n == "number" ? n >>> 0 : e(n)());
17
17
  }
18
- //#endregion
19
18
  export { n as seededRng };