@genai-fi/nanogpt 0.10.1 → 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-DgA3z9oO.js → RealDiv-KAPDe8zB.js} +28 -30
  3. package/dist/Reshape-BYkmUnAv.js +14 -0
  4. package/dist/{Reshape-_kILl6tK.js → Reshape-Zt6eb7yh.js} +18 -20
  5. package/dist/TeachableLLM.js +10 -11
  6. package/dist/{axis_util-BvHEw88j.js → axis_util-BaG7mf5A.js} +3 -3
  7. package/dist/backend.js +2 -2
  8. package/dist/{backend_util-D-rUb2ty.js → backend_util-RCe-rHaj.js} +59 -60
  9. package/dist/{backend_webgpu-B0u2ndUn.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-DcJk7YHS.js → concat_util-DpW8mL_l.js} +1 -1
  24. package/dist/{dataset-0xP8GjwI.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-xuidcwI4.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-CNLFZWea.js → gelu-CjNPL4OH.js} +10 -11
  31. package/dist/{gpgpu_math-DDVJCn6-.js → gpgpu_math-DAOmgtXR.js} +841 -1015
  32. package/dist/{index-CjOj7j-u.js → index-BwexR4lA.js} +262 -263
  33. package/dist/index-DOvlwCh-.js +3520 -0
  34. package/dist/{kernel_funcs_utils-Dg_-E44D.js → kernel_funcs_utils-CCzYdUZg.js} +129 -131
  35. package/dist/layers/BaseLayer.js +14 -15
  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--R5hOwDG.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-DY6Kk2Dl.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-5EL-8VAQ.js → scatter_nd_util-lvSiX8q4.js} +1 -1
  169. package/dist/selu_util-kbhpTdYD.js +44 -0
  170. package/dist/{shared-BRksrJb3.js → shared-DT1TkE6w.js} +1 -1
  171. package/dist/{shared-BuAXb4CI.js → shared-dntlHIDQ.js} +343 -345
  172. package/dist/slice-BfEGSH82.js +12 -0
  173. package/dist/{slice_util-DtEldBfK.js → slice_util-uTKwiEpW.js} +1 -1
  174. package/dist/{softmax-ZHVebtR1.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-G4Ys2GxX.js → tensor2d-Bs9wZRc7.js} +6 -7
  183. package/dist/{tensor4d-B8roDgtc.js → tensor4d-BARPdTaS.js} +6 -7
  184. package/dist/{tfjs_backend-kNyO5L2d.js → tfjs_backend-y1cvNhLA.js} +244 -253
  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 -711
  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-Bhn5bHYv.js → variable-WawDEaAb.js} +1 -1
  204. package/dist/{webgpu_program-Cigz-7RF.js → webgpu_program-DuOXPQol.js} +178 -172
  205. package/dist/{webgpu_util-BBCnKm2X.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-CF6odzV4.js +0 -16
  210. package/dist/broadcast_to-CwF7XIeu.js +0 -30
  211. package/dist/complex-CSlYz-2T.js +0 -13
  212. package/dist/concat-BHlIJeyT.js +0 -19
  213. package/dist/dropout-C1pM3f11.js +0 -99
  214. package/dist/expand_dims-BPG4fwBP.js +0 -13
  215. package/dist/gather-DykLGqmW.js +0 -10
  216. package/dist/index-ZyQhjEPo.js +0 -2157
  217. package/dist/log_sum_exp-DWI-76TI.js +0 -41
  218. package/dist/mat_mul-DeAh4uTH.js +0 -12
  219. package/dist/mod-Gt1rMB4n.js +0 -12
  220. package/dist/mulmat_packed_gpu-BMFhLwta.js +0 -55
  221. package/dist/ones-CAMiP4I2.js +0 -15
  222. package/dist/ops-CNI3TwqM.js +0 -645
  223. package/dist/pack16-CFUqumar.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 -10
  228. package/dist/patches/tape.d.ts +0 -12
  229. package/dist/patches/tape.js +0 -5
  230. package/dist/range-BMS52eQi.js +0 -11
  231. package/dist/reciprocal-CTmshQ9J.js +0 -10
  232. package/dist/register_all_kernels-Bwu1PTuU.js +0 -12307
  233. package/dist/relu-yZ2-7WxU.js +0 -10
  234. package/dist/reshape-DevtBWtf.js +0 -10
  235. package/dist/rope-B5UUMsPi.js +0 -32
  236. package/dist/selu_util-D1w6yyTO.js +0 -303
  237. package/dist/sin-BGfy2HZo.js +0 -16
  238. package/dist/slice-D_gkkqZK.js +0 -13
  239. package/dist/split-DrfihRpZ.js +0 -10
  240. package/dist/squeeze-DZEpeblb.js +0 -11
  241. package/dist/stack-yOIAalTq.js +0 -13
  242. package/dist/sum-_fzj5ZTB.js +0 -12
  243. package/dist/tensor-DdQUJZlz.js +0 -909
  244. package/dist/tensor-f35l8Odg.js +0 -8
  245. package/dist/tensor1d-CeZuc-Rv.js +0 -12
  246. package/dist/tensor_util-DV-FP5Q3.js +0 -523
  247. package/dist/tile-BzyEiF-F.js +0 -13
  248. package/dist/transpose-DKELTqhe.js +0 -38
  249. package/dist/zeros-2gldETuK.js +0 -14
@@ -1,113 +1,9 @@
1
- import { t as R, e as C, j as N } from "../../index-ZyQhjEPo.js";
2
- import { r as f } from "../../Reshape-_kILl6tK.js";
3
- import { M as H } from "../../mulmat_packed_gpu-BMFhLwta.js";
4
- import { r as E, u as O } from "../../tensor_util-DV-FP5Q3.js";
5
- import { m as $ } from "../../mat_mul-DeAh4uTH.js";
6
- import { s as A, a as U } from "../../tensor-DdQUJZlz.js";
7
- const M = 0.7978845608028654, g = 0.044715, j = `
8
- vec4 x3 = x * x * x;
9
- vec4 inner = x + ${g} * x3;
10
- inner = ${M} * inner;
11
- inner = vec4(
12
- abs(inner[0]) > 15.0 ? sign(inner[0]) : tanh(inner[0]),
13
- abs(inner[1]) > 15.0 ? sign(inner[1]) : tanh(inner[1]),
14
- abs(inner[2]) > 15.0 ? sign(inner[2]) : tanh(inner[2]),
15
- abs(inner[3]) > 15.0 ? sign(inner[3]) : tanh(inner[3])
16
- );
17
- inner = 0.5 * (1.0 + inner);
18
- vec4 result = x * inner;
19
- return result;
20
- `, q = `
21
- vec4 a2 = a * a;
22
- vec4 a3 = a2 * a;
23
- vec4 u = ${M} * (a + ${g} * a3);
24
- vec4 t = vec4(
25
- abs(u[0]) > 15.0 ? sign(u[0]) : tanh(u[0]),
26
- abs(u[1]) > 15.0 ? sign(u[1]) : tanh(u[1]),
27
- abs(u[2]) > 15.0 ? sign(u[2]) : tanh(u[2]),
28
- abs(u[3]) > 15.0 ? sign(u[3]) : tanh(u[3])
29
- );
30
- vec4 sech2 = 1.0 - t * t;
31
- vec4 du_dx = ${M} * (1.0 + 3.0 * ${g} * a2);
32
- vec4 dgelu = 0.5 * (1.0 + t) + 0.5 * a * sech2 * du_dx;
33
- return dgelu * b;
34
- `, se = 1e3;
35
- function _({
36
- a: e,
37
- b: n,
38
- transposeA: s,
39
- transposeB: t,
40
- backend: a,
41
- activationSnippet: i,
42
- multiplier: o
43
- }) {
44
- const r = e.shape.length, c = n.shape.length, u = s ? e.shape[r - 2] : e.shape[r - 1], p = t ? n.shape[c - 1] : n.shape[c - 2], h = s ? e.shape[r - 1] : e.shape[r - 2], l = t ? n.shape[c - 2] : n.shape[c - 1], w = e.shape.slice(0, -2), K = n.shape.slice(0, -2), m = A(w), d = A(K), T = N(e.shape.slice(0, -2), n.shape.slice(0, -2)).concat([h, l]);
45
- U(
46
- u === p,
47
- () => `Error in matMul: inner shapes (${u}) and (${p}) of Tensors with shapes ${e.shape} and ${n.shape} and transposeA=${s} and transposeB=${t} must match.`
48
- );
49
- const v = s ? [m, u, h] : [m, h, u], x = t ? [d, l, p] : [d, p, l], S = f({ inputs: { x: e }, backend: a, attrs: { shape: v } }), b = f({ inputs: { x: n }, backend: a, attrs: { shape: x } }), D = [S, b], y = Math.max(m, d), L = i, B = O(e.dtype, n.dtype), F = new H(
50
- v,
51
- x,
52
- [y, h, l],
53
- s,
54
- t,
55
- !1,
56
- L,
57
- !!o,
58
- !1
59
- ), G = [S, b];
60
- o && G.push(o);
61
- const k = a.runWebGLProgram(F, G, B), I = f({ inputs: { x: k }, backend: a, attrs: { shape: T } });
62
- D.push(k);
63
- for (const P of D)
64
- a.disposeIntermediateTensorInfo(P);
65
- return I;
66
- }
67
- function z(e) {
68
- const { inputs: n, backend: s } = e, { x: t, kernel: a } = n;
69
- if (t === void 0 || a === void 0)
70
- throw new Error("BatchMatMul requires two input tensors.");
71
- return _({
72
- a: t,
73
- b: a,
74
- transposeA: !1,
75
- transposeB: !1,
76
- backend: s,
77
- activationSnippet: j
78
- });
79
- }
80
- const W = {
81
- kernelName: "MatMulGelu",
82
- backendName: "webgl",
83
- kernelFunc: z
84
- };
85
- E(W);
86
- function J(e) {
87
- const { dy: n, x: s, kernel: t } = e.inputs, a = e.backend;
88
- return R(() => {
89
- const i = C().makeTensorFromTensorInfo(
90
- _({
91
- a: s,
92
- b: t,
93
- transposeA: !1,
94
- transposeB: !1,
95
- backend: a,
96
- activationSnippet: q,
97
- multiplier: n
98
- })
99
- ), o = $(i, t, !1, !0), r = $(s, i, !0, !1);
100
- return [o, r];
101
- });
102
- }
103
- const Q = {
104
- kernelName: "MatMulGeluGrad",
105
- backendName: "webgl",
106
- kernelFunc: J
107
- };
108
- E(Q);
1
+ import "../../index-DOvlwCh-.js";
2
+ import "../../Reshape-Zt6eb7yh.js";
3
+ import { a as m, b as o, c as p } from "../../matMulGelu-CzfgT6Wq.js";
4
+ import "../../mat_mul-SjpJRLyL.js";
109
5
  export {
110
- se as MATMUL_SHARED_DIM_THRESHOLD,
111
- _ as batchMatMulGeluImpl,
112
- z as batchMatMulKernel
6
+ m as MATMUL_SHARED_DIM_THRESHOLD,
7
+ o as batchMatMulGeluImpl,
8
+ p as batchMatMulKernel
113
9
  };
@@ -1,21 +1,20 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { batchMatMulGeluImpl as u } from "./matMulGelu.js";
3
- import { r as c } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { p as u } from "../../index-DOvlwCh-.js";
2
+ import { b as c } from "../../matMulGelu-CzfgT6Wq.js";
4
3
  const p = `
5
4
  return a * b;
6
5
  `;
7
6
  function M(r) {
8
- const { inputs: n, backend: o, attrs: a } = r, { x: t, kernel: e, y: i } = n, { transposeA: l, transposeB: s } = a;
7
+ const { inputs: n, backend: a, attrs: o } = r, { x: t, kernel: e, y: l } = n, { transposeA: s, transposeB: i } = o;
9
8
  if (t === void 0 || e === void 0)
10
9
  throw new Error("BatchMatMul requires two input tensors.");
11
- return u({
10
+ return c({
12
11
  a: t,
13
12
  b: e,
14
- transposeA: l,
15
- transposeB: s,
16
- backend: o,
13
+ transposeA: s,
14
+ transposeB: i,
15
+ backend: a,
17
16
  activationSnippet: p,
18
- multiplier: i
17
+ multiplier: l
19
18
  });
20
19
  }
21
20
  const m = {
@@ -23,7 +22,7 @@ const m = {
23
22
  backendName: "webgl",
24
23
  kernelFunc: M
25
24
  };
26
- c(m);
25
+ u(m);
27
26
  export {
28
27
  M as batchMatMulKernel
29
28
  };
@@ -1,5 +1,4 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { r as m } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { p as m } from "../../index-DOvlwCh-.js";
3
2
  class f {
4
3
  variableNames = ["a", "b"];
5
4
  outputShape;
@@ -8,8 +7,8 @@ class f {
8
7
  { name: "dropoutRate", type: "float" },
9
8
  { name: "seed", type: "float" }
10
9
  ];
11
- constructor(r, t, o) {
12
- this.outputShape = [r, t, o, o], this.userCode = `
10
+ constructor(t, r, o) {
11
+ this.outputShape = [t, r, o, o], this.userCode = `
13
12
  float random(ivec4 coords) {
14
13
  float x = float(coords.x * 4096 + coords.y * 256 + coords.z * 16 + coords.w);
15
14
  return fract(sin(seed + x) * 43758.5453123);
@@ -27,16 +26,16 @@ class f {
27
26
  `;
28
27
  }
29
28
  }
30
- function i(e) {
31
- const { inputs: r, attrs: t } = e, { a: o, b: s } = r, { dropoutRate: a, seed: c } = t, n = e.backend, d = o.shape[0], u = o.shape[2], p = o.shape[1], l = new f(d, p, u);
29
+ function b(e) {
30
+ const { inputs: t, attrs: r } = e, { a: o, b: s } = t, { dropoutRate: a, seed: c } = r, n = e.backend, d = o.shape[0], u = o.shape[2], p = o.shape[1], l = new f(d, p, u);
32
31
  return n.runWebGLProgram(l, [o, s], "float32", [
33
32
  [a ?? 0],
34
33
  [c ?? Math.random() * 1e4]
35
34
  ]);
36
35
  }
37
- const b = {
36
+ const i = {
38
37
  kernelName: "MulDropout",
39
38
  backendName: "webgl",
40
- kernelFunc: i
39
+ kernelFunc: b
41
40
  };
42
- m(b);
41
+ m(i);
@@ -1,6 +1,5 @@
1
- import { e as G } from "../../index-ZyQhjEPo.js";
2
- import { r as g } from "../../tensor_util-DV-FP5Q3.js";
3
- import { s as x } from "../../sum-_fzj5ZTB.js";
1
+ import { p as g, e as G } from "../../index-DOvlwCh-.js";
2
+ import { s as x } from "../../sum-DWAtNGez.js";
4
3
  class y {
5
4
  variableNames = ["x", "meanSquare", "gamma"];
6
5
  outputShape;
@@ -1,6 +1,5 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { r as i } from "../../tensor_util-DV-FP5Q3.js";
3
- class m {
1
+ import { p as i } from "../../index-DOvlwCh-.js";
2
+ class l {
4
3
  variableNames = ["x", "kernel"];
5
4
  outputShape;
6
5
  userCode;
@@ -31,8 +30,8 @@ class m {
31
30
  `;
32
31
  }
33
32
  }
34
- function l(r) {
35
- const { x: e, kernel: t } = r.inputs, { heads: s } = r.attrs, o = r.backend, n = e.shape[0], c = e.shape[1], u = e.shape[2], a = new m(n, s, c, u);
33
+ function m(r) {
34
+ const { x: e, kernel: t } = r.inputs, { heads: s } = r.attrs, o = r.backend, n = e.shape[0], c = e.shape[1], u = e.shape[2], a = new l(n, s, c, u);
36
35
  return [
37
36
  o.runWebGLProgram(a, [e, t], "float32", [[0]]),
38
37
  o.runWebGLProgram(a, [e, t], "float32", [[1]]),
@@ -42,6 +41,6 @@ function l(r) {
42
41
  const d = {
43
42
  kernelName: "QKV",
44
43
  backendName: "webgl",
45
- kernelFunc: l
44
+ kernelFunc: m
46
45
  };
47
46
  i(d);
@@ -1,5 +1,4 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { r as h } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { p as h } from "../../index-DOvlwCh-.js";
3
2
  class g {
4
3
  variableNames = ["x", "sin", "cos"];
5
4
  outputShape;
@@ -45,13 +44,13 @@ class g {
45
44
  `;
46
45
  }
47
46
  }
48
- function m(o) {
49
- const { x: t } = o.inputs, { pastLen: s, ropeCache: e, negSin: n } = o.attrs, a = n ? e.getNegSin() : e.getSin(), r = e.getCos(), i = o.backend, d = t.shape[0], c = t.shape[1], p = t.shape[2], u = t.shape[3], l = new g(d, c, p, u);
50
- return i.runWebGLProgram(l, [t, a, r], "float32", [[s]]);
47
+ function f(o) {
48
+ const { x: t } = o.inputs, { pastLen: s, ropeCache: e, negSin: n } = o.attrs, a = n ? e.getNegSin() : e.getSin(), r = e.getCos(), d = o.backend, i = t.shape[0], c = t.shape[1], p = t.shape[2], u = t.shape[3], l = new g(i, c, p, u);
49
+ return d.runWebGLProgram(l, [t, a, r], "float32", [[s]]);
51
50
  }
52
- const f = {
51
+ const m = {
53
52
  kernelName: "Rope",
54
53
  backendName: "webgl",
55
- kernelFunc: m
54
+ kernelFunc: f
56
55
  };
57
- h(f);
56
+ h(m);
@@ -1,11 +1,10 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { r as i } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { p as i } from "../../index-DOvlwCh-.js";
3
2
  class u {
4
3
  variableNames = ["labels", "softmaxProbs", "dy"];
5
4
  outputShape;
6
5
  userCode;
7
- constructor(t, e) {
8
- this.outputShape = [t, e], this.userCode = `
6
+ constructor(e, t) {
7
+ this.outputShape = [e, t], this.userCode = `
9
8
  void main() {
10
9
  ivec2 coords = getOutputCoords();
11
10
  int index = int(getLabels(coords.x));
@@ -17,8 +16,8 @@ class u {
17
16
  }
18
17
  }
19
18
  function d(o) {
20
- const { logits: t, labels: e, dy: r } = o.inputs, s = o.backend, n = e.shape[0], a = t.shape[1], c = new u(n, a);
21
- return s.runWebGLProgram(c, [e, t, r], "float32");
19
+ const { logits: e, labels: t, dy: r } = o.inputs, s = o.backend, n = t.shape[0], a = e.shape[1], c = new u(n, a);
20
+ return s.runWebGLProgram(c, [t, e, r], "float32");
22
21
  }
23
22
  const b = {
24
23
  kernelName: "EfficientScatterSub",
@@ -1,8 +1,6 @@
1
- import { e as p } from "../../webgpu_program-Cigz-7RF.js";
2
- import { f as d, c as l } from "../../webgpu_util-BBCnKm2X.js";
3
- import "../../index-ZyQhjEPo.js";
4
- import { j as f } from "../../tensor-DdQUJZlz.js";
5
- import { r as c } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { e as p } from "../../webgpu_program-DuOXPQol.js";
2
+ import { f as d, c as l } from "../../webgpu_util-RxEF33Rj.js";
3
+ import { p as f, ab as c } from "../../index-DOvlwCh-.js";
6
4
  class h {
7
5
  variableNames = ["moments", "value"];
8
6
  outputShape;
@@ -38,19 +36,19 @@ class h {
38
36
  }
39
37
  }
40
38
  function v(t) {
41
- const { moments: e, value: a } = t.inputs, { beta1: n, beta2: o, learningRate: s, epsilon: i } = t.attrs, r = t.backend;
42
- f(e.shape, [...a.shape, 2], "Error in AdamAdjust: ");
43
- const m = new h(a.shape), u = [
39
+ const { moments: e, value: a } = t.inputs, { beta1: n, beta2: s, learningRate: o, epsilon: i } = t.attrs, r = t.backend;
40
+ c(e.shape, [...a.shape, 2], "Error in AdamAdjust: ");
41
+ const u = new h(a.shape), m = [
44
42
  { type: "float32", data: [1 / n] },
45
- { type: "float32", data: [1 / o] },
46
- { type: "float32", data: [s] },
43
+ { type: "float32", data: [1 / s] },
44
+ { type: "float32", data: [o] },
47
45
  { type: "float32", data: [i] }
48
46
  ];
49
- return r.runWebGPUProgram(m, [e, a], "float32", u);
47
+ return r.runWebGPUProgram(u, [e, a], "float32", m);
50
48
  }
51
49
  const b = {
52
50
  kernelName: "AdamAdjust",
53
51
  backendName: "webgpu",
54
52
  kernelFunc: v
55
53
  };
56
- c(b);
54
+ f(b);
@@ -1,8 +1,6 @@
1
- import { e as p } from "../../webgpu_program-Cigz-7RF.js";
2
- import { f as u, c as d } from "../../webgpu_util-BBCnKm2X.js";
3
- import "../../index-ZyQhjEPo.js";
4
- import { j as f } from "../../tensor-DdQUJZlz.js";
5
- import { r as c } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { e as u } from "../../webgpu_program-DuOXPQol.js";
2
+ import { f as p, c as d } from "../../webgpu_util-RxEF33Rj.js";
3
+ import { p as c, ab as f } from "../../index-DOvlwCh-.js";
6
4
  class l {
7
5
  variableNames = ["moments", "gradient"];
8
6
  outputShape;
@@ -15,7 +13,7 @@ class l {
15
13
  outputComponent = 2;
16
14
  variableComponents = [2, 1];
17
15
  constructor(t) {
18
- this.outputShape = t, this.dispatchLayout = u(this.outputShape.slice(0, -1)), this.dispatch = d(
16
+ this.outputShape = t, this.dispatchLayout = p(this.outputShape.slice(0, -1)), this.dispatch = d(
19
17
  this.dispatchLayout,
20
18
  this.outputShape.slice(0, -1),
21
19
  this.workgroupSize,
@@ -24,7 +22,7 @@ class l {
24
22
  }
25
23
  getUserCode() {
26
24
  return `
27
- ${p("index")} {
25
+ ${u("index")} {
28
26
  if (index < uniforms.size) {
29
27
  let m: vec2<f32> = moments[index];
30
28
 
@@ -41,7 +39,7 @@ class l {
41
39
  }
42
40
  }
43
41
  function h(e) {
44
- const { moments: t, gradient: a } = e.inputs, { beta1: n, beta2: o, lossScaling: r } = e.attrs, s = e.backend;
42
+ const { moments: t, gradient: a } = e.inputs, { beta1: n, beta2: o, lossScaling: s } = e.attrs, r = e.backend;
45
43
  if (a.dtype !== "float32")
46
44
  throw new Error(`Gradient must be float32, but got ${a.dtype}`);
47
45
  if (f(t.shape, [...a.shape, 2], "Error in AdamMoments: "), n < 0 || n >= 1)
@@ -51,9 +49,9 @@ function h(e) {
51
49
  const i = new l(t.shape), m = [
52
50
  { type: "float32", data: [n] },
53
51
  { type: "float32", data: [o] },
54
- { type: "float32", data: [1 / r] }
52
+ { type: "float32", data: [1 / s] }
55
53
  ];
56
- return s.runWebGPUProgram(i, [t, a], "float32", m);
54
+ return r.runWebGPUProgram(i, [t, a], "float32", m);
57
55
  }
58
56
  const g = {
59
57
  kernelName: "AdamMoments",
@@ -1,14 +1,13 @@
1
- import "../../index-ZyQhjEPo.js";
1
+ import { p as t } from "../../index-DOvlwCh-.js";
2
2
  import { BinaryOpProgram as p } from "./utils/binary_op.js";
3
- import { B as m } from "../../binary_op_util-pKXltfxI.js";
4
- import { r as c } from "../../tensor_util-DV-FP5Q3.js";
5
- function i(r) {
6
- const { a: e, b: n } = r.inputs, a = r.backend, t = new p(m.ADD, e.shape, n.shape), o = a.runWebGPUProgram(t, [e, n], "int32");
7
- return o.packed = !0, o;
3
+ import { B as s } from "../../binary_op_util-pKXltfxI.js";
4
+ function c(e) {
5
+ const { a: r, b: n } = e.inputs, a = e.backend, o = new p(s.ADD, r.shape, n.shape);
6
+ return a.runWebGPUProgram(o, [r, n], "packedF16");
8
7
  }
9
- const s = {
8
+ const m = {
10
9
  kernelName: "Add16",
11
10
  backendName: "webgpu",
12
- kernelFunc: i
11
+ kernelFunc: c
13
12
  };
14
- c(s);
13
+ t(m);
@@ -1,10 +1,8 @@
1
- import { isPackedTensor as S } from "../../utilities/packed.js";
2
- import { e as d } from "../../webgpu_program-Cigz-7RF.js";
3
- import { f as u, c as m } from "../../webgpu_util-BBCnKm2X.js";
4
- import "../../index-ZyQhjEPo.js";
5
- import { j as g } from "../../tensor-DdQUJZlz.js";
6
- import { r as x } from "../../tensor_util-DV-FP5Q3.js";
7
- class b {
1
+ import { isPackedTensor as T } from "../../utilities/packed.js";
2
+ import { e as p } from "../../webgpu_program-DuOXPQol.js";
3
+ import { f as d, c as u } from "../../webgpu_util-RxEF33Rj.js";
4
+ import { p as S, ab as g } from "../../index-DOvlwCh-.js";
5
+ class x {
8
6
  variableNames = ["cache", "item"];
9
7
  outputShape;
10
8
  shaderKey = "AppendCache";
@@ -13,14 +11,14 @@ class b {
13
11
  workgroupSize = [64, 1, 1];
14
12
  size = !0;
15
13
  uniforms = "cacheT: i32";
16
- constructor(e, t, s, o, i) {
17
- const a = Math.min(s + 1, i);
18
- this.shaderKey = `AppendCache_${a}`, this.outputShape = [e, t, a, o], this.dispatchLayout = u(this.outputShape), this.dispatch = m(this.dispatchLayout, this.outputShape, this.workgroupSize);
14
+ constructor(e, t, a, s, i) {
15
+ const o = Math.min(a + 1, i);
16
+ this.shaderKey = `AppendCache_${o}`, this.outputShape = [e, t, o, s], this.dispatchLayout = d(this.outputShape), this.dispatch = u(this.dispatchLayout, this.outputShape, this.workgroupSize);
19
17
  }
20
18
  getUserCode() {
21
19
  const e = this.outputShape[2];
22
20
  return `
23
- ${d("index")} {
21
+ ${p("index")} {
24
22
  if (index < uniforms.size) {
25
23
  let coords = getCoordsFromIndex(index); // [b, h, t, d]
26
24
  let b = coords[0];
@@ -48,7 +46,7 @@ class b {
48
46
  `;
49
47
  }
50
48
  }
51
- class C {
49
+ class b {
52
50
  variableNames = ["cache", "item"];
53
51
  outputShape;
54
52
  shaderKey = "AppendCache";
@@ -57,14 +55,14 @@ class C {
57
55
  workgroupSize = [64, 1, 1];
58
56
  size = !0;
59
57
  uniforms = "cacheT: i32";
60
- constructor(e, t, s, o, i) {
61
- const a = Math.min(s + 1, i);
62
- this.shaderKey = `AppendCache_${a}`, this.outputShape = [e, t, a, o], this.dispatchLayout = u(this.outputShape), this.dispatch = m(this.dispatchLayout, this.outputShape, this.workgroupSize);
58
+ constructor(e, t, a, s, i) {
59
+ const o = Math.min(a + 1, i);
60
+ this.shaderKey = `AppendCache_${o}`, this.outputShape = [e, t, o, s], this.dispatchLayout = d(this.outputShape), this.dispatch = u(this.dispatchLayout, this.outputShape, this.workgroupSize);
63
61
  }
64
62
  getUserCode() {
65
63
  const e = this.outputShape[2];
66
64
  return `
67
- ${d("index")} {
65
+ ${p("index")} {
68
66
  if (index < uniforms.size) {
69
67
  let coords = getCoordsFromIndex(index); // [b, h, t, d]
70
68
  let b = coords[0];
@@ -92,16 +90,16 @@ class C {
92
90
  `;
93
91
  }
94
92
  }
95
- function v(r) {
96
- const { cache: e, item: t } = r.inputs, { maxSize: s, pastLen: o } = r.attrs, i = r.backend, a = S(e), c = e.shape[0], n = e.shape[2], h = e.shape[1];
97
- if (g(t.shape, [c, h, 1, t.shape[3]], "Error in AppendCache: "), o < 0 || o > s)
98
- throw new Error(`Invalid pastLen value: ${o}. Must be in the range [0, ${s}].`);
99
- const l = a ? new C(c, h, n, t.shape[3], s) : new b(c, h, n, t.shape[3], s), f = [{ type: "int32", data: [o] }], T = a ? "int32" : e.dtype, p = i.runWebGPUProgram(l, [e, t], T, f);
100
- return p.packed = a, p;
93
+ function C(r) {
94
+ const { cache: e, item: t } = r.inputs, { maxSize: a, pastLen: s } = r.attrs, i = r.backend, o = T(e), c = e.shape[0], n = e.shape[2], h = e.shape[1];
95
+ if (g(t.shape, [c, h, 1, t.shape[3]], "Error in AppendCache: "), s < 0 || s > a)
96
+ throw new Error(`Invalid pastLen value: ${s}. Must be in the range [0, ${a}].`);
97
+ const m = o ? new b(c, h, n, t.shape[3], a) : new x(c, h, n, t.shape[3], a), l = [{ type: "int32", data: [s] }], f = o ? "packedF16" : e.dtype;
98
+ return i.runWebGPUProgram(m, [e, t], f, l);
101
99
  }
102
- const z = {
100
+ const v = {
103
101
  kernelName: "AppendCache",
104
102
  backendName: "webgpu",
105
- kernelFunc: v
103
+ kernelFunc: C
106
104
  };
107
- x(z);
105
+ S(v);
@@ -1,19 +1,17 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { j as d } from "../../tensor-DdQUJZlz.js";
1
+ import { p as d, ab as b } from "../../index-DOvlwCh-.js";
3
2
  import { isPackedTensor as p } from "../../utilities/packed.js";
4
- import { b } from "../../matMul16--R5hOwDG.js";
5
- import l from "./attentionMask32_program.js";
6
- import { r as M } from "../../tensor_util-DV-FP5Q3.js";
3
+ import { b as l } from "../../matMul16-BWRSOCWB.js";
4
+ import M from "./attentionMask32_program.js";
7
5
  function w(n) {
8
6
  const { q: t, k: e } = n.inputs, { divisor: a, pastLen: o } = n.attrs, m = n.backend;
9
7
  if (p(t) && p(e))
10
- return b(t, e, !1, !0, { causalMask: !0, pastLen: o, scale: a });
11
- const r = t.shape[0], k = t.shape[2], s = e.shape[2], i = t.shape[1], c = t.shape[3];
12
- if (d(e.shape, [r, i, s, c], "Error in AttentionMask: "), a === 0)
8
+ return l(t, e, !1, !0, { causalMask: !0, pastLen: o, scale: a });
9
+ const s = t.shape[0], k = t.shape[2], r = e.shape[2], i = t.shape[1], c = t.shape[3];
10
+ if (b(e.shape, [s, i, r, c], "Error in AttentionMask: "), a === 0)
13
11
  throw new Error("Divisor must be non-zero in AttentionMask");
14
12
  if (o < 0)
15
13
  throw new Error("pastLen must be non-negative in AttentionMask");
16
- const u = new l(r, i, k, s, c), f = [
14
+ const u = new M(s, i, k, r, c), f = [
17
15
  { type: "float32", data: [a] },
18
16
  { type: "int32", data: [o] },
19
17
  { type: "float32", data: [Number.NEGATIVE_INFINITY] }
@@ -25,4 +23,4 @@ const A = {
25
23
  backendName: "webgpu",
26
24
  kernelFunc: w
27
25
  };
28
- M(A);
26
+ d(A);
@@ -1,5 +1,5 @@
1
- import { e as r } from "../../webgpu_program-Cigz-7RF.js";
2
- import { f as a, c as u } from "../../webgpu_util-BBCnKm2X.js";
1
+ import { e as r } from "../../webgpu_program-DuOXPQol.js";
2
+ import { f as a, c as u } from "../../webgpu_util-RxEF33Rj.js";
3
3
  class p {
4
4
  variableNames = ["q", "k"];
5
5
  outputShape;
@@ -1,10 +1,8 @@
1
- import "../../index-ZyQhjEPo.js";
2
- import { e as x } from "../../webgpu_program-Cigz-7RF.js";
3
- import { f as I, c as D } from "../../webgpu_util-BBCnKm2X.js";
4
- import { r as y } from "../../Reshape-CF6odzV4.js";
5
- import { r as $ } from "../../tensor_util-DV-FP5Q3.js";
6
- import { p as F, s as c } from "../../tensor-DdQUJZlz.js";
7
- import { a as L, c as d } from "../../concat_util-DcJk7YHS.js";
1
+ import { p as x, af as I, h as c } from "../../index-DOvlwCh-.js";
2
+ import { e as D } from "../../webgpu_program-DuOXPQol.js";
3
+ import { f as $, c as F } from "../../webgpu_util-RxEF33Rj.js";
4
+ import { r as g } from "../../Reshape-BYkmUnAv.js";
5
+ import { a as L, c as d } from "../../concat_util-DpW8mL_l.js";
8
6
  class T {
9
7
  outputShape;
10
8
  shaderKey;
@@ -21,7 +19,7 @@ class T {
21
19
  t,
22
20
  1
23
21
  /* axis */
24
- ), this.variableNames = t.map((e, a) => `T${a}`), this.dispatchLayout = I(this.outputShape), this.dispatch = D(this.dispatchLayout, this.outputShape, this.workgroupSize, [
22
+ ), this.variableNames = t.map((e, a) => `T${a}`), this.dispatchLayout = $(this.outputShape), this.dispatch = F(this.dispatchLayout, this.outputShape, this.workgroupSize, [
25
23
  this.workPerThread,
26
24
  1,
27
25
  1
@@ -49,7 +47,7 @@ class T {
49
47
  "result[getIndexFromCoords2D(coords, uniforms.outShape)] = T0[getIndexFromCoords2D(vec2<i32>(yR, yC), uniforms.t0Shape)];"
50
48
  );
51
49
  return `
52
- ${x("index")} {
50
+ ${D("index")} {
53
51
  for(var i = 0; i < ${this.workPerThread}; i = i + 1) {
54
52
  let flatIndex = index * ${this.workPerThread} + i;
55
53
  if(flatIndex < uniforms.size) {
@@ -86,8 +84,8 @@ function m(n, t, e) {
86
84
  }
87
85
  const l = e.runWebGPUProgram(u, i, i[0].dtype, f);
88
86
  i.forEach((o) => e.disposeData(o.dataId));
89
- const g = y({ inputs: { x: l }, backend: e, attrs: { shape: s } });
90
- return e.disposeData(l.dataId), g.packed = !0, g;
87
+ const y = g({ inputs: { x: l }, backend: e, attrs: { shape: s } });
88
+ return e.disposeData(l.dataId), y;
91
89
  }
92
90
  function P(n, t, e) {
93
91
  const a = d(
@@ -95,7 +93,7 @@ function P(n, t, e) {
95
93
  t
96
94
  );
97
95
  return { tensors2D: n.map(
98
- (s) => y({
96
+ (s) => g({
99
97
  inputs: { x: s },
100
98
  backend: e,
101
99
  attrs: {
@@ -105,7 +103,7 @@ function P(n, t, e) {
105
103
  ), outShape: a };
106
104
  }
107
105
  function w(n) {
108
- const { inputs: t, backend: e, attrs: a } = n, { axis: i } = a, s = F(i, t[0].shape)[0], h = t.map((r) => r.shape);
106
+ const { inputs: t, backend: e, attrs: a } = n, { axis: i } = a, s = I(i, t[0].shape)[0], h = t.map((r) => r.shape);
109
107
  L(h, s);
110
108
  const u = d(
111
109
  t.map((r) => r.shape),
@@ -121,7 +119,7 @@ const v = {
121
119
  backendName: "webgpu",
122
120
  kernelFunc: w
123
121
  };
124
- $(v);
122
+ x(v);
125
123
  export {
126
124
  T as ConcatProgram,
127
125
  v as concatConfig
@@ -1,8 +1,6 @@
1
- import { e as u } from "../../webgpu_program-Cigz-7RF.js";
2
- import { f as p, c as h } from "../../webgpu_util-BBCnKm2X.js";
3
- import "../../index-ZyQhjEPo.js";
4
- import { j as s } from "../../tensor-DdQUJZlz.js";
5
- import { r as c } from "../../tensor_util-DV-FP5Q3.js";
1
+ import { e as u } from "../../webgpu_program-DuOXPQol.js";
2
+ import { f as h, c as p } from "../../webgpu_util-RxEF33Rj.js";
3
+ import { p as c, ab as r } from "../../index-DOvlwCh-.js";
6
4
  class l {
7
5
  variableNames = ["labels", "logits", "values"];
8
6
  outputShape;
@@ -11,8 +9,8 @@ class l {
11
9
  dispatch;
12
10
  workgroupSize = [64, 1, 1];
13
11
  size = !0;
14
- constructor(e) {
15
- this.outputShape = [e], this.dispatchLayout = p(this.outputShape), this.dispatch = h(this.dispatchLayout, this.outputShape, this.workgroupSize);
12
+ constructor(t) {
13
+ this.outputShape = [t], this.dispatchLayout = h(this.outputShape), this.dispatch = p(this.dispatchLayout, this.outputShape, this.workgroupSize);
16
14
  }
17
15
  getUserCode() {
18
16
  return `
@@ -27,15 +25,15 @@ class l {
27
25
  `;
28
26
  }
29
27
  }
30
- function d(t) {
31
- const { logits: e, labels: a, values: r } = t.inputs, o = t.backend, i = a.shape[0];
32
- s(r.shape, [i], "Error in EfficientGatherSub: "), s(a.shape, [i], "Error in EfficientGatherSub: ");
28
+ function d(e) {
29
+ const { logits: t, labels: a, values: s } = e.inputs, o = e.backend, i = a.shape[0];
30
+ r(s.shape, [i], "Error in EfficientGatherSub: "), r(a.shape, [i], "Error in EfficientGatherSub: ");
33
31
  const n = new l(i);
34
- return o.runWebGPUProgram(n, [a, e, r], "float32");
32
+ return o.runWebGPUProgram(n, [a, t, s], "float32");
35
33
  }
36
- const f = {
34
+ const b = {
37
35
  kernelName: "EfficientGatherSub",
38
36
  backendName: "webgpu",
39
37
  kernelFunc: d
40
38
  };
41
- c(f);
39
+ c(b);