@genai-fi/nanogpt 0.17.4 → 0.18.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 (258) hide show
  1. package/dist/Generator.d.ts +2 -15
  2. package/dist/Generator.js +45 -34
  3. package/dist/{RealDiv-CGwv0liw.js → RealDiv-ioj6Z-ox.js} +9 -9
  4. package/dist/{Reshape-BW__R4mZ.js → Reshape-BZC-ebeR.js} +7 -7
  5. package/dist/{Reshape-CPBkTIH2.js → Reshape-pwprEaej.js} +1 -1
  6. package/dist/TeachableLLM.d.ts +3 -8
  7. package/dist/TeachableLLM.js +61 -44
  8. package/dist/Trainer.d.ts +6 -4
  9. package/dist/Trainer.js +107 -92
  10. package/dist/{axis_util-GTVlo58H.js → axis_util-QWWgLjut.js} +1 -1
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-GaFarB78.js → backend_util-qwSFfxYx.js} +21 -21
  13. package/dist/{backend_webgpu-BqASlsbV.js → backend_webgpu-DI2wXEC2.js} +8 -8
  14. package/dist/{broadcast_to-eS93CCN_.js → broadcast_to-C_EJTVTZ.js} +2 -2
  15. package/dist/checks/appendCache.js +2 -2
  16. package/dist/checks/attentionMask.js +5 -5
  17. package/dist/checks/gelu.js +2 -2
  18. package/dist/checks/matMulGelu.js +2 -2
  19. package/dist/checks/normRMS.js +6 -6
  20. package/dist/checks/normRMSGrad.js +3 -3
  21. package/dist/checks/packUnpack.js +6 -6
  22. package/dist/checks/qkv.js +2 -2
  23. package/dist/checks/rope.js +2 -2
  24. package/dist/{clip_by_value-DDA7rrcT.js → clip_by_value-CLAD4h_I.js} +1 -1
  25. package/dist/complex-3DpPEG9B.js +11 -0
  26. package/dist/{concat-CAQpCret.js → concat-Dqk7Xk7h.js} +5 -5
  27. package/dist/{concat_util-D18dJ4fD.js → concat_util-C1Mxe27t.js} +1 -1
  28. package/dist/{dataset-CGGp1z9P.js → dataset-DlqAN81i.js} +3 -3
  29. package/dist/{dropout_util--NxWuYg2.js → dropout_util-N0z8Os-K.js} +1 -1
  30. package/dist/{expand_dims-Bkd1YD5x.js → expand_dims-D0rBtgT1.js} +4 -4
  31. package/dist/{exports_initializers-CYzKLjN7.js → exports_initializers-DIOZQt_L.js} +1 -1
  32. package/dist/{floor-BQtb-Azg.js → floor-CymuCmTO.js} +1 -1
  33. package/dist/{gather-qIqEqaGn.js → gather-DEyjXNb1.js} +1 -1
  34. package/dist/{gelu-B220X1Go.js → gelu-DpTCC3eB.js} +1 -1
  35. package/dist/{gpgpu_math-BwvV12df.js → gpgpu_math-3bCb5ooU.js} +25 -25
  36. package/dist/{index-CjOWnMXP.js → index-BQvB7LCC.js} +15 -15
  37. package/dist/{index-CUXkjxiT.js → index-DSGwv2Yx.js} +33 -33
  38. package/dist/inference/types.d.ts +16 -0
  39. package/dist/inference/types.js +1 -0
  40. package/dist/{kernel_funcs_utils-pq0CK9co.js → kernel_funcs_utils-DGqzNlHT.js} +6 -6
  41. package/dist/layers/BaseLayer.js +4 -4
  42. package/dist/layers/CausalSelfAttention.js +6 -6
  43. package/dist/layers/LoRA.js +4 -4
  44. package/dist/layers/MLP.js +4 -4
  45. package/dist/layers/PositionEmbedding.js +5 -5
  46. package/dist/layers/RMSNorm.js +3 -3
  47. package/dist/layers/RoPECache.js +4 -4
  48. package/dist/layers/TiedEmbedding.js +6 -6
  49. package/dist/layers/TransformerBlock.js +1 -1
  50. package/dist/layers/WeightStore.js +2 -2
  51. package/dist/loader/load.d.ts +2 -8
  52. package/dist/loader/loadTransformers.d.ts +2 -8
  53. package/dist/loader/loadTransformers.js +13 -11
  54. package/dist/loader/newZipLoad.d.ts +2 -8
  55. package/dist/loader/newZipLoad.js +25 -10
  56. package/dist/loader/oldZipLoad.js +13 -13
  57. package/dist/loader/save.d.ts +9 -2
  58. package/dist/loader/save.js +64 -55
  59. package/dist/loader/types.d.ts +29 -1
  60. package/dist/main.d.ts +2 -0
  61. package/dist/main.js +45 -43
  62. package/dist/{matMul16-BcVC_E62.js → matMul16-BIT70Vya.js} +3 -3
  63. package/dist/{matMulGelu-JNLZqKQp.js → matMulGelu-CsZnh18H.js} +18 -18
  64. package/dist/mat_mul-DP86qZtZ.js +11 -0
  65. package/dist/mod-BXjLYwvM.js +11 -0
  66. package/dist/models/NanoGPTV1.js +2 -2
  67. package/dist/models/NanoGPTV2.js +2 -2
  68. package/dist/models/model.d.ts +3 -2
  69. package/dist/models/model.js +13 -13
  70. package/dist/{not_equal-hurPF26l.js → not_equal-CkQKkKZy.js} +15 -15
  71. package/dist/{ones-BytntneX.js → ones-DbVB5N58.js} +3 -3
  72. package/dist/ops/adamAdjust.js +3 -3
  73. package/dist/ops/adamMoments.js +3 -3
  74. package/dist/ops/add16.js +1 -1
  75. package/dist/ops/appendCache.js +6 -6
  76. package/dist/ops/attentionMask.js +3 -3
  77. package/dist/ops/concat16.js +3 -3
  78. package/dist/ops/cpu/adamAdjust.js +9 -9
  79. package/dist/ops/cpu/adamMoments.js +5 -5
  80. package/dist/ops/cpu/appendCache.js +2 -2
  81. package/dist/ops/cpu/attentionMask.js +6 -6
  82. package/dist/ops/cpu/fusedSoftmax.js +4 -4
  83. package/dist/ops/cpu/gatherSub.js +5 -5
  84. package/dist/ops/cpu/gelu.js +4 -4
  85. package/dist/ops/cpu/matMul16.js +2 -2
  86. package/dist/ops/cpu/matMulGelu.js +7 -7
  87. package/dist/ops/cpu/matMulMul.js +2 -2
  88. package/dist/ops/cpu/mulDropout.js +5 -5
  89. package/dist/ops/cpu/normRMS.js +1 -1
  90. package/dist/ops/cpu/qkv.js +3 -3
  91. package/dist/ops/cpu/rope.js +5 -5
  92. package/dist/ops/cpu/scatterSub.js +5 -5
  93. package/dist/ops/dot16.js +2 -2
  94. package/dist/ops/dropout.js +6 -6
  95. package/dist/ops/dropout16.js +1 -1
  96. package/dist/ops/gatherSub.js +1 -1
  97. package/dist/ops/gelu.js +2 -2
  98. package/dist/ops/globalNorm.js +7 -7
  99. package/dist/ops/grads/add16.js +1 -1
  100. package/dist/ops/grads/attentionMask.js +2 -2
  101. package/dist/ops/grads/dropout16.js +1 -1
  102. package/dist/ops/grads/gelu.js +2 -2
  103. package/dist/ops/grads/matMul16.js +3 -3
  104. package/dist/ops/grads/matMulGelu.js +1 -1
  105. package/dist/ops/grads/mul16.js +1 -1
  106. package/dist/ops/grads/normRMS.js +7 -7
  107. package/dist/ops/grads/pack16.js +3 -3
  108. package/dist/ops/grads/qkv.js +11 -11
  109. package/dist/ops/grads/rope.js +2 -2
  110. package/dist/ops/grads/softmax16.js +1 -1
  111. package/dist/ops/grads/unpack16.js +2 -2
  112. package/dist/ops/matMul16.js +3 -3
  113. package/dist/ops/matMulGelu.js +6 -6
  114. package/dist/ops/matMulMul.js +3 -3
  115. package/dist/ops/mul16.js +1 -1
  116. package/dist/ops/mulDrop.js +3 -3
  117. package/dist/ops/normRMS.js +4 -4
  118. package/dist/ops/pack16.js +2 -2
  119. package/dist/ops/qkv.js +3 -3
  120. package/dist/ops/reshape16.js +6 -6
  121. package/dist/ops/rope.js +2 -2
  122. package/dist/ops/scatterSub.js +1 -1
  123. package/dist/ops/slice16.js +2 -2
  124. package/dist/ops/softmax16.js +1 -1
  125. package/dist/ops/sub16.js +1 -1
  126. package/dist/ops/sum16.js +6 -6
  127. package/dist/ops/transpose16.js +3 -3
  128. package/dist/ops/unpack16.js +2 -2
  129. package/dist/ops/webgl/adamAdjust.js +2 -2
  130. package/dist/ops/webgl/adamMoments.js +1 -1
  131. package/dist/ops/webgl/appendCache.js +1 -1
  132. package/dist/ops/webgl/attentionMask.js +1 -1
  133. package/dist/ops/webgl/dropout16.js +1 -1
  134. package/dist/ops/webgl/fusedSoftmax.js +7 -7
  135. package/dist/ops/webgl/gatherSub.js +3 -3
  136. package/dist/ops/webgl/gelu.js +2 -2
  137. package/dist/ops/webgl/log.js +3 -3
  138. package/dist/ops/webgl/matMul16.js +13 -13
  139. package/dist/ops/webgl/matMulGelu.js +4 -4
  140. package/dist/ops/webgl/matMulMul.js +2 -2
  141. package/dist/ops/webgl/mulDropout.js +1 -1
  142. package/dist/ops/webgl/normRMS.js +2 -2
  143. package/dist/ops/webgl/qkv.js +1 -1
  144. package/dist/ops/webgl/rope.js +1 -1
  145. package/dist/ops/webgl/scatterSub.js +2 -2
  146. package/dist/ops/webgpu/adamAdjust.js +3 -3
  147. package/dist/ops/webgpu/adamMoments.js +3 -3
  148. package/dist/ops/webgpu/add16.js +6 -6
  149. package/dist/ops/webgpu/appendCache.js +3 -3
  150. package/dist/ops/webgpu/attentionMask.js +2 -2
  151. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  152. package/dist/ops/webgpu/clipScale.js +7 -7
  153. package/dist/ops/webgpu/concat16.js +5 -5
  154. package/dist/ops/webgpu/dropout16.js +6 -6
  155. package/dist/ops/webgpu/gatherSub.js +3 -3
  156. package/dist/ops/webgpu/gelu.js +8 -8
  157. package/dist/ops/webgpu/matMul16.js +16 -16
  158. package/dist/ops/webgpu/matMul16_program.js +2 -2
  159. package/dist/ops/webgpu/mul16.js +5 -5
  160. package/dist/ops/webgpu/norm2.js +1 -1
  161. package/dist/ops/webgpu/normRMS.js +2 -2
  162. package/dist/ops/webgpu/normRMSGrad.js +4 -4
  163. package/dist/ops/webgpu/pack16.js +4 -4
  164. package/dist/ops/webgpu/pack16_program.js +2 -2
  165. package/dist/ops/webgpu/qkv.js +2 -2
  166. package/dist/ops/webgpu/rope.js +3 -3
  167. package/dist/ops/webgpu/scatterSub.js +3 -3
  168. package/dist/ops/webgpu/slice16.js +4 -4
  169. package/dist/ops/webgpu/softmax16.js +4 -4
  170. package/dist/ops/webgpu/softmax16_program.js +2 -2
  171. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  172. package/dist/ops/webgpu/softmax16grad.js +4 -4
  173. package/dist/ops/webgpu/sub16.js +6 -6
  174. package/dist/ops/webgpu/sum16.js +3 -3
  175. package/dist/ops/webgpu/transpose16.js +8 -8
  176. package/dist/ops/webgpu/transpose16_program.js +2 -2
  177. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  178. package/dist/ops/webgpu/unpack16.js +3 -3
  179. package/dist/ops/webgpu/utils/binary_op.js +3 -3
  180. package/dist/ops/webgpu/utils/reductions.js +5 -5
  181. package/dist/{ops-CsXeTq1P.js → ops-CURIZSVt.js} +100 -100
  182. package/dist/{pack16-bqltoUlR.js → pack16-WlOSOuZA.js} +2 -2
  183. package/dist/patches/webgpu_backend.js +6 -6
  184. package/dist/patches/webgpu_base.js +1 -1
  185. package/dist/patches/webgpu_program.js +2 -2
  186. package/dist/{random_normal-IBRrha8a.js → random_normal-CIm8lk2-.js} +1 -1
  187. package/dist/{random_width-DN5ZtQkM.js → random_width-B_fVXhGx.js} +131 -131
  188. package/dist/{range-C-CjF-LI.js → range-BDxO73mk.js} +1 -1
  189. package/dist/{readers-iz5u3HBo.js → readers-17HLdxVM.js} +2 -2
  190. package/dist/relu-DTvZKBsZ.js +9 -0
  191. package/dist/{reshape-BDOuCSNW.js → reshape-BIN71H3p.js} +1 -1
  192. package/dist/{resize_nearest_neighbor-BojqlfRe.js → resize_nearest_neighbor-C6_0dAnK.js} +41 -41
  193. package/dist/{rope-0j_f1TPm.js → rope-CC5RjmKU.js} +4 -4
  194. package/dist/{scatter_nd_util-ByNJaL6I.js → scatter_nd_util-C-x73Cj6.js} +1 -1
  195. package/dist/{segment_util-Dasb2Zaf.js → segment_util-4zuHV5IG.js} +2 -2
  196. package/dist/{selu_util-BLhIqRkw.js → selu_util-BXdhy_W6.js} +5 -5
  197. package/dist/{shared-CagdqkLh.js → shared-DRWDyk9w.js} +6 -6
  198. package/dist/{shared-3agzAqQ_.js → shared-zTaJ5siv.js} +1 -1
  199. package/dist/slice-BvItlgXu.js +12 -0
  200. package/dist/{slice_util-CC35pLmT.js → slice_util-DPY56GzQ.js} +5 -5
  201. package/dist/{softmax-D4q1LJN7.js → softmax-BLGJqdwx.js} +1 -1
  202. package/dist/split-BN9LkEgS.js +9 -0
  203. package/dist/{squeeze-ho4wLUek.js → squeeze-O_YWJpw_.js} +2 -2
  204. package/dist/{stack-DudVrtmG.js → stack-z6QE7kmP.js} +1 -1
  205. package/dist/{step-BTxPtq1r.js → step-DQY6_ABw.js} +4 -4
  206. package/dist/{sum-BpiwSWvg.js → sum-D39FeU5h.js} +3 -3
  207. package/dist/{tensor-BWFldCso.js → tensor-D8e0Gd7c.js} +1 -1
  208. package/dist/{tensor1d-LMGMIUlr.js → tensor1d-BMl0eZYV.js} +1 -1
  209. package/dist/{tensor2d-BnXMKScO.js → tensor2d-DTtQ1QcT.js} +1 -1
  210. package/dist/{tensor4d-C6UCG_u8.js → tensor4d-Dj4rDssL.js} +1 -1
  211. package/dist/{tfjs_backend-BGnG-ppu.js → tfjs_backend-Bk3PmK91.js} +65 -65
  212. package/dist/{tile-CFy-xTO6.js → tile-CsWlVKKz.js} +1 -1
  213. package/dist/tokeniser/BaseTokeniser.d.ts +4 -1
  214. package/dist/tokeniser/BaseTokeniser.js +21 -5
  215. package/dist/tokeniser/CharTokeniser.d.ts +1 -1
  216. package/dist/tokeniser/CharTokeniser.js +62 -50
  217. package/dist/tokeniser/bpe.d.ts +1 -1
  218. package/dist/tokeniser/bpe.js +41 -35
  219. package/dist/tokeniser/type.d.ts +3 -1
  220. package/dist/training/AdamW.d.ts +3 -0
  221. package/dist/training/AdamW.js +59 -30
  222. package/dist/training/BasicTrainer.d.ts +1 -0
  223. package/dist/training/BasicTrainer.js +112 -92
  224. package/dist/training/DatasetBuilder.js +3 -3
  225. package/dist/training/Evaluator.js +2 -2
  226. package/dist/training/LRScheduler.d.ts +1 -0
  227. package/dist/training/LRScheduler.js +18 -12
  228. package/dist/training/PreTrainer.js +3 -3
  229. package/dist/training/SFTDatasetBuilder.js +3 -3
  230. package/dist/training/SFTTrainer.js +1 -1
  231. package/dist/training/orthoGrad.js +1 -1
  232. package/dist/training/sparseCrossEntropy.js +30 -30
  233. package/dist/training/types.d.ts +5 -3
  234. package/dist/training/validation.js +13 -13
  235. package/dist/{transpose-9kRxIXWR.js → transpose-Qxz-4os3.js} +7 -7
  236. package/dist/{unsorted_segment_sum-DJvk5xnh.js → unsorted_segment_sum-BfFVV9Zm.js} +20 -20
  237. package/dist/utilities/datasetID.d.ts +2 -0
  238. package/dist/utilities/datasetID.js +21 -0
  239. package/dist/utilities/dummy.js +6 -6
  240. package/dist/utilities/multinomialCPU.js +2 -2
  241. package/dist/utilities/packed.js +1 -1
  242. package/dist/utilities/performance.js +1 -1
  243. package/dist/utilities/profile.js +1 -1
  244. package/dist/utilities/safetensors.js +2 -2
  245. package/dist/utilities/sentences.js +5 -5
  246. package/dist/utilities/weights.js +2 -2
  247. package/dist/{variable-Ck482e3n.js → variable-SSATClyt.js} +1 -1
  248. package/dist/{webgpu_program-B4HmApL1.js → webgpu_program-CbjdYLYk.js} +1 -1
  249. package/dist/{webgpu_util-DYlGSwOJ.js → webgpu_util-DuofJBMo.js} +7 -7
  250. package/dist/{zeros-DvZpK8s6.js → zeros-Bw0puq_w.js} +2 -2
  251. package/dist/{zeros_like-CWjDdwr-.js → zeros_like-rOHr54NY.js} +69 -69
  252. package/package.json +3 -3
  253. package/dist/complex-DI35Q-gW.js +0 -11
  254. package/dist/mat_mul-DhG0Newp.js +0 -11
  255. package/dist/mod-CSdCpRjf.js +0 -11
  256. package/dist/relu-J_X6MUzx.js +0 -9
  257. package/dist/slice-BzS11Qh0.js +0 -12
  258. package/dist/split-C2Sj255c.js +0 -9
@@ -1,4 +1,4 @@
1
- import { E as e, Z as f } from "./index-CUXkjxiT.js";
1
+ import { E as e, X as f } from "./index-DSGwv2Yx.js";
2
2
  function E(n, o, r = 1, a = "float32") {
3
3
  if (r === 0)
4
4
  throw new Error("Cannot have a step of zero");
@@ -1,5 +1,5 @@
1
- import { d as o, i as n } from "./dataset-CGGp1z9P.js";
2
- import "./index-CUXkjxiT.js";
1
+ import { d as o, i as n } from "./dataset-DlqAN81i.js";
2
+ import "./index-DSGwv2Yx.js";
3
3
  import "./index-Cp39cXWe.js";
4
4
  function m(t) {
5
5
  return o(async () => {
@@ -0,0 +1,9 @@
1
+ import { o, n as e, E as s, A as t } from "./index-DSGwv2Yx.js";
2
+ function u(r) {
3
+ const n = { x: e(r, "x", "relu") };
4
+ return s.runKernel(t, n);
5
+ }
6
+ const l = /* @__PURE__ */ o({ relu_: u });
7
+ export {
8
+ l as r
9
+ };
@@ -1,4 +1,4 @@
1
- import { o, q as t, E as a, R as p } from "./index-CUXkjxiT.js";
1
+ import { o, n as t, E as a, R as p } from "./index-DSGwv2Yx.js";
2
2
  function c(r, s) {
3
3
  const e = { x: t(r, "x", "reshape", "string_or_numeric") }, n = { shape: s };
4
4
  return a.runKernel(p, e, n);
@@ -1,20 +1,20 @@
1
- import { o, q as t, E as i, aZ as y, ah as K, a_ as c, l as E, p as A, a as D, n as z, B as g, _ as p, a$ as I, b0 as w, b1 as B, b2 as v, b3 as T, b4 as L, L as k, b5 as G, b6 as S, b7 as M, x as f, b8 as R, b9 as P, ba as U } from "./index-CUXkjxiT.js";
2
- import { e as Z } from "./axis_util-GTVlo58H.js";
3
- import { m as d } from "./not_equal-hurPF26l.js";
4
- import { r as b } from "./reshape-BDOuCSNW.js";
5
- import { s as h } from "./sum-BpiwSWvg.js";
6
- function j(s, r = null, e = !1) {
1
+ import { o as i, n as t, E as o, aZ as y, ah as K, a_ as c, i as E, p as A, b as z, j as D, z as g, _ as p, a$ as I, b0 as v, b1 as w, b2 as B, b3 as T, b4 as G, J as k, b5 as L, b6 as S, b7 as M, v as f, b8 as R, b9 as j, ba as J } from "./index-DSGwv2Yx.js";
2
+ import { e as P } from "./axis_util-QWWgLjut.js";
3
+ import { m as d } from "./not_equal-CkQKkKZy.js";
4
+ import { r as b } from "./reshape-BIN71H3p.js";
5
+ import { s as h } from "./sum-D39FeU5h.js";
6
+ function U(s, r = null, e = !1) {
7
7
  const a = { x: t(s, "x", "min") }, u = { axis: r, keepDims: e };
8
- return i.runKernel(y, a, u);
8
+ return o.runKernel(y, a, u);
9
9
  }
10
- const q = /* @__PURE__ */ o({ min_: j });
11
- function C(s, r = "euclidean", e = null, n = !1) {
10
+ const q = /* @__PURE__ */ i({ min_: U });
11
+ function Z(s, r = "euclidean", e = null, n = !1) {
12
12
  s = t(s, "x", "norm");
13
13
  const a = N(s, r, e);
14
14
  let u = a.shape;
15
15
  if (n) {
16
16
  const m = K(e, s.shape);
17
- u = Z(a.shape, m);
17
+ u = P(a.shape, m);
18
18
  }
19
19
  return b(a, u);
20
20
  }
@@ -31,7 +31,7 @@ function N(s, r, e = null) {
31
31
  if (r === -1 / 0)
32
32
  return q(c(s), e);
33
33
  if (r === "euclidean" || r === 2)
34
- return E(h(A(c(s), D(2, "int32")), e));
34
+ return E(h(A(c(s), z(2, "int32")), e));
35
35
  throw new Error(`Error in norm: invalid ord value: ${r}`);
36
36
  }
37
37
  if (Array.isArray(e) && e.length === 2) {
@@ -42,96 +42,96 @@ function N(s, r, e = null) {
42
42
  if (r === -1 / 0)
43
43
  return q(h(c(s), e[1]), e[0]);
44
44
  if (r === "fro" || r === "euclidean")
45
- return E(h(z(s), e));
45
+ return E(h(D(s), e));
46
46
  throw new Error(`Error in norm: invalid ord value: ${r}`);
47
47
  }
48
48
  throw new Error(`Error in norm: invalid axis: ${e}`);
49
49
  }
50
- const ie = /* @__PURE__ */ o({ norm_: C });
51
- function F(s, r) {
50
+ const oe = /* @__PURE__ */ i({ norm_: Z });
51
+ function C(s, r) {
52
52
  let e = t(s, "a", "greater", "string_or_numeric"), n = t(r, "b", "greater", "string_or_numeric");
53
53
  [e, n] = g(e, n), p(e.shape, n.shape);
54
54
  const a = { a: e, b: n };
55
- return i.runKernel(I, a);
55
+ return o.runKernel(I, a);
56
56
  }
57
- const ue = /* @__PURE__ */ o({ greater_: F });
58
- function H(s, r) {
57
+ const ue = /* @__PURE__ */ i({ greater_: C });
58
+ function F(s, r) {
59
59
  let e = t(s, "a", "greaterEqual", "string_or_numeric"), n = t(r, "b", "greaterEqual", "string_or_numeric");
60
60
  [e, n] = g(e, n), p(e.shape, n.shape);
61
61
  const a = { a: e, b: n };
62
- return i.runKernel(w, a);
62
+ return o.runKernel(v, a);
63
63
  }
64
- const le = /* @__PURE__ */ o({ greaterEqual_: H });
65
- function J(s, r) {
64
+ const le = /* @__PURE__ */ i({ greaterEqual_: F });
65
+ function H(s, r) {
66
66
  let e = t(s, "a", "less", "string_or_numeric"), n = t(r, "b", "less", "string_or_numeric");
67
67
  [e, n] = g(e, n), p(e.shape, n.shape);
68
68
  const a = { a: e, b: n };
69
- return i.runKernel(B, a);
69
+ return o.runKernel(w, a);
70
70
  }
71
- const ce = /* @__PURE__ */ o({ less_: J });
71
+ const ce = /* @__PURE__ */ i({ less_: H });
72
72
  function O(s, r) {
73
73
  let e = t(s, "a", "lessEqual", "string_or_numeric"), n = t(r, "b", "lessEqual", "string_or_numeric");
74
74
  [e, n] = g(e, n), p(e.shape, n.shape);
75
75
  const a = { a: e, b: n };
76
- return i.runKernel(v, a);
76
+ return o.runKernel(B, a);
77
77
  }
78
- const fe = /* @__PURE__ */ o({ lessEqual_: O });
78
+ const fe = /* @__PURE__ */ i({ lessEqual_: O });
79
79
  function Q(s) {
80
80
  const e = { x: t(s, "x", "log1p") };
81
- return i.runKernel(T, e);
81
+ return o.runKernel(T, e);
82
82
  }
83
- const me = /* @__PURE__ */ o({ log1p_: Q });
83
+ const me = /* @__PURE__ */ i({ log1p_: Q });
84
84
  function V(s, r) {
85
85
  const e = t(s, "a", "logicalAnd", "bool"), n = t(r, "b", "logicalAnd", "bool");
86
86
  p(e.shape, n.shape);
87
87
  const a = { a: e, b: n };
88
- return i.runKernel(L, a);
88
+ return o.runKernel(G, a);
89
89
  }
90
- const pe = /* @__PURE__ */ o({ logicalAnd_: V });
90
+ const pe = /* @__PURE__ */ i({ logicalAnd_: V });
91
91
  function W(s, r) {
92
92
  let e = t(s, "a", "minimum"), n = t(r, "b", "minimum");
93
93
  [e, n] = g(e, n), e.dtype === "bool" && (e = k(e, "int32"), n = k(n, "int32")), p(e.shape, n.shape);
94
94
  const a = { a: e, b: n };
95
- return i.runKernel(G, a);
95
+ return o.runKernel(L, a);
96
96
  }
97
- const he = /* @__PURE__ */ o({ minimum_: W });
97
+ const he = /* @__PURE__ */ i({ minimum_: W });
98
98
  function X(s) {
99
99
  const e = { x: t(s, "x", "round") };
100
- return i.runKernel(S, e);
100
+ return o.runKernel(S, e);
101
101
  }
102
- const be = /* @__PURE__ */ o({ round_: X });
102
+ const be = /* @__PURE__ */ i({ round_: X });
103
103
  function Y(s, r) {
104
104
  let e = t(s, "a", "squaredDifference"), n = t(r, "b", "squaredDifference");
105
105
  [e, n] = g(e, n), p(e.shape, n.shape);
106
106
  const a = { a: e, b: n }, u = {};
107
- return i.runKernel(M, a, u);
107
+ return o.runKernel(M, a, u);
108
108
  }
109
- const ge = /* @__PURE__ */ o({ squaredDifference_: Y });
109
+ const ge = /* @__PURE__ */ i({ squaredDifference_: Y });
110
110
  function x(s, r = 0) {
111
111
  const e = t(s, "x", "unstack", "string_or_numeric");
112
112
  f(r >= -e.shape.length && r < e.shape.length, () => `Axis = ${r} is not in [-${e.shape.length}, ${e.shape.length})`);
113
113
  const n = { value: e }, a = { axis: r };
114
- return i.runKernel(R, n, a);
114
+ return o.runKernel(R, n, a);
115
115
  }
116
- const _e = /* @__PURE__ */ o({ unstack_: x });
116
+ const _e = /* @__PURE__ */ i({ unstack_: x });
117
117
  function ee(s, r, e = !1, n = !1) {
118
118
  const a = t(s, "images", "resizeBilinear");
119
119
  f(a.rank === 3 || a.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`), f(r.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${r}.`), f(n === !1 || e === !1, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
120
120
  let u = a, m = !1;
121
121
  a.rank === 3 && (m = !0, u = b(a, [1, a.shape[0], a.shape[1], a.shape[2]]));
122
- const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = i.runKernel(P, _, $);
122
+ const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = o.runKernel(j, _, $);
123
123
  return m ? b(l, [l.shape[1], l.shape[2], l.shape[3]]) : l;
124
124
  }
125
- const $e = /* @__PURE__ */ o({ resizeBilinear_: ee });
125
+ const $e = /* @__PURE__ */ i({ resizeBilinear_: ee });
126
126
  function re(s, r, e = !1, n = !1) {
127
127
  const a = t(s, "images", "resizeNearestNeighbor");
128
128
  f(a.rank === 3 || a.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${a.rank}.`), f(r.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${r}.`), f(a.dtype === "float32" || a.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), f(n === !1 || e === !1, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
129
129
  let u = a, m = !1;
130
130
  a.rank === 3 && (m = !0, u = b(a, [1, a.shape[0], a.shape[1], a.shape[2]]));
131
- const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = i.runKernel(U, _, $);
131
+ const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = o.runKernel(J, _, $);
132
132
  return m ? b(l, [l.shape[1], l.shape[2], l.shape[3]]) : l;
133
133
  }
134
- const de = /* @__PURE__ */ o({ resizeNearestNeighbor_: re });
134
+ const de = /* @__PURE__ */ i({ resizeNearestNeighbor_: re });
135
135
  export {
136
136
  ce as a,
137
137
  pe as b,
@@ -143,7 +143,7 @@ export {
143
143
  q as h,
144
144
  fe as l,
145
145
  he as m,
146
- ie as n,
146
+ oe as n,
147
147
  be as r,
148
148
  ge as s,
149
149
  _e as u
@@ -1,4 +1,4 @@
1
- import { e as p, h as s } from "./index-CUXkjxiT.js";
1
+ import { c as p, e as s } from "./index-DSGwv2Yx.js";
2
2
  import "./ops/cpu/rope.js";
3
3
  import "./ops/webgl/rope.js";
4
4
  const u = {
@@ -6,12 +6,12 @@ const u = {
6
6
  inputsToSave: [],
7
7
  outputsToSave: [],
8
8
  gradFunc: (e, n, r) => {
9
- const { ropeCache: o } = r, a = i(e, o, 0, !0);
9
+ const { ropeCache: o } = r, a = c(e, o, 0, !0);
10
10
  return { x: () => a };
11
11
  }
12
12
  };
13
13
  p(u);
14
- function i(e, n, r, o = !1) {
14
+ function c(e, n, r, o = !1) {
15
15
  return n.ensureRopeCache(e.shape[1] + r), s().runKernel("Rope", { x: e }, {
16
16
  pastLen: r,
17
17
  negSin: o,
@@ -20,5 +20,5 @@ function i(e, n, r, o = !1) {
20
20
  }
21
21
  export {
22
22
  u as a,
23
- i as r
23
+ c as r
24
24
  };
@@ -1,4 +1,4 @@
1
- import { U as p, a9 as w } from "./index-CUXkjxiT.js";
1
+ import { N as p, a9 as w } from "./index-DSGwv2Yx.js";
2
2
  function k(o, t, r) {
3
3
  const n = t.rank > 1 ? t.shape[t.rank - 1] : 1, e = t.rank > 1 ? t.rank - 1 : 1, h = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${r.shape}, indices.shape: ${t.shape}, shape: ${o}, sliceDim: ${n}, and batchDim: ${e}.`;
4
4
  if (r.rank < e)
@@ -1,5 +1,5 @@
1
- import { P as w } from "./backend_util-GaFarB78.js";
2
- import { a8 as f } from "./index-CUXkjxiT.js";
1
+ import { P as w } from "./backend_util-qwSFfxYx.js";
2
+ import { a8 as f } from "./index-DSGwv2Yx.js";
3
3
  function g(o, s) {
4
4
  let r = !1, t;
5
5
  for (o <= w ? (t = o, r = !0) : t = f(o, Math.floor(Math.sqrt(o))); !r; )
@@ -1,8 +1,8 @@
1
- import { m as n, $ as l } from "./index-CUXkjxiT.js";
2
- import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-BTxPtq1r.js";
3
- import { r as m } from "./relu-J_X6MUzx.js";
4
- import { r as d } from "./reshape-BDOuCSNW.js";
5
- import { s as g } from "./sum-BpiwSWvg.js";
1
+ import { m as n, $ as l } from "./index-DSGwv2Yx.js";
2
+ import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-DQY6_ABw.js";
3
+ import { r as m } from "./relu-DTvZKBsZ.js";
4
+ import { r as d } from "./reshape-BIN71H3p.js";
5
+ import { s as g } from "./sum-D39FeU5h.js";
6
6
  function L(e, r, s) {
7
7
  if (s == null || s === "linear")
8
8
  return e;
@@ -1,10 +1,10 @@
1
- import { x as Lt, bP as Ce, U as V, _ as Pt, a9 as H, af as et, ad as ht, bQ as dt, bR as at, a7 as De, Q as st, aU as Ue, aq as We, bS as $e, bT as ze, bU as Be, bV as At, a5 as K, bW as qt, bX as U, bY as _t, bA as Vt, aN as Ct, bZ as Dt, F as Ut, b_ as Wt, a$ as $t, b0 as zt, b1 as Bt, b2 as jt, aO as Gt, b$ as Zt, b5 as Kt, c0 as Ht, ap as je, aV as Ge, aQ as Xt, ar as Ze, c1 as Ke, ah as Qt, am as He, t as Xe, bK as Yt, c2 as It, aF as Jt, S as Qe, c3 as te, b7 as ee, c4 as ne, az as pt, c5 as se, c6 as ot } from "./index-CUXkjxiT.js";
2
- import { f as it, g as Ye, a as Je, R as tn, v as en, d as nn, e as sn, h as on, i as rn, j as an, k as ln, l as cn, m as un, n as hn, o as fn, p as kt, q as dn, r as gn, s as mn } from "./backend_util-GaFarB78.js";
1
+ import { v as Lt, bP as Ce, N as V, _ as Pt, a9 as H, af as et, ad as ht, bQ as dt, bR as at, a7 as De, L as st, aU as Ue, aq as We, bS as $e, bT as ze, bU as Be, bV as At, a5 as K, bW as qt, bX as U, bY as _t, bA as Vt, aN as Ct, bZ as Dt, F as Ut, b_ as Wt, a$ as $t, b0 as zt, b1 as Bt, b2 as jt, aO as Gt, b$ as Zt, b5 as Kt, c0 as Ht, ap as je, aV as Ge, aQ as Xt, ar as Ze, c1 as Ke, ah as Qt, am as He, t as Xe, bK as Yt, c2 as It, aF as Jt, S as Qe, c3 as te, b7 as ee, c4 as ne, az as pt, c5 as se, c6 as ot } from "./index-DSGwv2Yx.js";
2
+ import { f as it, g as Ye, a as Je, R as tn, v as en, d as nn, e as sn, h as on, i as rn, j as an, k as ln, l as cn, m as un, n as hn, o as fn, p as kt, q as dn, r as gn, s as mn } from "./backend_util-qwSFfxYx.js";
3
3
  import { m as Nt } from "./complex_util-Yc1A_gV1.js";
4
- import { a as pn, b as wn, e as In, c as bn } from "./axis_util-GTVlo58H.js";
5
- import { b as xn } from "./broadcast_to-eS93CCN_.js";
6
- import { r as En } from "./reshape-BDOuCSNW.js";
7
- import { p as Fn, a as yn, i as kn, c as Nn } from "./slice_util-CC35pLmT.js";
4
+ import { a as pn, b as wn, e as In, c as bn } from "./axis_util-QWWgLjut.js";
5
+ import { b as xn } from "./broadcast_to-C_EJTVTZ.js";
6
+ import { r as En } from "./reshape-BIN71H3p.js";
7
+ import { p as Fn, a as yn, i as kn, c as Nn } from "./slice_util-DPY56GzQ.js";
8
8
  import { g as vn } from "./_commonjsHelpers-ByX85dGu.js";
9
9
  function Sn(e, t) {
10
10
  for (var n = 0; n < t.length; n++) {
@@ -1,4 +1,4 @@
1
- import { s as l } from "./shared-CagdqkLh.js";
1
+ import { s as l } from "./shared-DRWDyk9w.js";
2
2
  const { addImpl: m, bincountImpl: s, bincountReduceImpl: a, bitwiseAndImpl: I, castImpl: e, ceilImpl: t, concatImpl: r, equalImpl: i, expImpl: C, expm1Impl: P, floorImpl: U, gatherNdImpl: n, gatherV2Impl: g, greaterImpl: o, greaterEqualImpl: c, lessImpl: u, lessEqualImpl: d, linSpaceImpl: q, logImpl: R, maxImpl: h, maximumImpl: x, minimumImpl: b, multiplyImpl: E, negImpl: S, notEqualImpl: T, prodImpl: w, raggedGatherImpl: y, raggedRangeImpl: A, raggedTensorToTensorImpl: F, rangeImpl: G, rsqrtImpl: N, scatterImpl: f, sigmoidImpl: k, simpleAbsImpl: B, sliceImpl: H, sparseFillEmptyRowsImpl: K, sparseReshapeImpl: V, sparseSegmentReductionImpl: j, sqrtImpl: v, staticRegexReplaceImpl: z, stridedSliceImpl: D, stringNGramsImpl: J, stringSplitImpl: L, stringToHashBucketFastImpl: M, subImpl: O, tileImpl: Q, topKImpl: W, transposeImpl: X, uniqueImpl: Y } = l;
3
3
  export {
4
4
  b as A,
@@ -0,0 +1,12 @@
1
+ import { o as c, n as e, E as a, S as l } from "./index-DSGwv2Yx.js";
2
+ function p(n, r, o) {
3
+ const s = e(n, "x", "slice", "string_or_numeric");
4
+ if (s.rank === 0)
5
+ throw new Error("Slicing scalar is not possible");
6
+ const t = { x: s }, i = { begin: r, size: o };
7
+ return a.runKernel(l, t, i);
8
+ }
9
+ const x = /* @__PURE__ */ c({ slice_: p });
10
+ export {
11
+ x as s
12
+ };
@@ -1,12 +1,12 @@
1
- import { x as b } from "./index-CUXkjxiT.js";
1
+ import { v as b } from "./index-DSGwv2Yx.js";
2
2
  const y = -2, N = -1;
3
- function L(r, e, n) {
3
+ function F(r, e, n) {
4
4
  const t = r.shape.length;
5
5
  b(t === e.length, () => `Error in slice${t}D: Length of begin ${e} must match the rank of the array (${t}).`), b(t === n.length, () => `Error in slice${t}D: Length of size ${n} must match the rank of the array (${t}).`);
6
6
  for (let l = 0; l < t; ++l)
7
7
  b(e[l] + n[l] <= r.shape[l], () => `Error in slice${t}D: begin[${l}] + size[${l}] (${e[l] + n[l]}) would overflow input.shape[${l}] (${r.shape[l]})`);
8
8
  }
9
- function v(r, e, n) {
9
+ function L(r, e, n) {
10
10
  const t = [];
11
11
  for (let l = 0; l < r.length; l++)
12
12
  t[l] = Math.ceil((e[l] - r[l]) / n[l]);
@@ -144,8 +144,8 @@ function V(r, e, n, t, l, a) {
144
144
  }
145
145
  }
146
146
  export {
147
- L as a,
148
- v as b,
147
+ F as a,
148
+ L as b,
149
149
  X as c,
150
150
  P as i,
151
151
  C as p,
@@ -1,4 +1,4 @@
1
- import { o as r, q as f, E as e, I as i } from "./index-CUXkjxiT.js";
1
+ import { o as r, n as f, E as e, D as i } from "./index-DSGwv2Yx.js";
2
2
  function l(s, o = -1) {
3
3
  const t = f(s, "logits", "softmax", "float32");
4
4
  if (o === -1 && (o = t.rank - 1), o !== t.rank - 1)
@@ -0,0 +1,9 @@
1
+ import { o as p, n as i, E as a, H as c } from "./index-DSGwv2Yx.js";
2
+ function e(t, s, n = 0) {
3
+ const o = { x: i(t, "x", "split") }, r = { numOrSizeSplits: s, axis: n };
4
+ return a.runKernel(c, o, r);
5
+ }
6
+ const u = /* @__PURE__ */ p({ split_: e });
7
+ export {
8
+ u as s
9
+ };
@@ -1,5 +1,5 @@
1
- import { o as r, q as n, K as a } from "./index-CUXkjxiT.js";
2
- import { r as t } from "./reshape-BDOuCSNW.js";
1
+ import { o as r, n, I as a } from "./index-DSGwv2Yx.js";
2
+ import { r as t } from "./reshape-BIN71H3p.js";
3
3
  function p(s, o) {
4
4
  const e = n(s, "x", "squeeze", "string_or_numeric");
5
5
  return t(e, a(e.shape, o).newShape);
@@ -1,4 +1,4 @@
1
- import { o as e, y as c, x as n, E as k, P as i } from "./index-CUXkjxiT.js";
1
+ import { o as e, w as c, v as n, E as k, P as i } from "./index-DSGwv2Yx.js";
2
2
  function u(r, t = 0) {
3
3
  const s = c(r, "tensors", "stack", "string_or_numeric");
4
4
  n(s.length >= 1, () => "Pass at least one tensor to tf.stack"), s.length > 0 && n(t <= s[0].rank, () => "Axis must be <= rank of the tensor");
@@ -1,4 +1,4 @@
1
- import { x as _, aE as P, o as A, q as I, E as v, aF as G, aG as q, aH as J, aI as X, aJ as Q, aK as Y } from "./index-CUXkjxiT.js";
1
+ import { v as _, aE as P, o as A, n as I, E as v, aF as G, aG as J, aH as X, aI as q, aJ as Q, aK as Y } from "./index-DSGwv2Yx.js";
2
2
  function it(t, n, e, o, s = "NHWC", f) {
3
3
  const l = t[3], r = [...n, l], c = nt(s);
4
4
  return j(t, r, e, f, o, null, null, c);
@@ -217,17 +217,17 @@ function et(t) {
217
217
  const gt = /* @__PURE__ */ A({ sigmoid_: et });
218
218
  function ot(t) {
219
219
  const e = { x: I(t, "x", "elu", "float32") };
220
- return v.runKernel(q, e);
220
+ return v.runKernel(J, e);
221
221
  }
222
222
  const wt = /* @__PURE__ */ A({ elu_: ot });
223
223
  function st(t, n = 0.2) {
224
224
  const o = { x: I(t, "x", "leakyRelu") }, s = { alpha: n };
225
- return v.runKernel(J, o, s);
225
+ return v.runKernel(X, o, s);
226
226
  }
227
227
  const xt = /* @__PURE__ */ A({ leakyRelu_: st });
228
228
  function rt(t, n) {
229
229
  const e = I(t, "x", "prelu"), o = I(n, "alpha", "prelu"), s = { x: e, alpha: o };
230
- return v.runKernel(X, s);
230
+ return v.runKernel(q, s);
231
231
  }
232
232
  const Et = /* @__PURE__ */ A({ prelu_: rt });
233
233
  function lt(t) {
@@ -1,8 +1,8 @@
1
- import { o as e, q as u, L as c, E as l, N as m } from "./index-CUXkjxiT.js";
2
- function i(t, o = null, n = !1) {
1
+ import { o as e, n as u, J as c, E as l, K as m } from "./index-DSGwv2Yx.js";
2
+ function i(t, n = null, o = !1) {
3
3
  let s = u(t, "x", "sum");
4
4
  s.dtype === "bool" && (s = c(s, "int32"));
5
- const r = { x: s }, a = { axis: o, keepDims: n };
5
+ const r = { x: s }, a = { axis: n, keepDims: o };
6
6
  return l.runKernel(m, r, a);
7
7
  }
8
8
  const f = /* @__PURE__ */ e({ sum_: i });
@@ -1,4 +1,4 @@
1
- import { X as t, Y as a } from "./index-CUXkjxiT.js";
1
+ import { V as t, W as a } from "./index-DSGwv2Yx.js";
2
2
  function f(r, n, e) {
3
3
  const o = t(r, e);
4
4
  return a(r, n, o, e);
@@ -1,4 +1,4 @@
1
- import { W as o, X as s, Y as t } from "./index-CUXkjxiT.js";
1
+ import { U as o, V as s, W as t } from "./index-DSGwv2Yx.js";
2
2
  function h(r, e) {
3
3
  o(r);
4
4
  const n = s(r, e);
@@ -1,4 +1,4 @@
1
- import { W as t, X as s, Y as a } from "./index-CUXkjxiT.js";
1
+ import { U as t, V as s, W as a } from "./index-DSGwv2Yx.js";
2
2
  function i(n, r, o) {
3
3
  if (t(n), r != null && r.length !== 2)
4
4
  throw new Error("tensor2d() requires shape to have two numbers");
@@ -1,4 +1,4 @@
1
- import { W as t, X as a, Y as s } from "./index-CUXkjxiT.js";
1
+ import { U as t, V as a, W as s } from "./index-DSGwv2Yx.js";
2
2
  function i(n, r, o) {
3
3
  if (t(n), r != null && r.length !== 4)
4
4
  throw new Error("tensor4d() requires shape to have four numbers");