@genai-fi/nanogpt 0.5.1 → 0.5.2

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 (102) hide show
  1. package/dist/Generator.js +90 -41
  2. package/dist/NanoGPTModel.d.ts +1 -0
  3. package/dist/NanoGPTModel.js +86 -73
  4. package/dist/{Reshape-BE5rA4rT.js → Reshape-Bt_t7RNz.js} +4 -4
  5. package/dist/TeachableLLM.js +1 -1
  6. package/dist/TiedEmbedding-DORsPlNL.js +44 -0
  7. package/dist/{axis_util-97KkkyRQ.js → axis_util-CVbf1vmL.js} +3 -3
  8. package/dist/{broadcast_to-CMlkG8NS.js → broadcast_to-BBoMQXbL.js} +4 -4
  9. package/dist/{concat-Cxbo2sOz.js → concat-BRRtq4S2.js} +1 -1
  10. package/dist/dataset-ZHEPJmED.js +1226 -0
  11. package/dist/{dropout-kbDY39Ci.js → dropout-lQm_YyX3.js} +1 -1
  12. package/dist/{gather-Bxe1Qip8.js → gather-BWyutxwi.js} +3 -3
  13. package/dist/{gpgpu_math-C0zyxKFi.js → gpgpu_math-Df7gzJWH.js} +1 -1
  14. package/dist/{index-iNhkcAEQ.js → index-CnHyhpKc.js} +32 -32
  15. package/dist/{kernel_funcs_utils-C4eIk4fE.js → kernel_funcs_utils-Dqo82NH4.js} +25 -25
  16. package/dist/layers/BaseLayer.js +114 -3
  17. package/dist/layers/CausalSelfAttention.js +29 -28
  18. package/dist/layers/MLP.js +10 -9
  19. package/dist/layers/RMSNorm.js +12 -11
  20. package/dist/layers/RoPECache.js +3 -3
  21. package/dist/layers/TiedEmbedding.js +8 -6
  22. package/dist/layers/TransformerBlock.js +2 -2
  23. package/dist/{log_sum_exp-CkumwesB.js → log_sum_exp-CRH7Np9v.js} +12 -12
  24. package/dist/main.js +1 -1
  25. package/dist/{mat_mul-D0SifYfJ.js → mat_mul-DeGU1U_C.js} +3 -3
  26. package/dist/{max-CYaAjEEp.js → max-CcnEArWK.js} +3 -3
  27. package/dist/{moments-B06NlR_V.js → moments-DLTE6-1p.js} +4 -4
  28. package/dist/{norm-D3676xIo.js → norm-BpWsOapl.js} +5 -5
  29. package/dist/{ones-BIeFnPHR.js → ones-CDWGzVnm.js} +6 -6
  30. package/dist/ops/appendCache.js +3 -3
  31. package/dist/ops/attentionMask.js +1 -1
  32. package/dist/ops/cpu/appendCache.js +2 -2
  33. package/dist/ops/cpu/attentionMask.js +5 -5
  34. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  35. package/dist/ops/cpu/gatherSub.js +5 -5
  36. package/dist/ops/cpu/gelu.js +1 -1
  37. package/dist/ops/cpu/matMulGelu.js +1 -1
  38. package/dist/ops/cpu/matMulMul.js +1 -1
  39. package/dist/ops/cpu/mulDropout.js +1 -1
  40. package/dist/ops/cpu/normRMS.js +1 -1
  41. package/dist/ops/cpu/qkv.js +3 -3
  42. package/dist/ops/cpu/rope.js +5 -5
  43. package/dist/ops/cpu/scatterSub.js +27 -27
  44. package/dist/ops/fusedSoftmax.js +1 -1
  45. package/dist/ops/gatherSub.js +1 -1
  46. package/dist/ops/gelu.js +1 -1
  47. package/dist/ops/grads/attentionMask.js +1 -1
  48. package/dist/ops/grads/fusedSoftmax.js +2 -2
  49. package/dist/ops/grads/gelu.js +1 -1
  50. package/dist/ops/grads/matMulGelu.js +1 -1
  51. package/dist/ops/grads/normRMS.js +1 -1
  52. package/dist/ops/grads/qkv.js +1 -1
  53. package/dist/ops/grads/rope.js +1 -1
  54. package/dist/ops/matMulGelu.js +1 -1
  55. package/dist/ops/matMulMul.js +1 -1
  56. package/dist/ops/mulDrop.js +1 -1
  57. package/dist/ops/node/sparseCrossEntropy.js +1 -1
  58. package/dist/ops/normRMS.js +1 -1
  59. package/dist/ops/qkv.js +1 -1
  60. package/dist/ops/scatterSub.js +1 -1
  61. package/dist/ops/webgl/appendCache.js +1 -1
  62. package/dist/ops/webgl/attentionMask.js +1 -1
  63. package/dist/ops/webgl/fusedSoftmax.js +36 -36
  64. package/dist/ops/webgl/gatherSub.js +1 -1
  65. package/dist/ops/webgl/gelu.js +2 -2
  66. package/dist/ops/webgl/matMulGelu.js +22 -22
  67. package/dist/ops/webgl/matMulMul.js +1 -1
  68. package/dist/ops/webgl/mulDropout.js +1 -1
  69. package/dist/ops/webgl/normRMS.js +2 -2
  70. package/dist/ops/webgl/qkv.js +1 -1
  71. package/dist/ops/webgl/rope.js +1 -1
  72. package/dist/ops/webgl/scatterSub.js +1 -1
  73. package/dist/{ops-ObfXLHYQ.js → ops-DzQTmLIl.js} +60 -60
  74. package/dist/{TiedEmbedding-DsDRvLB0.js → random_width-DI2h9CMs.js} +1215 -1250
  75. package/dist/{range-BsFU-SNG.js → range-CkOJ7090.js} +1 -1
  76. package/dist/{reshape-DxTPgnwL.js → reshape-CTIbqjwm.js} +1 -1
  77. package/dist/{sin-BOX-JVAj.js → sin-HzioENy_.js} +5 -5
  78. package/dist/{slice_util-D-kaD4ZV.js → slice_util-n4wHKmex.js} +1 -1
  79. package/dist/{softmax-BjsptB07.js → softmax-DX6qXAbm.js} +2 -2
  80. package/dist/{split-BCbrzthj.js → split-CVwhL8Oe.js} +3 -3
  81. package/dist/{stack--cqr9Dgc.js → stack-S2-D2JAQ.js} +1 -1
  82. package/dist/{sum-B_92TaHD.js → sum-UdfvaNhB.js} +4 -4
  83. package/dist/{tensor-CfiPXsW4.js → tensor-IZex6Bwp.js} +1 -1
  84. package/dist/{tensor2d-tSxWdFMH.js → tensor2d-CqtBzOKq.js} +1 -1
  85. package/dist/{tfjs_backend-NucKez4s.js → tfjs_backend-DX9yVvwk.js} +41 -41
  86. package/dist/tokeniser/CharTokeniser.js +27 -27
  87. package/dist/tokeniser/bpe.d.ts +1 -0
  88. package/dist/tokeniser/bpe.js +38 -35
  89. package/dist/training/AdamExt.js +1 -1
  90. package/dist/training/DatasetBuilder.js +22 -1242
  91. package/dist/training/FullTrainer.js +1 -1
  92. package/dist/training/Trainer.js +5 -5
  93. package/dist/training/sparseCrossEntropy.js +4 -4
  94. package/dist/utilities/dummy.js +2 -2
  95. package/dist/utilities/generate.js +3 -3
  96. package/dist/utilities/load.js +1 -1
  97. package/dist/utilities/profile.js +1 -1
  98. package/dist/utilities/weights.js +2 -2
  99. package/dist/variable-BGvK-VN3.js +23 -0
  100. package/dist/{zeros-NMYTayy7.js → zeros-CYMicyqz.js} +3 -3
  101. package/package.json +1 -1
  102. package/dist/BaseLayer-BhrMN8JO.js +0 -135
@@ -1,16 +1,16 @@
1
- import { o as h, i as l, E as f, aA as hn, k as p, aB as fn, N as w, aC as dn, aD as bn, aE as gn, T as $n, ah as xn, q as j, aF as kn, aG as yn, aH as In, aI as _n, aJ as En, aK as Nn, aL as Mn, y as D, aM as An, aN as Tn, aO as Sn, aP as wn, H as zn, I as Bn, J as qn, aQ as Gn, t as Kn, aR as J, aS as Rn, aT as Dn, aU as Pn, aV as Vn, aW as vn, aX as jn, f as Fn, aY as Wn, aZ as On, b as k, a9 as Z, ai as K, g as Yn, s as S, a_ as Cn, x as L, a as Jn } from "./index-iNhkcAEQ.js";
2
- import { r as _ } from "./reshape-DxTPgnwL.js";
3
- import { s as un } from "./split-BCbrzthj.js";
4
- import { s as q } from "./sum-B_92TaHD.js";
5
- import { b as X } from "./broadcast_to-CMlkG8NS.js";
6
- import { r as O } from "./range-BsFU-SNG.js";
7
- import { t as Ln } from "./tensor-CfiPXsW4.js";
8
- import { s as Y } from "./stack--cqr9Dgc.js";
9
- import { c as Xn, z as Hn } from "./zeros-NMYTayy7.js";
10
- import { n as ln } from "./norm-D3676xIo.js";
11
- import { c as H } from "./concat-Cxbo2sOz.js";
12
- import { m as T } from "./mat_mul-D0SifYfJ.js";
13
- import { t as Q } from "./tensor2d-tSxWdFMH.js";
1
+ import { o as h, j as l, E as f, aA as hn, l as p, aB as fn, Q as w, aC as dn, aD as bn, aE as gn, L as $n, al as xn, u as j, aF as kn, aG as yn, aH as In, aI as _n, aJ as En, aK as Mn, aL as Nn, D, aM as An, aN as Tn, aO as Sn, aP as wn, I as zn, J as Bn, K as qn, aQ as Kn, t as Gn, aR as J, aS as Rn, aT as Dn, aU as Pn, aV as Vn, aW as vn, aX as jn, f as Fn, aY as Wn, aZ as On, b as k, a9 as Z, am as G, g as Yn, s as S, a_ as Cn, y as L, a as Jn } from "./index-CnHyhpKc.js";
2
+ import { r as _ } from "./reshape-CTIbqjwm.js";
3
+ import { s as un } from "./split-CVwhL8Oe.js";
4
+ import { s as q } from "./sum-UdfvaNhB.js";
5
+ import { b as X } from "./broadcast_to-BBoMQXbL.js";
6
+ import { r as O } from "./range-CkOJ7090.js";
7
+ import { t as Ln } from "./tensor-IZex6Bwp.js";
8
+ import { s as Y } from "./stack-S2-D2JAQ.js";
9
+ import { c as Xn, z as Qn } from "./zeros-CYMicyqz.js";
10
+ import { n as ln } from "./norm-BpWsOapl.js";
11
+ import { c as Q } from "./concat-BRRtq4S2.js";
12
+ import { m as T } from "./mat_mul-DeGU1U_C.js";
13
+ import { t as H } from "./tensor2d-CqtBzOKq.js";
14
14
  /**
15
15
  * @license
16
16
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -27,14 +27,14 @@ import { t as Q } from "./tensor2d-tSxWdFMH.js";
27
27
  * limitations under the License.
28
28
  * =============================================================================
29
29
  */
30
- function Qn(r, t, n) {
30
+ function Hn(r, t, n) {
31
31
  const e = l(r, "x", "slice", "string_or_numeric");
32
32
  if (e.rank === 0)
33
33
  throw new Error("Slicing scalar is not possible");
34
34
  const s = { x: e }, a = { begin: t, size: n };
35
35
  return f.runKernel(hn, s, a);
36
36
  }
37
- const N = /* @__PURE__ */ h({ slice_: Qn });
37
+ const M = /* @__PURE__ */ h({ slice_: Hn });
38
38
  /**
39
39
  * @license
40
40
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -126,7 +126,7 @@ function se(r, t = 0) {
126
126
  const e = { input: n }, s = { dim: t };
127
127
  return f.runKernel(gn, e, s);
128
128
  }
129
- const G = /* @__PURE__ */ h({ expandDims_: se });
129
+ const K = /* @__PURE__ */ h({ expandDims_: se });
130
130
  /**
131
131
  * @license
132
132
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -175,11 +175,11 @@ function re(r, t, n, e = "float32") {
175
175
  if (n == null)
176
176
  return o;
177
177
  if (n.length === 1)
178
- return W(G(o, 0), [n[0], 1, 1]);
178
+ return W(K(o, 0), [n[0], 1, 1]);
179
179
  if (n.length === 2)
180
- return W(G(G(o, 0), 0), [n[0], n[1], 1, 1]);
180
+ return W(K(K(o, 0), 0), [n[0], n[1], 1, 1]);
181
181
  if (n.length === 3)
182
- return W(G(G(G(o, 0), 0), 0), [
182
+ return W(K(K(K(o, 0), 0), 0), [
183
183
  n[0],
184
184
  n[1],
185
185
  n[2],
@@ -320,7 +320,7 @@ const pn = /* @__PURE__ */ h({ lessEqual_: me });
320
320
  */
321
321
  function he(r) {
322
322
  const n = { x: l(r, "x", "neg") };
323
- return f.runKernel(Nn, n);
323
+ return f.runKernel(Mn, n);
324
324
  }
325
325
  const nn = /* @__PURE__ */ h({ neg_: he });
326
326
  /**
@@ -343,7 +343,7 @@ function fe(r, t) {
343
343
  const n = l(r, "a", "logicalAnd", "bool"), e = l(t, "b", "logicalAnd", "bool");
344
344
  w(n.shape, e.shape);
345
345
  const s = { a: n, b: e };
346
- return f.runKernel(Mn, s);
346
+ return f.runKernel(Nn, s);
347
347
  }
348
348
  const de = /* @__PURE__ */ h({ logicalAnd_: fe });
349
349
  /**
@@ -448,7 +448,7 @@ const Ie = /* @__PURE__ */ h({ squeeze_: ye });
448
448
  * limitations under the License.
449
449
  * =============================================================================
450
450
  */
451
- function M(r, t) {
451
+ function N(r, t) {
452
452
  zn(r);
453
453
  const n = Bn(r, t);
454
454
  if (n.length !== 1)
@@ -475,7 +475,7 @@ function _e(r, t = 0) {
475
475
  const n = l(r, "x", "unstack", "string_or_numeric");
476
476
  p(t >= -n.shape.length && t < n.shape.length, () => `Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);
477
477
  const e = { value: n }, s = { axis: t };
478
- return f.runKernel(Gn, e, s);
478
+ return f.runKernel(Kn, e, s);
479
479
  }
480
480
  const mn = /* @__PURE__ */ h({ unstack_: _e });
481
481
  /**
@@ -501,7 +501,7 @@ function Ee(r, t, n) {
501
501
  }), e.rank <= 1)
502
502
  return e.clone();
503
503
  const s = { x: e }, a = { perm: t };
504
- return e.dtype === "complex64" ? Kn(() => {
504
+ return e.dtype === "complex64" ? Gn(() => {
505
505
  let o = $e(e), i = le(e);
506
506
  return o = f.runKernel(J, { x: o }, a), i = f.runKernel(J, { x: i }, a), n && (i = nn(i)), Xn(o, i);
507
507
  }) : f.runKernel(J, s, a);
@@ -523,13 +523,13 @@ const an = /* @__PURE__ */ h({ transpose_: Ee });
523
523
  * limitations under the License.
524
524
  * =============================================================================
525
525
  */
526
- function Ne(r, t, n, e, s = "bilinear", a = 0) {
526
+ function Me(r, t, n, e, s = "bilinear", a = 0) {
527
527
  const o = l(r, "image", "cropAndResize"), i = l(t, "boxes", "cropAndResize", "float32"), u = l(n, "boxInd", "cropAndResize", "int32"), c = i.shape[0];
528
528
  p(o.rank === 4, () => `Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`), p(i.rank === 2 && i.shape[1] === 4, () => `Error in cropAndResize: boxes must be have size [${c},4] but had shape ${i.shape}.`), p(u.rank === 1 && u.shape[0] === c, () => `Error in cropAndResize: boxInd must be have size [${c}] but had shape ${i.shape}.`), p(e.length === 2, () => `Error in cropAndResize: cropSize must be of length 2, but got length ${e.length}.`), p(e[0] >= 1 && e[1] >= 1, () => `cropSize must be atleast [1,1], but was ${e}`), p(s === "bilinear" || s === "nearest", () => `method must be bilinear or nearest, but was ${s}`);
529
529
  const d = { image: o, boxes: i, boxInd: u }, m = { method: s, extrapolationValue: a, cropSize: e };
530
530
  return f.runKernel(Rn, d, m);
531
531
  }
532
- const Me = /* @__PURE__ */ h({ cropAndResize_: Ne });
532
+ const Ne = /* @__PURE__ */ h({ cropAndResize_: Me });
533
533
  /**
534
534
  * @license
535
535
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -595,7 +595,7 @@ const we = /* @__PURE__ */ h({ grayscaleToRGB_: Se });
595
595
  function ze(r) {
596
596
  const t = l(r, "image", "RGBToGrayscale"), n = t.rank - 1, e = t.shape[n];
597
597
  p(t.rank >= 2, () => `Error in RGBToGrayscale: images must be at least rank 2, but got rank ${t.rank}.`), p(e === 3, () => `Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${e}.`);
598
- const s = t.dtype, a = D(t, "float32"), o = M([0.2989, 0.587, 0.114]);
598
+ const s = t.dtype, a = D(t, "float32"), o = N([0.2989, 0.587, 0.114]);
599
599
  let i;
600
600
  switch (t.rank) {
601
601
  case 2:
@@ -616,7 +616,7 @@ function ze(r) {
616
616
  default:
617
617
  throw new Error("Not a valid tensor rank.");
618
618
  }
619
- return i = G(i, -1), D(i, s);
619
+ return i = K(i, -1), D(i, s);
620
620
  }
621
621
  const Be = /* @__PURE__ */ h({ rgbToGrayscale_: ze });
622
622
  /**
@@ -641,7 +641,7 @@ function qe(r, t, n = 0, e = 0.5) {
641
641
  const a = { image: s }, o = { radians: t, fillValue: n, center: e };
642
642
  return f.runKernel(Pn, a, o);
643
643
  }
644
- const Ge = /* @__PURE__ */ h({ rotateWithOffset_: qe });
644
+ const Ke = /* @__PURE__ */ h({ rotateWithOffset_: qe });
645
645
  /**
646
646
  * @license
647
647
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -679,13 +679,13 @@ function P(r, t, n, e, s, a) {
679
679
  * limitations under the License.
680
680
  * =============================================================================
681
681
  */
682
- function Ke(r, t, n, e = 0.5, s = Number.NEGATIVE_INFINITY) {
682
+ function Ge(r, t, n, e = 0.5, s = Number.NEGATIVE_INFINITY) {
683
683
  const a = l(r, "boxes", "nonMaxSuppression", "float32"), o = l(t, "scores", "nonMaxSuppression", "float32"), i = P(a, o, n, e, s);
684
684
  n = i.maxOutputSize, e = i.iouThreshold, s = i.scoreThreshold;
685
685
  const u = { maxOutputSize: n, iouThreshold: e, scoreThreshold: s };
686
686
  return f.runKernel(Vn, { boxes: a, scores: o }, u);
687
687
  }
688
- const Re = /* @__PURE__ */ h({ nonMaxSuppression_: Ke });
688
+ const Re = /* @__PURE__ */ h({ nonMaxSuppression_: Ge });
689
689
  /**
690
690
  * @license
691
691
  * Copyright 2019 Google LLC. All Rights Reserved.
@@ -835,7 +835,7 @@ async function Ce(r, t, n, e = 0.5, s = Number.NEGATIVE_INFINITY) {
835
835
  const a = l(r, "boxes", "nonMaxSuppressionAsync"), o = l(t, "scores", "nonMaxSuppressionAsync"), i = P(a, o, n, e, s);
836
836
  n = i.maxOutputSize, e = i.iouThreshold, s = i.scoreThreshold;
837
837
  const u = await Promise.all([a.data(), o.data()]), c = u[0], d = u[1], { selectedIndices: m } = je(c, d, n, e, s);
838
- return a !== r && a.dispose(), o !== t && o.dispose(), M(m, "int32");
838
+ return a !== r && a.dispose(), o !== t && o.dispose(), N(m, "int32");
839
839
  }
840
840
  const Je = Ce;
841
841
  /**
@@ -877,16 +877,16 @@ const Xe = /* @__PURE__ */ h({ nonMaxSuppressionWithScore_: Le });
877
877
  * limitations under the License.
878
878
  * =============================================================================
879
879
  */
880
- async function He(r, t, n, e = 0.5, s = Number.NEGATIVE_INFINITY, a = 0) {
880
+ async function Qe(r, t, n, e = 0.5, s = Number.NEGATIVE_INFINITY, a = 0) {
881
881
  const o = l(r, "boxes", "nonMaxSuppressionAsync"), i = l(t, "scores", "nonMaxSuppressionAsync"), u = P(o, i, n, e, s, a);
882
882
  n = u.maxOutputSize, e = u.iouThreshold, s = u.scoreThreshold, a = u.softNmsSigma;
883
883
  const c = await Promise.all([o.data(), i.data()]), d = c[0], m = c[1], { selectedIndices: $, selectedScores: g } = We(d, m, n, e, s, a);
884
884
  return o !== r && o.dispose(), i !== t && i.dispose(), {
885
- selectedIndices: M($, "int32"),
886
- selectedScores: M(g)
885
+ selectedIndices: N($, "int32"),
886
+ selectedScores: N(g)
887
887
  };
888
888
  }
889
- const Qe = He;
889
+ const He = Qe;
890
890
  /**
891
891
  * @license
892
892
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -948,7 +948,7 @@ async function ns(r, t, n, e = 0.5, s = Number.NEGATIVE_INFINITY, a = !1) {
948
948
  /* softNmsSigma */
949
949
  ), c = u.maxOutputSize, d = u.iouThreshold, m = u.scoreThreshold, [$, g] = await Promise.all([o.data(), i.data()]), { selectedIndices: x, validOutputs: y } = Fe($, g, c, d, m, a);
950
950
  return o !== r && o.dispose(), i !== t && i.dispose(), {
951
- selectedIndices: M(x, "int32"),
951
+ selectedIndices: N(x, "int32"),
952
952
  validOutputs: Fn(y, "int32")
953
953
  };
954
954
  }
@@ -1021,7 +1021,7 @@ const as = /* @__PURE__ */ h({ resizeNearestNeighbor_: rs });
1021
1021
  */
1022
1022
  function os(r, t = "binary", n = !1, e = 0.5) {
1023
1023
  const s = l(r, "image", "threshold"), a = 0.2989, o = 0.587, i = 0.114, u = s.shape[0] * s.shape[1];
1024
- let c = k(M([e]), 255), d, m, $, g;
1024
+ let c = k(N([e]), 255), d, m, $, g;
1025
1025
  if (p(s.rank === 3, () => `Error in threshold: image must be rank 3,but got rank ${s.rank}.`), p(s.shape[2] === 3 || s.shape[2] === 1, () => `Error in threshold: image color channel must be equal to 3 or 1but got ${s.shape[2]}.`), p(s.dtype === "int32" || s.dtype === "float32", () => `Error in dtype: image dtype must be int32 or float32,but got dtype ${s.dtype}.`), p(t === "otsu" || t === "binary", () => `Method must be binary or otsu, but was ${t}`), s.shape[2] === 3) {
1026
1026
  [d, m, $] = un(s, [1, 1, 1], -1);
1027
1027
  const b = k(d, a), E = k(m, o), I = k($, i);
@@ -1036,17 +1036,17 @@ function os(r, t = "binary", n = !1, e = 0.5) {
1036
1036
  return D(k(x, 255), "int32");
1037
1037
  }
1038
1038
  function is(r, t) {
1039
- let n = M([-1]), e = M([0]), s = M([0]), a, o, i, u, c, d;
1039
+ let n = N([-1]), e = N([0]), s = N([0]), a, o, i, u, c, d;
1040
1040
  for (let m = 0; m < r.size - 1; m++) {
1041
- a = N(r, 0, m + 1), o = N(r, m + 1), c = K(q(a), t), d = K(q(o), t);
1041
+ a = M(r, 0, m + 1), o = M(r, m + 1), c = G(q(a), t), d = G(q(o), t);
1042
1042
  const $ = q(k(a, O(0, a.size)));
1043
- i = K($, q(a));
1043
+ i = G($, q(a));
1044
1044
  const g = Yn(o.shape, a.size), x = Z(O(0, o.size), g), y = k(o, x);
1045
- u = K(q(y), q(o));
1045
+ u = G(q(y), q(o));
1046
1046
  const b = S(i, u), E = S(i, u), I = k(c, d);
1047
1047
  s = k(k(I, b), E);
1048
1048
  const A = U(s, e);
1049
- e = R(A, s, e), n = R(A, M([m]), n);
1049
+ e = R(A, s, e), n = R(A, N([m]), n);
1050
1050
  }
1051
1051
  return n;
1052
1052
  }
@@ -1096,7 +1096,7 @@ function ps(r, t, n) {
1096
1096
  const s = e.shape, [a, o] = e.shape.slice(-2);
1097
1097
  let i, u;
1098
1098
  typeof t == "number" ? (p(t % 1 === 0, () => `bandPart(): numLower must be an integer, got ${t}.`), p(t <= a, () => `bandPart(): numLower (${t}) must not be greater than the number of rows (${a}).`), i = l(t < 0 ? a : t, "numLower", "bandPart")) : (p(t.dtype === "int32", () => "bandPart(): numLower's dtype must be an int32."), i = R(tn(t, 0), a, rn(t, a))), typeof n == "number" ? (p(n % 1 === 0, () => `bandPart(): numUpper must be an integer, got ${n}.`), p(n <= o, () => `bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`), u = l(n < 0 ? o : n, "numUpper", "bandPart")) : (p(n.dtype === "int32", () => "bandPart(): numUpper's dtype must be an int32."), u = R(tn(n, 0), o, rn(n, o)));
1099
- const c = _(O(0, a, 1, "int32"), [-1, 1]), d = O(0, o, 1, "int32"), m = S(c, d), $ = de(pn(m, i), ce(m, nn(u))), g = Hn([a, o], e.dtype);
1099
+ const c = _(O(0, a, 1, "int32"), [-1, 1]), d = O(0, o, 1, "int32"), m = S(c, d), $ = de(pn(m, i), ce(m, nn(u))), g = Qn([a, o], e.dtype);
1100
1100
  return _(Y(mn(_(e, [-1, a, o])).map((x) => R($, x, g))), s);
1101
1101
  }
1102
1102
  const ms = /* @__PURE__ */ h({ bandPart_: ps });
@@ -1135,7 +1135,7 @@ function hs(r) {
1135
1135
  const i = k(q(k(n[o], a)), n[o]);
1136
1136
  a = S(a, i);
1137
1137
  }
1138
- return K(a, ln(a, "euclidean"));
1138
+ return G(a, ln(a, "euclidean"));
1139
1139
  }));
1140
1140
  return t ? Y(n, 0) : n;
1141
1141
  }
@@ -1178,35 +1178,35 @@ function cn(r, t = !1) {
1178
1178
  p(r.shape.length === 2, () => `qr2d() requires a 2D Tensor, but got a ${r.shape.length}D Tensor.`);
1179
1179
  const n = r.shape[0], e = r.shape[1];
1180
1180
  let s = ae(n), a = L(r);
1181
- const o = Q([[1]], [1, 1]);
1181
+ const o = H([[1]], [1, 1]);
1182
1182
  let i = L(o);
1183
1183
  const u = n >= e ? e : n;
1184
1184
  for (let c = 0; c < u; ++c) {
1185
1185
  const d = a, m = i, $ = s;
1186
1186
  [i, a, s] = f.tidy(() => {
1187
- const g = N(a, [c, c], [n - c, 1]), x = ln(g), y = N(a, [c, c], [1, 1]), b = R(U(y, 0), Q([[-1]]), Q([[1]])), E = S(y, k(b, x)), I = K(g, E);
1188
- I.shape[0] === 1 ? i = L(o) : i = H([
1187
+ const g = M(a, [c, c], [n - c, 1]), x = ln(g), y = M(a, [c, c], [1, 1]), b = R(U(y, 0), H([[-1]]), H([[1]])), E = S(y, k(b, x)), I = G(g, E);
1188
+ I.shape[0] === 1 ? i = L(o) : i = Q([
1189
1189
  o,
1190
- N(I, [1, 0], [I.shape[0] - 1, I.shape[1]])
1190
+ M(I, [1, 0], [I.shape[0] - 1, I.shape[1]])
1191
1191
  ], 0);
1192
- const A = nn(K(T(b, E), x)), z = N(a, [c, 0], [n - c, e]), B = k(A, i), V = an(i);
1192
+ const A = nn(G(T(b, E), x)), z = M(a, [c, 0], [n - c, e]), B = k(A, i), V = an(i);
1193
1193
  if (c === 0)
1194
1194
  a = S(z, T(B, T(V, z)));
1195
1195
  else {
1196
1196
  const C = S(z, T(B, T(V, z)));
1197
- a = H([N(a, [0, 0], [c, e]), C], 0);
1197
+ a = Q([M(a, [0, 0], [c, e]), C], 0);
1198
1198
  }
1199
- const sn = an(B), F = N(s, [0, c], [n, s.shape[1] - c]);
1199
+ const sn = an(B), F = M(s, [0, c], [n, s.shape[1] - c]);
1200
1200
  if (c === 0)
1201
1201
  s = S(F, T(T(F, i), sn));
1202
1202
  else {
1203
1203
  const C = S(F, T(T(F, i), sn));
1204
- s = H([N(s, [0, 0], [n, c]), C], 1);
1204
+ s = Q([M(s, [0, 0], [n, c]), C], 1);
1205
1205
  }
1206
1206
  return [i, a, s];
1207
1207
  }), Jn([d, m, $]);
1208
1208
  }
1209
- return !t && n > e && (s = N(s, [0, 0], [n, e]), a = N(a, [0, 0], [e, e])), [s, a];
1209
+ return !t && n > e && (s = M(s, [0, 0], [n, e]), a = M(a, [0, 0], [e, e])), [s, a];
1210
1210
  });
1211
1211
  }
1212
1212
  const bs = /* @__PURE__ */ h({ qr_: ds });
@@ -1232,12 +1232,12 @@ const ws = {
1232
1232
  resizeNearestNeighbor: as,
1233
1233
  resizeBilinear: ts,
1234
1234
  rgbToGrayscale: Be,
1235
- rotateWithOffset: Ge,
1236
- cropAndResize: Me,
1235
+ rotateWithOffset: Ke,
1236
+ cropAndResize: Ne,
1237
1237
  nonMaxSuppression: Re,
1238
1238
  nonMaxSuppressionAsync: Je,
1239
1239
  nonMaxSuppressionWithScore: Xe,
1240
- nonMaxSuppressionWithScoreAsync: Qe,
1240
+ nonMaxSuppressionWithScoreAsync: He,
1241
1241
  nonMaxSuppressionPadded: Ue,
1242
1242
  nonMaxSuppressionPaddedAsync: es,
1243
1243
  threshold: cs,
@@ -1256,14 +1256,14 @@ export {
1256
1256
  U as f,
1257
1257
  ce as g,
1258
1258
  tn as h,
1259
- G as i,
1259
+ K as i,
1260
1260
  Ie as j,
1261
1261
  ws as k,
1262
1262
  zs as l,
1263
1263
  rn as m,
1264
1264
  nn as n,
1265
- N as s,
1266
- M as t,
1265
+ M as s,
1266
+ N as t,
1267
1267
  mn as u,
1268
1268
  R as w
1269
1269
  };