@genai-fi/nanogpt 0.17.5 → 0.18.0

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 (258) hide show
  1. package/dist/Generator.d.ts +2 -15
  2. package/dist/Generator.js +45 -34
  3. package/dist/{RealDiv-CGwv0liw.js → RealDiv-ioj6Z-ox.js} +9 -9
  4. package/dist/{Reshape-BW__R4mZ.js → Reshape-BZC-ebeR.js} +7 -7
  5. package/dist/{Reshape-CPBkTIH2.js → Reshape-pwprEaej.js} +1 -1
  6. package/dist/TeachableLLM.d.ts +3 -8
  7. package/dist/TeachableLLM.js +61 -44
  8. package/dist/Trainer.d.ts +6 -4
  9. package/dist/Trainer.js +107 -92
  10. package/dist/{axis_util-GTVlo58H.js → axis_util-QWWgLjut.js} +1 -1
  11. package/dist/backend.js +2 -2
  12. package/dist/{backend_util-GaFarB78.js → backend_util-qwSFfxYx.js} +21 -21
  13. package/dist/{backend_webgpu-BqASlsbV.js → backend_webgpu-DI2wXEC2.js} +8 -8
  14. package/dist/{broadcast_to-eS93CCN_.js → broadcast_to-C_EJTVTZ.js} +2 -2
  15. package/dist/checks/appendCache.js +2 -2
  16. package/dist/checks/attentionMask.js +5 -5
  17. package/dist/checks/gelu.js +2 -2
  18. package/dist/checks/matMulGelu.js +2 -2
  19. package/dist/checks/normRMS.js +6 -6
  20. package/dist/checks/normRMSGrad.js +3 -3
  21. package/dist/checks/packUnpack.js +6 -6
  22. package/dist/checks/qkv.js +2 -2
  23. package/dist/checks/rope.js +2 -2
  24. package/dist/{clip_by_value-DDA7rrcT.js → clip_by_value-CLAD4h_I.js} +1 -1
  25. package/dist/complex-3DpPEG9B.js +11 -0
  26. package/dist/{concat-CAQpCret.js → concat-Dqk7Xk7h.js} +5 -5
  27. package/dist/{concat_util-D18dJ4fD.js → concat_util-C1Mxe27t.js} +1 -1
  28. package/dist/{dataset-CGGp1z9P.js → dataset-DlqAN81i.js} +3 -3
  29. package/dist/{dropout_util--NxWuYg2.js → dropout_util-N0z8Os-K.js} +1 -1
  30. package/dist/{expand_dims-Bkd1YD5x.js → expand_dims-D0rBtgT1.js} +4 -4
  31. package/dist/{exports_initializers-CYzKLjN7.js → exports_initializers-DIOZQt_L.js} +1 -1
  32. package/dist/{floor-BQtb-Azg.js → floor-CymuCmTO.js} +1 -1
  33. package/dist/{gather-qIqEqaGn.js → gather-DEyjXNb1.js} +1 -1
  34. package/dist/{gelu-B220X1Go.js → gelu-DpTCC3eB.js} +1 -1
  35. package/dist/{gpgpu_math-BwvV12df.js → gpgpu_math-3bCb5ooU.js} +25 -25
  36. package/dist/{index-CjOWnMXP.js → index-BQvB7LCC.js} +15 -15
  37. package/dist/{index-CUXkjxiT.js → index-DSGwv2Yx.js} +33 -33
  38. package/dist/inference/types.d.ts +16 -0
  39. package/dist/inference/types.js +1 -0
  40. package/dist/{kernel_funcs_utils-pq0CK9co.js → kernel_funcs_utils-DGqzNlHT.js} +6 -6
  41. package/dist/layers/BaseLayer.js +4 -4
  42. package/dist/layers/CausalSelfAttention.js +6 -6
  43. package/dist/layers/LoRA.js +4 -4
  44. package/dist/layers/MLP.js +4 -4
  45. package/dist/layers/PositionEmbedding.js +5 -5
  46. package/dist/layers/RMSNorm.js +3 -3
  47. package/dist/layers/RoPECache.js +4 -4
  48. package/dist/layers/TiedEmbedding.js +6 -6
  49. package/dist/layers/TransformerBlock.js +1 -1
  50. package/dist/layers/WeightStore.js +2 -2
  51. package/dist/loader/load.d.ts +2 -8
  52. package/dist/loader/loadTransformers.d.ts +2 -8
  53. package/dist/loader/loadTransformers.js +13 -11
  54. package/dist/loader/newZipLoad.d.ts +2 -8
  55. package/dist/loader/newZipLoad.js +25 -10
  56. package/dist/loader/oldZipLoad.js +13 -13
  57. package/dist/loader/save.d.ts +9 -2
  58. package/dist/loader/save.js +64 -55
  59. package/dist/loader/types.d.ts +29 -1
  60. package/dist/main.d.ts +2 -0
  61. package/dist/main.js +45 -43
  62. package/dist/{matMul16-BcVC_E62.js → matMul16-BIT70Vya.js} +3 -3
  63. package/dist/{matMulGelu-JNLZqKQp.js → matMulGelu-CsZnh18H.js} +18 -18
  64. package/dist/mat_mul-DP86qZtZ.js +11 -0
  65. package/dist/mod-BXjLYwvM.js +11 -0
  66. package/dist/models/NanoGPTV1.js +2 -2
  67. package/dist/models/NanoGPTV2.js +2 -2
  68. package/dist/models/model.d.ts +3 -2
  69. package/dist/models/model.js +13 -13
  70. package/dist/{not_equal-hurPF26l.js → not_equal-CkQKkKZy.js} +15 -15
  71. package/dist/{ones-BytntneX.js → ones-DbVB5N58.js} +3 -3
  72. package/dist/ops/adamAdjust.js +3 -3
  73. package/dist/ops/adamMoments.js +3 -3
  74. package/dist/ops/add16.js +1 -1
  75. package/dist/ops/appendCache.js +6 -6
  76. package/dist/ops/attentionMask.js +3 -3
  77. package/dist/ops/concat16.js +3 -3
  78. package/dist/ops/cpu/adamAdjust.js +9 -9
  79. package/dist/ops/cpu/adamMoments.js +5 -5
  80. package/dist/ops/cpu/appendCache.js +2 -2
  81. package/dist/ops/cpu/attentionMask.js +6 -6
  82. package/dist/ops/cpu/fusedSoftmax.js +4 -4
  83. package/dist/ops/cpu/gatherSub.js +5 -5
  84. package/dist/ops/cpu/gelu.js +4 -4
  85. package/dist/ops/cpu/matMul16.js +2 -2
  86. package/dist/ops/cpu/matMulGelu.js +7 -7
  87. package/dist/ops/cpu/matMulMul.js +2 -2
  88. package/dist/ops/cpu/mulDropout.js +5 -5
  89. package/dist/ops/cpu/normRMS.js +1 -1
  90. package/dist/ops/cpu/qkv.js +3 -3
  91. package/dist/ops/cpu/rope.js +5 -5
  92. package/dist/ops/cpu/scatterSub.js +5 -5
  93. package/dist/ops/dot16.js +2 -2
  94. package/dist/ops/dropout.js +6 -6
  95. package/dist/ops/dropout16.js +1 -1
  96. package/dist/ops/gatherSub.js +1 -1
  97. package/dist/ops/gelu.js +2 -2
  98. package/dist/ops/globalNorm.js +7 -7
  99. package/dist/ops/grads/add16.js +1 -1
  100. package/dist/ops/grads/attentionMask.js +2 -2
  101. package/dist/ops/grads/dropout16.js +1 -1
  102. package/dist/ops/grads/gelu.js +2 -2
  103. package/dist/ops/grads/matMul16.js +3 -3
  104. package/dist/ops/grads/matMulGelu.js +1 -1
  105. package/dist/ops/grads/mul16.js +1 -1
  106. package/dist/ops/grads/normRMS.js +7 -7
  107. package/dist/ops/grads/pack16.js +3 -3
  108. package/dist/ops/grads/qkv.js +11 -11
  109. package/dist/ops/grads/rope.js +2 -2
  110. package/dist/ops/grads/softmax16.js +1 -1
  111. package/dist/ops/grads/unpack16.js +2 -2
  112. package/dist/ops/matMul16.js +3 -3
  113. package/dist/ops/matMulGelu.js +6 -6
  114. package/dist/ops/matMulMul.js +3 -3
  115. package/dist/ops/mul16.js +1 -1
  116. package/dist/ops/mulDrop.js +3 -3
  117. package/dist/ops/normRMS.js +4 -4
  118. package/dist/ops/pack16.js +2 -2
  119. package/dist/ops/qkv.js +3 -3
  120. package/dist/ops/reshape16.js +6 -6
  121. package/dist/ops/rope.js +2 -2
  122. package/dist/ops/scatterSub.js +1 -1
  123. package/dist/ops/slice16.js +2 -2
  124. package/dist/ops/softmax16.js +1 -1
  125. package/dist/ops/sub16.js +1 -1
  126. package/dist/ops/sum16.js +6 -6
  127. package/dist/ops/transpose16.js +3 -3
  128. package/dist/ops/unpack16.js +2 -2
  129. package/dist/ops/webgl/adamAdjust.js +2 -2
  130. package/dist/ops/webgl/adamMoments.js +1 -1
  131. package/dist/ops/webgl/appendCache.js +1 -1
  132. package/dist/ops/webgl/attentionMask.js +1 -1
  133. package/dist/ops/webgl/dropout16.js +1 -1
  134. package/dist/ops/webgl/fusedSoftmax.js +7 -7
  135. package/dist/ops/webgl/gatherSub.js +3 -3
  136. package/dist/ops/webgl/gelu.js +2 -2
  137. package/dist/ops/webgl/log.js +3 -3
  138. package/dist/ops/webgl/matMul16.js +13 -13
  139. package/dist/ops/webgl/matMulGelu.js +4 -4
  140. package/dist/ops/webgl/matMulMul.js +2 -2
  141. package/dist/ops/webgl/mulDropout.js +1 -1
  142. package/dist/ops/webgl/normRMS.js +2 -2
  143. package/dist/ops/webgl/qkv.js +1 -1
  144. package/dist/ops/webgl/rope.js +1 -1
  145. package/dist/ops/webgl/scatterSub.js +2 -2
  146. package/dist/ops/webgpu/adamAdjust.js +3 -3
  147. package/dist/ops/webgpu/adamMoments.js +3 -3
  148. package/dist/ops/webgpu/add16.js +6 -6
  149. package/dist/ops/webgpu/appendCache.js +3 -3
  150. package/dist/ops/webgpu/attentionMask.js +2 -2
  151. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  152. package/dist/ops/webgpu/clipScale.js +7 -7
  153. package/dist/ops/webgpu/concat16.js +5 -5
  154. package/dist/ops/webgpu/dropout16.js +6 -6
  155. package/dist/ops/webgpu/gatherSub.js +3 -3
  156. package/dist/ops/webgpu/gelu.js +8 -8
  157. package/dist/ops/webgpu/matMul16.js +16 -16
  158. package/dist/ops/webgpu/matMul16_program.js +2 -2
  159. package/dist/ops/webgpu/mul16.js +5 -5
  160. package/dist/ops/webgpu/norm2.js +1 -1
  161. package/dist/ops/webgpu/normRMS.js +2 -2
  162. package/dist/ops/webgpu/normRMSGrad.js +4 -4
  163. package/dist/ops/webgpu/pack16.js +4 -4
  164. package/dist/ops/webgpu/pack16_program.js +2 -2
  165. package/dist/ops/webgpu/qkv.js +2 -2
  166. package/dist/ops/webgpu/rope.js +3 -3
  167. package/dist/ops/webgpu/scatterSub.js +3 -3
  168. package/dist/ops/webgpu/slice16.js +4 -4
  169. package/dist/ops/webgpu/softmax16.js +4 -4
  170. package/dist/ops/webgpu/softmax16_program.js +2 -2
  171. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  172. package/dist/ops/webgpu/softmax16grad.js +4 -4
  173. package/dist/ops/webgpu/sub16.js +6 -6
  174. package/dist/ops/webgpu/sum16.js +3 -3
  175. package/dist/ops/webgpu/transpose16.js +8 -8
  176. package/dist/ops/webgpu/transpose16_program.js +2 -2
  177. package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
  178. package/dist/ops/webgpu/unpack16.js +3 -3
  179. package/dist/ops/webgpu/utils/binary_op.js +3 -3
  180. package/dist/ops/webgpu/utils/reductions.js +5 -5
  181. package/dist/{ops-CsXeTq1P.js → ops-CURIZSVt.js} +100 -100
  182. package/dist/{pack16-bqltoUlR.js → pack16-WlOSOuZA.js} +2 -2
  183. package/dist/patches/webgpu_backend.js +6 -6
  184. package/dist/patches/webgpu_base.js +1 -1
  185. package/dist/patches/webgpu_program.js +2 -2
  186. package/dist/{random_normal-IBRrha8a.js → random_normal-CIm8lk2-.js} +1 -1
  187. package/dist/{random_width-DN5ZtQkM.js → random_width-B_fVXhGx.js} +131 -131
  188. package/dist/{range-C-CjF-LI.js → range-BDxO73mk.js} +1 -1
  189. package/dist/{readers-iz5u3HBo.js → readers-17HLdxVM.js} +2 -2
  190. package/dist/relu-DTvZKBsZ.js +9 -0
  191. package/dist/{reshape-BDOuCSNW.js → reshape-BIN71H3p.js} +1 -1
  192. package/dist/{resize_nearest_neighbor-BojqlfRe.js → resize_nearest_neighbor-C6_0dAnK.js} +41 -41
  193. package/dist/{rope-0j_f1TPm.js → rope-CC5RjmKU.js} +4 -4
  194. package/dist/{scatter_nd_util-ByNJaL6I.js → scatter_nd_util-C-x73Cj6.js} +1 -1
  195. package/dist/{segment_util-Dasb2Zaf.js → segment_util-4zuHV5IG.js} +2 -2
  196. package/dist/{selu_util-BLhIqRkw.js → selu_util-BXdhy_W6.js} +5 -5
  197. package/dist/{shared-CagdqkLh.js → shared-DRWDyk9w.js} +6 -6
  198. package/dist/{shared-3agzAqQ_.js → shared-zTaJ5siv.js} +1 -1
  199. package/dist/slice-BvItlgXu.js +12 -0
  200. package/dist/{slice_util-CC35pLmT.js → slice_util-DPY56GzQ.js} +5 -5
  201. package/dist/{softmax-D4q1LJN7.js → softmax-BLGJqdwx.js} +1 -1
  202. package/dist/split-BN9LkEgS.js +9 -0
  203. package/dist/{squeeze-ho4wLUek.js → squeeze-O_YWJpw_.js} +2 -2
  204. package/dist/{stack-DudVrtmG.js → stack-z6QE7kmP.js} +1 -1
  205. package/dist/{step-BTxPtq1r.js → step-DQY6_ABw.js} +4 -4
  206. package/dist/{sum-BpiwSWvg.js → sum-D39FeU5h.js} +3 -3
  207. package/dist/{tensor-BWFldCso.js → tensor-D8e0Gd7c.js} +1 -1
  208. package/dist/{tensor1d-LMGMIUlr.js → tensor1d-BMl0eZYV.js} +1 -1
  209. package/dist/{tensor2d-BnXMKScO.js → tensor2d-DTtQ1QcT.js} +1 -1
  210. package/dist/{tensor4d-C6UCG_u8.js → tensor4d-Dj4rDssL.js} +1 -1
  211. package/dist/{tfjs_backend-BGnG-ppu.js → tfjs_backend-Bk3PmK91.js} +65 -65
  212. package/dist/{tile-CFy-xTO6.js → tile-CsWlVKKz.js} +1 -1
  213. package/dist/tokeniser/BaseTokeniser.d.ts +4 -1
  214. package/dist/tokeniser/BaseTokeniser.js +21 -5
  215. package/dist/tokeniser/CharTokeniser.d.ts +1 -1
  216. package/dist/tokeniser/CharTokeniser.js +29 -28
  217. package/dist/tokeniser/bpe.d.ts +1 -1
  218. package/dist/tokeniser/bpe.js +23 -22
  219. package/dist/tokeniser/type.d.ts +3 -1
  220. package/dist/training/AdamW.d.ts +3 -0
  221. package/dist/training/AdamW.js +59 -30
  222. package/dist/training/BasicTrainer.d.ts +1 -0
  223. package/dist/training/BasicTrainer.js +112 -92
  224. package/dist/training/DatasetBuilder.js +3 -3
  225. package/dist/training/Evaluator.js +2 -2
  226. package/dist/training/LRScheduler.d.ts +1 -0
  227. package/dist/training/LRScheduler.js +18 -12
  228. package/dist/training/PreTrainer.js +3 -3
  229. package/dist/training/SFTDatasetBuilder.js +3 -3
  230. package/dist/training/SFTTrainer.js +1 -1
  231. package/dist/training/orthoGrad.js +1 -1
  232. package/dist/training/sparseCrossEntropy.js +30 -30
  233. package/dist/training/types.d.ts +5 -3
  234. package/dist/training/validation.js +13 -13
  235. package/dist/{transpose-9kRxIXWR.js → transpose-Qxz-4os3.js} +7 -7
  236. package/dist/{unsorted_segment_sum-DJvk5xnh.js → unsorted_segment_sum-BfFVV9Zm.js} +20 -20
  237. package/dist/utilities/datasetID.d.ts +2 -0
  238. package/dist/utilities/datasetID.js +21 -0
  239. package/dist/utilities/dummy.js +6 -6
  240. package/dist/utilities/multinomialCPU.js +2 -2
  241. package/dist/utilities/packed.js +1 -1
  242. package/dist/utilities/performance.js +1 -1
  243. package/dist/utilities/profile.js +1 -1
  244. package/dist/utilities/safetensors.js +2 -2
  245. package/dist/utilities/sentences.js +5 -5
  246. package/dist/utilities/weights.js +2 -2
  247. package/dist/{variable-Ck482e3n.js → variable-SSATClyt.js} +1 -1
  248. package/dist/{webgpu_program-B4HmApL1.js → webgpu_program-CbjdYLYk.js} +1 -1
  249. package/dist/{webgpu_util-DYlGSwOJ.js → webgpu_util-DuofJBMo.js} +7 -7
  250. package/dist/{zeros-DvZpK8s6.js → zeros-Bw0puq_w.js} +2 -2
  251. package/dist/{zeros_like-CWjDdwr-.js → zeros_like-rOHr54NY.js} +69 -69
  252. package/package.json +3 -3
  253. package/dist/complex-DI35Q-gW.js +0 -11
  254. package/dist/mat_mul-DhG0Newp.js +0 -11
  255. package/dist/mod-CSdCpRjf.js +0 -11
  256. package/dist/relu-J_X6MUzx.js +0 -9
  257. package/dist/slice-BzS11Qh0.js +0 -12
  258. package/dist/split-C2Sj255c.js +0 -9
@@ -1,13 +1,13 @@
1
1
  import { isPackedTensor as d } from "../../utilities/packed.js";
2
- import { c as k, h as l } from "../../index-CUXkjxiT.js";
2
+ import { a as k, e as l } from "../../index-DSGwv2Yx.js";
3
3
  import { reshape16 as u } from "../reshape16.js";
4
4
  import P from "./transpose16_shared_program.js";
5
5
  import b from "./transpose16_program.js";
6
- import { t as T } from "../../transpose-9kRxIXWR.js";
7
- function w(p) {
8
- const { inputs: h, attrs: i } = p, { x: e } = h, { perm: r } = i, a = p.backend, c = d(e);
9
- if (c && r[r.length - 1] !== e.shape.length - 1) {
10
- const o = e.shape.length, m = o === 4 ? r.map((s) => s - 1).filter((s) => s >= 0) : r, t = o === 4 ? u(e, [e.shape[0] * e.shape[1], e.shape[2], e.shape[3]]) : e, f = new P(t.shape, m), n = a.runWebGPUProgram(f, [t], "packedF16");
6
+ import { t as T } from "../../transpose-Qxz-4os3.js";
7
+ function w(a) {
8
+ const { inputs: h, attrs: i } = a, { x: e } = h, { perm: r } = i, p = a.backend, m = d(e);
9
+ if (m && r[r.length - 1] !== e.shape.length - 1) {
10
+ const o = e.shape.length, c = o === 4 ? r.map((s) => s - 1).filter((s) => s >= 0) : r, t = o === 4 ? u(e, [e.shape[0] * e.shape[1], e.shape[2], e.shape[3]]) : e, f = new P(t.shape, c), n = p.runWebGPUProgram(f, [t], "packedF16");
11
11
  if (o === 4) {
12
12
  t.dispose();
13
13
  const s = l().makeTensorFromTensorInfo(n), g = u(s, [
@@ -20,9 +20,9 @@ function w(p) {
20
20
  }
21
21
  return n;
22
22
  }
23
- if (c) {
23
+ if (m) {
24
24
  const o = new b(e.shape, r);
25
- return a.runWebGPUProgram(o, [e], "packedF16");
25
+ return p.runWebGPUProgram(o, [e], "packedF16");
26
26
  } else
27
27
  return T(e, r);
28
28
  }
@@ -1,5 +1,5 @@
1
- import { f as a, c as i } from "../../webgpu_util-DYlGSwOJ.js";
2
- import { b as h, e as d, c as n } from "../../webgpu_program-B4HmApL1.js";
1
+ import { f as a, c as i } from "../../webgpu_util-DuofJBMo.js";
2
+ import { b as h, e as d, c as n } from "../../webgpu_program-CbjdYLYk.js";
3
3
  function p(r) {
4
4
  const e = r.length;
5
5
  if (e > 6)
@@ -1,6 +1,6 @@
1
- import { c as a } from "../../webgpu_util-DYlGSwOJ.js";
2
- import { e as l } from "../../webgpu_program-B4HmApL1.js";
3
- import { x as p } from "../../index-CUXkjxiT.js";
1
+ import { c as a } from "../../webgpu_util-DuofJBMo.js";
2
+ import { e as l } from "../../webgpu_program-CbjdYLYk.js";
3
+ import { v as p } from "../../index-DSGwv2Yx.js";
4
4
  class n {
5
5
  variableNames = ["A"];
6
6
  outputShape;
@@ -1,6 +1,6 @@
1
- import { f as c, c as r } from "../../webgpu_util-DYlGSwOJ.js";
2
- import { e as u } from "../../webgpu_program-B4HmApL1.js";
3
- import { c as p } from "../../index-CUXkjxiT.js";
1
+ import { f as c, c as r } from "../../webgpu_util-DuofJBMo.js";
2
+ import { e as u } from "../../webgpu_program-CbjdYLYk.js";
3
+ import { a as p } from "../../index-DSGwv2Yx.js";
4
4
  class l {
5
5
  outputShape;
6
6
  shaderKey = "Unpack16";
@@ -1,8 +1,8 @@
1
- import { f as r, c as n } from "../../../webgpu_util-DYlGSwOJ.js";
1
+ import { f as r, c as n } from "../../../webgpu_util-DuofJBMo.js";
2
2
  import { g as p } from "../../../binary_op_util-pKXltfxI.js";
3
3
  import { B as k } from "../../../binary_op_util-pKXltfxI.js";
4
- import { _ as c, ai as s } from "../../../index-CUXkjxiT.js";
5
- import { e as u } from "../../../webgpu_program-B4HmApL1.js";
4
+ import { _ as c, ai as s } from "../../../index-DSGwv2Yx.js";
5
+ import { e as u } from "../../../webgpu_program-CbjdYLYk.js";
6
6
  class x {
7
7
  dispatch;
8
8
  dispatchLayout;
@@ -1,9 +1,9 @@
1
- import { ah as h, U as S, h as f } from "../../../index-CUXkjxiT.js";
2
- import { e as d } from "../../../webgpu_program-B4HmApL1.js";
1
+ import { ah as h, N as S, e as f } from "../../../index-DSGwv2Yx.js";
2
+ import { e as d } from "../../../webgpu_program-CbjdYLYk.js";
3
3
  import { reshape16 as g } from "../../reshape16.js";
4
- import { f as z } from "../../../webgpu_util-DYlGSwOJ.js";
5
- import { c as k } from "../../../axis_util-GTVlo58H.js";
6
- import { z as x } from "../../../zeros-DvZpK8s6.js";
4
+ import { f as z } from "../../../webgpu_util-DuofJBMo.js";
5
+ import { c as k } from "../../../axis_util-QWWgLjut.js";
6
+ import { z as x } from "../../../zeros-Bw0puq_w.js";
7
7
  function c(e, u, t, i) {
8
8
  return e && !u ? `
9
9
  bestValue = subgroupAdd(bestValue);
@@ -1,38 +1,38 @@
1
- import { o as h, q as u, x as p, E as k, bd as ds, be as hs, a5 as bs, bf as gs, bg as Es, L as W, bh as $s, bi as ys, bj as _s, bk as Ns, a as $, m as d, j as G, i as S, f as Ss, a1 as b, bl as ks, w as K, d as Is, a6 as L, a_ as ns, n as Ts, a2 as Ms } from "./index-CUXkjxiT.js";
2
- import { t as v } from "./tile-CFy-xTO6.js";
3
- import { e as R } from "./expand_dims-Bkd1YD5x.js";
4
- import { t as x } from "./tensor1d-LMGMIUlr.js";
1
+ import { o as d, n as u, v as p, E as k, bd as hs, be as ds, a5 as bs, bf as gs, bg as Es, J as W, bh as $s, bi as ys, bj as _s, bk as Ns, b as $, m as h, h as G, d as S, f as Ss, a1 as b, bl as ks, u as K, l as Is, a6 as L, a_ as ns, j as Ts, a2 as Ms } from "./index-DSGwv2Yx.js";
2
+ import { t as j } from "./tile-CsWlVKKz.js";
3
+ import { e as R } from "./expand_dims-D0rBtgT1.js";
4
+ import { t as x } from "./tensor1d-BMl0eZYV.js";
5
5
  import { n as xs, a as As, b as ws } from "./non_max_suppression_impl-B2W7YjZB.js";
6
- import { r as Os, l as ls, g as es, a as rs, m as Q, b as Gs, c as Ls, u as us, n as ps, s as Bs, d as Ds, e as Ws, f as Rs } from "./resize_nearest_neighbor-BojqlfRe.js";
7
- import { s as ms } from "./split-C2Sj255c.js";
8
- import { s as _ } from "./sum-BpiwSWvg.js";
9
- import { w as q, a as qs, n as zs, b as as, e as ss, l as Vs } from "./not_equal-hurPF26l.js";
10
- import { s as T } from "./slice-BzS11Qh0.js";
11
- import { r as F } from "./range-C-CjF-LI.js";
12
- import { t as Cs } from "./tensor-BWFldCso.js";
13
- import { n as C, t as is } from "./transpose-9kRxIXWR.js";
14
- import { r as O } from "./reshape-BDOuCSNW.js";
15
- import { s as U } from "./stack-DudVrtmG.js";
16
- import { z as Ps } from "./zeros-DvZpK8s6.js";
17
- import { s as Ys } from "./squeeze-ho4wLUek.js";
18
- import { c as X } from "./concat-CAQpCret.js";
19
- import { m as w } from "./mat_mul-DhG0Newp.js";
20
- import { t as J } from "./tensor2d-BnXMKScO.js";
21
- import { o as js } from "./ones-BytntneX.js";
22
- import { r as fs } from "./relu-J_X6MUzx.js";
23
- import { e as vs } from "./axis_util-GTVlo58H.js";
6
+ import { r as Os, l as ls, g as es, a as rs, m as Q, b as Gs, c as Ls, u as us, n as ps, s as Bs, d as Ds, e as Ws, f as Rs } from "./resize_nearest_neighbor-C6_0dAnK.js";
7
+ import { s as ms } from "./split-BN9LkEgS.js";
8
+ import { s as _ } from "./sum-D39FeU5h.js";
9
+ import { w as q, a as qs, n as zs, b as as, e as ss, l as Vs } from "./not_equal-CkQKkKZy.js";
10
+ import { s as T } from "./slice-BvItlgXu.js";
11
+ import { r as F } from "./range-BDxO73mk.js";
12
+ import { t as Cs } from "./tensor-D8e0Gd7c.js";
13
+ import { n as C, t as is } from "./transpose-Qxz-4os3.js";
14
+ import { r as O } from "./reshape-BIN71H3p.js";
15
+ import { s as U } from "./stack-z6QE7kmP.js";
16
+ import { z as vs } from "./zeros-Bw0puq_w.js";
17
+ import { s as Ps } from "./squeeze-O_YWJpw_.js";
18
+ import { c as J } from "./concat-Dqk7Xk7h.js";
19
+ import { m as w } from "./mat_mul-DP86qZtZ.js";
20
+ import { t as X } from "./tensor2d-DTtQ1QcT.js";
21
+ import { o as Ys } from "./ones-DbVB5N58.js";
22
+ import { r as fs } from "./relu-DTvZKBsZ.js";
23
+ import { e as js } from "./axis_util-QWWgLjut.js";
24
24
  function Fs(t, a, n) {
25
25
  const r = u(t, "x", "bincount"), e = u(a, "weights", "bincount");
26
26
  p(r.dtype === "int32", () => `Error in bincount: input dtype must be int32, but got ${r.dtype}`), p(n >= 0, () => `size must be non-negative, but got ${n}.`), p(e.size === r.size || e.size === 0, () => `Error in bincount: weights must have the same size as input or0-length, but got input shape: ${r.shape}, weights shape: ${e.shape}.`);
27
27
  const s = { x: r, weights: e }, o = { size: n };
28
- return k.runKernel(ds, s, o);
28
+ return k.runKernel(hs, s, o);
29
29
  }
30
- const Us = /* @__PURE__ */ h({ bincount_: Fs });
30
+ const Us = /* @__PURE__ */ d({ bincount_: Fs });
31
31
  function Zs(t, ...a) {
32
32
  const n = a.map((e, s) => u(e, `tensors${s}`, "einsum")), r = { equation: t };
33
- return k.runKernel(hs, n, r);
33
+ return k.runKernel(ds, n, r);
34
34
  }
35
- const V = /* @__PURE__ */ h({ einsum_: Zs });
35
+ const V = /* @__PURE__ */ d({ einsum_: Zs });
36
36
  function Hs(t, a, n, r = "float32") {
37
37
  a == null && (a = t);
38
38
  const e = bs([t, a], r), s = t <= a ? t : a;
@@ -42,11 +42,11 @@ function Hs(t, a, n, r = "float32") {
42
42
  if (n == null)
43
43
  return o;
44
44
  if (n.length === 1)
45
- return v(R(o, 0), [n[0], 1, 1]);
45
+ return j(R(o, 0), [n[0], 1, 1]);
46
46
  if (n.length === 2)
47
- return v(R(R(o, 0), 0), [n[0], n[1], 1, 1]);
47
+ return j(R(R(o, 0), 0), [n[0], n[1], 1, 1]);
48
48
  if (n.length === 3)
49
- return v(R(R(R(o, 0), 0), 0), [
49
+ return j(R(R(R(o, 0), 0), 0), [
50
50
  n[0],
51
51
  n[1],
52
52
  n[2],
@@ -55,28 +55,28 @@ function Hs(t, a, n, r = "float32") {
55
55
  ]);
56
56
  throw new Error(`eye() currently supports only 1D and 2D batchShapes, but received ${n.length}D.`);
57
57
  }
58
- const Ks = /* @__PURE__ */ h({ eye_: Hs });
59
- function Xs(t, a, n, r, e = "bilinear", s = 0) {
58
+ const Ks = /* @__PURE__ */ d({ eye_: Hs });
59
+ function Js(t, a, n, r, e = "bilinear", s = 0) {
60
60
  const o = u(t, "image", "cropAndResize"), i = u(a, "boxes", "cropAndResize", "float32"), l = u(n, "boxInd", "cropAndResize", "int32"), c = i.shape[0];
61
61
  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(l.rank === 1 && l.shape[0] === c, () => `Error in cropAndResize: boxInd must be have size [${c}] but had shape ${i.shape}.`), p(r.length === 2, () => `Error in cropAndResize: cropSize must be of length 2, but got length ${r.length}.`), p(r[0] >= 1 && r[1] >= 1, () => `cropSize must be atleast [1,1], but was ${r}`), p(e === "bilinear" || e === "nearest", () => `method must be bilinear or nearest, but was ${e}`);
62
62
  const f = { image: o, boxes: i, boxInd: l }, m = { method: e, extrapolationValue: s, cropSize: r };
63
63
  return k.runKernel(gs, f, m);
64
64
  }
65
- const Js = /* @__PURE__ */ h({ cropAndResize_: Xs });
65
+ const Xs = /* @__PURE__ */ d({ cropAndResize_: Js });
66
66
  function Qs(t) {
67
67
  const a = u(t, "image", "flipLeftRight", "float32");
68
68
  p(a.rank === 4, () => `Error in flipLeftRight: image must be rank 4,but got rank ${a.rank}.`);
69
69
  const n = { image: a };
70
70
  return k.runKernel(Es, n, {});
71
71
  }
72
- const sn = /* @__PURE__ */ h({ flipLeftRight_: Qs });
72
+ const sn = /* @__PURE__ */ d({ flipLeftRight_: Qs });
73
73
  function nn(t) {
74
74
  const a = u(t, "image", "grayscaleToRGB"), n = a.rank - 1, r = a.shape[n];
75
75
  p(a.rank >= 2, () => `Error in grayscaleToRGB: images must be at least rank 2, but got rank ${a.rank}.`), p(r === 1, () => `Error in grayscaleToRGB: last dimension of a grayscale image should be size 1, but got size ${r}.`);
76
76
  const e = new Array(a.rank);
77
- return e.fill(1, 0, n), e[n] = 3, v(a, e);
77
+ return e.fill(1, 0, n), e[n] = 3, j(a, e);
78
78
  }
79
- const en = /* @__PURE__ */ h({ grayscaleToRGB_: nn });
79
+ const en = /* @__PURE__ */ d({ grayscaleToRGB_: nn });
80
80
  function tn(t) {
81
81
  const a = u(t, "image", "RGBToGrayscale"), n = a.rank - 1, r = a.shape[n];
82
82
  p(a.rank >= 2, () => `Error in RGBToGrayscale: images must be at least rank 2, but got rank ${a.rank}.`), p(r === 3, () => `Error in RGBToGrayscale: last dimension of an RGB image should be size 3, but got size ${r}.`);
@@ -103,14 +103,14 @@ function tn(t) {
103
103
  }
104
104
  return i = R(i, -1), W(i, e);
105
105
  }
106
- const on = /* @__PURE__ */ h({ rgbToGrayscale_: tn });
106
+ const on = /* @__PURE__ */ d({ rgbToGrayscale_: tn });
107
107
  function rn(t, a, n = 0, r = 0.5) {
108
108
  const e = u(t, "image", "rotateWithOffset", "float32");
109
109
  p(e.rank === 4, () => `Error in rotateWithOffset: image must be rank 4,but got rank ${e.rank}.`);
110
110
  const s = { image: e }, o = { radians: a, fillValue: n, center: r };
111
111
  return k.runKernel($s, s, o);
112
112
  }
113
- const an = /* @__PURE__ */ h({ rotateWithOffset_: rn });
113
+ const an = /* @__PURE__ */ d({ rotateWithOffset_: rn });
114
114
  function z(t, a, n, r, e, s) {
115
115
  r == null && (r = 0.5), e == null && (e = Number.NEGATIVE_INFINITY), s == null && (s = 0);
116
116
  const o = t.shape[0];
@@ -122,7 +122,7 @@ function cn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY) {
122
122
  const l = { maxOutputSize: n, iouThreshold: r, scoreThreshold: e };
123
123
  return k.runKernel(ys, { boxes: s, scores: o }, l);
124
124
  }
125
- const ln = /* @__PURE__ */ h({ nonMaxSuppression_: cn });
125
+ const ln = /* @__PURE__ */ d({ nonMaxSuppression_: cn });
126
126
  async function un(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY) {
127
127
  const s = u(t, "boxes", "nonMaxSuppressionAsync"), o = u(a, "scores", "nonMaxSuppressionAsync"), i = z(s, o, n, r, e);
128
128
  n = i.maxOutputSize, r = i.iouThreshold, e = i.scoreThreshold;
@@ -136,8 +136,8 @@ function mn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = 0) {
136
136
  const c = { boxes: o, scores: i }, f = { maxOutputSize: n, iouThreshold: r, scoreThreshold: e, softNmsSigma: s }, m = k.runKernel(_s, c, f);
137
137
  return { selectedIndices: m[0], selectedScores: m[1] };
138
138
  }
139
- const fn = /* @__PURE__ */ h({ nonMaxSuppressionWithScore_: mn });
140
- async function dn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = 0) {
139
+ const fn = /* @__PURE__ */ d({ nonMaxSuppressionWithScore_: mn });
140
+ async function hn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = 0) {
141
141
  const o = u(t, "boxes", "nonMaxSuppressionAsync"), i = u(a, "scores", "nonMaxSuppressionAsync"), l = z(o, i, n, r, e, s);
142
142
  n = l.maxOutputSize, r = l.iouThreshold, e = l.scoreThreshold, s = l.softNmsSigma;
143
143
  const c = await Promise.all([o.data(), i.data()]), f = c[0], m = c[1], { selectedIndices: E, selectedScores: g } = As(f, m, n, r, e, s);
@@ -146,7 +146,7 @@ async function dn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = 0) {
146
146
  selectedScores: x(g)
147
147
  };
148
148
  }
149
- const hn = dn;
149
+ const dn = hn;
150
150
  function bn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = !1) {
151
151
  const o = u(t, "boxes", "nonMaxSuppression"), i = u(a, "scores", "nonMaxSuppression"), l = z(
152
152
  o,
@@ -164,7 +164,7 @@ function bn(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = !1) {
164
164
  }, y = k.runKernel(Ns, E, g);
165
165
  return { selectedIndices: y[0], validOutputs: y[1] };
166
166
  }
167
- const gn = /* @__PURE__ */ h({ nonMaxSuppressionPadded_: bn });
167
+ const gn = /* @__PURE__ */ d({ nonMaxSuppressionPadded_: bn });
168
168
  async function En(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = !1) {
169
169
  const o = u(t, "boxes", "nonMaxSuppressionAsync"), i = u(a, "scores", "nonMaxSuppressionAsync"), l = z(
170
170
  o,
@@ -183,10 +183,10 @@ async function En(t, a, n, r = 0.5, e = Number.NEGATIVE_INFINITY, s = !1) {
183
183
  const $n = En;
184
184
  function yn(t, a = "binary", n = !1, r = 0.5) {
185
185
  const e = u(t, "image", "threshold"), s = 0.2989, o = 0.587, i = 0.114, l = e.shape[0] * e.shape[1];
186
- let c = d(x([r]), 255), f, m, E, g;
186
+ let c = h(x([r]), 255), f, m, E, g;
187
187
  if (p(e.rank === 3, () => `Error in threshold: image must be rank 3,but got rank ${e.rank}.`), p(e.shape[2] === 3 || e.shape[2] === 1, () => `Error in threshold: image color channel must be equal to 3 or 1but got ${e.shape[2]}.`), p(e.dtype === "int32" || e.dtype === "float32", () => `Error in dtype: image dtype must be int32 or float32,but got dtype ${e.dtype}.`), p(a === "otsu" || a === "binary", () => `Method must be binary or otsu, but was ${a}`), e.shape[2] === 3) {
188
188
  [f, m, E] = ms(e, [1, 1, 1], -1);
189
- const I = d(f, s), A = d(m, o), D = d(E, i);
189
+ const I = h(f, s), A = h(m, o), D = h(E, i);
190
190
  g = G(G(I, A), D);
191
191
  } else
192
192
  g = t;
@@ -195,41 +195,41 @@ function yn(t, a = "binary", n = !1, r = 0.5) {
195
195
  c = _n(I, l);
196
196
  }
197
197
  const y = n ? ls(g, c) : es(g, c);
198
- return W(d(y, 255), "int32");
198
+ return W(h(y, 255), "int32");
199
199
  }
200
200
  function _n(t, a) {
201
201
  let n = x([-1]), r = x([0]), e = x([0]), s, o, i, l, c, f;
202
202
  for (let m = 0; m < t.size - 1; m++) {
203
203
  s = T(t, 0, m + 1), o = T(t, m + 1), c = S(_(s), a), f = S(_(o), a);
204
- const E = _(d(s, F(0, s.size)));
204
+ const E = _(h(s, F(0, s.size)));
205
205
  i = S(E, _(s));
206
- const g = Ss(o.shape, s.size), y = G(F(0, o.size), g), M = d(o, y);
206
+ const g = Ss(o.shape, s.size), y = G(F(0, o.size), g), M = h(o, y);
207
207
  l = S(_(M), _(o));
208
- const I = b(i, l), A = b(i, l), D = d(c, f);
209
- e = d(d(D, I), A);
210
- const P = es(e, r);
211
- r = q(P, e, r), n = q(P, x([m]), n);
208
+ const I = b(i, l), A = b(i, l), D = h(c, f);
209
+ e = h(h(D, I), A);
210
+ const v = es(e, r);
211
+ r = q(v, e, r), n = q(v, x([m]), n);
212
212
  }
213
213
  return n;
214
214
  }
215
- const Nn = /* @__PURE__ */ h({ threshold_: yn });
215
+ const Nn = /* @__PURE__ */ d({ threshold_: yn });
216
216
  function Sn(t, a, n = "nearest", r = "constant", e = 0, s) {
217
217
  const o = u(t, "image", "transform", "float32"), i = u(a, "transforms", "transform", "float32");
218
218
  p(o.rank === 4, () => `Error in transform: image must be rank 4,but got rank ${o.rank}.`), p(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"), p(s == null || s.length === 2, () => `Error in transform: outputShape must be [height, width] or null, but got ${s}.`);
219
219
  const l = { image: o, transforms: i }, c = { interpolation: n, fillMode: r, fillValue: e, outputShape: s };
220
220
  return k.runKernel(ks, l, c);
221
221
  }
222
- const kn = /* @__PURE__ */ h({ transform_: Sn });
222
+ const kn = /* @__PURE__ */ d({ transform_: Sn });
223
223
  function In(t, a, n) {
224
224
  const r = u(t, "a", "bandPart");
225
225
  p(r.rank >= 2, () => `bandPart(): Rank must be at least 2, got ${r.rank}.`);
226
226
  const e = r.shape, [s, o] = r.shape.slice(-2);
227
227
  let i, l;
228
228
  typeof a == "number" ? (p(a % 1 === 0, () => `bandPart(): numLower must be an integer, got ${a}.`), p(a <= s, () => `bandPart(): numLower (${a}) must not be greater than the number of rows (${s}).`), i = u(a < 0 ? s : a, "numLower", "bandPart")) : (p(a.dtype === "int32", () => "bandPart(): numLower's dtype must be an int32."), i = q(rs(a, 0), s, Q(a, s))), 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}).`), l = u(n < 0 ? o : n, "numUpper", "bandPart")) : (p(n.dtype === "int32", () => "bandPart(): numUpper's dtype must be an int32."), l = q(rs(n, 0), o, Q(n, o)));
229
- const c = O(F(0, s, 1, "int32"), [-1, 1]), f = F(0, o, 1, "int32"), m = b(c, f), E = Gs(ls(m, i), Ls(m, C(l))), g = Ps([s, o], r.dtype);
229
+ const c = O(F(0, s, 1, "int32"), [-1, 1]), f = F(0, o, 1, "int32"), m = b(c, f), E = Gs(ls(m, i), Ls(m, C(l))), g = vs([s, o], r.dtype);
230
230
  return O(U(us(O(r, [-1, s, o])).map((y) => q(E, y, g))), e);
231
231
  }
232
- const Tn = /* @__PURE__ */ h({ bandPart_: In });
232
+ const Tn = /* @__PURE__ */ d({ bandPart_: In });
233
233
  function Mn(t) {
234
234
  let a;
235
235
  if (Array.isArray(t)) {
@@ -238,7 +238,7 @@ function Mn(t) {
238
238
  for (let s = 1; s < t.length; ++s)
239
239
  p(t[s].shape[0] === e, () => `Gram-Schmidt: Non-unique lengths found in the input vectors: (${t[s].shape[0]} vs. ${e})`);
240
240
  } else
241
- a = !0, t = ms(t, t.shape[0], 0).map((e) => Ys(e, [0]));
241
+ a = !0, t = ms(t, t.shape[0], 0).map((e) => Ps(e, [0]));
242
242
  p(t.length <= t[0].shape[0], () => `Gram-Schmidt: Number of vectors (${t.length}) exceeds number of dimensions (${t[0].shape[0]}).`);
243
243
  const n = [], r = t;
244
244
  for (let e = 0; e < t.length; ++e)
@@ -246,14 +246,14 @@ function Mn(t) {
246
246
  let s = r[e];
247
247
  if (e > 0)
248
248
  for (let o = 0; o < e; ++o) {
249
- const i = d(_(d(n[o], s)), n[o]);
249
+ const i = h(_(h(n[o], s)), n[o]);
250
250
  s = b(s, i);
251
251
  }
252
252
  return S(s, ps(s, "euclidean"));
253
253
  }));
254
254
  return a ? U(n, 0) : n;
255
255
  }
256
- const xn = /* @__PURE__ */ h({ gramSchmidt_: Mn });
256
+ const xn = /* @__PURE__ */ d({ gramSchmidt_: Mn });
257
257
  function An(t, a = !1) {
258
258
  if (p(t.rank >= 2, () => `qr() requires input tensor to have a rank >= 2, but got rank ${t.rank}`), t.rank === 2)
259
259
  return cs(t, a);
@@ -276,30 +276,30 @@ function cs(t, a = !1) {
276
276
  p(t.shape.length === 2, () => `qr2d() requires a 2D Tensor, but got a ${t.shape.length}D Tensor.`);
277
277
  const n = t.shape[0], r = t.shape[1];
278
278
  let e = Ks(n), s = K(t);
279
- const o = J([[1]], [1, 1]);
279
+ const o = X([[1]], [1, 1]);
280
280
  let i = K(o);
281
281
  const l = n >= r ? r : n;
282
282
  for (let c = 0; c < l; ++c) {
283
283
  const f = s, m = i, E = e;
284
284
  [i, s, e] = k.tidy(() => {
285
- const g = T(s, [c, c], [n - c, 1]), y = ps(g), M = T(s, [c, c], [1, 1]), I = q(es(M, 0), J([[-1]]), J([[1]])), A = b(M, d(I, y)), D = S(g, A);
286
- D.shape[0] === 1 ? i = K(o) : i = X([
285
+ const g = T(s, [c, c], [n - c, 1]), y = ps(g), M = T(s, [c, c], [1, 1]), I = q(es(M, 0), X([[-1]]), X([[1]])), A = b(M, h(I, y)), D = S(g, A);
286
+ D.shape[0] === 1 ? i = K(o) : i = J([
287
287
  o,
288
288
  T(D, [1, 0], [D.shape[0] - 1, D.shape[1]])
289
289
  ], 0);
290
- const P = C(S(w(I, A), y)), Y = T(s, [c, 0], [n - c, r]), Z = d(P, i), ts = is(i);
290
+ const v = C(S(w(I, A), y)), P = T(s, [c, 0], [n - c, r]), Z = h(v, i), ts = is(i);
291
291
  if (c === 0)
292
- s = b(Y, w(Z, w(ts, Y)));
292
+ s = b(P, w(Z, w(ts, P)));
293
293
  else {
294
- const H = b(Y, w(Z, w(ts, Y)));
295
- s = X([T(s, [0, 0], [c, r]), H], 0);
294
+ const H = b(P, w(Z, w(ts, P)));
295
+ s = J([T(s, [0, 0], [c, r]), H], 0);
296
296
  }
297
- const os = is(Z), j = T(e, [0, c], [n, e.shape[1] - c]);
297
+ const os = is(Z), Y = T(e, [0, c], [n, e.shape[1] - c]);
298
298
  if (c === 0)
299
- e = b(j, w(w(j, i), os));
299
+ e = b(Y, w(w(Y, i), os));
300
300
  else {
301
- const H = b(j, w(w(j, i), os));
302
- e = X([T(e, [0, 0], [n, c]), H], 1);
301
+ const H = b(Y, w(w(Y, i), os));
302
+ e = J([T(e, [0, 0], [n, c]), H], 1);
303
303
  }
304
304
  return [i, s, e];
305
305
  }), Is([f, m, E]);
@@ -307,7 +307,7 @@ function cs(t, a = !1) {
307
307
  return !a && n > r && (e = T(e, [0, 0], [n, r]), s = T(s, [0, 0], [r, r])), [e, s];
308
308
  });
309
309
  }
310
- const wn = /* @__PURE__ */ h({ qr_: An });
310
+ const wn = /* @__PURE__ */ d({ qr_: An });
311
311
  var N;
312
312
  (function(t) {
313
313
  t[t.NONE = 0] = "NONE", t[t.MEAN = 1] = "MEAN", t[t.SUM = 2] = "SUM", t[t.SUM_BY_NONZERO_WEIGHTS = 3] = "SUM_BY_NONZERO_WEIGHTS";
@@ -316,7 +316,7 @@ function On(t, a, n = N.SUM_BY_NONZERO_WEIGHTS) {
316
316
  const r = u(t, "losses", "computeWeightedLoss");
317
317
  let e = null;
318
318
  a != null && (e = u(a, "weights", "computeWeightedLoss"));
319
- const s = e == null ? r : d(r, e);
319
+ const s = e == null ? r : h(r, e);
320
320
  if (n === N.NONE)
321
321
  return s;
322
322
  if (n === N.SUM)
@@ -333,13 +333,13 @@ function On(t, a, n = N.SUM_BY_NONZERO_WEIGHTS) {
333
333
  if (e == null)
334
334
  return S(_(s), $(r.size));
335
335
  {
336
- const o = d(e, js(r.shape)), i = W(_(zs(o, $(0))), "float32");
336
+ const o = h(e, Ys(r.shape)), i = W(_(zs(o, $(0))), "float32");
337
337
  return S(_(s), i);
338
338
  }
339
339
  }
340
340
  throw Error(`Unknown reduction: ${n}`);
341
341
  }
342
- const B = /* @__PURE__ */ h({ computeWeightedLoss_: On });
342
+ const B = /* @__PURE__ */ d({ computeWeightedLoss_: On });
343
343
  function Gn(t, a, n, r = N.SUM_BY_NONZERO_WEIGHTS) {
344
344
  const e = u(t, "labels", "absoluteDifference"), s = u(a, "predictions", "absoluteDifference");
345
345
  let o = null;
@@ -347,80 +347,80 @@ function Gn(t, a, n, r = N.SUM_BY_NONZERO_WEIGHTS) {
347
347
  const i = ns(b(e, s));
348
348
  return B(i, o, r);
349
349
  }
350
- const Ln = /* @__PURE__ */ h({ absoluteDifference_: Gn });
350
+ const Ln = /* @__PURE__ */ d({ absoluteDifference_: Gn });
351
351
  function Bn(t, a, n, r, e = N.SUM_BY_NONZERO_WEIGHTS) {
352
352
  const s = u(t, "labels", "cosineDistance"), o = u(a, "predictions", "cosineDistance");
353
353
  let i = null;
354
354
  r != null && (i = u(r, "weights", "cosineDistance")), L(s.shape, o.shape, "Error in cosineDistance: ");
355
- const l = $(1), c = b(l, _(d(s, o), n, !0));
355
+ const l = $(1), c = b(l, _(h(s, o), n, !0));
356
356
  return B(c, i, e);
357
357
  }
358
- const Dn = /* @__PURE__ */ h({ cosineDistance_: Bn });
358
+ const Dn = /* @__PURE__ */ d({ cosineDistance_: Bn });
359
359
  function Wn(t, a, n, r = N.SUM_BY_NONZERO_WEIGHTS) {
360
360
  let e = u(t, "labels", "hingeLoss");
361
361
  const s = u(a, "predictions", "hingeLoss");
362
362
  let o = null;
363
363
  n != null && (o = u(n, "weights", "hingeLoss")), L(e.shape, s.shape, "Error in hingeLoss: ");
364
364
  const i = $(1);
365
- e = b(d($(2), e), i);
366
- const l = fs(b(i, d(e, s)));
365
+ e = b(h($(2), e), i);
366
+ const l = fs(b(i, h(e, s)));
367
367
  return B(l, o, r);
368
368
  }
369
- const Rn = /* @__PURE__ */ h({ hingeLoss_: Wn });
369
+ const Rn = /* @__PURE__ */ d({ hingeLoss_: Wn });
370
370
  function qn(t, a, n, r = 1, e = N.SUM_BY_NONZERO_WEIGHTS) {
371
371
  const s = u(t, "labels", "huberLoss"), o = u(a, "predictions", "huberLoss");
372
372
  let i = null;
373
373
  n != null && (i = u(n, "weights", "huberLoss")), L(s.shape, o.shape, "Error in huberLoss: ");
374
- const l = $(r), c = ns(b(o, s)), f = Q(c, l), m = b(c, f), E = G(d($(0.5), Ts(f)), d(l, m));
374
+ const l = $(r), c = ns(b(o, s)), f = Q(c, l), m = b(c, f), E = G(h($(0.5), Ts(f)), h(l, m));
375
375
  return B(E, i, e);
376
376
  }
377
- const zn = /* @__PURE__ */ h({ huberLoss_: qn });
377
+ const zn = /* @__PURE__ */ d({ huberLoss_: qn });
378
378
  function Vn(t, a, n, r = 1e-7, e = N.SUM_BY_NONZERO_WEIGHTS) {
379
379
  const s = u(t, "labels", "logLoss"), o = u(a, "predictions", "logLoss");
380
380
  let i = null;
381
381
  n != null && (i = u(n, "weights", "logLoss")), L(s.shape, o.shape, "Error in logLoss: ");
382
- const l = $(1), c = $(r), f = C(d(s, as(G(o, c)))), m = d(b(l, s), as(G(b(l, o), c))), E = b(f, m);
382
+ const l = $(1), c = $(r), f = C(h(s, as(G(o, c)))), m = h(b(l, s), as(G(b(l, o), c))), E = b(f, m);
383
383
  return B(E, i, e);
384
384
  }
385
- const Cn = /* @__PURE__ */ h({ logLoss_: Vn });
386
- function Pn(t, a, n, r = N.SUM_BY_NONZERO_WEIGHTS) {
385
+ const Cn = /* @__PURE__ */ d({ logLoss_: Vn });
386
+ function vn(t, a, n, r = N.SUM_BY_NONZERO_WEIGHTS) {
387
387
  const e = u(t, "labels", "meanSquaredError"), s = u(a, "predictions", "meanSquaredError");
388
388
  let o = null;
389
389
  n != null && (o = u(n, "weights", "meanSquaredError")), L(e.shape, s.shape, "Error in meanSquaredError: ");
390
390
  const i = Bs(e, s);
391
391
  return B(i, o, r);
392
392
  }
393
- const Yn = /* @__PURE__ */ h({ meanSquaredError_: Pn });
394
- function jn(t, a) {
393
+ const Pn = /* @__PURE__ */ d({ meanSquaredError_: vn });
394
+ function Yn(t, a) {
395
395
  const n = u(t, "labels", "sigmoidCrossEntropyWithLogits"), r = u(a, "logits", "sigmoidCrossEntropyWithLogits");
396
396
  L(n.shape, r.shape, "Error in sigmoidCrossEntropyWithLogits: ");
397
- const e = fs(r), s = d(r, n), o = Ds(ss(C(ns(r))));
397
+ const e = fs(r), s = h(r, n), o = Ds(ss(C(ns(r))));
398
398
  return G(b(e, s), o);
399
399
  }
400
- function vn(t, a, n, r = 0, e = N.SUM_BY_NONZERO_WEIGHTS) {
400
+ function jn(t, a, n, r = 0, e = N.SUM_BY_NONZERO_WEIGHTS) {
401
401
  let s = u(t, "multiClassLabels", "sigmoidCrossEntropy");
402
402
  const o = u(a, "logits", "sigmoidCrossEntropy");
403
403
  let i = null;
404
404
  if (n != null && (i = u(n, "weights", "sigmoidCrossEntropy")), L(s.shape, o.shape, "Error in sigmoidCrossEntropy: "), r > 0) {
405
405
  const c = $(r), f = $(1), m = $(0.5);
406
- s = G(d(s, b(f, c)), d(m, c));
406
+ s = G(h(s, b(f, c)), h(m, c));
407
407
  }
408
- const l = jn(s, o);
408
+ const l = Yn(s, o);
409
409
  return B(l, i, e);
410
410
  }
411
- const Fn = /* @__PURE__ */ h({ sigmoidCrossEntropy_: vn });
411
+ const Fn = /* @__PURE__ */ d({ sigmoidCrossEntropy_: jn });
412
412
  function Un(t, a, n = -1) {
413
413
  if (n === -1 && (n = a.rank - 1), n !== a.rank - 1)
414
414
  throw Error(`Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank ${a.rank} and dim was ${n}`);
415
415
  return Ms((e, s, o) => {
416
416
  const l = Vs(s, [n], !0), c = b(W(s, "float32"), l);
417
417
  o([e, c]);
418
- const f = C(d(c, e));
418
+ const f = C(h(c, e));
419
419
  return { value: _(f, [n]), gradFunc: (g, y) => {
420
- const [M, I] = y, A = vs(g.shape, [n]);
420
+ const [M, I] = y, A = js(g.shape, [n]);
421
421
  return [
422
- d(O(g, A), b(W(M, "float32"), ss(I))),
423
- d(O(g, A), b(ss(I), W(M, "float32")))
422
+ h(O(g, A), b(W(M, "float32"), ss(I))),
423
+ h(O(g, A), b(ss(I), W(M, "float32")))
424
424
  ];
425
425
  } };
426
426
  })(t, a);
@@ -431,12 +431,12 @@ function Zn(t, a, n, r = 0, e = N.SUM_BY_NONZERO_WEIGHTS) {
431
431
  let i = null;
432
432
  if (n != null && (i = u(n, "weights", "softmaxCrossEntropy")), L(s.shape, o.shape, "Error in softmaxCrossEntropy: "), r > 0) {
433
433
  const c = $(r), f = $(1), m = $(s.shape[1]);
434
- s = G(d(s, b(f, c)), S(c, m));
434
+ s = G(h(s, b(f, c)), S(c, m));
435
435
  }
436
436
  const l = Un(s, o);
437
437
  return B(l, i, e);
438
438
  }
439
- const Hn = /* @__PURE__ */ h({ softmaxCrossEntropy_: Zn });
439
+ const Hn = /* @__PURE__ */ d({ softmaxCrossEntropy_: Zn });
440
440
  const $e = {
441
441
  flipLeftRight: sn,
442
442
  grayscaleToRGB: en,
@@ -444,11 +444,11 @@ const $e = {
444
444
  resizeBilinear: Rs,
445
445
  rgbToGrayscale: on,
446
446
  rotateWithOffset: an,
447
- cropAndResize: Js,
447
+ cropAndResize: Xs,
448
448
  nonMaxSuppression: ln,
449
449
  nonMaxSuppressionAsync: pn,
450
450
  nonMaxSuppressionWithScore: fn,
451
- nonMaxSuppressionWithScoreAsync: hn,
451
+ nonMaxSuppressionWithScoreAsync: dn,
452
452
  nonMaxSuppressionPadded: gn,
453
453
  nonMaxSuppressionPaddedAsync: $n,
454
454
  threshold: Nn,
@@ -464,7 +464,7 @@ const $e = {
464
464
  hingeLoss: Rn,
465
465
  huberLoss: zn,
466
466
  logLoss: Cn,
467
- meanSquaredError: Yn,
467
+ meanSquaredError: Pn,
468
468
  sigmoidCrossEntropy: Fn,
469
469
  softmaxCrossEntropy: Hn
470
470
  };
@@ -1,6 +1,6 @@
1
- import { e as o, h as i } from "./index-CUXkjxiT.js";
1
+ import { c as o, e as i } from "./index-DSGwv2Yx.js";
2
2
  import { isPackedTensor as t } from "./utilities/packed.js";
3
- import { s as u } from "./slice-BzS11Qh0.js";
3
+ import { s as u } from "./slice-BvItlgXu.js";
4
4
  const s = {
5
5
  kernelName: "Unpack16",
6
6
  inputsToSave: [],
@@ -1,8 +1,8 @@
1
- import { U as c, af as l, ab as m, x as n } from "../index-CUXkjxiT.js";
2
- import "../webgpu_util-DYlGSwOJ.js";
3
- import { W as P } from "../backend_webgpu-BqASlsbV.js";
1
+ import { N as c, af as l, ab as m, v as n } from "../index-DSGwv2Yx.js";
2
+ import "../webgpu_util-DuofJBMo.js";
3
+ import { W as P } from "../backend_webgpu-DI2wXEC2.js";
4
4
  import { compileProgram as y } from "./webgpu_program.js";
5
- import { m as M } from "../webgpu_program-B4HmApL1.js";
5
+ import { m as M } from "../webgpu_program-CbjdYLYk.js";
6
6
  const b = (o, s) => {
7
7
  const i = o.limits.maxComputeWorkgroupsPerDimension, t = s.dispatchLayout, a = s.dispatch;
8
8
  if (a.every((r) => r <= i))
@@ -17,7 +17,7 @@ const b = (o, s) => {
17
17
  () => "Total dispatch size exceeds WebGPU maximum."
18
18
  ), [e, e, e]) : [e, e, 1];
19
19
  };
20
- class U extends P {
20
+ class v extends P {
21
21
  subgroupMaxSize;
22
22
  subgroupMinSize;
23
23
  constructor(s, i) {
@@ -52,5 +52,5 @@ class U extends P {
52
52
  }
53
53
  }
54
54
  export {
55
- U as default
55
+ v as default
56
56
  };
@@ -1,4 +1,4 @@
1
- import { ae as n } from "../index-CUXkjxiT.js";
1
+ import { ae as n } from "../index-DSGwv2Yx.js";
2
2
  import p from "./webgpu_backend.js";
3
3
  function c(a) {
4
4
  n(
@@ -1,5 +1,5 @@
1
- import { ab as z, x as F, ac as O, ad as _ } from "../index-CUXkjxiT.js";
2
- import { g as A, d as b, a as x, b as g, s as L, t as l, c as y } from "../webgpu_program-B4HmApL1.js";
1
+ import { ab as z, v as F, ac as O, ad as _ } from "../index-DSGwv2Yx.js";
2
+ import { g as A, d as b, a as x, b as g, s as L, t as l, c as y } from "../webgpu_program-CbjdYLYk.js";
3
3
  var N = /* @__PURE__ */ ((s) => (s[s.FROM_PIXELS = 0] = "FROM_PIXELS", s[s.DRAW = 1] = "DRAW", s))(N || {});
4
4
  const H = (s, t, e, o, u) => {
5
5
  const a = { dtype: o.dtype, shape: o.shape }, n = D(e, a, t), r = s.createShaderModule({ code: n, label: t.constructor.name });
@@ -1,4 +1,4 @@
1
- import { o as u, u as m, a5 as f } from "./index-CUXkjxiT.js";
1
+ import { o as u, q as m, a5 as f } from "./index-DSGwv2Yx.js";
2
2
  import { M as i } from "./rand_util-CZ7yLoUm.js";
3
3
  function c(n, s = 0, e = 1, o, t) {
4
4
  if (m(n), o != null && o === "bool")