@genai-fi/nanogpt 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/dist/Generator.js +11761 -171
  2. package/dist/{RealDiv-zz7FpkKX.js → RealDiv-KAPDe8zB.js} +23 -25
  3. package/dist/Reshape-BYkmUnAv.js +14 -0
  4. package/dist/{Reshape-CHdUjC72.js → Reshape-Zt6eb7yh.js} +18 -20
  5. package/dist/TeachableLLM.js +10 -11
  6. package/dist/{axis_util-BsIr9ZNu.js → axis_util-BaG7mf5A.js} +3 -3
  7. package/dist/backend.js +2 -2
  8. package/dist/{backend_util-B1XRLuq9.js → backend_util-RCe-rHaj.js} +72 -73
  9. package/dist/{backend_webgpu-CqpfEImu.js → backend_webgpu-DE3ACOLx.js} +45 -47
  10. package/dist/broadcast_to-B3eYlZm7.js +28 -0
  11. package/dist/checks/appendCache.js +2 -2
  12. package/dist/checks/attentionMask.js +3 -3
  13. package/dist/checks/gelu.js +2 -2
  14. package/dist/checks/matMulGelu.js +7 -11
  15. package/dist/checks/normRMS.js +9 -9
  16. package/dist/checks/normRMSGrad.js +3 -3
  17. package/dist/checks/packUnpack.js +2 -2
  18. package/dist/checks/qkv.js +12 -13
  19. package/dist/checks/rope.js +2 -2
  20. package/dist/clip_by_value-BnO7-a88.js +12 -0
  21. package/dist/complex-DjxcVmoX.js +11 -0
  22. package/dist/concat-BV8bt5H-.js +17 -0
  23. package/dist/{concat_util-iBYIyuQe.js → concat_util-DpW8mL_l.js} +1 -1
  24. package/dist/{dataset-D2P7rHAw.js → dataset-BcwmTGYc.js} +137 -139
  25. package/dist/dropout-BcvN9JYi.js +92 -0
  26. package/dist/expand_dims-DT4tEPwA.js +11 -0
  27. package/dist/{exports_initializers-CZSUJoVE.js → exports_initializers-Hta_rEnm.js} +1 -1
  28. package/dist/floor-D5QdR_le.js +9 -0
  29. package/dist/gather-D3JcZUaI.js +9 -0
  30. package/dist/{gelu-Bmhopi0J.js → gelu-CjNPL4OH.js} +10 -11
  31. package/dist/{gpgpu_math-DsCcikas.js → gpgpu_math-DAOmgtXR.js} +841 -1015
  32. package/dist/{index-DRyE072i.js → index-BwexR4lA.js} +262 -263
  33. package/dist/index-DOvlwCh-.js +3520 -0
  34. package/dist/{kernel_funcs_utils-CWfOAPGO.js → kernel_funcs_utils-CCzYdUZg.js} +130 -132
  35. package/dist/layers/BaseLayer.js +15 -16
  36. package/dist/layers/CausalSelfAttention.js +6 -6
  37. package/dist/layers/MLP.js +4 -4
  38. package/dist/layers/PositionEmbedding.js +7 -7
  39. package/dist/layers/RMSNorm.js +3 -3
  40. package/dist/layers/RoPECache.js +9 -9
  41. package/dist/layers/TiedEmbedding.js +6 -6
  42. package/dist/layers/TransformerBlock.js +1 -1
  43. package/dist/loader/loadTransformers.js +1 -1
  44. package/dist/loader/oldZipLoad.js +13 -14
  45. package/dist/log_sum_exp-ngO0-4pK.js +39 -0
  46. package/dist/main.js +49 -50
  47. package/dist/{matMul16-fEAJ4smh.js → matMul16-BWRSOCWB.js} +14 -15
  48. package/dist/matMulGelu-CzfgT6Wq.js +163 -0
  49. package/dist/mat_mul-SjpJRLyL.js +11 -0
  50. package/dist/mod-AnXEvvpo.js +11 -0
  51. package/dist/models/NanoGPTV1.js +2 -2
  52. package/dist/models/model.js +13 -14
  53. package/dist/ones-D2rT0xk2.js +14 -0
  54. package/dist/ops/adamAdjust.js +1 -1
  55. package/dist/ops/adamMoments.js +1 -1
  56. package/dist/ops/add16.js +1 -1
  57. package/dist/ops/appendCache.js +3 -3
  58. package/dist/ops/attentionMask.js +1 -1
  59. package/dist/ops/concat16.js +2 -2
  60. package/dist/ops/cpu/adamAdjust.js +13 -14
  61. package/dist/ops/cpu/adamMoments.js +6 -7
  62. package/dist/ops/cpu/appendCache.js +7 -8
  63. package/dist/ops/cpu/attentionMask.js +7 -7
  64. package/dist/ops/cpu/fusedSoftmax.js +10 -11
  65. package/dist/ops/cpu/gatherSub.js +9 -10
  66. package/dist/ops/cpu/gelu.js +9 -10
  67. package/dist/ops/cpu/matMul16.js +6 -7
  68. package/dist/ops/cpu/matMulGelu.js +5 -6
  69. package/dist/ops/cpu/matMulMul.js +3 -4
  70. package/dist/ops/cpu/mulDropout.js +3 -4
  71. package/dist/ops/cpu/normRMS.js +10 -11
  72. package/dist/ops/cpu/qkv.js +8 -9
  73. package/dist/ops/cpu/rope.js +5 -6
  74. package/dist/ops/cpu/scatterSub.js +17 -19
  75. package/dist/ops/dot16.js +2 -2
  76. package/dist/ops/gatherSub.js +1 -1
  77. package/dist/ops/gelu.js +2 -2
  78. package/dist/ops/grads/add16.js +11 -12
  79. package/dist/ops/grads/attentionMask.js +5 -6
  80. package/dist/ops/grads/gelu.js +3 -4
  81. package/dist/ops/grads/matMul16.js +4 -5
  82. package/dist/ops/grads/matMulGelu.js +9 -10
  83. package/dist/ops/grads/normRMS.js +7 -8
  84. package/dist/ops/grads/pack16.js +4 -5
  85. package/dist/ops/grads/qkv.js +17 -19
  86. package/dist/ops/grads/rope.js +3 -5
  87. package/dist/ops/grads/softmax16.js +3 -4
  88. package/dist/ops/grads/unpack16.js +3 -4
  89. package/dist/ops/grads/utils.d.ts +1 -0
  90. package/dist/ops/grads/utils.js +8 -4
  91. package/dist/ops/matMul16.js +3 -3
  92. package/dist/ops/matMulGelu.js +2 -2
  93. package/dist/ops/matMulMul.js +1 -1
  94. package/dist/ops/mul16.js +1 -1
  95. package/dist/ops/mulDrop.js +1 -1
  96. package/dist/ops/normRMS.js +1 -1
  97. package/dist/ops/pack16.js +3 -4
  98. package/dist/ops/qkv.js +4 -8
  99. package/dist/ops/reshape16.js +14 -16
  100. package/dist/ops/rope.d.ts +1 -1
  101. package/dist/ops/rope.js +3 -8
  102. package/dist/ops/scatterSub.js +1 -1
  103. package/dist/ops/slice16.js +2 -2
  104. package/dist/ops/softmax16.js +5 -8
  105. package/dist/ops/sub16.js +1 -1
  106. package/dist/ops/sum16.js +2 -2
  107. package/dist/ops/transpose16.js +23 -24
  108. package/dist/ops/unpack16.js +2 -2
  109. package/dist/ops/webgl/adamAdjust.js +2 -3
  110. package/dist/ops/webgl/adamMoments.js +1 -2
  111. package/dist/ops/webgl/appendCache.js +1 -2
  112. package/dist/ops/webgl/attentionMask.js +4 -5
  113. package/dist/ops/webgl/fusedSoftmax.js +4 -6
  114. package/dist/ops/webgl/gatherSub.js +6 -7
  115. package/dist/ops/webgl/gelu.js +2 -3
  116. package/dist/ops/webgl/log.js +11 -12
  117. package/dist/ops/webgl/matMul16.js +10 -11
  118. package/dist/ops/webgl/matMulGelu.js +7 -111
  119. package/dist/ops/webgl/matMulMul.js +9 -10
  120. package/dist/ops/webgl/mulDropout.js +8 -9
  121. package/dist/ops/webgl/normRMS.js +2 -3
  122. package/dist/ops/webgl/qkv.js +5 -6
  123. package/dist/ops/webgl/rope.js +7 -8
  124. package/dist/ops/webgl/scatterSub.js +5 -6
  125. package/dist/ops/webgpu/adamAdjust.js +10 -12
  126. package/dist/ops/webgpu/adamMoments.js +8 -10
  127. package/dist/ops/webgpu/add16.js +8 -9
  128. package/dist/ops/webgpu/appendCache.js +23 -25
  129. package/dist/ops/webgpu/attentionMask.js +8 -10
  130. package/dist/ops/webgpu/attentionMask32_program.js +2 -2
  131. package/dist/ops/webgpu/concat16.js +12 -14
  132. package/dist/ops/webgpu/gatherSub.js +11 -13
  133. package/dist/ops/webgpu/gelu.js +28 -29
  134. package/dist/ops/webgpu/matMul16.js +26 -28
  135. package/dist/ops/webgpu/matMul16_program.js +4 -5
  136. package/dist/ops/webgpu/mul16.js +9 -10
  137. package/dist/ops/webgpu/normRMS.js +15 -17
  138. package/dist/ops/webgpu/normRMSGrad.js +21 -28
  139. package/dist/ops/webgpu/pack16.js +12 -13
  140. package/dist/ops/webgpu/pack16_program.js +2 -2
  141. package/dist/ops/webgpu/qkv.js +16 -18
  142. package/dist/ops/webgpu/rope.js +25 -27
  143. package/dist/ops/webgpu/scatterSub.js +7 -9
  144. package/dist/ops/webgpu/slice16.js +21 -23
  145. package/dist/ops/webgpu/softmax16.js +17 -19
  146. package/dist/ops/webgpu/softmax16_program.js +2 -2
  147. package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
  148. package/dist/ops/webgpu/softmax16grad.js +7 -8
  149. package/dist/ops/webgpu/sub16.js +7 -8
  150. package/dist/ops/webgpu/sum16.js +18 -20
  151. package/dist/ops/webgpu/transpose16.js +19 -20
  152. package/dist/ops/webgpu/transpose16_program.js +2 -2
  153. package/dist/ops/webgpu/transpose16_shared_program.js +11 -12
  154. package/dist/ops/webgpu/unpack16.js +3 -4
  155. package/dist/ops/webgpu/utils/binary_op.js +7 -8
  156. package/dist/ops/webgpu/utils/reductions.js +14 -22
  157. package/dist/ops-B5yanEdW.js +476 -0
  158. package/dist/pack16-nQ6JaLo-.js +39 -0
  159. package/dist/patches/webgpu_backend.js +19 -20
  160. package/dist/patches/webgpu_base.js +1 -1
  161. package/dist/patches/webgpu_program.js +21 -22
  162. package/dist/{random_width-BVV9HveY.js → random_width-or-CEftb.js} +2506 -2761
  163. package/dist/range-BklejeeW.js +10 -0
  164. package/dist/relu-CP0ZcxWO.js +9 -0
  165. package/dist/reshape-ByE68wS9.js +9 -0
  166. package/dist/resize_nearest_neighbor-B19mCEg2.js +175 -0
  167. package/dist/rope-Ir4mTyD1.js +24 -0
  168. package/dist/{scatter_nd_util-C7zXRT_h.js → scatter_nd_util-lvSiX8q4.js} +1 -1
  169. package/dist/selu_util-kbhpTdYD.js +44 -0
  170. package/dist/{shared-CHhxz-O5.js → shared-DT1TkE6w.js} +1 -1
  171. package/dist/{shared-D2NP_CpY.js → shared-dntlHIDQ.js} +343 -345
  172. package/dist/slice-BfEGSH82.js +12 -0
  173. package/dist/{slice_util-DyjSAD0u.js → slice_util-uTKwiEpW.js} +1 -1
  174. package/dist/{softmax-C9JQEtnO.js → softmax-CA5jFsLR.js} +4 -5
  175. package/dist/split-CVLc0w--.js +9 -0
  176. package/dist/squeeze-C7Z2srUo.js +10 -0
  177. package/dist/stack-Cf4n9h0N.js +11 -0
  178. package/dist/step-CINUs5QB.js +261 -0
  179. package/dist/sum-DWAtNGez.js +11 -0
  180. package/dist/tensor-DJoc7gJU.js +8 -0
  181. package/dist/tensor1d-D11P_7Dp.js +11 -0
  182. package/dist/{tensor2d-CSB4KOb0.js → tensor2d-Bs9wZRc7.js} +6 -7
  183. package/dist/{tensor4d-D7bLqGqz.js → tensor4d-BARPdTaS.js} +6 -7
  184. package/dist/{tfjs_backend-CNkSTL0c.js → tfjs_backend-y1cvNhLA.js} +255 -264
  185. package/dist/tile-mbfagpsB.js +11 -0
  186. package/dist/training/Adam.js +2 -2
  187. package/dist/training/AdamExt.js +1 -1
  188. package/dist/training/DatasetBuilder.js +2 -2
  189. package/dist/training/FullTrainer.js +1 -1
  190. package/dist/training/Trainer.js +2 -2
  191. package/dist/training/sparseCrossEntropy.js +5 -5
  192. package/dist/transpose-ClWiBS_b.js +36 -0
  193. package/dist/unsorted_segment_sum-BDDhB_E6.js +277 -0
  194. package/dist/utilities/dummy.js +3 -3
  195. package/dist/utilities/multinomialCPU.js +2 -2
  196. package/dist/utilities/packed.d.ts +1 -4
  197. package/dist/utilities/packed.js +10 -745
  198. package/dist/utilities/performance.js +1 -1
  199. package/dist/utilities/profile.js +1 -1
  200. package/dist/utilities/safetensors.js +2 -2
  201. package/dist/utilities/sentences.js +5 -5
  202. package/dist/utilities/weights.js +2 -2
  203. package/dist/{variable-DzfrwYuP.js → variable-WawDEaAb.js} +1 -1
  204. package/dist/{webgpu_program-DzaQiqel.js → webgpu_program-DuOXPQol.js} +178 -172
  205. package/dist/{webgpu_util-0_ubCEHJ.js → webgpu_util-RxEF33Rj.js} +34 -35
  206. package/dist/zeros-KnWaWf-X.js +13 -0
  207. package/dist/zeros_like-DvE73F4e.js +721 -0
  208. package/package.json +4 -2
  209. package/dist/Reshape-CDVLyVfz.js +0 -16
  210. package/dist/broadcast_to-B0ChcDaz.js +0 -30
  211. package/dist/complex-BBiRlsVq.js +0 -13
  212. package/dist/concat-DmBLPVGC.js +0 -19
  213. package/dist/dropout-B1x1kYMa.js +0 -99
  214. package/dist/expand_dims-ouvfxQ1n.js +0 -13
  215. package/dist/gather-CH9sdacz.js +0 -10
  216. package/dist/index-D6Q1lPZO.js +0 -2157
  217. package/dist/log_sum_exp-D3ftBNY5.js +0 -41
  218. package/dist/mat_mul-C59XWcJd.js +0 -12
  219. package/dist/mod-DESSvHIU.js +0 -12
  220. package/dist/mulmat_packed_gpu-Coh6qbJk.js +0 -55
  221. package/dist/ones-jU9jlQvM.js +0 -15
  222. package/dist/ops-BFDtP6th.js +0 -645
  223. package/dist/pack16-CmVZs6af.js +0 -41
  224. package/dist/patches/PackedTensor.d.ts +0 -12
  225. package/dist/patches/PackedTensor.js +0 -11
  226. package/dist/patches/engine.d.ts +0 -261
  227. package/dist/patches/engine.js +0 -12
  228. package/dist/patches/tape.d.ts +0 -12
  229. package/dist/patches/tape.js +0 -5
  230. package/dist/range-ZZZD60Fx.js +0 -11
  231. package/dist/reciprocal-CrYlsAGD.js +0 -10
  232. package/dist/register_all_kernels-nvj2k7OC.js +0 -12307
  233. package/dist/relu-BYDneVPn.js +0 -10
  234. package/dist/reshape-CaPQzFvz.js +0 -10
  235. package/dist/rope-s4W2XO9B.js +0 -32
  236. package/dist/selu_util-BGPXmd4B.js +0 -303
  237. package/dist/sin-Djs4aQiu.js +0 -16
  238. package/dist/slice-DvovR5wq.js +0 -13
  239. package/dist/split-DBck65sX.js +0 -10
  240. package/dist/squeeze-C00Ipm_7.js +0 -11
  241. package/dist/stack-ChnHwRpX.js +0 -13
  242. package/dist/sum-ywRJj3Zr.js +0 -12
  243. package/dist/tensor-0r5yOo2R.js +0 -8
  244. package/dist/tensor-CzmOBsdf.js +0 -909
  245. package/dist/tensor1d-BlUT89BP.js +0 -12
  246. package/dist/tensor_util-DfwaWayG.js +0 -523
  247. package/dist/tile-CR074jmp.js +0 -13
  248. package/dist/transpose-DH4gmHvu.js +0 -38
  249. package/dist/zeros-DBFVbpv5.js +0 -14
@@ -1,107 +1,99 @@
1
- import { A as g, B as $, i as _e, E as M, n as x, j as ie, w as ue, R as Te, t as A, G as ge, m as ke, l as Ee, S as Ie } from "./index-D6Q1lPZO.js";
2
- import { a as y, s as ae, v as le } from "./tensor-CzmOBsdf.js";
3
- import { t as Le } from "./tensor1d-BlUT89BP.js";
4
- import { r as Ne, d as be } from "./dropout-B1x1kYMa.js";
5
- import { s as C } from "./slice-DvovR5wq.js";
6
- import { r as c } from "./reshape-CaPQzFvz.js";
7
- import { g as Ce } from "./gather-CH9sdacz.js";
8
- import { s as ve, b as Fe, m as Pe, l as je, o as Be } from "./selu_util-BGPXmd4B.js";
9
- import { a1 as Me, m as fe, a2 as he } from "./tensor_util-DfwaWayG.js";
10
- import { t as Ue } from "./tile-CR074jmp.js";
11
- import { m as w } from "./mat_mul-C59XWcJd.js";
12
- import { t as xe } from "./transpose-DH4gmHvu.js";
13
- import { c as j } from "./concat-DmBLPVGC.js";
14
- function Ge(e, n, t) {
15
- const s = $(e, "x", "clipByValue");
16
- if (y(n <= t, () => `Error in clip: min (${n}) must be less than or equal to max (${t}).`), n === t)
17
- return _e(s.shape, n, s.dtype);
18
- const r = { x: s }, o = { clipValueMin: n, clipValueMax: t };
19
- return M.runKernel(Me, r, o);
20
- }
21
- const Ve = /* @__PURE__ */ g({ clipByValue_: Ge });
22
- function qe(e) {
23
- return j(
1
+ import { A as w, B as S, l as T, E as q, x as U, L as ie, h as ue, a3 as ae, a6 as le, aX as fe, aF as he, aY as Te, t as $, X as ge, m as ke, w as _e, aZ as Ie } from "./index-DOvlwCh-.js";
2
+ import { t as Ee } from "./tensor1d-D11P_7Dp.js";
3
+ import { r as Le, d as Ne } from "./dropout-BcvN9JYi.js";
4
+ import { s as F } from "./slice-BfEGSH82.js";
5
+ import { r as c } from "./reshape-ByE68wS9.js";
6
+ import { g as be } from "./gather-D3JcZUaI.js";
7
+ import { e as Fe } from "./step-CINUs5QB.js";
8
+ import { c as Ce } from "./clip_by_value-BnO7-a88.js";
9
+ import { t as Pe } from "./tile-mbfagpsB.js";
10
+ import { s as ve, b as Me, c as je, g as Ve } from "./selu_util-kbhpTdYD.js";
11
+ import { m as k } from "./mat_mul-SjpJRLyL.js";
12
+ import { t as Ue } from "./transpose-ClWiBS_b.js";
13
+ import { c as M } from "./concat-BV8bt5H-.js";
14
+ function Be(e) {
15
+ return M(
24
16
  e,
25
17
  0
26
18
  /* axis */
27
19
  );
28
20
  }
29
- const Je = /* @__PURE__ */ g({ concat1d_: qe });
30
- function Ke(e, n) {
31
- return j(e, n);
21
+ const xe = /* @__PURE__ */ w({ concat1d_: Be });
22
+ function Ge(e, n) {
23
+ return M(e, n);
32
24
  }
33
- const Re = /* @__PURE__ */ g({ concat2d_: Ke });
25
+ const Je = /* @__PURE__ */ w({ concat2d_: Ge });
26
+ function qe(e, n) {
27
+ return M(e, n);
28
+ }
29
+ const Ke = /* @__PURE__ */ w({ concat3d_: qe });
34
30
  function Ze(e, n) {
35
- return j(e, n);
31
+ return M(e, n);
36
32
  }
37
- const We = /* @__PURE__ */ g({ concat3d_: Ze });
38
- function Ye(e, n) {
39
- return j(e, n);
33
+ const Re = /* @__PURE__ */ w({ concat4d_: Ze });
34
+ function Ye(e, n, t) {
35
+ const s = S(e, "x", "slice1d");
36
+ return T(s.rank === 1, () => `slice1d expects a rank-1 tensor, but got a rank-${s.rank} tensor`), F(s, [n], [t]);
40
37
  }
41
- const He = /* @__PURE__ */ g({ concat4d_: Ye });
42
- function Qe(e, n, t) {
43
- const s = $(e, "x", "slice1d");
44
- return y(s.rank === 1, () => `slice1d expects a rank-1 tensor, but got a rank-${s.rank} tensor`), C(s, [n], [t]);
38
+ const H = /* @__PURE__ */ w({ slice1d_: Ye });
39
+ function We(e, n, t) {
40
+ const s = S(e, "x", "slice2d");
41
+ return T(s.rank === 2, () => `slice2d expects a rank-2 tensor, but got a rank-${s.rank} tensor`), F(s, n, t);
45
42
  }
46
- const Q = /* @__PURE__ */ g({ slice1d_: Qe });
43
+ const we = /* @__PURE__ */ w({ slice2d_: We });
47
44
  function Xe(e, n, t) {
48
- const s = $(e, "x", "slice2d");
49
- return y(s.rank === 2, () => `slice2d expects a rank-2 tensor, but got a rank-${s.rank} tensor`), C(s, n, t);
50
- }
51
- const we = /* @__PURE__ */ g({ slice2d_: Xe });
52
- function ze(e, n, t) {
53
- const s = $(e, "x", "slice3d");
54
- return y(s.rank === 3, () => `slice3d expects a rank-3 tensor, but got a rank-${s.rank} tensor`), C(s, n, t);
55
- }
56
- const X = /* @__PURE__ */ g({ slice3d_: ze });
57
- function en(e, n, t) {
58
- const s = $(e, "x", "slice4d");
59
- return y(s.rank === 4, () => `slice4d expects a rank-4 tensor, but got a rank-${s.rank} tensor`), C(s, n, t);
60
- }
61
- const U = /* @__PURE__ */ g({ slice4d_: en });
62
- function nn({ a: e, b: n, transposeA: t = !1, transposeB: s = !1, bias: r, activation: o = "linear", preluActivationWeights: a, leakyreluAlpha: f = 0.2 }) {
63
- if (ve(M.state.gradientDepth, o) === !1) {
64
- let D = w(e, n, t, s);
65
- return r != null && (D = x(D, r)), Fe(D, o, a, f);
45
+ const s = S(e, "x", "slice3d");
46
+ return T(s.rank === 3, () => `slice3d expects a rank-3 tensor, but got a rank-${s.rank} tensor`), F(s, n, t);
47
+ }
48
+ const Q = /* @__PURE__ */ w({ slice3d_: Xe });
49
+ function He(e, n, t) {
50
+ const s = S(e, "x", "slice4d");
51
+ return T(s.rank === 4, () => `slice4d expects a rank-4 tensor, but got a rank-${s.rank} tensor`), F(s, n, t);
52
+ }
53
+ const V = /* @__PURE__ */ w({ slice4d_: He });
54
+ function Qe({ a: e, b: n, transposeA: t = !1, transposeB: s = !1, bias: r, activation: o = "linear", preluActivationWeights: a, leakyreluAlpha: f = 0.2 }) {
55
+ if (ve(q.state.gradientDepth, o) === !1) {
56
+ let D = k(e, n, t, s);
57
+ return r != null && (D = U(D, r)), Me(D, o, a, f);
66
58
  }
67
- let i = $(e, "a", "fused matMul"), u = $(n, "b", "fused matMul");
68
- [i, u] = fe(i, u);
69
- const m = t ? i.shape[i.rank - 2] : i.shape[i.rank - 1], d = s ? u.shape[u.rank - 1] : u.shape[u.rank - 2], T = t ? i.shape[i.rank - 1] : i.shape[i.rank - 2], h = s ? u.shape[u.rank - 2] : u.shape[u.rank - 1], ee = i.shape.slice(0, -2), E = u.shape.slice(0, -2), ne = ae(ee), te = ae(E);
70
- y(m === d, () => `Error in fused matMul: inner shapes (${m}) and (${d}) of Tensors with shapes ${i.shape} and ${u.shape} and transposeA=${t} and transposeB=${s} must match.`);
71
- const V = ie(i.shape.slice(0, -2), u.shape.slice(0, -2)).concat([T, h]), q = t ? c(i, [ne, m, T]) : c(i, [ne, T, m]), J = s ? c(u, [te, h, d]) : c(u, [te, d, h]);
72
- let I;
73
- r != null && (I = $(r, "bias", "fused matMul"), [I] = fe(I, i), ie(V, I.shape));
59
+ let i = S(e, "a", "fused matMul"), u = S(n, "b", "fused matMul");
60
+ [i, u] = ie(i, u);
61
+ const m = t ? i.shape[i.rank - 2] : i.shape[i.rank - 1], d = s ? u.shape[u.rank - 1] : u.shape[u.rank - 2], _ = t ? i.shape[i.rank - 1] : i.shape[i.rank - 2], h = s ? u.shape[u.rank - 2] : u.shape[u.rank - 1], ee = i.shape.slice(0, -2), I = u.shape.slice(0, -2), ne = ue(ee), te = ue(I);
62
+ T(m === d, () => `Error in fused matMul: inner shapes (${m}) and (${d}) of Tensors with shapes ${i.shape} and ${u.shape} and transposeA=${t} and transposeB=${s} must match.`);
63
+ const x = ae(i.shape.slice(0, -2), u.shape.slice(0, -2)).concat([_, h]), G = t ? c(i, [ne, m, _]) : c(i, [ne, _, m]), J = s ? c(u, [te, h, d]) : c(u, [te, d, h]);
64
+ let E;
65
+ r != null && (E = S(r, "bias", "fused matMul"), [E] = ie(E, i), ae(x, E.shape));
74
66
  let se;
75
- a != null && (se = $(a, "prelu weights", "fused matMul"));
76
- const re = (D, v) => {
77
- const [S, O, _, B] = v, k = Pe(c(D, _.shape), _, o);
67
+ a != null && (se = S(a, "prelu weights", "fused matMul"));
68
+ const re = (D, C) => {
69
+ const [A, O, y, j] = C, g = je(c(D, y.shape), y, o);
78
70
  let L, N;
79
- if (!t && !s ? (L = w(k, O, !1, !0), N = w(S, k, !0, !1)) : !t && s ? (L = w(k, O, !1, !1), N = w(k, S, !0, !1)) : t && !s ? (L = w(O, k, !1, !0), N = w(S, k, !1, !1)) : (L = w(O, k, !0, !0), N = w(k, S, !0, !0)), r != null) {
80
- const De = je(B, k);
81
- return [L, N, De];
71
+ if (!t && !s ? (L = k(g, O, !1, !0), N = k(A, g, !0, !1)) : !t && s ? (L = k(g, O, !1, !1), N = k(g, A, !0, !1)) : t && !s ? (L = k(O, g, !1, !0), N = k(A, g, !1, !1)) : (L = k(O, g, !0, !0), N = k(g, A, !0, !0)), r != null) {
72
+ const ye = Ve(j, g);
73
+ return [L, N, ye];
82
74
  } else
83
75
  return [L, N];
84
76
  }, oe = {
85
- a: q,
77
+ a: G,
86
78
  b: J,
87
- bias: I,
79
+ bias: E,
88
80
  preluActivationWeights: se
89
81
  }, ce = { transposeA: t, transposeB: s, activation: o, leakyreluAlpha: f };
90
- return r == null ? ue((v, S, O) => {
91
- const _ = (
82
+ return r == null ? le((C, A, O) => {
83
+ const y = (
92
84
  // tslint:disable-next-line: no-unnecessary-type-assertion
93
- M.runKernel(he, oe, ce)
85
+ q.runKernel(fe, oe, ce)
94
86
  );
95
- return O([v, S, _]), { value: c(_, V), gradFunc: re };
96
- })(q, J) : ue((v, S, O, _) => {
97
- const B = (
87
+ return O([C, A, y]), { value: c(y, x), gradFunc: re };
88
+ })(G, J) : le((C, A, O, y) => {
89
+ const j = (
98
90
  // tslint:disable-next-line: no-unnecessary-type-assertion
99
- M.runKernel(he, oe, ce)
91
+ q.runKernel(fe, oe, ce)
100
92
  );
101
- return _([v, S, B, O]), { value: c(B, V), gradFunc: re };
102
- })(q, J, I);
93
+ return y([C, A, j, O]), { value: c(j, x), gradFunc: re };
94
+ })(G, J, E);
103
95
  }
104
- const pe = /* @__PURE__ */ g({ fusedMatMul_: nn });
96
+ const pe = /* @__PURE__ */ w({ fusedMatMul_: Qe });
105
97
  class $e extends Error {
106
98
  constructor(n) {
107
99
  super(n), Object.setPrototypeOf(this, $e.prototype);
@@ -117,9 +109,9 @@ class l extends Error {
117
109
  super(n), Object.setPrototypeOf(this, l.prototype);
118
110
  }
119
111
  }
120
- class P extends Error {
112
+ class v extends Error {
121
113
  constructor(n) {
122
- super(n), Object.setPrototypeOf(this, P.prototype);
114
+ super(n), Object.setPrototypeOf(this, v.prototype);
123
115
  }
124
116
  }
125
117
  class z extends Error {
@@ -127,7 +119,7 @@ class z extends Error {
127
119
  super(n), Object.setPrototypeOf(this, z.prototype);
128
120
  }
129
121
  }
130
- function In(e, n) {
122
+ function Tn(e, n) {
131
123
  if (Array.isArray(e)) {
132
124
  let t = [];
133
125
  for (let s = 0; s < n; s++)
@@ -142,45 +134,45 @@ function de(e, n) {
142
134
  if (!e)
143
135
  throw new z(n);
144
136
  }
145
- function Ln(e, n) {
137
+ function _n(e, n) {
146
138
  let t = 0;
147
139
  for (const s of e)
148
140
  s === n && t++;
149
141
  return t;
150
142
  }
151
- function Nn(e) {
143
+ function In(e) {
152
144
  return e.length === 1 ? e[0] : e;
153
145
  }
154
- function bn(e) {
146
+ function En(e) {
155
147
  return Array.isArray(e) ? e : [e];
156
148
  }
157
- function Cn(e) {
149
+ function Ln(e) {
158
150
  const t = e.replace(/(.)([A-Z][a-z0-9]+)/g, "$1_$2").replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
159
151
  return t[0] !== "_" ? t : "private" + t;
160
152
  }
161
- function vn(e) {
153
+ function Nn(e) {
162
154
  return e.length <= 1 || e.indexOf("_") === -1 ? e : e.replace(/[_]+(\w|$)/g, (n, t) => t.toUpperCase());
163
155
  }
164
156
  let p = {};
165
- function Fn(e) {
157
+ function bn(e) {
166
158
  if (e == null)
167
159
  return null;
168
160
  const n = {};
169
161
  return n.className = e.getClassName(), n.config = e.getConfig(), n;
170
162
  }
171
- function W(e) {
163
+ function Y(e) {
172
164
  if (!(e == null || typeof e != "object"))
173
165
  if (Array.isArray(e))
174
- e.forEach((n) => W(n));
166
+ e.forEach((n) => Y(n));
175
167
  else {
176
168
  const n = Object.keys(e);
177
169
  for (const t of n) {
178
170
  const s = e[t];
179
- s != null && typeof s == "object" && (!Array.isArray(s) && s.type === "ndarray" && typeof s.value == "number" ? e[t] = s.value : W(s));
171
+ s != null && typeof s == "object" && (!Array.isArray(s) && s.type === "ndarray" && typeof s.value == "number" ? e[t] = s.value : Y(s));
180
172
  }
181
173
  }
182
174
  }
183
- function Pn(e, n = {}, t = {}, s = "object", r = !1) {
175
+ function Fn(e, n = {}, t = {}, s = "object", r = !1) {
184
176
  if (typeof e == "string") {
185
177
  const o = e;
186
178
  let a;
@@ -215,9 +207,9 @@ function Pn(e, n = {}, t = {}, s = "object", r = !1) {
215
207
  const d = Object.assign({}, p);
216
208
  for (const h of Object.keys(t))
217
209
  p[h] = t[h];
218
- W(o.config);
219
- const T = i(f, o.config, t, r);
220
- return p = Object.assign({}, d), T;
210
+ Y(o.config);
211
+ const _ = i(f, o.config, t, r);
212
+ return p = Object.assign({}, d), _;
221
213
  } else {
222
214
  const u = Object.assign({}, p);
223
215
  for (const d of Object.keys(t))
@@ -227,13 +219,13 @@ function Pn(e, n = {}, t = {}, s = "object", r = !1) {
227
219
  }
228
220
  }
229
221
  }
230
- function tn(e, n) {
222
+ function ze(e, n) {
231
223
  return e < n ? -1 : e > n ? 1 : 0;
232
224
  }
233
- function jn(e, n) {
234
- return -1 * tn(e, n);
225
+ function Cn(e, n) {
226
+ return -1 * ze(e, n);
235
227
  }
236
- function Bn(e) {
228
+ function Pn(e) {
237
229
  if (e == null)
238
230
  return e;
239
231
  const n = [];
@@ -241,7 +233,7 @@ function Bn(e) {
241
233
  n.indexOf(t) === -1 && n.push(t);
242
234
  return n;
243
235
  }
244
- function Mn(e) {
236
+ function vn(e) {
245
237
  if (e == null)
246
238
  throw new l(`Invalid value in obj: ${JSON.stringify(e)}`);
247
239
  for (const n in e)
@@ -249,63 +241,63 @@ function Mn(e) {
249
241
  return !1;
250
242
  return !0;
251
243
  }
252
- function G(e, n, t) {
244
+ function B(e, n, t) {
253
245
  if (t != null && e.indexOf(t) < 0)
254
246
  throw new l(`${t} is not a valid ${n}. Valid values are ${e} or null/undefined.`);
255
247
  }
256
- function Un(e, n, t = 0, s = 1 / 0) {
248
+ function Mn(e, n, t = 0, s = 1 / 0) {
257
249
  return de(t >= 0), de(s >= t), Array.isArray(e) && e.length >= t && e.length <= s && e.every((r) => typeof r === n);
258
250
  }
259
- function sn(e, n) {
260
- Array.isArray(e) ? (y(e.length > 0, () => `${n} is unexpectedly an empty array.`), e.forEach((t, s) => sn(t, `element ${s + 1} of ${n}`))) : y(Number.isInteger(e) && e > 0, () => `Expected ${n} to be a positive integer, but got ${Se(e)}.`);
251
+ function en(e, n) {
252
+ Array.isArray(e) ? (T(e.length > 0, () => `${n} is unexpectedly an empty array.`), e.forEach((t, s) => en(t, `element ${s + 1} of ${n}`))) : T(Number.isInteger(e) && e > 0, () => `Expected ${n} to be a positive integer, but got ${Oe(e)}.`);
261
253
  }
262
- function Se(e) {
263
- return e === null ? "null" : Array.isArray(e) ? "[" + e.map((n) => Se(n)).join(",") + "]" : typeof e == "string" ? `"${e}"` : `${e}`;
254
+ function Oe(e) {
255
+ return e === null ? "null" : Array.isArray(e) ? "[" + e.map((n) => Oe(n)).join(",") + "]" : typeof e == "string" ? `"${e}"` : `${e}`;
264
256
  }
265
- function xn(e, n, t) {
266
- let s = t != null ? t() : le(), r;
257
+ function jn(e, n, t) {
258
+ let s = t != null ? t() : he(), r;
267
259
  return (...a) => {
268
- const f = t != null ? t() : le();
260
+ const f = t != null ? t() : he();
269
261
  return f - s < n || (s = f, r = e(...a)), r;
270
262
  };
271
263
  }
272
- function Gn(e) {
264
+ function Vn(e) {
273
265
  return e === "relu" ? "relu" : e === "linear" ? "linear" : e === "elu" ? "elu" : null;
274
266
  }
275
- const rn = ["channelsFirst", "channelsLast"], on = ["nearest", "bilinear"], cn = ["valid", "same", "causal"], un = ["max", "avg"], Vn = ["sum", "mul", "concat", "ave"];
267
+ const nn = ["channelsFirst", "channelsLast"], tn = ["nearest", "bilinear"], sn = ["valid", "same", "causal"], rn = ["max", "avg"], Un = ["sum", "mul", "concat", "ave"];
276
268
  const b = /* @__PURE__ */ new Map();
277
- function an(e) {
278
- G(rn, "DataFormat", e);
269
+ function on(e) {
270
+ B(nn, "DataFormat", e);
279
271
  }
280
- function qn(e) {
281
- G(on, "InterpolationFormat", e);
272
+ function Bn(e) {
273
+ B(tn, "InterpolationFormat", e);
282
274
  }
283
- function Jn(e) {
284
- G(cn, "PaddingMode", e);
275
+ function xn(e) {
276
+ B(sn, "PaddingMode", e);
285
277
  }
286
- function Kn(e) {
287
- G(un, "PoolMode", e);
278
+ function Gn(e) {
279
+ B(rn, "PoolMode", e);
288
280
  }
289
- const F = [], me = "/";
290
- function Rn(e, n) {
291
- F.push(e);
281
+ const P = [], me = "/";
282
+ function Jn(e, n) {
283
+ P.push(e);
292
284
  try {
293
285
  const t = n();
294
- return F.pop(), t;
286
+ return P.pop(), t;
295
287
  } catch (t) {
296
- throw F.pop(), t;
288
+ throw P.pop(), t;
297
289
  }
298
290
  }
299
- function ln() {
300
- return F.length === 0 ? "" : F.join(me) + me;
291
+ function cn() {
292
+ return P.length === 0 ? "" : P.join(me) + me;
301
293
  }
302
- function Zn(e) {
303
- if (!Oe(e))
294
+ function qn(e) {
295
+ if (!Se(e))
304
296
  throw new Error("Not a valid tensor name: '" + e + "'");
305
- return ln() + e;
297
+ return cn() + e;
306
298
  }
307
- function Wn(e) {
308
- if (!Oe(e))
299
+ function Kn(e) {
300
+ if (!Se(e))
309
301
  throw new Error("Not a valid tensor name: '" + e + "'");
310
302
  b.has(e) || b.set(e, 0);
311
303
  const n = b.get(e);
@@ -315,21 +307,21 @@ function Wn(e) {
315
307
  } else
316
308
  return e;
317
309
  }
318
- const fn = new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);
319
- function Oe(e) {
320
- return !!e.match(fn);
310
+ const un = new RegExp(/^[A-Za-z0-9][-A-Za-z0-9\._\/]*$/);
311
+ function Se(e) {
312
+ return !!e.match(un);
321
313
  }
322
- function Yn(e) {
314
+ function Zn(e) {
323
315
  return e === parseInt(e.toString(), 10);
324
316
  }
325
- function ye(e, n, t) {
317
+ function De(e, n, t) {
326
318
  n == null && (n = 0), t == null && (t = e.length);
327
319
  let s = 1;
328
320
  for (let r = n; r < t; ++r)
329
321
  s *= e[r];
330
322
  return s;
331
323
  }
332
- function Hn(e) {
324
+ function Rn(e) {
333
325
  if (e.length === 0)
334
326
  return Number.NaN;
335
327
  let n = Number.POSITIVE_INFINITY;
@@ -339,7 +331,7 @@ function Hn(e) {
339
331
  }
340
332
  return n;
341
333
  }
342
- function Qn(e) {
334
+ function Yn(e) {
343
335
  if (e.length === 0)
344
336
  return Number.NaN;
345
337
  let n = Number.NEGATIVE_INFINITY;
@@ -349,7 +341,7 @@ function Qn(e) {
349
341
  }
350
342
  return n;
351
343
  }
352
- function Xn(e, n) {
344
+ function Wn(e, n) {
353
345
  if (n < e)
354
346
  throw new l(`end (${n}) < begin (${e}) is forbidden.`);
355
347
  const t = [];
@@ -358,50 +350,50 @@ function Xn(e, n) {
358
350
  return t;
359
351
  }
360
352
  let K;
361
- function zn() {
353
+ function Xn() {
362
354
  return K == null && (K = Te().epsilon()), K;
363
355
  }
364
- function Y() {
356
+ function W() {
365
357
  return "channelsLast";
366
358
  }
367
- function et(e, n) {
359
+ function Hn(e, n) {
368
360
  return ge(e, n);
369
361
  }
370
- function hn(e, n = -1) {
362
+ function an(e, n = -1) {
371
363
  const t = e.shape.slice();
372
364
  return n < 0 && (n = t.length + n + 1), t.splice(n, 0, 1), c(e, t);
373
365
  }
374
- function nt(e, n) {
375
- return A(() => {
366
+ function Qn(e, n) {
367
+ return $(() => {
376
368
  if (e.shape.length !== 2)
377
369
  throw new l(`repeat() expects a rank-2 tensor, but received a rank-${e.shape.length} tensor.`);
378
- const t = hn(e, 1);
379
- return pn(t, [1, n, 1]);
370
+ const t = an(e, 1);
371
+ return ln(t, [1, n, 1]);
380
372
  });
381
373
  }
382
- function tt(e) {
383
- const n = [ye(e.shape)];
374
+ function zn(e) {
375
+ const n = [De(e.shape)];
384
376
  return c(e, n);
385
377
  }
386
- function st(e) {
378
+ function et(e) {
387
379
  if (e.rank <= 1)
388
380
  throw new l(`batchFlatten requires a minimum rank of 2. Got rank: ${e.rank}.`);
389
- const n = [e.shape[0], ye(e.shape, 1)];
381
+ const n = [e.shape[0], De(e.shape, 1)];
390
382
  return c(e, n);
391
383
  }
392
- function R(e, n, t) {
393
- return A(() => {
384
+ function Z(e, n, t) {
385
+ return $(() => {
394
386
  switch (e.rank) {
395
387
  case 1:
396
- return Q(e, n, t);
388
+ return H(e, n, t);
397
389
  case 2:
398
390
  return we(e, [n, 0], [t, e.shape[1]]);
399
391
  case 3:
400
- return X(e, [n, 0, 0], [t, e.shape[1], e.shape[2]]);
392
+ return Q(e, [n, 0, 0], [t, e.shape[1], e.shape[2]]);
401
393
  case 4:
402
- return U(e, [n, 0, 0, 0], [t, e.shape[1], e.shape[2], e.shape[3]]);
394
+ return V(e, [n, 0, 0, 0], [t, e.shape[1], e.shape[2], e.shape[3]]);
403
395
  case 5:
404
- return C(e, [n, 0, 0, 0, 0], [
396
+ return F(e, [n, 0, 0, 0, 0], [
405
397
  t,
406
398
  e.shape[1],
407
399
  e.shape[2],
@@ -409,7 +401,7 @@ function R(e, n, t) {
409
401
  e.shape[4]
410
402
  ]);
411
403
  case 6:
412
- return C(e, [n, 0, 0, 0, 0, 0], [
404
+ return F(e, [n, 0, 0, 0, 0, 0], [
413
405
  t,
414
406
  e.shape[1],
415
407
  e.shape[2],
@@ -422,57 +414,57 @@ function R(e, n, t) {
422
414
  }
423
415
  });
424
416
  }
425
- function Z(e, n, t) {
426
- return A(() => {
417
+ function R(e, n, t) {
418
+ return $(() => {
427
419
  switch (e.rank) {
428
420
  case 1:
429
- return Q(e, n, t);
421
+ return H(e, n, t);
430
422
  case 2:
431
423
  return we(e, [0, n], [e.shape[0], t]);
432
424
  case 3:
433
- return X(e, [0, 0, n], [e.shape[0], e.shape[1], t]);
425
+ return Q(e, [0, 0, n], [e.shape[0], e.shape[1], t]);
434
426
  case 4:
435
- return U(e, [0, 0, 0, n], [e.shape[0], e.shape[1], e.shape[2], t]);
427
+ return V(e, [0, 0, 0, n], [e.shape[0], e.shape[1], e.shape[2], t]);
436
428
  default:
437
429
  throw new l(`sliceAlongLastAxis() received an unsupported tensor rank: ${e.rank}`);
438
430
  }
439
431
  });
440
432
  }
441
- function rt(e, n, t, s) {
442
- return A(() => {
433
+ function nt(e, n, t, s) {
434
+ return $(() => {
443
435
  switch (e.rank) {
444
436
  case 1:
445
- return Q(e, n, t);
437
+ return H(e, n, t);
446
438
  case 2:
447
439
  switch (s) {
448
440
  case 1:
449
- return R(e, n, t);
450
- case 2:
451
441
  return Z(e, n, t);
442
+ case 2:
443
+ return R(e, n, t);
452
444
  default:
453
445
  throw new l(`The axis is not within the rank of the tensor ${s}`);
454
446
  }
455
447
  case 3:
456
448
  switch (s) {
457
449
  case 1:
458
- return R(e, n, t);
450
+ return Z(e, n, t);
459
451
  case 2:
460
- return X(e, [0, n, 0], [e.shape[0], t, e.shape[2]]);
452
+ return Q(e, [0, n, 0], [e.shape[0], t, e.shape[2]]);
461
453
  case 3:
462
- return Z(e, n, t);
454
+ return R(e, n, t);
463
455
  default:
464
456
  throw new l(`The axis is not within the rank of the tensor ${s}`);
465
457
  }
466
458
  case 4:
467
459
  switch (s) {
468
460
  case 1:
469
- return R(e, n, t);
461
+ return Z(e, n, t);
470
462
  case 2:
471
- return U(e, [0, n, 0, 0], [e.shape[0], t, e.shape[2], e.shape[3]]);
463
+ return V(e, [0, n, 0, 0], [e.shape[0], t, e.shape[2], e.shape[3]]);
472
464
  case 3:
473
- return U(e, [0, 0, n, 0], [e.shape[0], e.shape[1], t, e.shape[3]]);
465
+ return V(e, [0, 0, n, 0], [e.shape[0], e.shape[1], t, e.shape[3]]);
474
466
  case 4:
475
- return Z(e, n, t);
467
+ return R(e, n, t);
476
468
  default:
477
469
  throw new l(`The axis is not within the rank of the tensor ${s}`);
478
470
  }
@@ -481,39 +473,39 @@ function rt(e, n, t, s) {
481
473
  }
482
474
  });
483
475
  }
484
- function ot(e, n = -1) {
476
+ function tt(e, n = -1) {
485
477
  let t;
486
- return n < 0 && (t = e[0].rank, t !== 0 ? n = t : n = 0), n === e[0].rank && (n = -1), j(e, n);
478
+ return n < 0 && (t = e[0].rank, t !== 0 ? n = t : n = 0), n === e[0].rank && (n = -1), M(e, n);
487
479
  }
488
- function ct(e, n) {
480
+ function st(e, n) {
489
481
  switch (e.rank) {
490
482
  case 1:
491
- return Je([e, n]);
483
+ return xe([e, n]);
492
484
  case 2:
493
- return Re([e, n], 0);
485
+ return Je([e, n], 0);
494
486
  case 3:
495
- return We([e, n], 0);
487
+ return Ke([e, n], 0);
496
488
  case 4:
497
- return He([e, n], 0);
489
+ return Re([e, n], 0);
498
490
  default:
499
491
  throw new l(`concatAlongFirstAxis() received an unsupported tensor rank: ${e.rank}`);
500
492
  }
501
493
  }
502
- function pn(e, n) {
494
+ function ln(e, n) {
503
495
  if (Array.isArray(n) || (n = [n]), e.rank !== n.length)
504
496
  throw new l(`The length of input n (${n.length}) does not match the number of dimensions in input x (${e.rank})`);
505
- return Ue(e, n);
497
+ return Pe(e, n);
506
498
  }
507
- function it(e, n = 0, t = 1, s, r) {
508
- return Ne(e, n, t, s, r);
499
+ function rt(e, n = 0, t = 1, s, r) {
500
+ return Le(e, n, t, s, r);
509
501
  }
510
- function ut(e, n, t, s) {
502
+ function ot(e, n, t, s) {
511
503
  if (e.rank < 2 || n.rank < 2)
512
- throw new P(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${n.shape}`);
504
+ throw new v(`dot requires both inputs to be rank >= 2 but got x shape = ${e.shape} and y shape = ${n.shape}`);
513
505
  if (n.rank >= 3) {
514
506
  const r = e.shape.slice(-1)[0], o = n.shape.slice(-2)[0];
515
507
  if (r !== o)
516
- throw new P(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${n.shape}`);
508
+ throw new v(`If rank y >= 3, then the second last dim of y must equal the last dim of x but got x shape = ${e.shape} and y shape = ${n.shape}`);
517
509
  }
518
510
  if (e.rank === 2 && n.rank === 2)
519
511
  return pe({
@@ -521,32 +513,32 @@ function ut(e, n, t, s) {
521
513
  b: n,
522
514
  transposeA: !1,
523
515
  transposeB: !1,
524
- bias: s ? H(e.rank, s, Y()) : null,
516
+ bias: s ? X(e.rank, s, W()) : null,
525
517
  activation: t
526
518
  });
527
519
  {
528
520
  const r = e.shape.slice(), o = r.pop();
529
521
  e = c(e, [-1, o]);
530
- const a = n.shape.slice(), f = a.pop(), i = a.pop(), u = [...a, f], m = Array.from({ length: n.rank }, (ee, E) => E === 0 ? n.rank - 2 : E <= n.rank - 2 ? E - 1 : E);
531
- n = c(xe(n, m), [i, -1]);
522
+ const a = n.shape.slice(), f = a.pop(), i = a.pop(), u = [...a, f], m = Array.from({ length: n.rank }, (ee, I) => I === 0 ? n.rank - 2 : I <= n.rank - 2 ? I - 1 : I);
523
+ n = c(Ue(n, m), [i, -1]);
532
524
  const d = [...r, ...u];
533
525
  return c(pe({
534
526
  a: e,
535
527
  b: n,
536
528
  transposeA: !1,
537
529
  transposeB: !1,
538
- bias: s ? H(e.rank, s, Y()) : null,
530
+ bias: s ? X(e.rank, s, W()) : null,
539
531
  activation: t
540
532
  }), d);
541
533
  }
542
534
  }
543
- function at(e, n, t) {
544
- return A(() => (Array.isArray(n) ? n = Le(n, "int32") : n = ge(n, "int32"), Ce(e, n, t)));
535
+ function ct(e, n, t) {
536
+ return $(() => (Array.isArray(n) ? n = Ee(n, "int32") : n = ge(n, "int32"), be(e, n, t)));
545
537
  }
546
- function lt(e) {
538
+ function it(e) {
547
539
  return ke(e, e);
548
540
  }
549
- function H(e, n, t) {
541
+ function X(e, n, t) {
550
542
  const s = n.shape;
551
543
  if (n.rank !== 1 && n.rank !== e)
552
544
  throw new l(`Unexpected bias dimensions: ${n.rank}; expected it to be 1 or ${e}`);
@@ -569,85 +561,84 @@ function H(e, n, t) {
569
561
  return n;
570
562
  throw new l(`Unsupported input rank by biasAdd: ${n.rank}`);
571
563
  }
572
- function ft(e, n, t) {
573
- return A(() => (t == null && (t = Y()), an(t), x(e, H(e.rank, n, t))));
564
+ function ut(e, n, t) {
565
+ return $(() => (t == null && (t = W()), on(t), U(e, X(e.rank, n, t))));
574
566
  }
575
- function ht(e, n = 1) {
567
+ function at(e, n = 1) {
576
568
  if (n !== 1)
577
- throw new P(`Support for alpha values other than 1 (${n}) is not implemented yet.`);
578
- return Be(e);
569
+ throw new v(`Support for alpha values other than 1 (${n}) is not implemented yet.`);
570
+ return Fe(e);
579
571
  }
580
- function pt(e) {
581
- return A(() => Ee(e, x(Ie(e), 1)));
572
+ function lt(e) {
573
+ return $(() => _e(e, U(Ie(e), 1)));
582
574
  }
583
- function dt(e, n, t, s) {
584
- return A(() => be(e, n, t, s));
575
+ function ft(e, n, t, s) {
576
+ return $(() => Ne(e, n, t, s));
585
577
  }
586
- function mt(e) {
587
- return A(() => {
588
- const n = x(0.5, ke(0.2, e));
589
- return Ve(n, 0, 1);
578
+ function ht(e) {
579
+ return $(() => {
580
+ const n = U(0.5, ke(0.2, e));
581
+ return Ce(n, 0, 1);
590
582
  });
591
583
  }
592
- function gt(e, n, t = !1) {
584
+ function pt(e, n, t = !1) {
593
585
  return t ? e() : n();
594
586
  }
595
587
  export {
596
- st as $,
588
+ Qn as $,
597
589
  $e as A,
598
- hn as B,
599
- at as C,
600
- Xn as D,
601
- Ln as E,
590
+ ct as B,
591
+ Wn as C,
592
+ _n as D,
593
+ at as E,
602
594
  ht as F,
603
- mt as G,
604
- pt as H,
605
- Qn as I,
606
- Yn as J,
607
- Un as K,
608
- ft as L,
609
- rt as M,
610
- P as N,
611
- qn as O,
612
- sn as P,
613
- Gn as Q,
595
+ lt as G,
596
+ Yn as H,
597
+ Zn as I,
598
+ Mn as J,
599
+ ut as K,
600
+ nt as L,
601
+ Bn as M,
602
+ v as N,
603
+ en as O,
604
+ Vn as P,
605
+ xn as Q,
614
606
  Ae as R,
615
- Jn as S,
616
- Y as T,
617
- pn as U,
607
+ W as S,
608
+ ln as T,
609
+ Rn as U,
618
610
  l as V,
619
- Hn as W,
620
- ct as X,
621
- gt as Y,
622
- dt as Z,
623
- ot as _,
624
- an as a,
625
- nt as a0,
626
- Kn as a1,
627
- Vn as a2,
628
- ye as b,
629
- G as c,
630
- ut as d,
631
- Pn as e,
632
- Wn as f,
633
- Zn as g,
634
- Nn as h,
635
- bn as i,
636
- Ve as j,
637
- zn as k,
638
- xn as l,
639
- tt as m,
640
- Rn as n,
641
- lt as o,
642
- de as p,
643
- et as q,
644
- it as r,
645
- Fn as s,
646
- Cn as t,
647
- vn as u,
648
- Bn as v,
649
- jn as w,
650
- In as x,
651
- Mn as y,
652
- R as z
611
+ st as W,
612
+ pt as X,
613
+ ft as Y,
614
+ tt as Z,
615
+ et as _,
616
+ on as a,
617
+ Gn as a0,
618
+ Un as a1,
619
+ De as b,
620
+ B as c,
621
+ ot as d,
622
+ Fn as e,
623
+ Kn as f,
624
+ qn as g,
625
+ In as h,
626
+ En as i,
627
+ Xn as j,
628
+ jn as k,
629
+ zn as l,
630
+ it as m,
631
+ Jn as n,
632
+ de as o,
633
+ Hn as p,
634
+ Nn as q,
635
+ rt as r,
636
+ bn as s,
637
+ Ln as t,
638
+ Pn as u,
639
+ Cn as v,
640
+ Tn as w,
641
+ vn as x,
642
+ Z as y,
643
+ an as z
653
644
  };