@genai-fi/nanogpt 0.17.4 → 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.
- package/dist/Generator.d.ts +2 -15
- package/dist/Generator.js +45 -34
- package/dist/{RealDiv-CGwv0liw.js → RealDiv-ioj6Z-ox.js} +9 -9
- package/dist/{Reshape-BW__R4mZ.js → Reshape-BZC-ebeR.js} +7 -7
- package/dist/{Reshape-CPBkTIH2.js → Reshape-pwprEaej.js} +1 -1
- package/dist/TeachableLLM.d.ts +3 -8
- package/dist/TeachableLLM.js +61 -44
- package/dist/Trainer.d.ts +6 -4
- package/dist/Trainer.js +107 -92
- package/dist/{axis_util-GTVlo58H.js → axis_util-QWWgLjut.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-GaFarB78.js → backend_util-qwSFfxYx.js} +21 -21
- package/dist/{backend_webgpu-BqASlsbV.js → backend_webgpu-DI2wXEC2.js} +8 -8
- package/dist/{broadcast_to-eS93CCN_.js → broadcast_to-C_EJTVTZ.js} +2 -2
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +5 -5
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/matMulGelu.js +2 -2
- package/dist/checks/normRMS.js +6 -6
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.js +6 -6
- package/dist/checks/qkv.js +2 -2
- package/dist/checks/rope.js +2 -2
- package/dist/{clip_by_value-DDA7rrcT.js → clip_by_value-CLAD4h_I.js} +1 -1
- package/dist/complex-3DpPEG9B.js +11 -0
- package/dist/{concat-CAQpCret.js → concat-Dqk7Xk7h.js} +5 -5
- package/dist/{concat_util-D18dJ4fD.js → concat_util-C1Mxe27t.js} +1 -1
- package/dist/{dataset-CGGp1z9P.js → dataset-DlqAN81i.js} +3 -3
- package/dist/{dropout_util--NxWuYg2.js → dropout_util-N0z8Os-K.js} +1 -1
- package/dist/{expand_dims-Bkd1YD5x.js → expand_dims-D0rBtgT1.js} +4 -4
- package/dist/{exports_initializers-CYzKLjN7.js → exports_initializers-DIOZQt_L.js} +1 -1
- package/dist/{floor-BQtb-Azg.js → floor-CymuCmTO.js} +1 -1
- package/dist/{gather-qIqEqaGn.js → gather-DEyjXNb1.js} +1 -1
- package/dist/{gelu-B220X1Go.js → gelu-DpTCC3eB.js} +1 -1
- package/dist/{gpgpu_math-BwvV12df.js → gpgpu_math-3bCb5ooU.js} +25 -25
- package/dist/{index-CjOWnMXP.js → index-BQvB7LCC.js} +15 -15
- package/dist/{index-CUXkjxiT.js → index-DSGwv2Yx.js} +33 -33
- package/dist/inference/types.d.ts +16 -0
- package/dist/inference/types.js +1 -0
- package/dist/{kernel_funcs_utils-pq0CK9co.js → kernel_funcs_utils-DGqzNlHT.js} +6 -6
- package/dist/layers/BaseLayer.js +4 -4
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/LoRA.js +4 -4
- package/dist/layers/MLP.js +4 -4
- package/dist/layers/PositionEmbedding.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +4 -4
- package/dist/layers/TiedEmbedding.js +6 -6
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/layers/WeightStore.js +2 -2
- package/dist/loader/load.d.ts +2 -8
- package/dist/loader/loadTransformers.d.ts +2 -8
- package/dist/loader/loadTransformers.js +13 -11
- package/dist/loader/newZipLoad.d.ts +2 -8
- package/dist/loader/newZipLoad.js +25 -10
- package/dist/loader/oldZipLoad.js +13 -13
- package/dist/loader/save.d.ts +9 -2
- package/dist/loader/save.js +64 -55
- package/dist/loader/types.d.ts +29 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +45 -43
- package/dist/{matMul16-BcVC_E62.js → matMul16-BIT70Vya.js} +3 -3
- package/dist/{matMulGelu-JNLZqKQp.js → matMulGelu-CsZnh18H.js} +18 -18
- package/dist/mat_mul-DP86qZtZ.js +11 -0
- package/dist/mod-BXjLYwvM.js +11 -0
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/NanoGPTV2.js +2 -2
- package/dist/models/model.d.ts +3 -2
- package/dist/models/model.js +13 -13
- package/dist/{not_equal-hurPF26l.js → not_equal-CkQKkKZy.js} +15 -15
- package/dist/{ones-BytntneX.js → ones-DbVB5N58.js} +3 -3
- package/dist/ops/adamAdjust.js +3 -3
- package/dist/ops/adamMoments.js +3 -3
- package/dist/ops/add16.js +1 -1
- package/dist/ops/appendCache.js +6 -6
- package/dist/ops/attentionMask.js +3 -3
- package/dist/ops/concat16.js +3 -3
- package/dist/ops/cpu/adamAdjust.js +9 -9
- package/dist/ops/cpu/adamMoments.js +5 -5
- package/dist/ops/cpu/appendCache.js +2 -2
- package/dist/ops/cpu/attentionMask.js +6 -6
- package/dist/ops/cpu/fusedSoftmax.js +4 -4
- package/dist/ops/cpu/gatherSub.js +5 -5
- package/dist/ops/cpu/gelu.js +4 -4
- package/dist/ops/cpu/matMul16.js +2 -2
- package/dist/ops/cpu/matMulGelu.js +7 -7
- package/dist/ops/cpu/matMulMul.js +2 -2
- package/dist/ops/cpu/mulDropout.js +5 -5
- package/dist/ops/cpu/normRMS.js +1 -1
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +5 -5
- package/dist/ops/cpu/scatterSub.js +5 -5
- package/dist/ops/dot16.js +2 -2
- package/dist/ops/dropout.js +6 -6
- package/dist/ops/dropout16.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/globalNorm.js +7 -7
- package/dist/ops/grads/add16.js +1 -1
- package/dist/ops/grads/attentionMask.js +2 -2
- package/dist/ops/grads/dropout16.js +1 -1
- package/dist/ops/grads/gelu.js +2 -2
- package/dist/ops/grads/matMul16.js +3 -3
- package/dist/ops/grads/matMulGelu.js +1 -1
- package/dist/ops/grads/mul16.js +1 -1
- package/dist/ops/grads/normRMS.js +7 -7
- package/dist/ops/grads/pack16.js +3 -3
- package/dist/ops/grads/qkv.js +11 -11
- package/dist/ops/grads/rope.js +2 -2
- package/dist/ops/grads/softmax16.js +1 -1
- package/dist/ops/grads/unpack16.js +2 -2
- package/dist/ops/matMul16.js +3 -3
- package/dist/ops/matMulGelu.js +6 -6
- package/dist/ops/matMulMul.js +3 -3
- package/dist/ops/mul16.js +1 -1
- package/dist/ops/mulDrop.js +3 -3
- package/dist/ops/normRMS.js +4 -4
- package/dist/ops/pack16.js +2 -2
- package/dist/ops/qkv.js +3 -3
- package/dist/ops/reshape16.js +6 -6
- package/dist/ops/rope.js +2 -2
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/slice16.js +2 -2
- package/dist/ops/softmax16.js +1 -1
- package/dist/ops/sub16.js +1 -1
- package/dist/ops/sum16.js +6 -6
- package/dist/ops/transpose16.js +3 -3
- package/dist/ops/unpack16.js +2 -2
- package/dist/ops/webgl/adamAdjust.js +2 -2
- package/dist/ops/webgl/adamMoments.js +1 -1
- package/dist/ops/webgl/appendCache.js +1 -1
- package/dist/ops/webgl/attentionMask.js +1 -1
- package/dist/ops/webgl/dropout16.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +7 -7
- package/dist/ops/webgl/gatherSub.js +3 -3
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +3 -3
- package/dist/ops/webgl/matMul16.js +13 -13
- package/dist/ops/webgl/matMulGelu.js +4 -4
- package/dist/ops/webgl/matMulMul.js +2 -2
- package/dist/ops/webgl/mulDropout.js +1 -1
- package/dist/ops/webgl/normRMS.js +2 -2
- package/dist/ops/webgl/qkv.js +1 -1
- package/dist/ops/webgl/rope.js +1 -1
- package/dist/ops/webgl/scatterSub.js +2 -2
- package/dist/ops/webgpu/adamAdjust.js +3 -3
- package/dist/ops/webgpu/adamMoments.js +3 -3
- package/dist/ops/webgpu/add16.js +6 -6
- package/dist/ops/webgpu/appendCache.js +3 -3
- package/dist/ops/webgpu/attentionMask.js +2 -2
- package/dist/ops/webgpu/attentionMask32_program.js +2 -2
- package/dist/ops/webgpu/clipScale.js +7 -7
- package/dist/ops/webgpu/concat16.js +5 -5
- package/dist/ops/webgpu/dropout16.js +6 -6
- package/dist/ops/webgpu/gatherSub.js +3 -3
- package/dist/ops/webgpu/gelu.js +8 -8
- package/dist/ops/webgpu/matMul16.js +16 -16
- package/dist/ops/webgpu/matMul16_program.js +2 -2
- package/dist/ops/webgpu/mul16.js +5 -5
- package/dist/ops/webgpu/norm2.js +1 -1
- package/dist/ops/webgpu/normRMS.js +2 -2
- package/dist/ops/webgpu/normRMSGrad.js +4 -4
- package/dist/ops/webgpu/pack16.js +4 -4
- package/dist/ops/webgpu/pack16_program.js +2 -2
- package/dist/ops/webgpu/qkv.js +2 -2
- package/dist/ops/webgpu/rope.js +3 -3
- package/dist/ops/webgpu/scatterSub.js +3 -3
- package/dist/ops/webgpu/slice16.js +4 -4
- package/dist/ops/webgpu/softmax16.js +4 -4
- package/dist/ops/webgpu/softmax16_program.js +2 -2
- package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
- package/dist/ops/webgpu/softmax16grad.js +4 -4
- package/dist/ops/webgpu/sub16.js +6 -6
- package/dist/ops/webgpu/sum16.js +3 -3
- package/dist/ops/webgpu/transpose16.js +8 -8
- package/dist/ops/webgpu/transpose16_program.js +2 -2
- package/dist/ops/webgpu/transpose16_shared_program.js +3 -3
- package/dist/ops/webgpu/unpack16.js +3 -3
- package/dist/ops/webgpu/utils/binary_op.js +3 -3
- package/dist/ops/webgpu/utils/reductions.js +5 -5
- package/dist/{ops-CsXeTq1P.js → ops-CURIZSVt.js} +100 -100
- package/dist/{pack16-bqltoUlR.js → pack16-WlOSOuZA.js} +2 -2
- package/dist/patches/webgpu_backend.js +6 -6
- package/dist/patches/webgpu_base.js +1 -1
- package/dist/patches/webgpu_program.js +2 -2
- package/dist/{random_normal-IBRrha8a.js → random_normal-CIm8lk2-.js} +1 -1
- package/dist/{random_width-DN5ZtQkM.js → random_width-B_fVXhGx.js} +131 -131
- package/dist/{range-C-CjF-LI.js → range-BDxO73mk.js} +1 -1
- package/dist/{readers-iz5u3HBo.js → readers-17HLdxVM.js} +2 -2
- package/dist/relu-DTvZKBsZ.js +9 -0
- package/dist/{reshape-BDOuCSNW.js → reshape-BIN71H3p.js} +1 -1
- package/dist/{resize_nearest_neighbor-BojqlfRe.js → resize_nearest_neighbor-C6_0dAnK.js} +41 -41
- package/dist/{rope-0j_f1TPm.js → rope-CC5RjmKU.js} +4 -4
- package/dist/{scatter_nd_util-ByNJaL6I.js → scatter_nd_util-C-x73Cj6.js} +1 -1
- package/dist/{segment_util-Dasb2Zaf.js → segment_util-4zuHV5IG.js} +2 -2
- package/dist/{selu_util-BLhIqRkw.js → selu_util-BXdhy_W6.js} +5 -5
- package/dist/{shared-CagdqkLh.js → shared-DRWDyk9w.js} +6 -6
- package/dist/{shared-3agzAqQ_.js → shared-zTaJ5siv.js} +1 -1
- package/dist/slice-BvItlgXu.js +12 -0
- package/dist/{slice_util-CC35pLmT.js → slice_util-DPY56GzQ.js} +5 -5
- package/dist/{softmax-D4q1LJN7.js → softmax-BLGJqdwx.js} +1 -1
- package/dist/split-BN9LkEgS.js +9 -0
- package/dist/{squeeze-ho4wLUek.js → squeeze-O_YWJpw_.js} +2 -2
- package/dist/{stack-DudVrtmG.js → stack-z6QE7kmP.js} +1 -1
- package/dist/{step-BTxPtq1r.js → step-DQY6_ABw.js} +4 -4
- package/dist/{sum-BpiwSWvg.js → sum-D39FeU5h.js} +3 -3
- package/dist/{tensor-BWFldCso.js → tensor-D8e0Gd7c.js} +1 -1
- package/dist/{tensor1d-LMGMIUlr.js → tensor1d-BMl0eZYV.js} +1 -1
- package/dist/{tensor2d-BnXMKScO.js → tensor2d-DTtQ1QcT.js} +1 -1
- package/dist/{tensor4d-C6UCG_u8.js → tensor4d-Dj4rDssL.js} +1 -1
- package/dist/{tfjs_backend-BGnG-ppu.js → tfjs_backend-Bk3PmK91.js} +65 -65
- package/dist/{tile-CFy-xTO6.js → tile-CsWlVKKz.js} +1 -1
- package/dist/tokeniser/BaseTokeniser.d.ts +4 -1
- package/dist/tokeniser/BaseTokeniser.js +21 -5
- package/dist/tokeniser/CharTokeniser.d.ts +1 -1
- package/dist/tokeniser/CharTokeniser.js +62 -50
- package/dist/tokeniser/bpe.d.ts +1 -1
- package/dist/tokeniser/bpe.js +41 -35
- package/dist/tokeniser/type.d.ts +3 -1
- package/dist/training/AdamW.d.ts +3 -0
- package/dist/training/AdamW.js +59 -30
- package/dist/training/BasicTrainer.d.ts +1 -0
- package/dist/training/BasicTrainer.js +112 -92
- package/dist/training/DatasetBuilder.js +3 -3
- package/dist/training/Evaluator.js +2 -2
- package/dist/training/LRScheduler.d.ts +1 -0
- package/dist/training/LRScheduler.js +18 -12
- package/dist/training/PreTrainer.js +3 -3
- package/dist/training/SFTDatasetBuilder.js +3 -3
- package/dist/training/SFTTrainer.js +1 -1
- package/dist/training/orthoGrad.js +1 -1
- package/dist/training/sparseCrossEntropy.js +30 -30
- package/dist/training/types.d.ts +5 -3
- package/dist/training/validation.js +13 -13
- package/dist/{transpose-9kRxIXWR.js → transpose-Qxz-4os3.js} +7 -7
- package/dist/{unsorted_segment_sum-DJvk5xnh.js → unsorted_segment_sum-BfFVV9Zm.js} +20 -20
- package/dist/utilities/datasetID.d.ts +2 -0
- package/dist/utilities/datasetID.js +21 -0
- package/dist/utilities/dummy.js +6 -6
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/packed.js +1 -1
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/sentences.js +5 -5
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-Ck482e3n.js → variable-SSATClyt.js} +1 -1
- package/dist/{webgpu_program-B4HmApL1.js → webgpu_program-CbjdYLYk.js} +1 -1
- package/dist/{webgpu_util-DYlGSwOJ.js → webgpu_util-DuofJBMo.js} +7 -7
- package/dist/{zeros-DvZpK8s6.js → zeros-Bw0puq_w.js} +2 -2
- package/dist/{zeros_like-CWjDdwr-.js → zeros_like-rOHr54NY.js} +69 -69
- package/package.json +3 -3
- package/dist/complex-DI35Q-gW.js +0 -11
- package/dist/mat_mul-DhG0Newp.js +0 -11
- package/dist/mod-CSdCpRjf.js +0 -11
- package/dist/relu-J_X6MUzx.js +0 -9
- package/dist/slice-BzS11Qh0.js +0 -12
- package/dist/split-C2Sj255c.js +0 -9
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { o,
|
|
2
|
-
import { e as
|
|
3
|
-
import { m as d } from "./not_equal-
|
|
4
|
-
import { r as b } from "./reshape-
|
|
5
|
-
import { s as h } from "./sum-
|
|
6
|
-
function
|
|
1
|
+
import { o as i, n as t, E as o, aZ as y, ah as K, a_ as c, i as E, p as A, b as z, j as D, z as g, _ as p, a$ as I, b0 as v, b1 as w, b2 as B, b3 as T, b4 as G, J as k, b5 as L, b6 as S, b7 as M, v as f, b8 as R, b9 as j, ba as J } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { e as P } from "./axis_util-QWWgLjut.js";
|
|
3
|
+
import { m as d } from "./not_equal-CkQKkKZy.js";
|
|
4
|
+
import { r as b } from "./reshape-BIN71H3p.js";
|
|
5
|
+
import { s as h } from "./sum-D39FeU5h.js";
|
|
6
|
+
function U(s, r = null, e = !1) {
|
|
7
7
|
const a = { x: t(s, "x", "min") }, u = { axis: r, keepDims: e };
|
|
8
|
-
return
|
|
8
|
+
return o.runKernel(y, a, u);
|
|
9
9
|
}
|
|
10
|
-
const q = /* @__PURE__ */
|
|
11
|
-
function
|
|
10
|
+
const q = /* @__PURE__ */ i({ min_: U });
|
|
11
|
+
function Z(s, r = "euclidean", e = null, n = !1) {
|
|
12
12
|
s = t(s, "x", "norm");
|
|
13
13
|
const a = N(s, r, e);
|
|
14
14
|
let u = a.shape;
|
|
15
15
|
if (n) {
|
|
16
16
|
const m = K(e, s.shape);
|
|
17
|
-
u =
|
|
17
|
+
u = P(a.shape, m);
|
|
18
18
|
}
|
|
19
19
|
return b(a, u);
|
|
20
20
|
}
|
|
@@ -31,7 +31,7 @@ function N(s, r, e = null) {
|
|
|
31
31
|
if (r === -1 / 0)
|
|
32
32
|
return q(c(s), e);
|
|
33
33
|
if (r === "euclidean" || r === 2)
|
|
34
|
-
return E(h(A(c(s),
|
|
34
|
+
return E(h(A(c(s), z(2, "int32")), e));
|
|
35
35
|
throw new Error(`Error in norm: invalid ord value: ${r}`);
|
|
36
36
|
}
|
|
37
37
|
if (Array.isArray(e) && e.length === 2) {
|
|
@@ -42,96 +42,96 @@ function N(s, r, e = null) {
|
|
|
42
42
|
if (r === -1 / 0)
|
|
43
43
|
return q(h(c(s), e[1]), e[0]);
|
|
44
44
|
if (r === "fro" || r === "euclidean")
|
|
45
|
-
return E(h(
|
|
45
|
+
return E(h(D(s), e));
|
|
46
46
|
throw new Error(`Error in norm: invalid ord value: ${r}`);
|
|
47
47
|
}
|
|
48
48
|
throw new Error(`Error in norm: invalid axis: ${e}`);
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
function
|
|
50
|
+
const oe = /* @__PURE__ */ i({ norm_: Z });
|
|
51
|
+
function C(s, r) {
|
|
52
52
|
let e = t(s, "a", "greater", "string_or_numeric"), n = t(r, "b", "greater", "string_or_numeric");
|
|
53
53
|
[e, n] = g(e, n), p(e.shape, n.shape);
|
|
54
54
|
const a = { a: e, b: n };
|
|
55
|
-
return
|
|
55
|
+
return o.runKernel(I, a);
|
|
56
56
|
}
|
|
57
|
-
const ue = /* @__PURE__ */
|
|
58
|
-
function
|
|
57
|
+
const ue = /* @__PURE__ */ i({ greater_: C });
|
|
58
|
+
function F(s, r) {
|
|
59
59
|
let e = t(s, "a", "greaterEqual", "string_or_numeric"), n = t(r, "b", "greaterEqual", "string_or_numeric");
|
|
60
60
|
[e, n] = g(e, n), p(e.shape, n.shape);
|
|
61
61
|
const a = { a: e, b: n };
|
|
62
|
-
return
|
|
62
|
+
return o.runKernel(v, a);
|
|
63
63
|
}
|
|
64
|
-
const le = /* @__PURE__ */
|
|
65
|
-
function
|
|
64
|
+
const le = /* @__PURE__ */ i({ greaterEqual_: F });
|
|
65
|
+
function H(s, r) {
|
|
66
66
|
let e = t(s, "a", "less", "string_or_numeric"), n = t(r, "b", "less", "string_or_numeric");
|
|
67
67
|
[e, n] = g(e, n), p(e.shape, n.shape);
|
|
68
68
|
const a = { a: e, b: n };
|
|
69
|
-
return
|
|
69
|
+
return o.runKernel(w, a);
|
|
70
70
|
}
|
|
71
|
-
const ce = /* @__PURE__ */
|
|
71
|
+
const ce = /* @__PURE__ */ i({ less_: H });
|
|
72
72
|
function O(s, r) {
|
|
73
73
|
let e = t(s, "a", "lessEqual", "string_or_numeric"), n = t(r, "b", "lessEqual", "string_or_numeric");
|
|
74
74
|
[e, n] = g(e, n), p(e.shape, n.shape);
|
|
75
75
|
const a = { a: e, b: n };
|
|
76
|
-
return
|
|
76
|
+
return o.runKernel(B, a);
|
|
77
77
|
}
|
|
78
|
-
const fe = /* @__PURE__ */
|
|
78
|
+
const fe = /* @__PURE__ */ i({ lessEqual_: O });
|
|
79
79
|
function Q(s) {
|
|
80
80
|
const e = { x: t(s, "x", "log1p") };
|
|
81
|
-
return
|
|
81
|
+
return o.runKernel(T, e);
|
|
82
82
|
}
|
|
83
|
-
const me = /* @__PURE__ */
|
|
83
|
+
const me = /* @__PURE__ */ i({ log1p_: Q });
|
|
84
84
|
function V(s, r) {
|
|
85
85
|
const e = t(s, "a", "logicalAnd", "bool"), n = t(r, "b", "logicalAnd", "bool");
|
|
86
86
|
p(e.shape, n.shape);
|
|
87
87
|
const a = { a: e, b: n };
|
|
88
|
-
return
|
|
88
|
+
return o.runKernel(G, a);
|
|
89
89
|
}
|
|
90
|
-
const pe = /* @__PURE__ */
|
|
90
|
+
const pe = /* @__PURE__ */ i({ logicalAnd_: V });
|
|
91
91
|
function W(s, r) {
|
|
92
92
|
let e = t(s, "a", "minimum"), n = t(r, "b", "minimum");
|
|
93
93
|
[e, n] = g(e, n), e.dtype === "bool" && (e = k(e, "int32"), n = k(n, "int32")), p(e.shape, n.shape);
|
|
94
94
|
const a = { a: e, b: n };
|
|
95
|
-
return
|
|
95
|
+
return o.runKernel(L, a);
|
|
96
96
|
}
|
|
97
|
-
const he = /* @__PURE__ */
|
|
97
|
+
const he = /* @__PURE__ */ i({ minimum_: W });
|
|
98
98
|
function X(s) {
|
|
99
99
|
const e = { x: t(s, "x", "round") };
|
|
100
|
-
return
|
|
100
|
+
return o.runKernel(S, e);
|
|
101
101
|
}
|
|
102
|
-
const be = /* @__PURE__ */
|
|
102
|
+
const be = /* @__PURE__ */ i({ round_: X });
|
|
103
103
|
function Y(s, r) {
|
|
104
104
|
let e = t(s, "a", "squaredDifference"), n = t(r, "b", "squaredDifference");
|
|
105
105
|
[e, n] = g(e, n), p(e.shape, n.shape);
|
|
106
106
|
const a = { a: e, b: n }, u = {};
|
|
107
|
-
return
|
|
107
|
+
return o.runKernel(M, a, u);
|
|
108
108
|
}
|
|
109
|
-
const ge = /* @__PURE__ */
|
|
109
|
+
const ge = /* @__PURE__ */ i({ squaredDifference_: Y });
|
|
110
110
|
function x(s, r = 0) {
|
|
111
111
|
const e = t(s, "x", "unstack", "string_or_numeric");
|
|
112
112
|
f(r >= -e.shape.length && r < e.shape.length, () => `Axis = ${r} is not in [-${e.shape.length}, ${e.shape.length})`);
|
|
113
113
|
const n = { value: e }, a = { axis: r };
|
|
114
|
-
return
|
|
114
|
+
return o.runKernel(R, n, a);
|
|
115
115
|
}
|
|
116
|
-
const _e = /* @__PURE__ */
|
|
116
|
+
const _e = /* @__PURE__ */ i({ unstack_: x });
|
|
117
117
|
function ee(s, r, e = !1, n = !1) {
|
|
118
118
|
const a = t(s, "images", "resizeBilinear");
|
|
119
119
|
f(a.rank === 3 || a.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`), f(r.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${r}.`), f(n === !1 || e === !1, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
|
|
120
120
|
let u = a, m = !1;
|
|
121
121
|
a.rank === 3 && (m = !0, u = b(a, [1, a.shape[0], a.shape[1], a.shape[2]]));
|
|
122
|
-
const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l =
|
|
122
|
+
const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = o.runKernel(j, _, $);
|
|
123
123
|
return m ? b(l, [l.shape[1], l.shape[2], l.shape[3]]) : l;
|
|
124
124
|
}
|
|
125
|
-
const $e = /* @__PURE__ */
|
|
125
|
+
const $e = /* @__PURE__ */ i({ resizeBilinear_: ee });
|
|
126
126
|
function re(s, r, e = !1, n = !1) {
|
|
127
127
|
const a = t(s, "images", "resizeNearestNeighbor");
|
|
128
128
|
f(a.rank === 3 || a.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${a.rank}.`), f(r.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${r}.`), f(a.dtype === "float32" || a.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), f(n === !1 || e === !1, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
|
|
129
129
|
let u = a, m = !1;
|
|
130
130
|
a.rank === 3 && (m = !0, u = b(a, [1, a.shape[0], a.shape[1], a.shape[2]]));
|
|
131
|
-
const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l =
|
|
131
|
+
const _ = { images: u }, $ = { alignCorners: e, halfPixelCenters: n, size: r }, l = o.runKernel(J, _, $);
|
|
132
132
|
return m ? b(l, [l.shape[1], l.shape[2], l.shape[3]]) : l;
|
|
133
133
|
}
|
|
134
|
-
const de = /* @__PURE__ */
|
|
134
|
+
const de = /* @__PURE__ */ i({ resizeNearestNeighbor_: re });
|
|
135
135
|
export {
|
|
136
136
|
ce as a,
|
|
137
137
|
pe as b,
|
|
@@ -143,7 +143,7 @@ export {
|
|
|
143
143
|
q as h,
|
|
144
144
|
fe as l,
|
|
145
145
|
he as m,
|
|
146
|
-
|
|
146
|
+
oe as n,
|
|
147
147
|
be as r,
|
|
148
148
|
ge as s,
|
|
149
149
|
_e as u
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as p, e as s } from "./index-DSGwv2Yx.js";
|
|
2
2
|
import "./ops/cpu/rope.js";
|
|
3
3
|
import "./ops/webgl/rope.js";
|
|
4
4
|
const u = {
|
|
@@ -6,12 +6,12 @@ const u = {
|
|
|
6
6
|
inputsToSave: [],
|
|
7
7
|
outputsToSave: [],
|
|
8
8
|
gradFunc: (e, n, r) => {
|
|
9
|
-
const { ropeCache: o } = r, a =
|
|
9
|
+
const { ropeCache: o } = r, a = c(e, o, 0, !0);
|
|
10
10
|
return { x: () => a };
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
p(u);
|
|
14
|
-
function
|
|
14
|
+
function c(e, n, r, o = !1) {
|
|
15
15
|
return n.ensureRopeCache(e.shape[1] + r), s().runKernel("Rope", { x: e }, {
|
|
16
16
|
pastLen: r,
|
|
17
17
|
negSin: o,
|
|
@@ -20,5 +20,5 @@ function i(e, n, r, o = !1) {
|
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
22
22
|
u as a,
|
|
23
|
-
|
|
23
|
+
c as r
|
|
24
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as p, a9 as w } from "./index-DSGwv2Yx.js";
|
|
2
2
|
function k(o, t, r) {
|
|
3
3
|
const n = t.rank > 1 ? t.shape[t.rank - 1] : 1, e = t.rank > 1 ? t.rank - 1 : 1, h = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${r.shape}, indices.shape: ${t.shape}, shape: ${o}, sliceDim: ${n}, and batchDim: ${e}.`;
|
|
4
4
|
if (r.rank < e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as w } from "./backend_util-
|
|
2
|
-
import { a8 as f } from "./index-
|
|
1
|
+
import { P as w } from "./backend_util-qwSFfxYx.js";
|
|
2
|
+
import { a8 as f } from "./index-DSGwv2Yx.js";
|
|
3
3
|
function g(o, s) {
|
|
4
4
|
let r = !1, t;
|
|
5
5
|
for (o <= w ? (t = o, r = !0) : t = f(o, Math.floor(Math.sqrt(o))); !r; )
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { m as n, $ as l } from "./index-
|
|
2
|
-
import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-
|
|
3
|
-
import { r as m } from "./relu-
|
|
4
|
-
import { r as d } from "./reshape-
|
|
5
|
-
import { s as g } from "./sum-
|
|
1
|
+
import { m as n, $ as l } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-DQY6_ABw.js";
|
|
3
|
+
import { r as m } from "./relu-DTvZKBsZ.js";
|
|
4
|
+
import { r as d } from "./reshape-BIN71H3p.js";
|
|
5
|
+
import { s as g } from "./sum-D39FeU5h.js";
|
|
6
6
|
function L(e, r, s) {
|
|
7
7
|
if (s == null || s === "linear")
|
|
8
8
|
return e;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { f as it, g as Ye, a as Je, R as tn, v as en, d as nn, e as sn, h as on, i as rn, j as an, k as ln, l as cn, m as un, n as hn, o as fn, p as kt, q as dn, r as gn, s as mn } from "./backend_util-
|
|
1
|
+
import { v as Lt, bP as Ce, N as V, _ as Pt, a9 as H, af as et, ad as ht, bQ as dt, bR as at, a7 as De, L as st, aU as Ue, aq as We, bS as $e, bT as ze, bU as Be, bV as At, a5 as K, bW as qt, bX as U, bY as _t, bA as Vt, aN as Ct, bZ as Dt, F as Ut, b_ as Wt, a$ as $t, b0 as zt, b1 as Bt, b2 as jt, aO as Gt, b$ as Zt, b5 as Kt, c0 as Ht, ap as je, aV as Ge, aQ as Xt, ar as Ze, c1 as Ke, ah as Qt, am as He, t as Xe, bK as Yt, c2 as It, aF as Jt, S as Qe, c3 as te, b7 as ee, c4 as ne, az as pt, c5 as se, c6 as ot } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { f as it, g as Ye, a as Je, R as tn, v as en, d as nn, e as sn, h as on, i as rn, j as an, k as ln, l as cn, m as un, n as hn, o as fn, p as kt, q as dn, r as gn, s as mn } from "./backend_util-qwSFfxYx.js";
|
|
3
3
|
import { m as Nt } from "./complex_util-Yc1A_gV1.js";
|
|
4
|
-
import { a as pn, b as wn, e as In, c as bn } from "./axis_util-
|
|
5
|
-
import { b as xn } from "./broadcast_to-
|
|
6
|
-
import { r as En } from "./reshape-
|
|
7
|
-
import { p as Fn, a as yn, i as kn, c as Nn } from "./slice_util-
|
|
4
|
+
import { a as pn, b as wn, e as In, c as bn } from "./axis_util-QWWgLjut.js";
|
|
5
|
+
import { b as xn } from "./broadcast_to-C_EJTVTZ.js";
|
|
6
|
+
import { r as En } from "./reshape-BIN71H3p.js";
|
|
7
|
+
import { p as Fn, a as yn, i as kn, c as Nn } from "./slice_util-DPY56GzQ.js";
|
|
8
8
|
import { g as vn } from "./_commonjsHelpers-ByX85dGu.js";
|
|
9
9
|
function Sn(e, t) {
|
|
10
10
|
for (var n = 0; n < t.length; n++) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as l } from "./shared-
|
|
1
|
+
import { s as l } from "./shared-DRWDyk9w.js";
|
|
2
2
|
const { addImpl: m, bincountImpl: s, bincountReduceImpl: a, bitwiseAndImpl: I, castImpl: e, ceilImpl: t, concatImpl: r, equalImpl: i, expImpl: C, expm1Impl: P, floorImpl: U, gatherNdImpl: n, gatherV2Impl: g, greaterImpl: o, greaterEqualImpl: c, lessImpl: u, lessEqualImpl: d, linSpaceImpl: q, logImpl: R, maxImpl: h, maximumImpl: x, minimumImpl: b, multiplyImpl: E, negImpl: S, notEqualImpl: T, prodImpl: w, raggedGatherImpl: y, raggedRangeImpl: A, raggedTensorToTensorImpl: F, rangeImpl: G, rsqrtImpl: N, scatterImpl: f, sigmoidImpl: k, simpleAbsImpl: B, sliceImpl: H, sparseFillEmptyRowsImpl: K, sparseReshapeImpl: V, sparseSegmentReductionImpl: j, sqrtImpl: v, staticRegexReplaceImpl: z, stridedSliceImpl: D, stringNGramsImpl: J, stringSplitImpl: L, stringToHashBucketFastImpl: M, subImpl: O, tileImpl: Q, topKImpl: W, transposeImpl: X, uniqueImpl: Y } = l;
|
|
3
3
|
export {
|
|
4
4
|
b as A,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { o as c, n as e, E as a, S as l } from "./index-DSGwv2Yx.js";
|
|
2
|
+
function p(n, r, o) {
|
|
3
|
+
const s = e(n, "x", "slice", "string_or_numeric");
|
|
4
|
+
if (s.rank === 0)
|
|
5
|
+
throw new Error("Slicing scalar is not possible");
|
|
6
|
+
const t = { x: s }, i = { begin: r, size: o };
|
|
7
|
+
return a.runKernel(l, t, i);
|
|
8
|
+
}
|
|
9
|
+
const x = /* @__PURE__ */ c({ slice_: p });
|
|
10
|
+
export {
|
|
11
|
+
x as s
|
|
12
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as b } from "./index-DSGwv2Yx.js";
|
|
2
2
|
const y = -2, N = -1;
|
|
3
|
-
function
|
|
3
|
+
function F(r, e, n) {
|
|
4
4
|
const t = r.shape.length;
|
|
5
5
|
b(t === e.length, () => `Error in slice${t}D: Length of begin ${e} must match the rank of the array (${t}).`), b(t === n.length, () => `Error in slice${t}D: Length of size ${n} must match the rank of the array (${t}).`);
|
|
6
6
|
for (let l = 0; l < t; ++l)
|
|
7
7
|
b(e[l] + n[l] <= r.shape[l], () => `Error in slice${t}D: begin[${l}] + size[${l}] (${e[l] + n[l]}) would overflow input.shape[${l}] (${r.shape[l]})`);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function L(r, e, n) {
|
|
10
10
|
const t = [];
|
|
11
11
|
for (let l = 0; l < r.length; l++)
|
|
12
12
|
t[l] = Math.ceil((e[l] - r[l]) / n[l]);
|
|
@@ -144,8 +144,8 @@ function V(r, e, n, t, l, a) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
export {
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
F as a,
|
|
148
|
+
L as b,
|
|
149
149
|
X as c,
|
|
150
150
|
P as i,
|
|
151
151
|
C as p,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { o as p, n as i, E as a, H as c } from "./index-DSGwv2Yx.js";
|
|
2
|
+
function e(t, s, n = 0) {
|
|
3
|
+
const o = { x: i(t, "x", "split") }, r = { numOrSizeSplits: s, axis: n };
|
|
4
|
+
return a.runKernel(c, o, r);
|
|
5
|
+
}
|
|
6
|
+
const u = /* @__PURE__ */ p({ split_: e });
|
|
7
|
+
export {
|
|
8
|
+
u as s
|
|
9
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as r,
|
|
2
|
-
import { r as t } from "./reshape-
|
|
1
|
+
import { o as r, n, I as a } from "./index-DSGwv2Yx.js";
|
|
2
|
+
import { r as t } from "./reshape-BIN71H3p.js";
|
|
3
3
|
function p(s, o) {
|
|
4
4
|
const e = n(s, "x", "squeeze", "string_or_numeric");
|
|
5
5
|
return t(e, a(e.shape, o).newShape);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as e,
|
|
1
|
+
import { o as e, w as c, v as n, E as k, P as i } from "./index-DSGwv2Yx.js";
|
|
2
2
|
function u(r, t = 0) {
|
|
3
3
|
const s = c(r, "tensors", "stack", "string_or_numeric");
|
|
4
4
|
n(s.length >= 1, () => "Pass at least one tensor to tf.stack"), s.length > 0 && n(t <= s[0].rank, () => "Axis must be <= rank of the tensor");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v as _, aE as P, o as A, n as I, E as v, aF as G, aG as J, aH as X, aI as q, aJ as Q, aK as Y } from "./index-DSGwv2Yx.js";
|
|
2
2
|
function it(t, n, e, o, s = "NHWC", f) {
|
|
3
3
|
const l = t[3], r = [...n, l], c = nt(s);
|
|
4
4
|
return j(t, r, e, f, o, null, null, c);
|
|
@@ -217,17 +217,17 @@ function et(t) {
|
|
|
217
217
|
const gt = /* @__PURE__ */ A({ sigmoid_: et });
|
|
218
218
|
function ot(t) {
|
|
219
219
|
const e = { x: I(t, "x", "elu", "float32") };
|
|
220
|
-
return v.runKernel(
|
|
220
|
+
return v.runKernel(J, e);
|
|
221
221
|
}
|
|
222
222
|
const wt = /* @__PURE__ */ A({ elu_: ot });
|
|
223
223
|
function st(t, n = 0.2) {
|
|
224
224
|
const o = { x: I(t, "x", "leakyRelu") }, s = { alpha: n };
|
|
225
|
-
return v.runKernel(
|
|
225
|
+
return v.runKernel(X, o, s);
|
|
226
226
|
}
|
|
227
227
|
const xt = /* @__PURE__ */ A({ leakyRelu_: st });
|
|
228
228
|
function rt(t, n) {
|
|
229
229
|
const e = I(t, "x", "prelu"), o = I(n, "alpha", "prelu"), s = { x: e, alpha: o };
|
|
230
|
-
return v.runKernel(
|
|
230
|
+
return v.runKernel(q, s);
|
|
231
231
|
}
|
|
232
232
|
const Et = /* @__PURE__ */ A({ prelu_: rt });
|
|
233
233
|
function lt(t) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { o as e,
|
|
2
|
-
function i(t,
|
|
1
|
+
import { o as e, n as u, J as c, E as l, K as m } from "./index-DSGwv2Yx.js";
|
|
2
|
+
function i(t, n = null, o = !1) {
|
|
3
3
|
let s = u(t, "x", "sum");
|
|
4
4
|
s.dtype === "bool" && (s = c(s, "int32"));
|
|
5
|
-
const r = { x: s }, a = { axis:
|
|
5
|
+
const r = { x: s }, a = { axis: n, keepDims: o };
|
|
6
6
|
return l.runKernel(m, r, a);
|
|
7
7
|
}
|
|
8
8
|
const f = /* @__PURE__ */ e({ sum_: i });
|