@genai-fi/nanogpt 0.10.2 → 0.10.3

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 (249) hide show
  1. package/dist/Generator.js +11761 -171
  2. package/dist/{RealDiv-zz7FpkKX.js → RealDiv-KAPDe8zB.js} +23 -25
  3. package/dist/Reshape-BYkmUnAv.js +14 -0
  4. package/dist/{Reshape-CHdUjC72.js → Reshape-Zt6eb7yh.js} +18 -20
  5. package/dist/TeachableLLM.js +10 -11
  6. package/dist/{axis_util-BsIr9ZNu.js → axis_util-BaG7mf5A.js} +3 -3
  7. package/dist/backend.js +2 -2
  8. package/dist/{backend_util-B1XRLuq9.js → backend_util-RCe-rHaj.js} +72 -73
  9. package/dist/{backend_webgpu-CqpfEImu.js → backend_webgpu-DE3ACOLx.js} +45 -47
  10. package/dist/broadcast_to-B3eYlZm7.js +28 -0
  11. package/dist/checks/appendCache.js +2 -2
  12. package/dist/checks/attentionMask.js +3 -3
  13. package/dist/checks/gelu.js +2 -2
  14. package/dist/checks/matMulGelu.js +7 -11
  15. package/dist/checks/normRMS.js +9 -9
  16. package/dist/checks/normRMSGrad.js +3 -3
  17. package/dist/checks/packUnpack.js +2 -2
  18. package/dist/checks/qkv.js +12 -13
  19. package/dist/checks/rope.js +2 -2
  20. package/dist/clip_by_value-BnO7-a88.js +12 -0
  21. package/dist/complex-DjxcVmoX.js +11 -0
  22. package/dist/concat-BV8bt5H-.js +17 -0
  23. package/dist/{concat_util-iBYIyuQe.js → concat_util-DpW8mL_l.js} +1 -1
  24. package/dist/{dataset-D2P7rHAw.js → dataset-BcwmTGYc.js} +137 -139
  25. package/dist/dropout-BcvN9JYi.js +92 -0
  26. package/dist/expand_dims-DT4tEPwA.js +11 -0
  27. package/dist/{exports_initializers-CZSUJoVE.js → exports_initializers-Hta_rEnm.js} +1 -1
  28. package/dist/floor-D5QdR_le.js +9 -0
  29. package/dist/gather-D3JcZUaI.js +9 -0
  30. package/dist/{gelu-Bmhopi0J.js → gelu-CjNPL4OH.js} +10 -11
  31. package/dist/{gpgpu_math-DsCcikas.js → gpgpu_math-DAOmgtXR.js} +841 -1015
  32. package/dist/{index-DRyE072i.js → index-BwexR4lA.js} +262 -263
  33. package/dist/index-DOvlwCh-.js +3520 -0
  34. package/dist/{kernel_funcs_utils-CWfOAPGO.js → kernel_funcs_utils-CCzYdUZg.js} +130 -132
  35. package/dist/layers/BaseLayer.js +15 -16
  36. package/dist/layers/CausalSelfAttention.js +6 -6
  37. package/dist/layers/MLP.js +4 -4
  38. package/dist/layers/PositionEmbedding.js +7 -7
  39. package/dist/layers/RMSNorm.js +3 -3
  40. package/dist/layers/RoPECache.js +9 -9
  41. package/dist/layers/TiedEmbedding.js +6 -6
  42. package/dist/layers/TransformerBlock.js +1 -1
  43. package/dist/loader/loadTransformers.js +1 -1
  44. package/dist/loader/oldZipLoad.js +13 -14
  45. package/dist/log_sum_exp-ngO0-4pK.js +39 -0
  46. package/dist/main.js +49 -50
  47. package/dist/{matMul16-fEAJ4smh.js → matMul16-BWRSOCWB.js} +14 -15
  48. package/dist/matMulGelu-CzfgT6Wq.js +163 -0
  49. package/dist/mat_mul-SjpJRLyL.js +11 -0
  50. package/dist/mod-AnXEvvpo.js +11 -0
  51. package/dist/models/NanoGPTV1.js +2 -2
  52. package/dist/models/model.js +13 -14
  53. package/dist/ones-D2rT0xk2.js +14 -0
  54. package/dist/ops/adamAdjust.js +1 -1
  55. package/dist/ops/adamMoments.js +1 -1
  56. package/dist/ops/add16.js +1 -1
  57. package/dist/ops/appendCache.js +3 -3
  58. package/dist/ops/attentionMask.js +1 -1
  59. package/dist/ops/concat16.js +2 -2
  60. package/dist/ops/cpu/adamAdjust.js +13 -14
  61. package/dist/ops/cpu/adamMoments.js +6 -7
  62. package/dist/ops/cpu/appendCache.js +7 -8
  63. package/dist/ops/cpu/attentionMask.js +7 -7
  64. package/dist/ops/cpu/fusedSoftmax.js +10 -11
  65. package/dist/ops/cpu/gatherSub.js +9 -10
  66. package/dist/ops/cpu/gelu.js +9 -10
  67. package/dist/ops/cpu/matMul16.js +6 -7
  68. package/dist/ops/cpu/matMulGelu.js +5 -6
  69. package/dist/ops/cpu/matMulMul.js +3 -4
  70. package/dist/ops/cpu/mulDropout.js +3 -4
  71. package/dist/ops/cpu/normRMS.js +10 -11
  72. package/dist/ops/cpu/qkv.js +8 -9
  73. package/dist/ops/cpu/rope.js +5 -6
  74. package/dist/ops/cpu/scatterSub.js +17 -19
  75. package/dist/ops/dot16.js +2 -2
  76. package/dist/ops/gatherSub.js +1 -1
  77. package/dist/ops/gelu.js +2 -2
  78. package/dist/ops/grads/add16.js +11 -12
  79. package/dist/ops/grads/attentionMask.js +5 -6
  80. package/dist/ops/grads/gelu.js +3 -4
  81. package/dist/ops/grads/matMul16.js +4 -5
  82. package/dist/ops/grads/matMulGelu.js +9 -10
  83. package/dist/ops/grads/normRMS.js +7 -8
  84. package/dist/ops/grads/pack16.js +4 -5
  85. package/dist/ops/grads/qkv.js +17 -19
  86. package/dist/ops/grads/rope.js +3 -5
  87. package/dist/ops/grads/softmax16.js +3 -4
  88. package/dist/ops/grads/unpack16.js +3 -4
  89. package/dist/ops/grads/utils.d.ts +1 -0
  90. package/dist/ops/grads/utils.js +8 -4
  91. package/dist/ops/matMul16.js +3 -3
  92. package/dist/ops/matMulGelu.js +2 -2
  93. package/dist/ops/matMulMul.js +1 -1
  94. package/dist/ops/mul16.js +1 -1
  95. package/dist/ops/mulDrop.js +1 -1
  96. package/dist/ops/normRMS.js +1 -1
  97. package/dist/ops/pack16.js +3 -4
  98. package/dist/ops/qkv.js +4 -8
  99. package/dist/ops/reshape16.js +14 -16
  100. package/dist/ops/rope.d.ts +1 -1
  101. package/dist/ops/rope.js +3 -8
  102. package/dist/ops/scatterSub.js +1 -1
  103. package/dist/ops/slice16.js +2 -2
  104. package/dist/ops/softmax16.js +5 -8
  105. package/dist/ops/sub16.js +1 -1
  106. package/dist/ops/sum16.js +2 -2
  107. package/dist/ops/transpose16.js +23 -24
  108. package/dist/ops/unpack16.js +2 -2
  109. package/dist/ops/webgl/adamAdjust.js +2 -3
  110. package/dist/ops/webgl/adamMoments.js +1 -2
  111. package/dist/ops/webgl/appendCache.js +1 -2
  112. package/dist/ops/webgl/attentionMask.js +4 -5
  113. package/dist/ops/webgl/fusedSoftmax.js +4 -6
  114. package/dist/ops/webgl/gatherSub.js +6 -7
  115. package/dist/ops/webgl/gelu.js +2 -3
  116. package/dist/ops/webgl/log.js +11 -12
  117. package/dist/ops/webgl/matMul16.js +10 -11
  118. package/dist/ops/webgl/matMulGelu.js +7 -111
  119. package/dist/ops/webgl/matMulMul.js +9 -10
  120. package/dist/ops/webgl/mulDropout.js +8 -9
  121. package/dist/ops/webgl/normRMS.js +2 -3
  122. package/dist/ops/webgl/qkv.js +5 -6
  123. package/dist/ops/webgl/rope.js +7 -8
  124. package/dist/ops/webgl/scatterSub.js +5 -6
  125. package/dist/ops/webgpu/adamAdjust.js +10 -12
  126. package/dist/ops/webgpu/adamMoments.js +8 -10
  127. package/dist/ops/webgpu/add16.js +8 -9
  128. package/dist/ops/webgpu/appendCache.js +23 -25
  129. package/dist/ops/webgpu/attentionMask.js +8 -10
  130. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  131. package/dist/ops/webgpu/concat16.js +12 -14
  132. package/dist/ops/webgpu/gatherSub.js +11 -13
  133. package/dist/ops/webgpu/gelu.js +28 -29
  134. package/dist/ops/webgpu/matMul16.js +26 -28
  135. package/dist/ops/webgpu/matMul16_program.js +4 -5
  136. package/dist/ops/webgpu/mul16.js +9 -10
  137. package/dist/ops/webgpu/normRMS.js +15 -17
  138. package/dist/ops/webgpu/normRMSGrad.js +21 -28
  139. package/dist/ops/webgpu/pack16.js +12 -13
  140. package/dist/ops/webgpu/pack16_program.js +2 -2
  141. package/dist/ops/webgpu/qkv.js +16 -18
  142. package/dist/ops/webgpu/rope.js +25 -27
  143. package/dist/ops/webgpu/scatterSub.js +7 -9
  144. package/dist/ops/webgpu/slice16.js +21 -23
  145. package/dist/ops/webgpu/softmax16.js +17 -19
  146. package/dist/ops/webgpu/softmax16_program.js +2 -2
  147. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  148. package/dist/ops/webgpu/softmax16grad.js +7 -8
  149. package/dist/ops/webgpu/sub16.js +7 -8
  150. package/dist/ops/webgpu/sum16.js +18 -20
  151. package/dist/ops/webgpu/transpose16.js +19 -20
  152. package/dist/ops/webgpu/transpose16_program.js +2 -2
  153. package/dist/ops/webgpu/transpose16_shared_program.js +11 -12
  154. package/dist/ops/webgpu/unpack16.js +3 -4
  155. package/dist/ops/webgpu/utils/binary_op.js +7 -8
  156. package/dist/ops/webgpu/utils/reductions.js +14 -22
  157. package/dist/ops-B5yanEdW.js +476 -0
  158. package/dist/pack16-nQ6JaLo-.js +39 -0
  159. package/dist/patches/webgpu_backend.js +19 -20
  160. package/dist/patches/webgpu_base.js +1 -1
  161. package/dist/patches/webgpu_program.js +21 -22
  162. package/dist/{random_width-BVV9HveY.js → random_width-or-CEftb.js} +2506 -2761
  163. package/dist/range-BklejeeW.js +10 -0
  164. package/dist/relu-CP0ZcxWO.js +9 -0
  165. package/dist/reshape-ByE68wS9.js +9 -0
  166. package/dist/resize_nearest_neighbor-B19mCEg2.js +175 -0
  167. package/dist/rope-Ir4mTyD1.js +24 -0
  168. package/dist/{scatter_nd_util-C7zXRT_h.js → scatter_nd_util-lvSiX8q4.js} +1 -1
  169. package/dist/selu_util-kbhpTdYD.js +44 -0
  170. package/dist/{shared-CHhxz-O5.js → shared-DT1TkE6w.js} +1 -1
  171. package/dist/{shared-D2NP_CpY.js → shared-dntlHIDQ.js} +343 -345
  172. package/dist/slice-BfEGSH82.js +12 -0
  173. package/dist/{slice_util-DyjSAD0u.js → slice_util-uTKwiEpW.js} +1 -1
  174. package/dist/{softmax-C9JQEtnO.js → softmax-CA5jFsLR.js} +4 -5
  175. package/dist/split-CVLc0w--.js +9 -0
  176. package/dist/squeeze-C7Z2srUo.js +10 -0
  177. package/dist/stack-Cf4n9h0N.js +11 -0
  178. package/dist/step-CINUs5QB.js +261 -0
  179. package/dist/sum-DWAtNGez.js +11 -0
  180. package/dist/tensor-DJoc7gJU.js +8 -0
  181. package/dist/tensor1d-D11P_7Dp.js +11 -0
  182. package/dist/{tensor2d-CSB4KOb0.js → tensor2d-Bs9wZRc7.js} +6 -7
  183. package/dist/{tensor4d-D7bLqGqz.js → tensor4d-BARPdTaS.js} +6 -7
  184. package/dist/{tfjs_backend-CNkSTL0c.js → tfjs_backend-y1cvNhLA.js} +255 -264
  185. package/dist/tile-mbfagpsB.js +11 -0
  186. package/dist/training/Adam.js +2 -2
  187. package/dist/training/AdamExt.js +1 -1
  188. package/dist/training/DatasetBuilder.js +2 -2
  189. package/dist/training/FullTrainer.js +1 -1
  190. package/dist/training/Trainer.js +2 -2
  191. package/dist/training/sparseCrossEntropy.js +5 -5
  192. package/dist/transpose-ClWiBS_b.js +36 -0
  193. package/dist/unsorted_segment_sum-BDDhB_E6.js +277 -0
  194. package/dist/utilities/dummy.js +3 -3
  195. package/dist/utilities/multinomialCPU.js +2 -2
  196. package/dist/utilities/packed.d.ts +1 -4
  197. package/dist/utilities/packed.js +10 -745
  198. package/dist/utilities/performance.js +1 -1
  199. package/dist/utilities/profile.js +1 -1
  200. package/dist/utilities/safetensors.js +2 -2
  201. package/dist/utilities/sentences.js +5 -5
  202. package/dist/utilities/weights.js +2 -2
  203. package/dist/{variable-DzfrwYuP.js → variable-WawDEaAb.js} +1 -1
  204. package/dist/{webgpu_program-DzaQiqel.js → webgpu_program-DuOXPQol.js} +178 -172
  205. package/dist/{webgpu_util-0_ubCEHJ.js → webgpu_util-RxEF33Rj.js} +34 -35
  206. package/dist/zeros-KnWaWf-X.js +13 -0
  207. package/dist/zeros_like-DvE73F4e.js +721 -0
  208. package/package.json +4 -2
  209. package/dist/Reshape-CDVLyVfz.js +0 -16
  210. package/dist/broadcast_to-B0ChcDaz.js +0 -30
  211. package/dist/complex-BBiRlsVq.js +0 -13
  212. package/dist/concat-DmBLPVGC.js +0 -19
  213. package/dist/dropout-B1x1kYMa.js +0 -99
  214. package/dist/expand_dims-ouvfxQ1n.js +0 -13
  215. package/dist/gather-CH9sdacz.js +0 -10
  216. package/dist/index-D6Q1lPZO.js +0 -2157
  217. package/dist/log_sum_exp-D3ftBNY5.js +0 -41
  218. package/dist/mat_mul-C59XWcJd.js +0 -12
  219. package/dist/mod-DESSvHIU.js +0 -12
  220. package/dist/mulmat_packed_gpu-Coh6qbJk.js +0 -55
  221. package/dist/ones-jU9jlQvM.js +0 -15
  222. package/dist/ops-BFDtP6th.js +0 -645
  223. package/dist/pack16-CmVZs6af.js +0 -41
  224. package/dist/patches/PackedTensor.d.ts +0 -12
  225. package/dist/patches/PackedTensor.js +0 -11
  226. package/dist/patches/engine.d.ts +0 -261
  227. package/dist/patches/engine.js +0 -12
  228. package/dist/patches/tape.d.ts +0 -12
  229. package/dist/patches/tape.js +0 -5
  230. package/dist/range-ZZZD60Fx.js +0 -11
  231. package/dist/reciprocal-CrYlsAGD.js +0 -10
  232. package/dist/register_all_kernels-nvj2k7OC.js +0 -12307
  233. package/dist/relu-BYDneVPn.js +0 -10
  234. package/dist/reshape-CaPQzFvz.js +0 -10
  235. package/dist/rope-s4W2XO9B.js +0 -32
  236. package/dist/selu_util-BGPXmd4B.js +0 -303
  237. package/dist/sin-Djs4aQiu.js +0 -16
  238. package/dist/slice-DvovR5wq.js +0 -13
  239. package/dist/split-DBck65sX.js +0 -10
  240. package/dist/squeeze-C00Ipm_7.js +0 -11
  241. package/dist/stack-ChnHwRpX.js +0 -13
  242. package/dist/sum-ywRJj3Zr.js +0 -12
  243. package/dist/tensor-0r5yOo2R.js +0 -8
  244. package/dist/tensor-CzmOBsdf.js +0 -909
  245. package/dist/tensor1d-BlUT89BP.js +0 -12
  246. package/dist/tensor_util-DfwaWayG.js +0 -523
  247. package/dist/tile-CR074jmp.js +0 -13
  248. package/dist/transpose-DH4gmHvu.js +0 -38
  249. package/dist/zeros-DBFVbpv5.js +0 -14
@@ -0,0 +1,10 @@
1
+ import { E as e, a2 as f } from "./index-DOvlwCh-.js";
2
+ function E(a, n, r = 1, o = "float32") {
3
+ if (r === 0)
4
+ throw new Error("Cannot have a step of zero");
5
+ const t = { start: a, stop: n, step: r, dtype: o };
6
+ return e.runKernel(f, {}, t);
7
+ }
8
+ export {
9
+ E as r
10
+ };
@@ -0,0 +1,9 @@
1
+ import { A as o, B as e, E as s, P as t } from "./index-DOvlwCh-.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
+ };
@@ -0,0 +1,9 @@
1
+ import { A as o, B as t, E as a, R as p } from "./index-DOvlwCh-.js";
2
+ function c(r, s) {
3
+ const e = { x: t(r, "x", "reshape", "string_or_numeric") }, n = { shape: s };
4
+ return a.runKernel(p, e, n);
5
+ }
6
+ const x = /* @__PURE__ */ o({ reshape_: c });
7
+ export {
8
+ x as r
9
+ };
@@ -0,0 +1,175 @@
1
+ import { A as i, B as a, a3 as f, E as u, a_ as y, a$ as A, af as z, aZ as p, y as q, z as D, b as B, b0 as I, L as m, b1 as v, b2 as T, b3 as S, b4 as L, b5 as G, b6 as M, b7 as R, X as k, b8 as j, b9 as C, ba as P, bb as U, l as h, bc as X, bd as Z, be as F } from "./index-DOvlwCh-.js";
2
+ import { b as _ } from "./broadcast_to-B3eYlZm7.js";
3
+ import { e as H } from "./axis_util-BaG7mf5A.js";
4
+ import { m as E } from "./log_sum_exp-ngO0-4pK.js";
5
+ import { r as g } from "./reshape-ByE68wS9.js";
6
+ import { s as b } from "./sum-DWAtNGez.js";
7
+ function J(s, r, e) {
8
+ const n = a(r, "a", "where"), t = a(e, "b", "where"), o = a(s, "condition", "where", "bool"), c = f(f(o.shape, n.shape), t.shape), d = _(o, c), $ = _(n, c), l = _(t, c), w = {
9
+ condition: d,
10
+ t: $,
11
+ e: l
12
+ };
13
+ return u.runKernel(y, w);
14
+ }
15
+ const ge = /* @__PURE__ */ i({ where_: J });
16
+ function O(s, r = null, e = !1) {
17
+ const t = { x: a(s, "x", "min") }, o = { axis: r, keepDims: e };
18
+ return u.runKernel(A, t, o);
19
+ }
20
+ const K = /* @__PURE__ */ i({ min_: O });
21
+ function Q(s, r = "euclidean", e = null, n = !1) {
22
+ s = a(s, "x", "norm");
23
+ const t = N(s, r, e);
24
+ let o = t.shape;
25
+ if (n) {
26
+ const c = z(e, s.shape);
27
+ o = H(t.shape, c);
28
+ }
29
+ return g(t, o);
30
+ }
31
+ function N(s, r, e = null) {
32
+ if (s.rank === 0)
33
+ return p(s);
34
+ if (s.rank !== 1 && e === null)
35
+ return N(g(s, [-1]), r, e);
36
+ if (s.rank === 1 || typeof e == "number" || Array.isArray(e) && e.length === 1) {
37
+ if (r === 1)
38
+ return b(p(s), e);
39
+ if (r === 1 / 0)
40
+ return E(p(s), e);
41
+ if (r === -1 / 0)
42
+ return K(p(s), e);
43
+ if (r === "euclidean" || r === 2)
44
+ return q(b(D(p(s), B(2, "int32")), e));
45
+ throw new Error(`Error in norm: invalid ord value: ${r}`);
46
+ }
47
+ if (Array.isArray(e) && e.length === 2) {
48
+ if (r === 1)
49
+ return E(b(p(s), e[0]), e[1] - 1);
50
+ if (r === 1 / 0)
51
+ return E(b(p(s), e[1]), e[0]);
52
+ if (r === -1 / 0)
53
+ return K(b(p(s), e[1]), e[0]);
54
+ if (r === "fro" || r === "euclidean")
55
+ return q(b(I(s), e));
56
+ throw new Error(`Error in norm: invalid ord value: ${r}`);
57
+ }
58
+ throw new Error(`Error in norm: invalid axis: ${e}`);
59
+ }
60
+ const de = /* @__PURE__ */ i({ norm_: Q });
61
+ function V(s, r) {
62
+ let e = a(s, "a", "greater", "string_or_numeric"), n = a(r, "b", "greater", "string_or_numeric");
63
+ [e, n] = m(e, n), f(e.shape, n.shape);
64
+ const t = { a: e, b: n };
65
+ return u.runKernel(v, t);
66
+ }
67
+ const $e = /* @__PURE__ */ i({ greater_: V });
68
+ function W(s, r) {
69
+ let e = a(s, "a", "greaterEqual", "string_or_numeric"), n = a(r, "b", "greaterEqual", "string_or_numeric");
70
+ [e, n] = m(e, n), f(e.shape, n.shape);
71
+ const t = { a: e, b: n };
72
+ return u.runKernel(T, t);
73
+ }
74
+ const _e = /* @__PURE__ */ i({ greaterEqual_: W });
75
+ function Y(s, r) {
76
+ let e = a(s, "a", "less", "string_or_numeric"), n = a(r, "b", "less", "string_or_numeric");
77
+ [e, n] = m(e, n), f(e.shape, n.shape);
78
+ const t = { a: e, b: n };
79
+ return u.runKernel(S, t);
80
+ }
81
+ const Ee = /* @__PURE__ */ i({ less_: Y });
82
+ function x(s, r) {
83
+ let e = a(s, "a", "lessEqual", "string_or_numeric"), n = a(r, "b", "lessEqual", "string_or_numeric");
84
+ [e, n] = m(e, n), f(e.shape, n.shape);
85
+ const t = { a: e, b: n };
86
+ return u.runKernel(L, t);
87
+ }
88
+ const qe = /* @__PURE__ */ i({ lessEqual_: x });
89
+ function ee(s) {
90
+ const e = { x: a(s, "x", "log1p") };
91
+ return u.runKernel(G, e);
92
+ }
93
+ const ke = /* @__PURE__ */ i({ log1p_: ee });
94
+ function ne(s, r) {
95
+ const e = a(s, "a", "logicalAnd", "bool"), n = a(r, "b", "logicalAnd", "bool");
96
+ f(e.shape, n.shape);
97
+ const t = { a: e, b: n };
98
+ return u.runKernel(M, t);
99
+ }
100
+ const Ke = /* @__PURE__ */ i({ logicalAnd_: ne });
101
+ function re(s, r = null, e = !1) {
102
+ const t = { x: a(s, "x", "mean") }, o = { axis: r, keepDims: e };
103
+ return u.runKernel(R, t, o);
104
+ }
105
+ const Ne = /* @__PURE__ */ i({ mean_: re });
106
+ function se(s, r) {
107
+ let e = a(s, "a", "minimum"), n = a(r, "b", "minimum");
108
+ [e, n] = m(e, n), e.dtype === "bool" && (e = k(e, "int32"), n = k(n, "int32")), f(e.shape, n.shape);
109
+ const t = { a: e, b: n };
110
+ return u.runKernel(j, t);
111
+ }
112
+ const we = /* @__PURE__ */ i({ minimum_: se });
113
+ function te(s, r) {
114
+ let e = a(s, "a", "notEqual", "string_or_numeric"), n = a(r, "b", "notEqual", "string_or_numeric");
115
+ [e, n] = m(e, n), f(e.shape, n.shape);
116
+ const t = { a: e, b: n };
117
+ return u.runKernel(C, t);
118
+ }
119
+ const ye = /* @__PURE__ */ i({ notEqual_: te });
120
+ function ae(s) {
121
+ const e = { x: a(s, "x", "round") };
122
+ return u.runKernel(P, e);
123
+ }
124
+ const Ae = /* @__PURE__ */ i({ round_: ae });
125
+ function oe(s, r) {
126
+ let e = a(s, "a", "squaredDifference"), n = a(r, "b", "squaredDifference");
127
+ [e, n] = m(e, n), f(e.shape, n.shape);
128
+ const t = { a: e, b: n }, o = {};
129
+ return u.runKernel(U, t, o);
130
+ }
131
+ const ze = /* @__PURE__ */ i({ squaredDifference_: oe });
132
+ function ie(s, r = 0) {
133
+ const e = a(s, "x", "unstack", "string_or_numeric");
134
+ h(r >= -e.shape.length && r < e.shape.length, () => `Axis = ${r} is not in [-${e.shape.length}, ${e.shape.length})`);
135
+ const n = { value: e }, t = { axis: r };
136
+ return u.runKernel(X, n, t);
137
+ }
138
+ const De = /* @__PURE__ */ i({ unstack_: ie });
139
+ function ue(s, r, e = !1, n = !1) {
140
+ const t = a(s, "images", "resizeBilinear");
141
+ h(t.rank === 3 || t.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${t.rank}.`), h(r.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${r}.`), h(n === !1 || e === !1, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
142
+ let o = t, c = !1;
143
+ t.rank === 3 && (c = !0, o = g(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
144
+ const d = { images: o }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = u.runKernel(Z, d, $);
145
+ return c ? g(l, [l.shape[1], l.shape[2], l.shape[3]]) : l;
146
+ }
147
+ const Be = /* @__PURE__ */ i({ resizeBilinear_: ue });
148
+ function le(s, r, e = !1, n = !1) {
149
+ const t = a(s, "images", "resizeNearestNeighbor");
150
+ h(t.rank === 3 || t.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${t.rank}.`), h(r.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${r}.`), h(t.dtype === "float32" || t.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), h(n === !1 || e === !1, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
151
+ let o = t, c = !1;
152
+ t.rank === 3 && (c = !0, o = g(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
153
+ const d = { images: o }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = u.runKernel(F, d, $);
154
+ return c ? g(l, [l.shape[1], l.shape[2], l.shape[3]]) : l;
155
+ }
156
+ const Ie = /* @__PURE__ */ i({ resizeNearestNeighbor_: le });
157
+ export {
158
+ Ee as a,
159
+ Ke as b,
160
+ _e as c,
161
+ Ne as d,
162
+ ye as e,
163
+ ke as f,
164
+ $e as g,
165
+ Ie as h,
166
+ Be as i,
167
+ K as j,
168
+ qe as l,
169
+ we as m,
170
+ de as n,
171
+ Ae as r,
172
+ ze as s,
173
+ De as u,
174
+ ge as w
175
+ };
@@ -0,0 +1,24 @@
1
+ import { u as p, e as s } from "./index-DOvlwCh-.js";
2
+ import "./ops/cpu/rope.js";
3
+ import "./ops/webgl/rope.js";
4
+ const u = {
5
+ kernelName: "Rope",
6
+ inputsToSave: [],
7
+ outputsToSave: [],
8
+ gradFunc: (e, n, r) => {
9
+ const { ropeCache: o } = r, a = i(e, o, 0, !0);
10
+ return { x: () => a };
11
+ }
12
+ };
13
+ p(u);
14
+ function i(e, n, r, o = !1) {
15
+ return n.ensureRopeCache(e.shape[1] + r), s().runKernel("Rope", { x: e }, {
16
+ pastLen: r,
17
+ negSin: o,
18
+ ropeCache: n
19
+ });
20
+ }
21
+ export {
22
+ u as a,
23
+ i as r
24
+ };
@@ -1,4 +1,4 @@
1
- import { s as p, i as w } from "./tensor-CzmOBsdf.js";
1
+ import { h as p, ad as w } from "./index-DOvlwCh-.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)
@@ -0,0 +1,44 @@
1
+ import { m as n, a4 as l } from "./index-DOvlwCh-.js";
2
+ import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-CINUs5QB.js";
3
+ import { r as m } from "./relu-CP0ZcxWO.js";
4
+ import { r as d } from "./reshape-ByE68wS9.js";
5
+ import { s as g } from "./sum-DWAtNGez.js";
6
+ function L(e, r, s) {
7
+ if (s == null || s === "linear")
8
+ return e;
9
+ if (s === "relu")
10
+ return n(e, i(r));
11
+ throw new Error(`Cannot compute gradient for fused activation ${s}.`);
12
+ }
13
+ function S(e, r) {
14
+ let s = r;
15
+ const u = l(e.shape, r.shape);
16
+ return u.length > 0 && (s = g(s, u)), d(s, e.shape);
17
+ }
18
+ function k(e, r, s, u) {
19
+ if (r === "linear")
20
+ return e;
21
+ if (r === "relu")
22
+ return m(e);
23
+ if (r === "elu")
24
+ return o(e);
25
+ if (r === "relu6")
26
+ return t(e);
27
+ if (r === "prelu")
28
+ return f(e, s);
29
+ if (r === "leakyrelu")
30
+ return a(e, u);
31
+ if (r === "sigmoid")
32
+ return p(e);
33
+ throw new Error(`Unknown fused activation ${r}.`);
34
+ }
35
+ const C = (e, r) => !(e > 0) || r === "linear";
36
+ const F = 1.7580993408473768, U = 1.0507009873554805;
37
+ export {
38
+ U as S,
39
+ F as a,
40
+ k as b,
41
+ L as c,
42
+ S as g,
43
+ C as s
44
+ };
@@ -1,4 +1,4 @@
1
- import { s as l } from "./shared-D2NP_CpY.js";
1
+ import { s as l } from "./shared-dntlHIDQ.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,