@genai-fi/nanogpt 0.6.3 → 0.7.1

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 (169) hide show
  1. package/dist/Generator.js +17 -13
  2. package/dist/NanoGPTModel.d.ts +2 -2
  3. package/dist/NanoGPTModel.js +104 -136
  4. package/dist/{RealDiv-BYViZwhN.js → RealDiv-CVYNbZxu.js} +30 -29
  5. package/dist/{Reshape-t7Kcikjk.js → Reshape-CEsEp0AI.js} +5 -5
  6. package/dist/Reshape-Do18N3gO.js +30 -0
  7. package/dist/TeachableLLM.js +9 -5
  8. package/dist/{TiedEmbedding-9WeDwvjO.js → TiedEmbedding-ccLBFiZi.js} +4 -4
  9. package/dist/{axis_util-Bu4h7XWV.js → axis_util-5DTW2tFV.js} +3 -3
  10. package/dist/backend.d.ts +1 -0
  11. package/dist/backend.js +7 -0
  12. package/dist/backend_util-C9Ut8n0Q.js +749 -0
  13. package/dist/{broadcast_to-DARN-DBD.js → broadcast_to-Ba9h_8DO.js} +2 -2
  14. package/dist/{concat-5aPGqw3Z.js → concat-CbXTetof.js} +8 -8
  15. package/dist/{dataset-pgqp-YfL.js → dataset-U3PrjwgU.js} +7 -7
  16. package/dist/{dropout-Bciw46HT.js → dropout-DPfPgWWe.js} +8 -8
  17. package/dist/{gather-DjyCjmOD.js → gather-Bbh8DHhM.js} +1 -1
  18. package/dist/gelu-BFwVnd1r.js +26 -0
  19. package/dist/gpgpu_math-DffelNS-.js +2371 -0
  20. package/dist/index-DYD_yPa-.js +12076 -0
  21. package/dist/{index-BAzbokzv.js → index-UdZhlibC.js} +414 -398
  22. package/dist/{kernel_funcs_utils-CUxJCg0g.js → kernel_funcs_utils-CXDy3EN7.js} +31 -30
  23. package/dist/layers/BaseLayer.js +2 -2
  24. package/dist/layers/CausalSelfAttention.js +8 -8
  25. package/dist/layers/MLP.js +5 -5
  26. package/dist/layers/RMSNorm.js +3 -3
  27. package/dist/layers/RoPECache.js +4 -4
  28. package/dist/layers/TiedEmbedding.js +5 -5
  29. package/dist/layers/TransformerBlock.js +1 -1
  30. package/dist/loader/loadTransformers.js +1 -1
  31. package/dist/loader/oldZipLoad.js +11 -7
  32. package/dist/{log_sum_exp-YEo2h3gb.js → log_sum_exp-BnmCkHWl.js} +16 -16
  33. package/dist/main.d.ts +13 -0
  34. package/dist/main.js +44 -23
  35. package/dist/{mat_mul-7121rsJk.js → mat_mul-dwmZz69e.js} +4 -4
  36. package/dist/{max-DtlIuVeW.js → max-ByjEGoFx.js} +3 -3
  37. package/dist/{mulmat_packed_gpu-D4nKF7Je.js → mulmat_packed_gpu-IGPBp6h9.js} +1 -1
  38. package/dist/non_max_suppression_impl-CsEgBuMA.js +134 -0
  39. package/dist/{ones-BBlSRqn1.js → ones-C8Mfln6-.js} +2 -2
  40. package/dist/ops/adamAdjust.d.ts +2 -0
  41. package/dist/ops/adamAdjust.js +9 -0
  42. package/dist/ops/adamMoments.d.ts +2 -0
  43. package/dist/ops/adamMoments.js +9 -0
  44. package/dist/ops/appendCache.js +3 -3
  45. package/dist/ops/attentionMask.js +1 -1
  46. package/dist/ops/cpu/adamAdjust.d.ts +1 -0
  47. package/dist/ops/cpu/adamAdjust.js +18 -0
  48. package/dist/ops/cpu/adamMoments.d.ts +1 -0
  49. package/dist/ops/cpu/adamMoments.js +16 -0
  50. package/dist/ops/cpu/appendCache.js +8 -8
  51. package/dist/ops/cpu/attentionMask.js +9 -9
  52. package/dist/ops/cpu/fusedSoftmax.js +17 -11
  53. package/dist/ops/cpu/gatherSub.js +7 -7
  54. package/dist/ops/cpu/gelu.js +13 -13
  55. package/dist/ops/cpu/matMulGelu.js +36 -24
  56. package/dist/ops/cpu/matMulMul.js +14 -8
  57. package/dist/ops/cpu/mulDropout.js +9 -3
  58. package/dist/ops/cpu/normRMS.js +5 -5
  59. package/dist/ops/cpu/qkv.js +3 -3
  60. package/dist/ops/cpu/rope.js +5 -5
  61. package/dist/ops/cpu/scatterSub.js +11 -11
  62. package/dist/ops/fusedSoftmax.js +1 -1
  63. package/dist/ops/gatherSub.js +1 -1
  64. package/dist/ops/gelu.js +2 -2
  65. package/dist/ops/grads/attentionMask.js +1 -1
  66. package/dist/ops/grads/fusedSoftmax.js +2 -2
  67. package/dist/ops/grads/gelu.js +3 -24
  68. package/dist/ops/grads/matMulGelu.js +5 -5
  69. package/dist/ops/grads/normRMS.js +6 -6
  70. package/dist/ops/grads/qkv.js +1 -1
  71. package/dist/ops/grads/rope.js +3 -3
  72. package/dist/ops/matMulGelu.js +1 -1
  73. package/dist/ops/matMulMul.js +1 -1
  74. package/dist/ops/mulDrop.js +1 -1
  75. package/dist/ops/normRMS.js +1 -1
  76. package/dist/ops/qkv.js +1 -1
  77. package/dist/ops/rope.js +4 -4
  78. package/dist/ops/scatterSub.js +1 -1
  79. package/dist/ops/webgl/adamAdjust.d.ts +1 -0
  80. package/dist/ops/webgl/adamAdjust.js +50 -0
  81. package/dist/ops/webgl/adamMoments.d.ts +1 -0
  82. package/dist/ops/webgl/adamMoments.js +38 -0
  83. package/dist/ops/webgl/appendCache.js +1 -1
  84. package/dist/ops/webgl/attentionMask.js +1 -1
  85. package/dist/ops/webgl/fusedSoftmax.js +4 -4
  86. package/dist/ops/webgl/gatherSub.js +8 -8
  87. package/dist/ops/webgl/gelu.js +2 -2
  88. package/dist/ops/webgl/log.js +5 -5
  89. package/dist/ops/webgl/matMulGelu.js +17 -17
  90. package/dist/ops/webgl/matMulMul.js +1 -1
  91. package/dist/ops/webgl/mulDropout.js +4 -4
  92. package/dist/ops/webgl/normRMS.js +2 -2
  93. package/dist/ops/webgl/qkv.js +1 -1
  94. package/dist/ops/webgl/rope.js +1 -1
  95. package/dist/ops/webgl/scatterSub.js +1 -1
  96. package/dist/ops/webgpu/adamAdjust.d.ts +1 -0
  97. package/dist/ops/webgpu/adamAdjust.js +52 -0
  98. package/dist/ops/webgpu/adamMoments.d.ts +1 -0
  99. package/dist/ops/webgpu/adamMoments.js +51 -0
  100. package/dist/ops/webgpu/appendCache.d.ts +1 -0
  101. package/dist/ops/webgpu/appendCache.js +57 -0
  102. package/dist/ops/webgpu/attentionMask.d.ts +1 -0
  103. package/dist/ops/webgpu/attentionMask.js +65 -0
  104. package/dist/ops/webgpu/gatherSub.d.ts +1 -0
  105. package/dist/ops/webgpu/gatherSub.js +52 -0
  106. package/dist/ops/webgpu/gelu.d.ts +14 -0
  107. package/dist/ops/webgpu/gelu.js +87 -0
  108. package/dist/ops/webgpu/index.d.ts +0 -0
  109. package/dist/ops/webgpu/index.js +11 -0
  110. package/dist/ops/webgpu/normRMS.d.ts +1 -0
  111. package/dist/ops/webgpu/normRMS.js +41 -0
  112. package/dist/ops/webgpu/normRMSGrad.d.ts +1 -0
  113. package/dist/ops/webgpu/normRMSGrad.js +128 -0
  114. package/dist/ops/webgpu/qkv.d.ts +1 -0
  115. package/dist/ops/webgpu/qkv.js +57 -0
  116. package/dist/ops/webgpu/rope.d.ts +1 -0
  117. package/dist/ops/webgpu/rope.js +69 -0
  118. package/dist/ops/webgpu/scatterSub.d.ts +1 -0
  119. package/dist/ops/webgpu/scatterSub.js +38 -0
  120. package/dist/ops/webgpu/utils/reductions.d.ts +9 -0
  121. package/dist/ops/webgpu/utils/reductions.js +68 -0
  122. package/dist/{ops-C0sQEcPw.js → ops-aRTXR2Sr.js} +433 -508
  123. package/dist/{random_width-DWzaOgrn.js → random_width-DbSpgl4o.js} +144 -144
  124. package/dist/{range-DYsrnfiy.js → range-D9CZhVlR.js} +1 -1
  125. package/dist/{reciprocal-CJQeasVa.js → reciprocal-CGB48wZB.js} +1 -1
  126. package/dist/{register_all_kernels-BfFCQAqs.js → register_all_kernels-DnbAyBXt.js} +203 -200
  127. package/dist/{reshape-krWGKraP.js → reshape-BR0eoLYN.js} +1 -1
  128. package/dist/{scatter_nd_util-93ln7Hut.js → scatter_nd_util-OjyAxku2.js} +3 -3
  129. package/dist/{selu_util-sntGesxr.js → selu_util-Ce6pu9IM.js} +44 -44
  130. package/dist/{shared-Ca6iDobD.js → shared-Czipaeb6.js} +541 -606
  131. package/dist/shared-DS5waSIY.js +69 -0
  132. package/dist/{sin-D_h-qCSx.js → sin-CiBxrDqX.js} +1 -1
  133. package/dist/slice-BHbDHObE.js +28 -0
  134. package/dist/{softmax-fsdtf6JC.js → softmax-JMEIUo2J.js} +1 -1
  135. package/dist/{split-eiktj-6L.js → split-CRU0PjVV.js} +4 -4
  136. package/dist/{stack-dfEEz2OY.js → stack-ikk2Y8_P.js} +2 -2
  137. package/dist/{sum-BE_Irnim.js → sum-NLYbiDag.js} +3 -3
  138. package/dist/{tensor-Xyi595sG.js → tensor-Do9PKbIE.js} +1 -1
  139. package/dist/{tensor2d-CPEkynbH.js → tensor2d-CWHxHpLh.js} +1 -1
  140. package/dist/training/Adam.d.ts +22 -0
  141. package/dist/training/Adam.js +93 -0
  142. package/dist/training/AdamExt.d.ts +1 -1
  143. package/dist/training/AdamExt.js +13 -12
  144. package/dist/training/DatasetBuilder.js +2 -2
  145. package/dist/training/Evaluator.js +1 -1
  146. package/dist/training/FullTrainer.js +27 -27
  147. package/dist/training/Trainer.d.ts +5 -6
  148. package/dist/training/Trainer.js +54 -55
  149. package/dist/training/sparseCrossEntropy.d.ts +0 -4
  150. package/dist/training/sparseCrossEntropy.js +7 -7
  151. package/dist/utilities/arrayClose.d.ts +1 -0
  152. package/dist/utilities/arrayClose.js +11 -0
  153. package/dist/utilities/dummy.js +19 -19
  154. package/dist/utilities/generate.js +15 -16
  155. package/dist/utilities/multinomialCPU.d.ts +2 -0
  156. package/dist/utilities/multinomialCPU.js +13 -0
  157. package/dist/utilities/performance.d.ts +2 -0
  158. package/dist/utilities/performance.js +16 -0
  159. package/dist/utilities/profile.d.ts +1 -0
  160. package/dist/utilities/profile.js +9 -6
  161. package/dist/utilities/safetensors.js +2 -2
  162. package/dist/utilities/weights.js +2 -2
  163. package/dist/{variable-wSS22xj5.js → variable-BTBkayv_.js} +1 -1
  164. package/dist/webgpu_program-WaoMq-WD.js +548 -0
  165. package/dist/webgpu_util-DhSeP4b6.js +80 -0
  166. package/dist/{zeros-YJDE7oRb.js → zeros-DnPT2nD4.js} +10 -10
  167. package/package.json +2 -1
  168. package/dist/gpgpu_math-CNslybmD.js +0 -3115
  169. package/dist/norm-CzltS9Fz.js +0 -86
@@ -1,4 +1,4 @@
1
- import { o, q as t, E as a, D as p } from "./index-BAzbokzv.js";
1
+ import { B as o, C as t, E as a, K as p } from "./index-UdZhlibC.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1,4 +1,4 @@
1
- import { g as p, W as w } from "./index-BAzbokzv.js";
1
+ import { j as p, a1 as w } from "./index-UdZhlibC.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)
@@ -31,7 +31,7 @@ function $(o, t, r) {
31
31
  }
32
32
  k(r, t, o);
33
33
  }
34
- function g(o, t, r) {
34
+ function m(o, t, r) {
35
35
  const n = t.shape.length, e = n > 1 ? t.shape[n - 1] : 1, h = r.length;
36
36
  let a = 1;
37
37
  for (let s = e; s < h; ++s)
@@ -41,6 +41,6 @@ function g(o, t, r) {
41
41
  }
42
42
  export {
43
43
  k as a,
44
- g as c,
44
+ m as c,
45
45
  $ as v
46
46
  };
@@ -1,6 +1,6 @@
1
- import { i as N, ao as H, o as _, q as S, E as L, ap as te, aq as ne, al as se, an as re, ar as ie, as as oe, at as le, a as ue, au as fe, av as O } from "./index-BAzbokzv.js";
2
- import { r as ce } from "./reshape-krWGKraP.js";
3
- import { s as ae } from "./sum-BE_Irnim.js";
1
+ import { l as N, aq as H, B as _, C as S, E as L, ar as te, as as ne, an as se, ap as re, at as ie, au as oe, av as le, a as ue, aw as fe, ax as O } from "./index-UdZhlibC.js";
2
+ import { r as ce } from "./reshape-BR0eoLYN.js";
3
+ import { s as ae } from "./sum-NLYbiDag.js";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -17,11 +17,11 @@ import { s as ae } from "./sum-BE_Irnim.js";
17
17
  * limitations under the License.
18
18
  * =============================================================================
19
19
  */
20
- function Xe(e, t, n, s, r = "NHWC", u) {
20
+ function Be(e, t, n, s, r = "NHWC", u) {
21
21
  const i = e[3], o = [...t, i], c = Ae(r);
22
- return X(e, o, n, u, s, null, null, c);
22
+ return B(e, o, n, u, s, null, null, c);
23
23
  }
24
- function Be(e, t, n, s, r, u, i = "channelsLast") {
24
+ function Xe(e, t, n, s, r, u, i = "channelsLast") {
25
25
  const [o, c] = T(t);
26
26
  let a;
27
27
  if (i === "channelsLast")
@@ -30,7 +30,7 @@ function Be(e, t, n, s, r, u, i = "channelsLast") {
30
30
  a = [o, c, e[1], e[1]];
31
31
  else
32
32
  throw new Error(`Unknown dataFormat ${i}`);
33
- return X(e, a, n, s, r, u, !1, i);
33
+ return B(e, a, n, s, r, u, !1, i);
34
34
  }
35
35
  function je(e, t, n, s, r, u, i = "NDHWC") {
36
36
  const [o, c, a] = W(t);
@@ -43,7 +43,7 @@ function je(e, t, n, s, r, u, i = "NDHWC") {
43
43
  throw new Error(`Unknown dataFormat ${i}`);
44
44
  return he(e, p, n, s, r, !1, g, u);
45
45
  }
46
- function X(e, t, n, s, r, u, i = !1, o = "channelsLast") {
46
+ function B(e, t, n, s, r, u, i = !1, o = "channelsLast") {
47
47
  let [c, a, p, g] = [-1, -1, -1, -1];
48
48
  if (o === "channelsLast")
49
49
  [c, a, p, g] = e;
@@ -51,7 +51,7 @@ function X(e, t, n, s, r, u, i = !1, o = "channelsLast") {
51
51
  [c, g, a, p] = e;
52
52
  else
53
53
  throw new Error(`Unknown dataFormat ${o}`);
54
- const [l, h, , d] = t, [A, m] = T(n), [b, k] = T(s), f = G(l, b), E = G(h, k), { padInfo: w, outHeight: I, outWidth: x } = de(r, a, p, A, m, f, E, u, o), y = i ? d * g : d;
54
+ const [l, h, , d] = t, [A, m] = T(n), [b, k] = T(s), f = G(l, b), w = G(h, k), { padInfo: E, outHeight: I, outWidth: x } = de(r, a, p, A, m, f, w, u, o), y = i ? d * g : d;
55
55
  let $;
56
56
  return o === "channelsFirst" ? $ = [c, y, I, x] : o === "channelsLast" && ($ = [c, I, x, y]), {
57
57
  batchSize: c,
@@ -62,13 +62,13 @@ function X(e, t, n, s, r, u, i = !1, o = "channelsLast") {
62
62
  outHeight: I,
63
63
  outWidth: x,
64
64
  outChannels: y,
65
- padInfo: w,
65
+ padInfo: E,
66
66
  strideHeight: A,
67
67
  strideWidth: m,
68
68
  filterHeight: l,
69
69
  filterWidth: h,
70
70
  effectiveFilterHeight: f,
71
- effectiveFilterWidth: E,
71
+ effectiveFilterWidth: w,
72
72
  dilationHeight: b,
73
73
  dilationWidth: k,
74
74
  inShape: e,
@@ -84,7 +84,7 @@ function he(e, t, n, s, r, u = !1, i = "channelsLast", o) {
84
84
  [c, l, a, p, g] = e;
85
85
  else
86
86
  throw new Error(`Unknown dataFormat ${i}`);
87
- const [h, d, A, , m] = t, [b, k, f] = W(n), [E, w, I] = W(s), x = G(h, E), y = G(d, w), $ = G(A, I), { padInfo: C, outDepth: M, outHeight: D, outWidth: F } = me(r, a, p, g, b, k, f, x, y, $, o), V = u ? m * l : m;
87
+ const [h, d, A, , m] = t, [b, k, f] = W(n), [w, E, I] = W(s), x = G(h, w), y = G(d, E), $ = G(A, I), { padInfo: C, outDepth: M, outHeight: D, outWidth: F } = me(r, a, p, g, b, k, f, x, y, $, o), V = u ? m * l : m;
88
88
  let U;
89
89
  return i === "channelsFirst" ? U = [c, V, M, D, F] : i === "channelsLast" && (U = [c, M, D, F, V]), {
90
90
  batchSize: c,
@@ -107,8 +107,8 @@ function he(e, t, n, s, r, u = !1, i = "channelsLast", o) {
107
107
  effectiveFilterDepth: x,
108
108
  effectiveFilterHeight: y,
109
109
  effectiveFilterWidth: $,
110
- dilationDepth: E,
111
- dilationHeight: w,
110
+ dilationDepth: w,
111
+ dilationHeight: E,
112
112
  dilationWidth: I,
113
113
  inShape: e,
114
114
  outShape: U,
@@ -116,18 +116,18 @@ function he(e, t, n, s, r, u = !1, i = "channelsLast", o) {
116
116
  };
117
117
  }
118
118
  function ge(e, t, n, s, r) {
119
- s == null && (s = B(e, t, n));
119
+ s == null && (s = X(e, t, n));
120
120
  const u = e[0], i = e[1], o = R((u - t + 2 * s) / n + 1, r), c = R((i - t + 2 * s) / n + 1, r);
121
121
  return [o, c];
122
122
  }
123
123
  function pe(e, t, n, s, r, u) {
124
- r == null && (r = B(e, t[0], s[0]));
124
+ r == null && (r = X(e, t[0], s[0]));
125
125
  const i = [0, 0, 0, n];
126
126
  for (let o = 0; o < 3; o++)
127
127
  e[o] + 2 * r >= t[o] && (i[o] = R((e[o] - t[o] + 2 * r) / s[o] + 1, u));
128
128
  return i;
129
129
  }
130
- function B(e, t, n, s = 1) {
130
+ function X(e, t, n, s = 1) {
131
131
  const r = G(t, s);
132
132
  return Math.floor((e[0] * (n - 1) - n + r) / 2);
133
133
  }
@@ -175,8 +175,8 @@ function me(e, t, n, s, r, u, i, o, c, a, p) {
175
175
  l = m[0], h = m[1], d = m[2];
176
176
  } else if (e === "same") {
177
177
  l = Math.ceil(t / r), h = Math.ceil(n / u), d = Math.ceil(s / i);
178
- const A = (l - 1) * r + o - t, m = (h - 1) * u + c - n, b = (d - 1) * i + a - s, k = Math.floor(A / 2), f = A - k, E = Math.floor(m / 2), w = m - E, I = Math.floor(b / 2), x = b - I;
179
- g = { top: E, bottom: w, left: I, right: x, front: k, back: f, type: "SAME" };
178
+ const A = (l - 1) * r + o - t, m = (h - 1) * u + c - n, b = (d - 1) * i + a - s, k = Math.floor(A / 2), f = A - k, w = Math.floor(m / 2), E = m - w, I = Math.floor(b / 2), x = b - I;
179
+ g = { top: w, bottom: E, left: I, right: x, front: k, back: f, type: "SAME" };
180
180
  } else
181
181
  throw Error(`Unknown padding parameter: ${e}`);
182
182
  return { padInfo: g, outDepth: l, outHeight: h, outWidth: d };
@@ -244,11 +244,11 @@ function Qe(e, t, n) {
244
244
  * limitations under the License.
245
245
  * =============================================================================
246
246
  */
247
- function Ee(e) {
247
+ function we(e) {
248
248
  const n = { x: S(e, "x", "sigmoid", "float32") };
249
249
  return L.runKernel(te, n);
250
250
  }
251
- const we = /* @__PURE__ */ _({ sigmoid_: Ee });
251
+ const Ee = /* @__PURE__ */ _({ sigmoid_: we });
252
252
  /**
253
253
  * @license
254
254
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -417,7 +417,7 @@ function ze(e, t, n, s) {
417
417
  if (t === "leakyrelu")
418
418
  return xe(e, s);
419
419
  if (t === "sigmoid")
420
- return we(e);
420
+ return Ee(e);
421
421
  throw new Error(`Unknown fused activation ${t}.`);
422
422
  }
423
423
  const et = (e, t) => !(e > 0) || t === "linear";
@@ -600,43 +600,43 @@ function We(e, t, n, s, r, u, i, o, c) {
600
600
  for (let f = 0; f < e.length; ++f) {
601
601
  if (l.strides[f] === 0)
602
602
  throw Error(`strides[${f}] must be non-zero`);
603
- const E = !!(l.shrinkAxisMask & 1 << f), w = e[f];
604
- if (w === -1) {
605
- m.push(E ? 1 : -1);
603
+ const w = !!(l.shrinkAxisMask & 1 << f), E = e[f];
604
+ if (E === -1) {
605
+ m.push(w ? 1 : -1);
606
606
  continue;
607
607
  }
608
608
  const I = [l.beginMask & 1 << f, l.endMask & 1 << f], x = [
609
609
  l.strides[f] > 0 ? 0 : -1,
610
- l.strides[f] > 0 ? w : w - 1
610
+ l.strides[f] > 0 ? E : E - 1
611
611
  ];
612
- if (E && l.strides[f] <= 0)
612
+ if (w && l.strides[f] <= 0)
613
613
  throw Error("only stride 1 allowed on non-range indexing.");
614
614
  A = A && l.strides[f] === 1;
615
615
  const y = !!(l.beginMask & 1 << f && l.endMask & 1 << f);
616
616
  if (l.beginValid && l.endValid) {
617
- if (E) {
618
- const D = l.begin[f] < 0 ? w + l.begin[f] : l.begin[f];
619
- if (l.begin[f] = D, l.end[f] = l.begin[f] + 1, D < 0 || D >= w)
617
+ if (w) {
618
+ const D = l.begin[f] < 0 ? E + l.begin[f] : l.begin[f];
619
+ if (l.begin[f] = D, l.end[f] = l.begin[f] + 1, D < 0 || D >= E)
620
620
  throw Error(`slice index ${l.begin[f]} of dimension ${f} out of bounds.`);
621
621
  } else
622
- l.begin[f] = K(l.begin[f], 0, l.strides[f], w, I, x), l.end[f] = K(l.end[f], 1, l.strides[f], w, I, x);
623
- const M = l.strides[f] === 1 && l.begin[f] === 0 && l.end[f] === w;
622
+ l.begin[f] = K(l.begin[f], 0, l.strides[f], E, I, x), l.end[f] = K(l.end[f], 1, l.strides[f], E, I, x);
623
+ const M = l.strides[f] === 1 && l.begin[f] === 0 && l.end[f] === E;
624
624
  h = h && M, d = d && (f === 0 && l.strides[f] === 1 || M);
625
625
  } else
626
626
  h = h && l.strides[f] === 1 && y, d = d && (f === 0 && l.strides[f] === 1 || y);
627
627
  let $, C = !1;
628
- if (l.beginValid && l.endValid ? ($ = l.end[f] - l.begin[f], C = !0) : E ? ($ = 1, C = !0) : y && w >= 0 && (l.strides[f] < 0 ? $ = -w : $ = w, C = !0), C) {
628
+ if (l.beginValid && l.endValid ? ($ = l.end[f] - l.begin[f], C = !0) : w ? ($ = 1, C = !0) : y && E >= 0 && (l.strides[f] < 0 ? $ = -E : $ = E, C = !0), C) {
629
629
  let M;
630
630
  $ === 0 || $ < 0 != l.strides[f] < 0 ? M = 0 : M = Math.trunc($ / l.strides[f]) + ($ % l.strides[f] !== 0 ? 1 : 0), m.push(M);
631
631
  } else
632
632
  m.push(-1);
633
633
  }
634
634
  for (let f = 0; f < l.finalShapeGatherIndices.length; ++f) {
635
- const E = l.finalShapeGatherIndices[f];
636
- E >= 0 ? b.push(m[E]) : E === v && b.push(1);
635
+ const w = l.finalShapeGatherIndices[f];
636
+ w >= 0 ? b.push(m[w]) : w === v && b.push(1);
637
637
  }
638
638
  return {
639
- finalShapeSparse: b.filter((f, E) => l.finalShapeGatherIndices[E] !== v),
639
+ finalShapeSparse: b.filter((f, w) => l.finalShapeGatherIndices[w] !== v),
640
640
  finalShape: b,
641
641
  isIdentity: h,
642
642
  sliceDim0: d,
@@ -707,18 +707,18 @@ const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
707
707
  const nt = 1.7580993408473768, st = 1.0507009873554805;
708
708
  export {
709
709
  Me as A,
710
- Ne as B,
711
- We as C,
712
- Re as D,
710
+ We as B,
711
+ Re as C,
712
+ Ne as D,
713
713
  st as S,
714
714
  nt as a,
715
715
  ze as b,
716
716
  Qe as c,
717
- X as d,
717
+ B as d,
718
718
  he as e,
719
- B as f,
720
- Xe as g,
721
- Be as h,
719
+ X as f,
720
+ Be as g,
721
+ Xe as h,
722
722
  je as i,
723
723
  Ae as j,
724
724
  qe as k,
@@ -733,7 +733,7 @@ export {
733
733
  P as t,
734
734
  Ve as u,
735
735
  Le as v,
736
- we as w,
736
+ Ee as w,
737
737
  $e as x,
738
738
  Se as y,
739
739
  xe as z