@genai-fi/nanogpt 0.7.0 → 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 (152) hide show
  1. package/dist/Generator.js +13 -9
  2. package/dist/NanoGPTModel.js +10 -10
  3. package/dist/{RealDiv-C4hOvYOZ.js → RealDiv-CVYNbZxu.js} +11 -11
  4. package/dist/{Reshape-BLijOA8h.js → Reshape-CEsEp0AI.js} +2 -2
  5. package/dist/Reshape-Do18N3gO.js +30 -0
  6. package/dist/TeachableLLM.js +9 -5
  7. package/dist/{TiedEmbedding-BLltddza.js → TiedEmbedding-ccLBFiZi.js} +4 -4
  8. package/dist/{axis_util-DaAl5MER.js → axis_util-5DTW2tFV.js} +1 -1
  9. package/dist/backend.js +2 -2
  10. package/dist/{backend_util-DWiwsi2N.js → backend_util-C9Ut8n0Q.js} +40 -40
  11. package/dist/{broadcast_to-C4v-j9yA.js → broadcast_to-Ba9h_8DO.js} +2 -2
  12. package/dist/{concat-CsHeR4zV.js → concat-CbXTetof.js} +1 -1
  13. package/dist/{dataset-JDyjG3QR.js → dataset-U3PrjwgU.js} +7 -7
  14. package/dist/{dropout-hpDwECTe.js → dropout-DPfPgWWe.js} +11 -11
  15. package/dist/{gather-D0_gPiBz.js → gather-Bbh8DHhM.js} +4 -4
  16. package/dist/{gelu-uyHP1x1f.js → gelu-BFwVnd1r.js} +1 -1
  17. package/dist/{gpgpu_math-DJm3ZTAf.js → gpgpu_math-DffelNS-.js} +2 -2
  18. package/dist/{index-BPPzKVdR.js → index-DYD_yPa-.js} +1083 -1106
  19. package/dist/{index-C0dhsYom.js → index-UdZhlibC.js} +126 -126
  20. package/dist/{kernel_funcs_utils-CwRTFqrc.js → kernel_funcs_utils-CXDy3EN7.js} +3 -3
  21. package/dist/layers/BaseLayer.js +2 -2
  22. package/dist/layers/CausalSelfAttention.js +8 -8
  23. package/dist/layers/MLP.js +5 -5
  24. package/dist/layers/RMSNorm.js +3 -3
  25. package/dist/layers/RoPECache.js +4 -4
  26. package/dist/layers/TiedEmbedding.js +5 -5
  27. package/dist/layers/TransformerBlock.js +1 -1
  28. package/dist/loader/loadTransformers.js +1 -1
  29. package/dist/loader/oldZipLoad.js +11 -7
  30. package/dist/{log_sum_exp-D086OgZJ.js → log_sum_exp-BnmCkHWl.js} +8 -8
  31. package/dist/main.d.ts +11 -0
  32. package/dist/main.js +44 -27
  33. package/dist/{mat_mul-1nwdPkQ_.js → mat_mul-dwmZz69e.js} +1 -1
  34. package/dist/{max-BQc2Aj-I.js → max-ByjEGoFx.js} +3 -3
  35. package/dist/{mulmat_packed_gpu-Gzf3I9UV.js → mulmat_packed_gpu-IGPBp6h9.js} +1 -1
  36. package/dist/{ones-D63HpSF_.js → ones-C8Mfln6-.js} +2 -2
  37. package/dist/ops/adamAdjust.d.ts +2 -0
  38. package/dist/ops/adamAdjust.js +9 -0
  39. package/dist/ops/adamMoments.d.ts +2 -0
  40. package/dist/ops/adamMoments.js +9 -0
  41. package/dist/ops/appendCache.js +3 -3
  42. package/dist/ops/attentionMask.js +1 -1
  43. package/dist/ops/cpu/adamAdjust.d.ts +1 -0
  44. package/dist/ops/cpu/adamAdjust.js +18 -0
  45. package/dist/ops/cpu/adamMoments.d.ts +1 -0
  46. package/dist/ops/cpu/adamMoments.js +16 -0
  47. package/dist/ops/cpu/appendCache.js +2 -2
  48. package/dist/ops/cpu/attentionMask.js +5 -5
  49. package/dist/ops/cpu/fusedSoftmax.js +2 -2
  50. package/dist/ops/cpu/gatherSub.js +3 -3
  51. package/dist/ops/cpu/gelu.js +1 -1
  52. package/dist/ops/cpu/matMulGelu.js +2 -2
  53. package/dist/ops/cpu/matMulMul.js +1 -1
  54. package/dist/ops/cpu/mulDropout.js +1 -1
  55. package/dist/ops/cpu/normRMS.js +1 -1
  56. package/dist/ops/cpu/qkv.js +3 -3
  57. package/dist/ops/cpu/rope.js +5 -5
  58. package/dist/ops/cpu/scatterSub.js +11 -11
  59. package/dist/ops/fusedSoftmax.js +1 -1
  60. package/dist/ops/gatherSub.js +1 -1
  61. package/dist/ops/gelu.js +2 -2
  62. package/dist/ops/grads/attentionMask.js +1 -1
  63. package/dist/ops/grads/fusedSoftmax.js +2 -2
  64. package/dist/ops/grads/gelu.js +2 -2
  65. package/dist/ops/grads/matMulGelu.js +1 -1
  66. package/dist/ops/grads/normRMS.js +1 -1
  67. package/dist/ops/grads/qkv.js +1 -1
  68. package/dist/ops/grads/rope.js +1 -1
  69. package/dist/ops/matMulGelu.js +1 -1
  70. package/dist/ops/matMulMul.js +1 -1
  71. package/dist/ops/mulDrop.js +1 -1
  72. package/dist/ops/normRMS.js +1 -1
  73. package/dist/ops/qkv.js +1 -1
  74. package/dist/ops/rope.js +4 -4
  75. package/dist/ops/scatterSub.js +1 -1
  76. package/dist/ops/webgl/adamAdjust.d.ts +1 -0
  77. package/dist/ops/webgl/adamAdjust.js +50 -0
  78. package/dist/ops/webgl/adamMoments.d.ts +1 -0
  79. package/dist/ops/webgl/adamMoments.js +38 -0
  80. package/dist/ops/webgl/appendCache.js +1 -1
  81. package/dist/ops/webgl/attentionMask.js +1 -1
  82. package/dist/ops/webgl/fusedSoftmax.js +4 -4
  83. package/dist/ops/webgl/gatherSub.js +8 -8
  84. package/dist/ops/webgl/gelu.js +2 -2
  85. package/dist/ops/webgl/log.js +3 -3
  86. package/dist/ops/webgl/matMulGelu.js +4 -4
  87. package/dist/ops/webgl/matMulMul.js +1 -1
  88. package/dist/ops/webgl/mulDropout.js +1 -1
  89. package/dist/ops/webgl/normRMS.js +2 -2
  90. package/dist/ops/webgl/qkv.js +1 -1
  91. package/dist/ops/webgl/rope.js +1 -1
  92. package/dist/ops/webgl/scatterSub.js +1 -1
  93. package/dist/ops/webgpu/adamAdjust.d.ts +1 -0
  94. package/dist/ops/webgpu/adamAdjust.js +52 -0
  95. package/dist/ops/webgpu/adamMoments.d.ts +1 -0
  96. package/dist/ops/webgpu/adamMoments.js +51 -0
  97. package/dist/ops/webgpu/appendCache.js +13 -12
  98. package/dist/ops/webgpu/attentionMask.js +11 -10
  99. package/dist/ops/webgpu/gatherSub.js +26 -11
  100. package/dist/ops/webgpu/gelu.js +7 -6
  101. package/dist/ops/webgpu/index.js +3 -0
  102. package/dist/ops/webgpu/normRMS.js +27 -101
  103. package/dist/ops/webgpu/normRMSGrad.d.ts +1 -0
  104. package/dist/ops/webgpu/normRMSGrad.js +128 -0
  105. package/dist/ops/webgpu/qkv.js +9 -8
  106. package/dist/ops/webgpu/rope.js +8 -7
  107. package/dist/ops/webgpu/scatterSub.js +8 -7
  108. package/dist/ops/webgpu/utils/reductions.d.ts +9 -0
  109. package/dist/ops/webgpu/utils/reductions.js +68 -0
  110. package/dist/{ops-CIQLNshk.js → ops-aRTXR2Sr.js} +195 -219
  111. package/dist/{random_width-DkYP8W8N.js → random_width-DbSpgl4o.js} +22 -21
  112. package/dist/{range-CYzpQY53.js → range-D9CZhVlR.js} +1 -1
  113. package/dist/{reciprocal-_A9yv27J.js → reciprocal-CGB48wZB.js} +1 -1
  114. package/dist/{register_all_kernels-guvSxp7M.js → register_all_kernels-DnbAyBXt.js} +30 -29
  115. package/dist/{reshape-BMUzc1UY.js → reshape-BR0eoLYN.js} +3 -3
  116. package/dist/{scatter_nd_util-IRBqKz_b.js → scatter_nd_util-OjyAxku2.js} +1 -1
  117. package/dist/{selu_util-Dt_iuXaq.js → selu_util-Ce6pu9IM.js} +41 -41
  118. package/dist/{shared-CDu9S76h.js → shared-Czipaeb6.js} +6 -6
  119. package/dist/{shared-BNa2q6jD.js → shared-DS5waSIY.js} +1 -1
  120. package/dist/{sin-Cocju-BY.js → sin-CiBxrDqX.js} +6 -6
  121. package/dist/slice-BHbDHObE.js +28 -0
  122. package/dist/{softmax-GPNK3o-U.js → softmax-JMEIUo2J.js} +3 -3
  123. package/dist/{split-CHzJjxDv.js → split-CRU0PjVV.js} +1 -1
  124. package/dist/{stack-Dpgg_1W1.js → stack-ikk2Y8_P.js} +1 -1
  125. package/dist/{sum-B8wEpKsg.js → sum-NLYbiDag.js} +3 -3
  126. package/dist/{tensor-RvZVNmg0.js → tensor-Do9PKbIE.js} +1 -1
  127. package/dist/{tensor2d-B_kyod7_.js → tensor2d-CWHxHpLh.js} +1 -1
  128. package/dist/training/Adam.d.ts +22 -0
  129. package/dist/training/Adam.js +93 -0
  130. package/dist/training/AdamExt.d.ts +1 -1
  131. package/dist/training/AdamExt.js +13 -12
  132. package/dist/training/DatasetBuilder.js +2 -2
  133. package/dist/training/FullTrainer.js +22 -22
  134. package/dist/training/Trainer.d.ts +1 -1
  135. package/dist/training/Trainer.js +32 -32
  136. package/dist/training/sparseCrossEntropy.d.ts +0 -4
  137. package/dist/training/sparseCrossEntropy.js +7 -7
  138. package/dist/utilities/arrayClose.d.ts +1 -0
  139. package/dist/utilities/arrayClose.js +11 -0
  140. package/dist/utilities/dummy.js +2 -2
  141. package/dist/utilities/generate.js +3 -3
  142. package/dist/utilities/multinomialCPU.js +2 -2
  143. package/dist/utilities/performance.d.ts +1 -1
  144. package/dist/utilities/performance.js +11 -11
  145. package/dist/utilities/profile.js +1 -1
  146. package/dist/utilities/safetensors.js +2 -2
  147. package/dist/utilities/weights.js +2 -2
  148. package/dist/{variable-DXEUOwew.js → variable-BTBkayv_.js} +1 -1
  149. package/dist/{webgpu_util-g13LvDIv.js → webgpu_program-WaoMq-WD.js} +138 -215
  150. package/dist/webgpu_util-DhSeP4b6.js +80 -0
  151. package/dist/{zeros-DCPCdFGq.js → zeros-DnPT2nD4.js} +4 -4
  152. package/package.json +1 -1
@@ -1,42 +1,19 @@
1
- import { x as m, y as u, E as f, aN as gn, l, aO as $n, k as S, aP as kn, aQ as yn, aR as En, p as _n, aS as w, aT as rn, n as In, b as pn, aU as Nn, aV as An, L as Tn, ai as xn, F as v, aW as wn, aX as Sn, aY as Mn, aZ as zn, a_ as qn, a$ as Kn, b0 as Bn, Q as G, b1 as Gn, b2 as Rn, b3 as Dn, aE as vn, X as Vn, V as Pn, W as jn, b4 as Fn, t as Wn, b5 as C, b6 as On, b7 as Yn, b8 as Ln, b9 as Cn, ba as Xn, bb as Qn, bc as Jn, bd as Zn, a as $, a6 as U, aj as q, h as Hn, c as A, be as Un, K as X, d as ne } from "./index-C0dhsYom.js";
2
- import { n as ee, a as se, b as te } from "./non_max_suppression_impl-CsEgBuMA.js";
3
- import { r as k } from "./reshape-BMUzc1UY.js";
4
- import { s as mn } from "./split-CHzJjxDv.js";
5
- import { s as E } from "./sum-B8wEpKsg.js";
6
- import { b as Q } from "./broadcast_to-C4v-j9yA.js";
7
- import { r as W } from "./range-CYzpQY53.js";
8
- import { t as re } from "./tensor-RvZVNmg0.js";
9
- import { s as O } from "./stack-Dpgg_1W1.js";
10
- import { c as ae, z as oe } from "./zeros-DCPCdFGq.js";
11
- import { e as ie } from "./axis_util-DaAl5MER.js";
12
- import { m as J } from "./max-BQc2Aj-I.js";
13
- import { c as Z } from "./concat-CsHeR4zV.js";
14
- import { m as N } from "./mat_mul-1nwdPkQ_.js";
15
- import { t as H } from "./tensor2d-B_kyod7_.js";
16
- /**
17
- * @license
18
- * Copyright 2018 Google LLC. All Rights Reserved.
19
- * Licensed under the Apache License, Version 2.0 (the "License");
20
- * you may not use this file except in compliance with the License.
21
- * You may obtain a copy of the License at
22
- *
23
- * http://www.apache.org/licenses/LICENSE-2.0
24
- *
25
- * Unless required by applicable law or agreed to in writing, software
26
- * distributed under the License is distributed on an "AS IS" BASIS,
27
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
- * See the License for the specific language governing permissions and
29
- * limitations under the License.
30
- * =============================================================================
31
- */
32
- function ce(s, e, n) {
33
- const r = u(s, "x", "slice", "string_or_numeric");
34
- if (r.rank === 0)
35
- throw new Error("Slicing scalar is not possible");
36
- const t = { x: r }, a = { begin: e, size: n };
37
- return f.runKernel(gn, t, a);
38
- }
39
- const _ = /* @__PURE__ */ m({ slice_: ce });
1
+ import { B as m, C as u, l, E as f, aP as gn, k as S, aQ as $n, aR as kn, aS as yn, p as En, aT as w, q as rn, x as _n, b as pn, aU as In, aV as Nn, N as An, al as Tn, I as v, aW as xn, aX as wn, aY as Sn, aZ as Mn, a_ as zn, a$ as qn, b0 as Bn, X as K, b1 as Gn, b2 as Kn, b3 as Rn, aG as Dn, $ as vn, Z as Vn, _ as Pn, b4 as jn, t as Fn, b5 as L, b6 as Wn, b7 as Yn, b8 as On, b9 as Cn, ba as Ln, bb as Xn, bc as Zn, bd as Jn, a as $, o as U, n as q, h as Qn, c as A, be as Hn, M as X, d as Un } from "./index-UdZhlibC.js";
2
+ import { n as ne, a as ee, b as se } from "./non_max_suppression_impl-CsEgBuMA.js";
3
+ import { r as k } from "./reshape-BR0eoLYN.js";
4
+ import { s as mn } from "./split-CRU0PjVV.js";
5
+ import { s as E } from "./sum-NLYbiDag.js";
6
+ import { b as Z } from "./broadcast_to-Ba9h_8DO.js";
7
+ import { s as _ } from "./slice-BHbDHObE.js";
8
+ import { r as W } from "./range-D9CZhVlR.js";
9
+ import { t as te } from "./tensor-Do9PKbIE.js";
10
+ import { s as Y } from "./stack-ikk2Y8_P.js";
11
+ import { c as re, z as ae } from "./zeros-DnPT2nD4.js";
12
+ import { e as oe } from "./axis_util-5DTW2tFV.js";
13
+ import { m as J } from "./max-ByjEGoFx.js";
14
+ import { c as Q } from "./concat-CbXTetof.js";
15
+ import { m as N } from "./mat_mul-dwmZz69e.js";
16
+ import { t as H } from "./tensor2d-CWHxHpLh.js";
40
17
  /**
41
18
  * @license
42
19
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -53,13 +30,13 @@ const _ = /* @__PURE__ */ m({ slice_: ce });
53
30
  * limitations under the License.
54
31
  * =============================================================================
55
32
  */
56
- function ue(s, e, n) {
33
+ function ie(s, e, n) {
57
34
  const r = u(s, "x", "bincount"), t = u(e, "weights", "bincount");
58
35
  l(r.dtype === "int32", () => `Error in bincount: input dtype must be int32, but got ${r.dtype}`), l(n >= 0, () => `size must be non-negative, but got ${n}.`), l(t.size === r.size || t.size === 0, () => `Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${t.shape}.`);
59
36
  const a = { x: r, weights: t }, o = { size: n };
60
- return f.runKernel($n, a, o);
37
+ return f.runKernel(gn, a, o);
61
38
  }
62
- const le = /* @__PURE__ */ m({ bincount_: ue });
39
+ const ce = /* @__PURE__ */ m({ bincount_: ie });
63
40
  /**
64
41
  * @license
65
42
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -76,15 +53,15 @@ const le = /* @__PURE__ */ m({ bincount_: ue });
76
53
  * limitations under the License.
77
54
  * =============================================================================
78
55
  */
79
- function pe(s, e, n) {
80
- const r = u(e, "a", "where"), t = u(n, "b", "where"), a = u(s, "condition", "where", "bool"), o = S(S(a.shape, r.shape), t.shape), i = Q(a, o), p = Q(r, o), c = Q(t, o), b = {
56
+ function ue(s, e, n) {
57
+ const r = u(e, "a", "where"), t = u(n, "b", "where"), a = u(s, "condition", "where", "bool"), o = S(S(a.shape, r.shape), t.shape), i = Z(a, o), p = Z(r, o), c = Z(t, o), b = {
81
58
  condition: i,
82
59
  t: p,
83
60
  e: c
84
61
  };
85
- return f.runKernel(kn, b);
62
+ return f.runKernel($n, b);
86
63
  }
87
- const B = /* @__PURE__ */ m({ where_: pe });
64
+ const G = /* @__PURE__ */ m({ where_: ue });
88
65
  /**
89
66
  * @license
90
67
  * Copyright 2021 Google LLC. All Rights Reserved.
@@ -101,11 +78,11 @@ const B = /* @__PURE__ */ m({ where_: pe });
101
78
  * limitations under the License.
102
79
  * =============================================================================
103
80
  */
104
- function me(s, ...e) {
81
+ function le(s, ...e) {
105
82
  const n = e.map((t, a) => u(t, `tensors${a}`, "einsum")), r = { equation: s };
106
- return f.runKernel(yn, n, r);
83
+ return f.runKernel(kn, n, r);
107
84
  }
108
- const D = /* @__PURE__ */ m({ einsum_: me });
85
+ const D = /* @__PURE__ */ m({ einsum_: le });
109
86
  /**
110
87
  * @license
111
88
  * Copyright 2020 Google Inc. All Rights Reserved.
@@ -122,11 +99,11 @@ const D = /* @__PURE__ */ m({ einsum_: me });
122
99
  * limitations under the License.
123
100
  * =============================================================================
124
101
  */
125
- function fe(s, e = null, n = !1) {
102
+ function pe(s, e = null, n = !1) {
126
103
  const t = { x: u(s, "x", "min") }, a = { axis: e, keepDims: n };
127
- return f.runKernel(En, t, a);
104
+ return f.runKernel(yn, t, a);
128
105
  }
129
- const an = /* @__PURE__ */ m({ min_: fe });
106
+ const an = /* @__PURE__ */ m({ min_: pe });
130
107
  /**
131
108
  * @license
132
109
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -143,13 +120,13 @@ const an = /* @__PURE__ */ m({ min_: fe });
143
120
  * limitations under the License.
144
121
  * =============================================================================
145
122
  */
146
- function he(s, e = "euclidean", n = null, r = !1) {
123
+ function me(s, e = "euclidean", n = null, r = !1) {
147
124
  s = u(s, "x", "norm");
148
125
  const t = fn(s, e, n);
149
126
  let a = t.shape;
150
127
  if (r) {
151
- const o = _n(n, s.shape);
152
- a = ie(t.shape, o);
128
+ const o = En(n, s.shape);
129
+ a = oe(t.shape, o);
153
130
  }
154
131
  return k(t, a);
155
132
  }
@@ -166,7 +143,7 @@ function fn(s, e, n = null) {
166
143
  if (e === -1 / 0)
167
144
  return an(w(s), n);
168
145
  if (e === "euclidean" || e === 2)
169
- return rn(E(In(w(s), pn(2, "int32")), n));
146
+ return rn(E(_n(w(s), pn(2, "int32")), n));
170
147
  throw new Error(`Error in norm: invalid ord value: ${e}`);
171
148
  }
172
149
  if (Array.isArray(n) && n.length === 2) {
@@ -177,12 +154,12 @@ function fn(s, e, n = null) {
177
154
  if (e === -1 / 0)
178
155
  return an(E(w(s), n[1]), n[0]);
179
156
  if (e === "fro" || e === "euclidean")
180
- return rn(E(Nn(s), n));
157
+ return rn(E(In(s), n));
181
158
  throw new Error(`Error in norm: invalid ord value: ${e}`);
182
159
  }
183
160
  throw new Error(`Error in norm: invalid axis: ${n}`);
184
161
  }
185
- const hn = /* @__PURE__ */ m({ norm_: he });
162
+ const hn = /* @__PURE__ */ m({ norm_: me });
186
163
  /**
187
164
  * @license
188
165
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -199,13 +176,13 @@ const hn = /* @__PURE__ */ m({ norm_: he });
199
176
  * limitations under the License.
200
177
  * =============================================================================
201
178
  */
202
- function be(s, e = 0) {
179
+ function fe(s, e = 0) {
203
180
  const n = u(s, "x", "expandDims", "string_or_numeric");
204
181
  l(e <= n.rank, () => "Axis must be <= rank of the tensor");
205
182
  const r = { input: n }, t = { dim: e };
206
- return f.runKernel(An, r, t);
183
+ return f.runKernel(Nn, r, t);
207
184
  }
208
- const z = /* @__PURE__ */ m({ expandDims_: be });
185
+ const z = /* @__PURE__ */ m({ expandDims_: fe });
209
186
  /**
210
187
  * @license
211
188
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -222,13 +199,13 @@ const z = /* @__PURE__ */ m({ expandDims_: be });
222
199
  * limitations under the License.
223
200
  * =============================================================================
224
201
  */
225
- function de(s, e) {
202
+ function he(s, e) {
226
203
  const n = u(s, "x", "tile", "string_or_numeric");
227
204
  l(n.rank === e.length, () => `Error in transpose: rank of input ${n.rank} must match length of reps ${e}.`);
228
205
  const r = { x: n }, t = { reps: e };
229
- return f.runKernel(Tn, r, t);
206
+ return f.runKernel(An, r, t);
230
207
  }
231
- const F = /* @__PURE__ */ m({ tile_: de });
208
+ const F = /* @__PURE__ */ m({ tile_: he });
232
209
  /**
233
210
  * @license
234
211
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -245,9 +222,9 @@ const F = /* @__PURE__ */ m({ tile_: de });
245
222
  * limitations under the License.
246
223
  * =============================================================================
247
224
  */
248
- function ge(s, e, n, r = "float32") {
225
+ function be(s, e, n, r = "float32") {
249
226
  e == null && (e = s);
250
- const t = xn([s, e], r), a = s <= e ? s : e;
227
+ const t = Tn([s, e], r), a = s <= e ? s : e;
251
228
  for (let i = 0; i < a; ++i)
252
229
  t.set(1, i, i);
253
230
  const o = k(t.toTensor(), [s, e]);
@@ -267,7 +244,7 @@ function ge(s, e, n, r = "float32") {
267
244
  ]);
268
245
  throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${n.length}D.`);
269
246
  }
270
- const $e = /* @__PURE__ */ m({ eye_: ge });
247
+ const de = /* @__PURE__ */ m({ eye_: be });
271
248
  /**
272
249
  * @license
273
250
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -284,13 +261,13 @@ const $e = /* @__PURE__ */ m({ eye_: ge });
284
261
  * limitations under the License.
285
262
  * =============================================================================
286
263
  */
287
- function ke(s, e) {
264
+ function ge(s, e) {
288
265
  let n = u(s, "a", "greater", "string_or_numeric"), r = u(e, "b", "greater", "string_or_numeric");
289
266
  [n, r] = v(n, r), S(n.shape, r.shape);
290
267
  const t = { a: n, b: r };
291
- return f.runKernel(wn, t);
268
+ return f.runKernel(xn, t);
292
269
  }
293
- const nn = /* @__PURE__ */ m({ greater_: ke });
270
+ const nn = /* @__PURE__ */ m({ greater_: ge });
294
271
  /**
295
272
  * @license
296
273
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -307,13 +284,13 @@ const nn = /* @__PURE__ */ m({ greater_: ke });
307
284
  * limitations under the License.
308
285
  * =============================================================================
309
286
  */
310
- function ye(s, e) {
287
+ function $e(s, e) {
311
288
  let n = u(s, "a", "greaterEqual", "string_or_numeric"), r = u(e, "b", "greaterEqual", "string_or_numeric");
312
289
  [n, r] = v(n, r), S(n.shape, r.shape);
313
290
  const t = { a: n, b: r };
314
- return f.runKernel(Sn, t);
291
+ return f.runKernel(wn, t);
315
292
  }
316
- const Ee = /* @__PURE__ */ m({ greaterEqual_: ye });
293
+ const ke = /* @__PURE__ */ m({ greaterEqual_: $e });
317
294
  /**
318
295
  * @license
319
296
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -330,11 +307,11 @@ const Ee = /* @__PURE__ */ m({ greaterEqual_: ye });
330
307
  * limitations under the License.
331
308
  * =============================================================================
332
309
  */
333
- function _e(s) {
310
+ function ye(s) {
334
311
  const n = { input: u(s, "input", "imag") };
335
- return f.runKernel(Mn, n);
312
+ return f.runKernel(Sn, n);
336
313
  }
337
- const Ie = /* @__PURE__ */ m({ imag_: _e });
314
+ const Ee = /* @__PURE__ */ m({ imag_: ye });
338
315
  /**
339
316
  * @license
340
317
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -351,13 +328,13 @@ const Ie = /* @__PURE__ */ m({ imag_: _e });
351
328
  * limitations under the License.
352
329
  * =============================================================================
353
330
  */
354
- function Ne(s, e) {
331
+ function _e(s, e) {
355
332
  let n = u(s, "a", "less", "string_or_numeric"), r = u(e, "b", "less", "string_or_numeric");
356
333
  [n, r] = v(n, r), S(n.shape, r.shape);
357
334
  const t = { a: n, b: r };
358
- return f.runKernel(zn, t);
335
+ return f.runKernel(Mn, t);
359
336
  }
360
- const on = /* @__PURE__ */ m({ less_: Ne });
337
+ const on = /* @__PURE__ */ m({ less_: _e });
361
338
  /**
362
339
  * @license
363
340
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -374,13 +351,13 @@ const on = /* @__PURE__ */ m({ less_: Ne });
374
351
  * limitations under the License.
375
352
  * =============================================================================
376
353
  */
377
- function Ae(s, e) {
354
+ function Ie(s, e) {
378
355
  let n = u(s, "a", "lessEqual", "string_or_numeric"), r = u(e, "b", "lessEqual", "string_or_numeric");
379
356
  [n, r] = v(n, r), S(n.shape, r.shape);
380
357
  const t = { a: n, b: r };
381
- return f.runKernel(qn, t);
358
+ return f.runKernel(zn, t);
382
359
  }
383
- const bn = /* @__PURE__ */ m({ lessEqual_: Ae });
360
+ const bn = /* @__PURE__ */ m({ lessEqual_: Ie });
384
361
  /**
385
362
  * @license
386
363
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -397,11 +374,11 @@ const bn = /* @__PURE__ */ m({ lessEqual_: Ae });
397
374
  * limitations under the License.
398
375
  * =============================================================================
399
376
  */
400
- function Te(s) {
377
+ function Ne(s) {
401
378
  const n = { x: u(s, "x", "neg") };
402
- return f.runKernel(Kn, n);
379
+ return f.runKernel(qn, n);
403
380
  }
404
- const en = /* @__PURE__ */ m({ neg_: Te });
381
+ const en = /* @__PURE__ */ m({ neg_: Ne });
405
382
  /**
406
383
  * @license
407
384
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -418,13 +395,13 @@ const en = /* @__PURE__ */ m({ neg_: Te });
418
395
  * limitations under the License.
419
396
  * =============================================================================
420
397
  */
421
- function xe(s, e) {
398
+ function Ae(s, e) {
422
399
  const n = u(s, "a", "logicalAnd", "bool"), r = u(e, "b", "logicalAnd", "bool");
423
400
  S(n.shape, r.shape);
424
401
  const t = { a: n, b: r };
425
402
  return f.runKernel(Bn, t);
426
403
  }
427
- const we = /* @__PURE__ */ m({ logicalAnd_: xe });
404
+ const Te = /* @__PURE__ */ m({ logicalAnd_: Ae });
428
405
  /**
429
406
  * @license
430
407
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -441,13 +418,13 @@ const we = /* @__PURE__ */ m({ logicalAnd_: xe });
441
418
  * limitations under the License.
442
419
  * =============================================================================
443
420
  */
444
- function Se(s, e) {
421
+ function xe(s, e) {
445
422
  let n = u(s, "a", "minimum"), r = u(e, "b", "minimum");
446
- [n, r] = v(n, r), n.dtype === "bool" && (n = G(n, "int32"), r = G(r, "int32")), S(n.shape, r.shape);
423
+ [n, r] = v(n, r), n.dtype === "bool" && (n = K(n, "int32"), r = K(r, "int32")), S(n.shape, r.shape);
447
424
  const t = { a: n, b: r };
448
425
  return f.runKernel(Gn, t);
449
426
  }
450
- const cn = /* @__PURE__ */ m({ minimum_: Se });
427
+ const cn = /* @__PURE__ */ m({ minimum_: xe });
451
428
  /**
452
429
  * @license
453
430
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -464,11 +441,11 @@ const cn = /* @__PURE__ */ m({ minimum_: Se });
464
441
  * limitations under the License.
465
442
  * =============================================================================
466
443
  */
467
- function Me(s) {
444
+ function we(s) {
468
445
  const n = { input: u(s, "input", "real") };
469
- return f.runKernel(Rn, n);
446
+ return f.runKernel(Kn, n);
470
447
  }
471
- const ze = /* @__PURE__ */ m({ real_: Me });
448
+ const Se = /* @__PURE__ */ m({ real_: we });
472
449
  /**
473
450
  * @license
474
451
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -485,11 +462,11 @@ const ze = /* @__PURE__ */ m({ real_: Me });
485
462
  * limitations under the License.
486
463
  * =============================================================================
487
464
  */
488
- function qe(s) {
465
+ function Me(s) {
489
466
  const n = { x: u(s, "x", "round") };
490
- return f.runKernel(Dn, n);
467
+ return f.runKernel(Rn, n);
491
468
  }
492
- const Ke = /* @__PURE__ */ m({ round_: qe });
469
+ const ze = /* @__PURE__ */ m({ round_: Me });
493
470
  /**
494
471
  * @license
495
472
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -506,11 +483,11 @@ const Ke = /* @__PURE__ */ m({ round_: qe });
506
483
  * limitations under the License.
507
484
  * =============================================================================
508
485
  */
509
- function Be(s, e) {
486
+ function qe(s, e) {
510
487
  const n = u(s, "x", "squeeze", "string_or_numeric");
511
- return k(n, vn(n.shape, e).newShape);
488
+ return k(n, Dn(n.shape, e).newShape);
512
489
  }
513
- const Ge = /* @__PURE__ */ m({ squeeze_: Be });
490
+ const Be = /* @__PURE__ */ m({ squeeze_: qe });
514
491
  /**
515
492
  * @license
516
493
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -528,11 +505,11 @@ const Ge = /* @__PURE__ */ m({ squeeze_: Be });
528
505
  * =============================================================================
529
506
  */
530
507
  function I(s, e) {
531
- Vn(s);
532
- const n = Pn(s, e);
508
+ vn(s);
509
+ const n = Vn(s, e);
533
510
  if (n.length !== 1)
534
511
  throw new Error("tensor1d() requires values to be a flat/TypedArray");
535
- return jn(s, null, n, e);
512
+ return Pn(s, null, n, e);
536
513
  }
537
514
  /**
538
515
  * @license
@@ -550,13 +527,13 @@ function I(s, e) {
550
527
  * limitations under the License.
551
528
  * =============================================================================
552
529
  */
553
- function Re(s, e = 0) {
530
+ function Ge(s, e = 0) {
554
531
  const n = u(s, "x", "unstack", "string_or_numeric");
555
532
  l(e >= -n.shape.length && e < n.shape.length, () => `Axis = ${e} is not in [-${n.shape.length}, ${n.shape.length})`);
556
533
  const r = { value: n }, t = { axis: e };
557
- return f.runKernel(Fn, r, t);
534
+ return f.runKernel(jn, r, t);
558
535
  }
559
- const dn = /* @__PURE__ */ m({ unstack_: Re });
536
+ const dn = /* @__PURE__ */ m({ unstack_: Ge });
560
537
  /**
561
538
  * @license
562
539
  * Copyright 2018 Google LLC. All Rights Reserved.
@@ -573,19 +550,19 @@ const dn = /* @__PURE__ */ m({ unstack_: Re });
573
550
  * limitations under the License.
574
551
  * =============================================================================
575
552
  */
576
- function De(s, e, n) {
553
+ function Ke(s, e, n) {
577
554
  const r = u(s, "x", "transpose");
578
555
  if (e == null && (e = r.shape.map((o, i) => i).reverse()), l(r.rank === e.length, () => `Error in transpose: rank of input ${r.rank} must match length of perm ${e}.`), e.forEach((o) => {
579
556
  l(o >= 0 && o < r.rank, () => `All entries in 'perm' must be between 0 and ${r.rank - 1} but got ${e}`);
580
557
  }), r.rank <= 1)
581
558
  return r.clone();
582
559
  const t = { x: r }, a = { perm: e };
583
- return r.dtype === "complex64" ? Wn(() => {
584
- let o = ze(r), i = Ie(r);
585
- return o = f.runKernel(C, { x: o }, a), i = f.runKernel(C, { x: i }, a), n && (i = en(i)), ae(o, i);
586
- }) : f.runKernel(C, t, a);
560
+ return r.dtype === "complex64" ? Fn(() => {
561
+ let o = Se(r), i = Ee(r);
562
+ return o = f.runKernel(L, { x: o }, a), i = f.runKernel(L, { x: i }, a), n && (i = en(i)), re(o, i);
563
+ }) : f.runKernel(L, t, a);
587
564
  }
588
- const un = /* @__PURE__ */ m({ transpose_: De });
565
+ const un = /* @__PURE__ */ m({ transpose_: Ke });
589
566
  /**
590
567
  * @license
591
568
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -602,13 +579,13 @@ const un = /* @__PURE__ */ m({ transpose_: De });
602
579
  * limitations under the License.
603
580
  * =============================================================================
604
581
  */
605
- function ve(s, e, n, r, t = "bilinear", a = 0) {
582
+ function Re(s, e, n, r, t = "bilinear", a = 0) {
606
583
  const o = u(s, "image", "cropAndResize"), i = u(e, "boxes", "cropAndResize", "float32"), p = u(n, "boxInd", "cropAndResize", "int32"), c = i.shape[0];
607
584
  l(o.rank === 4, () => `Error in cropAndResize: image must be rank 4,but got rank ${o.rank}.`), l(i.rank === 2 && i.shape[1] === 4, () => `Error in cropAndResize: boxes must be have size [${c},4] but had shape ${i.shape}.`), l(p.rank === 1 && p.shape[0] === c, () => `Error in cropAndResize: boxInd must be have size [${c}] but had shape ${i.shape}.`), l(r.length === 2, () => `Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`), l(r[0] >= 1 && r[1] >= 1, () => `cropSize must be atleast [1,1], but was ${r}`), l(t === "bilinear" || t === "nearest", () => `method must be bilinear or nearest, but was ${t}`);
608
585
  const b = { image: o, boxes: i, boxInd: p }, h = { method: t, extrapolationValue: a, cropSize: r };
609
- return f.runKernel(On, b, h);
586
+ return f.runKernel(Wn, b, h);
610
587
  }
611
- const Ve = /* @__PURE__ */ m({ cropAndResize_: ve });
588
+ const De = /* @__PURE__ */ m({ cropAndResize_: Re });
612
589
  /**
613
590
  * @license
614
591
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -625,13 +602,13 @@ const Ve = /* @__PURE__ */ m({ cropAndResize_: ve });
625
602
  * limitations under the License.
626
603
  * =============================================================================
627
604
  */
628
- function Pe(s) {
605
+ function ve(s) {
629
606
  const e = u(s, "image", "flipLeftRight", "float32");
630
607
  l(e.rank === 4, () => `Error in flipLeftRight: image must be rank 4,but got rank ${e.rank}.`);
631
608
  const n = { image: e };
632
609
  return f.runKernel(Yn, n, {});
633
610
  }
634
- const je = /* @__PURE__ */ m({ flipLeftRight_: Pe });
611
+ const Ve = /* @__PURE__ */ m({ flipLeftRight_: ve });
635
612
  /**
636
613
  * @license
637
614
  * Copyright 2021 Google LLC. All Rights Reserved.
@@ -648,13 +625,13 @@ const je = /* @__PURE__ */ m({ flipLeftRight_: Pe });
648
625
  * limitations under the License.
649
626
  * =============================================================================
650
627
  */
651
- function Fe(s) {
628
+ function Pe(s) {
652
629
  const e = u(s, "image", "grayscaleToRGB"), n = e.rank - 1, r = e.shape[n];
653
630
  l(e.rank >= 2, () => `Error in grayscaleToRGB: images must be at least rank 2, but got rank ${e.rank}.`), l(r === 1, () => `Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${r}.`);
654
631
  const t = new Array(e.rank);
655
632
  return t.fill(1, 0, n), t[n] = 3, F(e, t);
656
633
  }
657
- const We = /* @__PURE__ */ m({ grayscaleToRGB_: Fe });
634
+ const je = /* @__PURE__ */ m({ grayscaleToRGB_: Pe });
658
635
  /**
659
636
  * @license
660
637
  * Copyright 2023 Google LLC.
@@ -671,10 +648,10 @@ const We = /* @__PURE__ */ m({ grayscaleToRGB_: Fe });
671
648
  * limitations under the License.
672
649
  * =============================================================================
673
650
  */
674
- function Oe(s) {
651
+ function Fe(s) {
675
652
  const e = u(s, "image", "RGBToGrayscale"), n = e.rank - 1, r = e.shape[n];
676
653
  l(e.rank >= 2, () => `Error in RGBToGrayscale: images must be at least rank 2, but got rank ${e.rank}.`), l(r === 3, () => `Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${r}.`);
677
- const t = e.dtype, a = G(e, "float32"), o = I([0.2989, 0.587, 0.114]);
654
+ const t = e.dtype, a = K(e, "float32"), o = I([0.2989, 0.587, 0.114]);
678
655
  let i;
679
656
  switch (e.rank) {
680
657
  case 2:
@@ -695,9 +672,9 @@ function Oe(s) {
695
672
  default:
696
673
  throw new Error("Not a valid tensor rank.");
697
674
  }
698
- return i = z(i, -1), G(i, t);
675
+ return i = z(i, -1), K(i, t);
699
676
  }
700
- const Ye = /* @__PURE__ */ m({ rgbToGrayscale_: Oe });
677
+ const We = /* @__PURE__ */ m({ rgbToGrayscale_: Fe });
701
678
  /**
702
679
  * @license
703
680
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -714,13 +691,13 @@ const Ye = /* @__PURE__ */ m({ rgbToGrayscale_: Oe });
714
691
  * limitations under the License.
715
692
  * =============================================================================
716
693
  */
717
- function Le(s, e, n = 0, r = 0.5) {
694
+ function Ye(s, e, n = 0, r = 0.5) {
718
695
  const t = u(s, "image", "rotateWithOffset", "float32");
719
696
  l(t.rank === 4, () => `Error in rotateWithOffset: image must be rank 4,but got rank ${t.rank}.`);
720
697
  const a = { image: t }, o = { radians: e, fillValue: n, center: r };
721
- return f.runKernel(Ln, a, o);
698
+ return f.runKernel(On, a, o);
722
699
  }
723
- const Ce = /* @__PURE__ */ m({ rotateWithOffset_: Le });
700
+ const Oe = /* @__PURE__ */ m({ rotateWithOffset_: Ye });
724
701
  /**
725
702
  * @license
726
703
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -758,13 +735,13 @@ function R(s, e, n, r, t, a) {
758
735
  * limitations under the License.
759
736
  * =============================================================================
760
737
  */
761
- function Xe(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY) {
738
+ function Ce(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY) {
762
739
  const a = u(s, "boxes", "nonMaxSuppression", "float32"), o = u(e, "scores", "nonMaxSuppression", "float32"), i = R(a, o, n, r, t);
763
740
  n = i.maxOutputSize, r = i.iouThreshold, t = i.scoreThreshold;
764
741
  const p = { maxOutputSize: n, iouThreshold: r, scoreThreshold: t };
765
742
  return f.runKernel(Cn, { boxes: a, scores: o }, p);
766
743
  }
767
- const Qe = /* @__PURE__ */ m({ nonMaxSuppression_: Xe });
744
+ const Le = /* @__PURE__ */ m({ nonMaxSuppression_: Ce });
768
745
  /**
769
746
  * @license
770
747
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -781,13 +758,13 @@ const Qe = /* @__PURE__ */ m({ nonMaxSuppression_: Xe });
781
758
  * limitations under the License.
782
759
  * =============================================================================
783
760
  */
784
- async function Je(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY) {
761
+ async function Xe(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY) {
785
762
  const a = u(s, "boxes", "nonMaxSuppressionAsync"), o = u(e, "scores", "nonMaxSuppressionAsync"), i = R(a, o, n, r, t);
786
763
  n = i.maxOutputSize, r = i.iouThreshold, t = i.scoreThreshold;
787
- const p = await Promise.all([a.data(), o.data()]), c = p[0], b = p[1], { selectedIndices: h } = ee(c, b, n, r, t);
764
+ const p = await Promise.all([a.data(), o.data()]), c = p[0], b = p[1], { selectedIndices: h } = ne(c, b, n, r, t);
788
765
  return a !== s && a.dispose(), o !== e && o.dispose(), I(h, "int32");
789
766
  }
790
- const Ze = Je;
767
+ const Ze = Xe;
791
768
  /**
792
769
  * @license
793
770
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -804,13 +781,13 @@ const Ze = Je;
804
781
  * limitations under the License.
805
782
  * =============================================================================
806
783
  */
807
- function He(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = 0) {
784
+ function Je(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = 0) {
808
785
  const o = u(s, "boxes", "nonMaxSuppression"), i = u(e, "scores", "nonMaxSuppression"), p = R(o, i, n, r, t, a);
809
786
  n = p.maxOutputSize, r = p.iouThreshold, t = p.scoreThreshold, a = p.softNmsSigma;
810
- const c = { boxes: o, scores: i }, b = { maxOutputSize: n, iouThreshold: r, scoreThreshold: t, softNmsSigma: a }, h = f.runKernel(Xn, c, b);
787
+ const c = { boxes: o, scores: i }, b = { maxOutputSize: n, iouThreshold: r, scoreThreshold: t, softNmsSigma: a }, h = f.runKernel(Ln, c, b);
811
788
  return { selectedIndices: h[0], selectedScores: h[1] };
812
789
  }
813
- const Ue = /* @__PURE__ */ m({ nonMaxSuppressionWithScore_: He });
790
+ const Qe = /* @__PURE__ */ m({ nonMaxSuppressionWithScore_: Je });
814
791
  /**
815
792
  * @license
816
793
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -827,16 +804,16 @@ const Ue = /* @__PURE__ */ m({ nonMaxSuppressionWithScore_: He });
827
804
  * limitations under the License.
828
805
  * =============================================================================
829
806
  */
830
- async function ns(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = 0) {
807
+ async function He(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = 0) {
831
808
  const o = u(s, "boxes", "nonMaxSuppressionAsync"), i = u(e, "scores", "nonMaxSuppressionAsync"), p = R(o, i, n, r, t, a);
832
809
  n = p.maxOutputSize, r = p.iouThreshold, t = p.scoreThreshold, a = p.softNmsSigma;
833
- const c = await Promise.all([o.data(), i.data()]), b = c[0], h = c[1], { selectedIndices: g, selectedScores: d } = se(b, h, n, r, t, a);
810
+ const c = await Promise.all([o.data(), i.data()]), b = c[0], h = c[1], { selectedIndices: g, selectedScores: d } = ee(b, h, n, r, t, a);
834
811
  return o !== s && o.dispose(), i !== e && i.dispose(), {
835
812
  selectedIndices: I(g, "int32"),
836
813
  selectedScores: I(d)
837
814
  };
838
815
  }
839
- const es = ns;
816
+ const Ue = He;
840
817
  /**
841
818
  * @license
842
819
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -853,7 +830,7 @@ const es = ns;
853
830
  * limitations under the License.
854
831
  * =============================================================================
855
832
  */
856
- function ss(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = !1) {
833
+ function ns(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = !1) {
857
834
  const o = u(s, "boxes", "nonMaxSuppression"), i = u(e, "scores", "nonMaxSuppression"), p = R(
858
835
  o,
859
836
  i,
@@ -867,10 +844,10 @@ function ss(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = !1) {
867
844
  iouThreshold: b,
868
845
  scoreThreshold: h,
869
846
  padToMaxOutputSize: a
870
- }, y = f.runKernel(Qn, g, d);
847
+ }, y = f.runKernel(Xn, g, d);
871
848
  return { selectedIndices: y[0], validOutputs: y[1] };
872
849
  }
873
- const ts = /* @__PURE__ */ m({ nonMaxSuppressionPadded_: ss });
850
+ const es = /* @__PURE__ */ m({ nonMaxSuppressionPadded_: ns });
874
851
  /**
875
852
  * @license
876
853
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -887,7 +864,7 @@ const ts = /* @__PURE__ */ m({ nonMaxSuppressionPadded_: ss });
887
864
  * limitations under the License.
888
865
  * =============================================================================
889
866
  */
890
- async function rs(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = !1) {
867
+ async function ss(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = !1) {
891
868
  const o = u(s, "boxes", "nonMaxSuppressionAsync"), i = u(e, "scores", "nonMaxSuppressionAsync"), p = R(
892
869
  o,
893
870
  i,
@@ -896,13 +873,13 @@ async function rs(s, e, n, r = 0.5, t = Number.NEGATIVE_INFINITY, a = !1) {
896
873
  t,
897
874
  null
898
875
  /* softNmsSigma */
899
- ), c = p.maxOutputSize, b = p.iouThreshold, h = p.scoreThreshold, [g, d] = await Promise.all([o.data(), i.data()]), { selectedIndices: y, validOutputs: M } = te(g, d, c, b, h, a);
876
+ ), c = p.maxOutputSize, b = p.iouThreshold, h = p.scoreThreshold, [g, d] = await Promise.all([o.data(), i.data()]), { selectedIndices: y, validOutputs: M } = se(g, d, c, b, h, a);
900
877
  return o !== s && o.dispose(), i !== e && i.dispose(), {
901
878
  selectedIndices: I(y, "int32"),
902
879
  validOutputs: pn(M, "int32")
903
880
  };
904
881
  }
905
- const as = rs;
882
+ const ts = ss;
906
883
  /**
907
884
  * @license
908
885
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -919,15 +896,15 @@ const as = rs;
919
896
  * limitations under the License.
920
897
  * =============================================================================
921
898
  */
922
- function os(s, e, n = !1, r = !1) {
899
+ function rs(s, e, n = !1, r = !1) {
923
900
  const t = u(s, "images", "resizeBilinear");
924
901
  l(t.rank === 3 || t.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${t.rank}.`), l(e.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${e}.`), l(r === !1 || n === !1, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
925
902
  let a = t, o = !1;
926
903
  t.rank === 3 && (o = !0, a = k(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
927
- const i = { images: a }, p = { alignCorners: n, halfPixelCenters: r, size: e }, c = f.runKernel(Jn, i, p);
904
+ const i = { images: a }, p = { alignCorners: n, halfPixelCenters: r, size: e }, c = f.runKernel(Zn, i, p);
928
905
  return o ? k(c, [c.shape[1], c.shape[2], c.shape[3]]) : c;
929
906
  }
930
- const is = /* @__PURE__ */ m({ resizeBilinear_: os });
907
+ const as = /* @__PURE__ */ m({ resizeBilinear_: rs });
931
908
  /**
932
909
  * @license
933
910
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -944,15 +921,15 @@ const is = /* @__PURE__ */ m({ resizeBilinear_: os });
944
921
  * limitations under the License.
945
922
  * =============================================================================
946
923
  */
947
- function cs(s, e, n = !1, r = !1) {
924
+ function os(s, e, n = !1, r = !1) {
948
925
  const t = u(s, "images", "resizeNearestNeighbor");
949
926
  l(t.rank === 3 || t.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${t.rank}.`), l(e.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${e}.`), l(t.dtype === "float32" || t.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), l(r === !1 || n === !1, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
950
927
  let a = t, o = !1;
951
928
  t.rank === 3 && (o = !0, a = k(t, [1, t.shape[0], t.shape[1], t.shape[2]]));
952
- const i = { images: a }, p = { alignCorners: n, halfPixelCenters: r, size: e }, c = f.runKernel(Zn, i, p);
929
+ const i = { images: a }, p = { alignCorners: n, halfPixelCenters: r, size: e }, c = f.runKernel(Jn, i, p);
953
930
  return o ? k(c, [c.shape[1], c.shape[2], c.shape[3]]) : c;
954
931
  }
955
- const us = /* @__PURE__ */ m({ resizeNearestNeighbor_: cs });
932
+ const is = /* @__PURE__ */ m({ resizeNearestNeighbor_: os });
956
933
  /**
957
934
  * @license
958
935
  * Copyright 2021 Google LLC. All Rights Reserved.
@@ -969,38 +946,38 @@ const us = /* @__PURE__ */ m({ resizeNearestNeighbor_: cs });
969
946
  * limitations under the License.
970
947
  * =============================================================================
971
948
  */
972
- function ls(s, e = "binary", n = !1, r = 0.5) {
949
+ function cs(s, e = "binary", n = !1, r = 0.5) {
973
950
  const t = u(s, "image", "threshold"), a = 0.2989, o = 0.587, i = 0.114, p = t.shape[0] * t.shape[1];
974
951
  let c = $(I([r]), 255), b, h, g, d;
975
952
  if (l(t.rank === 3, () => `Error in threshold: image must be rank 3,but got rank ${t.rank}.`), l(t.shape[2] === 3 || t.shape[2] === 1, () => `Error in threshold: image color channel must be equal to 3 or 1but got ${t.shape[2]}.`), l(t.dtype === "int32" || t.dtype === "float32", () => `Error in dtype: image dtype must be int32 or float32,but got dtype ${t.dtype}.`), l(e === "otsu" || e === "binary", () => `Method must be binary or otsu, but was ${e}`), t.shape[2] === 3) {
976
953
  [b, h, g] = mn(t, [1, 1, 1], -1);
977
- const T = $(b, a), K = $(h, o), x = $(g, i);
978
- d = U(U(T, K), x);
954
+ const T = $(b, a), B = $(h, o), x = $(g, i);
955
+ d = U(U(T, B), x);
979
956
  } else
980
957
  d = s;
981
958
  if (e === "otsu") {
982
- const T = le(G(Ke(d), "int32"), re([]), 256);
983
- c = ps(T, p);
959
+ const T = ce(K(ze(d), "int32"), te([]), 256);
960
+ c = us(T, p);
984
961
  }
985
962
  const y = n ? bn(d, c) : nn(d, c);
986
- return G($(y, 255), "int32");
963
+ return K($(y, 255), "int32");
987
964
  }
988
- function ps(s, e) {
965
+ function us(s, e) {
989
966
  let n = I([-1]), r = I([0]), t = I([0]), a, o, i, p, c, b;
990
967
  for (let h = 0; h < s.size - 1; h++) {
991
968
  a = _(s, 0, h + 1), o = _(s, h + 1), c = q(E(a), e), b = q(E(o), e);
992
969
  const g = E($(a, W(0, a.size)));
993
970
  i = q(g, E(a));
994
- const d = Hn(o.shape, a.size), y = U(W(0, o.size), d), M = $(o, y);
971
+ const d = Qn(o.shape, a.size), y = U(W(0, o.size), d), M = $(o, y);
995
972
  p = q(E(M), E(o));
996
- const T = A(i, p), K = A(i, p), x = $(c, b);
997
- t = $($(x, T), K);
973
+ const T = A(i, p), B = A(i, p), x = $(c, b);
974
+ t = $($(x, T), B);
998
975
  const V = nn(t, r);
999
- r = B(V, t, r), n = B(V, I([h]), n);
976
+ r = G(V, t, r), n = G(V, I([h]), n);
1000
977
  }
1001
978
  return n;
1002
979
  }
1003
- const ms = /* @__PURE__ */ m({ threshold_: ls });
980
+ const ls = /* @__PURE__ */ m({ threshold_: cs });
1004
981
  /**
1005
982
  * @license
1006
983
  * Copyright 2021 Google LLC. All Rights Reserved.
@@ -1017,13 +994,13 @@ const ms = /* @__PURE__ */ m({ threshold_: ls });
1017
994
  * limitations under the License.
1018
995
  * =============================================================================
1019
996
  */
1020
- function fs(s, e, n = "nearest", r = "constant", t = 0, a) {
997
+ function ps(s, e, n = "nearest", r = "constant", t = 0, a) {
1021
998
  const o = u(s, "image", "transform", "float32"), i = u(e, "transforms", "transform", "float32");
1022
999
  l(o.rank === 4, () => `Error in transform: image must be rank 4,but got rank ${o.rank}.`), l(i.rank === 2 && (i.shape[0] === o.shape[0] || i.shape[0] === 1) && i.shape[1] === 8, () => "Error in transform: Input transform should be batch x 8 or 1 x 8"), l(a == null || a.length === 2, () => `Error in transform: outputShape must be [height, width] or null, but got ${a}.`);
1023
1000
  const p = { image: o, transforms: i }, c = { interpolation: n, fillMode: r, fillValue: t, outputShape: a };
1024
- return f.runKernel(Un, p, c);
1001
+ return f.runKernel(Hn, p, c);
1025
1002
  }
1026
- const hs = /* @__PURE__ */ m({ transform_: fs });
1003
+ const ms = /* @__PURE__ */ m({ transform_: ps });
1027
1004
  /**
1028
1005
  * @license
1029
1006
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1040,16 +1017,16 @@ const hs = /* @__PURE__ */ m({ transform_: fs });
1040
1017
  * limitations under the License.
1041
1018
  * =============================================================================
1042
1019
  */
1043
- function bs(s, e, n) {
1020
+ function fs(s, e, n) {
1044
1021
  const r = u(s, "a", "bandPart");
1045
1022
  l(r.rank >= 2, () => `bandPart(): Rank must be at least 2, got ${r.rank}.`);
1046
1023
  const t = r.shape, [a, o] = r.shape.slice(-2);
1047
1024
  let i, p;
1048
- typeof e == "number" ? (l(e % 1 === 0, () => `bandPart(): numLower must be an integer, got ${e}.`), l(e <= a, () => `bandPart(): numLower (${e}) must not be greater than the number of rows (${a}).`), i = u(e < 0 ? a : e, "numLower", "bandPart")) : (l(e.dtype === "int32", () => "bandPart(): numLower's dtype must be an int32."), i = B(on(e, 0), a, cn(e, a))), typeof n == "number" ? (l(n % 1 === 0, () => `bandPart(): numUpper must be an integer, got ${n}.`), l(n <= o, () => `bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`), p = u(n < 0 ? o : n, "numUpper", "bandPart")) : (l(n.dtype === "int32", () => "bandPart(): numUpper's dtype must be an int32."), p = B(on(n, 0), o, cn(n, o)));
1049
- const c = k(W(0, a, 1, "int32"), [-1, 1]), b = W(0, o, 1, "int32"), h = A(c, b), g = we(bn(h, i), Ee(h, en(p))), d = oe([a, o], r.dtype);
1050
- return k(O(dn(k(r, [-1, a, o])).map((y) => B(g, y, d))), t);
1025
+ typeof e == "number" ? (l(e % 1 === 0, () => `bandPart(): numLower must be an integer, got ${e}.`), l(e <= a, () => `bandPart(): numLower (${e}) must not be greater than the number of rows (${a}).`), i = u(e < 0 ? a : e, "numLower", "bandPart")) : (l(e.dtype === "int32", () => "bandPart(): numLower's dtype must be an int32."), i = G(on(e, 0), a, cn(e, a))), typeof n == "number" ? (l(n % 1 === 0, () => `bandPart(): numUpper must be an integer, got ${n}.`), l(n <= o, () => `bandPart(): numUpper (${n}) must not be greater than the number of columns (${o}).`), p = u(n < 0 ? o : n, "numUpper", "bandPart")) : (l(n.dtype === "int32", () => "bandPart(): numUpper's dtype must be an int32."), p = G(on(n, 0), o, cn(n, o)));
1026
+ const c = k(W(0, a, 1, "int32"), [-1, 1]), b = W(0, o, 1, "int32"), h = A(c, b), g = Te(bn(h, i), ke(h, en(p))), d = ae([a, o], r.dtype);
1027
+ return k(Y(dn(k(r, [-1, a, o])).map((y) => G(g, y, d))), t);
1051
1028
  }
1052
- const ds = /* @__PURE__ */ m({ bandPart_: bs });
1029
+ const hs = /* @__PURE__ */ m({ bandPart_: fs });
1053
1030
  /**
1054
1031
  * @license
1055
1032
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1066,7 +1043,7 @@ const ds = /* @__PURE__ */ m({ bandPart_: bs });
1066
1043
  * limitations under the License.
1067
1044
  * =============================================================================
1068
1045
  */
1069
- function gs(s) {
1046
+ function bs(s) {
1070
1047
  let e;
1071
1048
  if (Array.isArray(s)) {
1072
1049
  e = !1, l(s != null && s.length > 0, () => "Gram-Schmidt process: input must not be null, undefined, or empty");
@@ -1074,7 +1051,7 @@ function gs(s) {
1074
1051
  for (let a = 1; a < s.length; ++a)
1075
1052
  l(s[a].shape[0] === t, () => `Gram-Schmidt: Non-unique lengths found in the input vectors: (${s[a].shape[0]} vs. ${t})`);
1076
1053
  } else
1077
- e = !0, s = mn(s, s.shape[0], 0).map((t) => Ge(t, [0]));
1054
+ e = !0, s = mn(s, s.shape[0], 0).map((t) => Be(t, [0]));
1078
1055
  l(s.length <= s[0].shape[0], () => `Gram-Schmidt: Number of vectors (${s.length}) exceeds number of dimensions (${s[0].shape[0]}).`);
1079
1056
  const n = [], r = s;
1080
1057
  for (let t = 0; t < s.length; ++t)
@@ -1087,9 +1064,9 @@ function gs(s) {
1087
1064
  }
1088
1065
  return q(a, hn(a, "euclidean"));
1089
1066
  }));
1090
- return e ? O(n, 0) : n;
1067
+ return e ? Y(n, 0) : n;
1091
1068
  }
1092
- const $s = /* @__PURE__ */ m({ gramSchmidt_: gs });
1069
+ const ds = /* @__PURE__ */ m({ gramSchmidt_: bs });
1093
1070
  /**
1094
1071
  * @license
1095
1072
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1106,7 +1083,7 @@ const $s = /* @__PURE__ */ m({ gramSchmidt_: gs });
1106
1083
  * limitations under the License.
1107
1084
  * =============================================================================
1108
1085
  */
1109
- function ks(s, e = !1) {
1086
+ function gs(s, e = !1) {
1110
1087
  if (l(s.rank >= 2, () => `qr() requires input tensor to have a rank >= 2, but got rank ${s.rank}`), s.rank === 2)
1111
1088
  return ln(s, e);
1112
1089
  {
@@ -1119,7 +1096,7 @@ function ks(s, e = !1) {
1119
1096
  const [c, b] = ln(p, e);
1120
1097
  t.push(c), a.push(b);
1121
1098
  });
1122
- const o = k(O(t, 0), s.shape), i = k(O(a, 0), s.shape);
1099
+ const o = k(Y(t, 0), s.shape), i = k(Y(a, 0), s.shape);
1123
1100
  return [o, i];
1124
1101
  }
1125
1102
  }
@@ -1127,39 +1104,39 @@ function ln(s, e = !1) {
1127
1104
  return f.tidy(() => {
1128
1105
  l(s.shape.length === 2, () => `qr2d() requires a 2D Tensor, but got a ${s.shape.length}D Tensor.`);
1129
1106
  const n = s.shape[0], r = s.shape[1];
1130
- let t = $e(n), a = X(s);
1107
+ let t = de(n), a = X(s);
1131
1108
  const o = H([[1]], [1, 1]);
1132
1109
  let i = X(o);
1133
1110
  const p = n >= r ? r : n;
1134
1111
  for (let c = 0; c < p; ++c) {
1135
1112
  const b = a, h = i, g = t;
1136
1113
  [i, a, t] = f.tidy(() => {
1137
- const d = _(a, [c, c], [n - c, 1]), y = hn(d), M = _(a, [c, c], [1, 1]), T = B(nn(M, 0), H([[-1]]), H([[1]])), K = A(M, $(T, y)), x = q(d, K);
1138
- x.shape[0] === 1 ? i = X(o) : i = Z([
1114
+ const d = _(a, [c, c], [n - c, 1]), y = hn(d), M = _(a, [c, c], [1, 1]), T = G(nn(M, 0), H([[-1]]), H([[1]])), B = A(M, $(T, y)), x = q(d, B);
1115
+ x.shape[0] === 1 ? i = X(o) : i = Q([
1139
1116
  o,
1140
1117
  _(x, [1, 0], [x.shape[0] - 1, x.shape[1]])
1141
1118
  ], 0);
1142
- const V = en(q(N(T, K), y)), P = _(a, [c, 0], [n - c, r]), Y = $(V, i), sn = un(i);
1119
+ const V = en(q(N(T, B), y)), P = _(a, [c, 0], [n - c, r]), O = $(V, i), sn = un(i);
1143
1120
  if (c === 0)
1144
- a = A(P, N(Y, N(sn, P)));
1121
+ a = A(P, N(O, N(sn, P)));
1145
1122
  else {
1146
- const L = A(P, N(Y, N(sn, P)));
1147
- a = Z([_(a, [0, 0], [c, r]), L], 0);
1123
+ const C = A(P, N(O, N(sn, P)));
1124
+ a = Q([_(a, [0, 0], [c, r]), C], 0);
1148
1125
  }
1149
- const tn = un(Y), j = _(t, [0, c], [n, t.shape[1] - c]);
1126
+ const tn = un(O), j = _(t, [0, c], [n, t.shape[1] - c]);
1150
1127
  if (c === 0)
1151
1128
  t = A(j, N(N(j, i), tn));
1152
1129
  else {
1153
- const L = A(j, N(N(j, i), tn));
1154
- t = Z([_(t, [0, 0], [n, c]), L], 1);
1130
+ const C = A(j, N(N(j, i), tn));
1131
+ t = Q([_(t, [0, 0], [n, c]), C], 1);
1155
1132
  }
1156
1133
  return [i, a, t];
1157
- }), ne([b, h, g]);
1134
+ }), Un([b, h, g]);
1158
1135
  }
1159
1136
  return !e && n > r && (t = _(t, [0, 0], [n, r]), a = _(a, [0, 0], [r, r])), [t, a];
1160
1137
  });
1161
1138
  }
1162
- const ys = /* @__PURE__ */ m({ qr_: ks });
1139
+ const $s = /* @__PURE__ */ m({ qr_: gs });
1163
1140
  /**
1164
1141
  * @license
1165
1142
  * Copyright 2020 Google LLC. All Rights Reserved.
@@ -1176,51 +1153,50 @@ const ys = /* @__PURE__ */ m({ qr_: ks });
1176
1153
  * limitations under the License.
1177
1154
  * =============================================================================
1178
1155
  */
1179
- const Rs = {
1180
- flipLeftRight: je,
1181
- grayscaleToRGB: We,
1182
- resizeNearestNeighbor: us,
1183
- resizeBilinear: is,
1184
- rgbToGrayscale: Ye,
1185
- rotateWithOffset: Ce,
1186
- cropAndResize: Ve,
1187
- nonMaxSuppression: Qe,
1156
+ const Ks = {
1157
+ flipLeftRight: Ve,
1158
+ grayscaleToRGB: je,
1159
+ resizeNearestNeighbor: is,
1160
+ resizeBilinear: as,
1161
+ rgbToGrayscale: We,
1162
+ rotateWithOffset: Oe,
1163
+ cropAndResize: De,
1164
+ nonMaxSuppression: Le,
1188
1165
  nonMaxSuppressionAsync: Ze,
1189
- nonMaxSuppressionWithScore: Ue,
1190
- nonMaxSuppressionWithScoreAsync: es,
1191
- nonMaxSuppressionPadded: ts,
1192
- nonMaxSuppressionPaddedAsync: as,
1193
- threshold: ms,
1194
- transform: hs
1195
- }, Ds = {
1196
- bandPart: ds,
1197
- gramSchmidt: $s,
1198
- qr: ys
1166
+ nonMaxSuppressionWithScore: Qe,
1167
+ nonMaxSuppressionWithScoreAsync: Ue,
1168
+ nonMaxSuppressionPadded: es,
1169
+ nonMaxSuppressionPaddedAsync: ts,
1170
+ threshold: ls,
1171
+ transform: ms
1172
+ }, Rs = {
1173
+ bandPart: hs,
1174
+ gramSchmidt: ds,
1175
+ qr: $s
1199
1176
  };
1200
1177
  export {
1201
- we as a,
1178
+ Te as a,
1202
1179
  bn as b,
1203
1180
  F as c,
1204
1181
  nn as d,
1205
1182
  on as e,
1206
1183
  z as f,
1207
- Ee as g,
1184
+ ke as g,
1208
1185
  I as h,
1209
- $e as i,
1210
- Ge as j,
1211
- Rs as k,
1212
- Ds as l,
1186
+ de as i,
1187
+ Ks as j,
1188
+ an as k,
1189
+ Rs as l,
1213
1190
  cn as m,
1214
1191
  en as n,
1215
- an as o,
1216
- hn as p,
1217
- Ie as q,
1218
- ze as r,
1219
- _ as s,
1192
+ hn as o,
1193
+ Ee as p,
1194
+ as as q,
1195
+ Se as r,
1196
+ Be as s,
1220
1197
  un as t,
1221
1198
  dn as u,
1222
1199
  is as v,
1223
- B as w,
1224
- us as x,
1225
- Ke as y
1200
+ G as w,
1201
+ ze as x
1226
1202
  };