@genai-fi/nanogpt 0.18.0 → 0.19.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.js +30 -30
- package/dist/{RealDiv-ioj6Z-ox.js → RealDiv-CGwv0liw.js} +9 -9
- package/dist/{Reshape-BZC-ebeR.js → Reshape-BW__R4mZ.js} +7 -7
- package/dist/{Reshape-pwprEaej.js → Reshape-CPBkTIH2.js} +1 -1
- package/dist/TeachableLLM.js +17 -17
- package/dist/Trainer.js +97 -95
- package/dist/{axis_util-QWWgLjut.js → axis_util-GTVlo58H.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-qwSFfxYx.js → backend_util-GaFarB78.js} +21 -21
- package/dist/{backend_webgpu-DI2wXEC2.js → backend_webgpu-BqASlsbV.js} +8 -8
- package/dist/{broadcast_to-C_EJTVTZ.js → broadcast_to-eS93CCN_.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-CLAD4h_I.js → clip_by_value-DDA7rrcT.js} +1 -1
- package/dist/complex-DI35Q-gW.js +11 -0
- package/dist/{concat-Dqk7Xk7h.js → concat-CAQpCret.js} +5 -5
- package/dist/{concat_util-C1Mxe27t.js → concat_util-D18dJ4fD.js} +1 -1
- package/dist/{dataset-DlqAN81i.js → dataset-CGGp1z9P.js} +3 -3
- package/dist/{dropout_util-N0z8Os-K.js → dropout_util--NxWuYg2.js} +1 -1
- package/dist/{expand_dims-D0rBtgT1.js → expand_dims-Bkd1YD5x.js} +4 -4
- package/dist/{exports_initializers-DIOZQt_L.js → exports_initializers-CYzKLjN7.js} +1 -1
- package/dist/{floor-CymuCmTO.js → floor-BQtb-Azg.js} +1 -1
- package/dist/{gather-DEyjXNb1.js → gather-qIqEqaGn.js} +1 -1
- package/dist/{gelu-DpTCC3eB.js → gelu-B220X1Go.js} +1 -1
- package/dist/{gpgpu_math-3bCb5ooU.js → gpgpu_math-BwvV12df.js} +25 -25
- package/dist/{index-DSGwv2Yx.js → index-CUXkjxiT.js} +33 -33
- package/dist/{index-BQvB7LCC.js → index-CjOWnMXP.js} +15 -15
- package/dist/{kernel_funcs_utils-DGqzNlHT.js → kernel_funcs_utils-pq0CK9co.js} +6 -6
- package/dist/layers/BaseLayer.js +4 -4
- package/dist/layers/CausalSelfAttention.d.ts +1 -0
- package/dist/layers/CausalSelfAttention.js +14 -14
- 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.d.ts +1 -0
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/layers/WeightStore.js +2 -2
- package/dist/loader/loadTransformers.js +9 -9
- package/dist/loader/oldZipLoad.js +9 -9
- package/dist/loader/save.js +38 -30
- package/dist/loader/types.d.ts +1 -0
- package/dist/main.js +9 -9
- package/dist/{matMul16-BIT70Vya.js → matMul16-BcVC_E62.js} +3 -3
- package/dist/{matMulGelu-CsZnh18H.js → matMulGelu-JNLZqKQp.js} +18 -18
- package/dist/mat_mul-DhG0Newp.js +11 -0
- package/dist/mod-CSdCpRjf.js +11 -0
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/NanoGPTV2.js +2 -2
- package/dist/models/model.d.ts +1 -0
- package/dist/models/model.js +9 -9
- package/dist/{not_equal-CkQKkKZy.js → not_equal-hurPF26l.js} +15 -15
- package/dist/{ones-DbVB5N58.js → ones-BytntneX.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-CURIZSVt.js → ops-CsXeTq1P.js} +100 -100
- package/dist/{pack16-WlOSOuZA.js → pack16-bqltoUlR.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-CIm8lk2-.js → random_normal-IBRrha8a.js} +1 -1
- package/dist/{random_width-B_fVXhGx.js → random_width-DN5ZtQkM.js} +131 -131
- package/dist/{range-BDxO73mk.js → range-C-CjF-LI.js} +1 -1
- package/dist/relu-J_X6MUzx.js +9 -0
- package/dist/{reshape-BIN71H3p.js → reshape-BDOuCSNW.js} +1 -1
- package/dist/{resize_nearest_neighbor-C6_0dAnK.js → resize_nearest_neighbor-BojqlfRe.js} +41 -41
- package/dist/{rope-CC5RjmKU.js → rope-DcrZM_e6.js} +5 -5
- package/dist/{scatter_nd_util-C-x73Cj6.js → scatter_nd_util-ByNJaL6I.js} +1 -1
- package/dist/{segment_util-4zuHV5IG.js → segment_util-Dasb2Zaf.js} +2 -2
- package/dist/{selu_util-BXdhy_W6.js → selu_util-BLhIqRkw.js} +5 -5
- package/dist/{shared-zTaJ5siv.js → shared-3agzAqQ_.js} +1 -1
- package/dist/{shared-DRWDyk9w.js → shared-CagdqkLh.js} +6 -6
- package/dist/slice-BzS11Qh0.js +12 -0
- package/dist/{slice_util-DPY56GzQ.js → slice_util-CC35pLmT.js} +5 -5
- package/dist/{softmax-BLGJqdwx.js → softmax-D4q1LJN7.js} +1 -1
- package/dist/split-C2Sj255c.js +9 -0
- package/dist/{squeeze-O_YWJpw_.js → squeeze-ho4wLUek.js} +2 -2
- package/dist/{stack-z6QE7kmP.js → stack-DudVrtmG.js} +1 -1
- package/dist/{step-DQY6_ABw.js → step-BTxPtq1r.js} +4 -4
- package/dist/{sum-D39FeU5h.js → sum-BpiwSWvg.js} +3 -3
- package/dist/{tensor-D8e0Gd7c.js → tensor-BWFldCso.js} +1 -1
- package/dist/{tensor1d-BMl0eZYV.js → tensor1d-LMGMIUlr.js} +1 -1
- package/dist/{tensor2d-DTtQ1QcT.js → tensor2d-BnXMKScO.js} +1 -1
- package/dist/{tensor4d-Dj4rDssL.js → tensor4d-C6UCG_u8.js} +1 -1
- package/dist/{tfjs_backend-Bk3PmK91.js → tfjs_backend-BGnG-ppu.js} +65 -65
- package/dist/{tile-CsWlVKKz.js → tile-CFy-xTO6.js} +1 -1
- package/dist/tokeniser/BaseTokeniser.d.ts +5 -1
- package/dist/tokeniser/BaseTokeniser.js +62 -53
- package/dist/tokeniser/type.d.ts +8 -0
- package/dist/training/AdamW.js +2 -2
- package/dist/training/BasicTrainer.d.ts +1 -0
- package/dist/training/BasicTrainer.js +95 -79
- package/dist/training/DatasetBuilder.d.ts +6 -2
- package/dist/training/DatasetBuilder.js +60 -41
- package/dist/training/Evaluator.d.ts +1 -2
- package/dist/training/Evaluator.js +21 -31
- package/dist/training/SFTTrainer.d.ts +3 -2
- package/dist/training/SFTTrainer.js +4 -3
- package/dist/training/orthoGrad.js +1 -1
- package/dist/training/sparseCrossEntropy.js +38 -38
- package/dist/training/tasks/ConversationTask.d.ts +4 -0
- package/dist/training/tasks/ConversationTask.js +7 -7
- package/dist/training/tasks/PretrainingTask.d.ts +4 -0
- package/dist/training/tasks/PretrainingTask.js +11 -7
- package/dist/training/tasks/StartSentenceTask.d.ts +4 -0
- package/dist/training/tasks/StartSentenceTask.js +5 -5
- package/dist/training/tasks/Task.d.ts +12 -0
- package/dist/training/tasks/Task.js +55 -31
- package/dist/training/types.d.ts +1 -0
- package/dist/training/validation.d.ts +1 -1
- package/dist/training/validation.js +33 -32
- package/dist/{transpose-Qxz-4os3.js → transpose-9kRxIXWR.js} +7 -7
- package/dist/{unsorted_segment_sum-BfFVV9Zm.js → unsorted_segment_sum-DJvk5xnh.js} +20 -20
- 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-SSATClyt.js → variable-Ck482e3n.js} +1 -1
- package/dist/{webgpu_program-CbjdYLYk.js → webgpu_program-B4HmApL1.js} +1 -1
- package/dist/{webgpu_util-DuofJBMo.js → webgpu_util-DYlGSwOJ.js} +7 -7
- package/dist/{zeros-Bw0puq_w.js → zeros-DvZpK8s6.js} +2 -2
- package/dist/{zeros_like-rOHr54NY.js → zeros_like-CWjDdwr-.js} +69 -69
- package/package.json +1 -1
- package/dist/complex-3DpPEG9B.js +0 -11
- package/dist/mat_mul-DP86qZtZ.js +0 -11
- package/dist/mod-BXjLYwvM.js +0 -11
- package/dist/readers-17HLdxVM.js +0 -12
- package/dist/relu-DTvZKBsZ.js +0 -9
- package/dist/slice-BvItlgXu.js +0 -12
- package/dist/split-BN9LkEgS.js +0 -9
- package/dist/training/SFTDatasetBuilder.d.ts +0 -23
- package/dist/training/SFTDatasetBuilder.js +0 -85
|
@@ -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, q as t, E as i, aZ as y, ah as K, a_ as c, l as E, p as A, a as D, n as z, B as g, _ as p, a$ as I, b0 as w, b1 as B, b2 as v, b3 as T, b4 as L, L as k, b5 as G, b6 as S, b7 as M, x as f, b8 as R, b9 as P, ba as U } from "./index-CUXkjxiT.js";
|
|
2
|
+
import { e as Z } from "./axis_util-GTVlo58H.js";
|
|
3
|
+
import { m as d } from "./not_equal-hurPF26l.js";
|
|
4
|
+
import { r as b } from "./reshape-BDOuCSNW.js";
|
|
5
|
+
import { s as h } from "./sum-BpiwSWvg.js";
|
|
6
|
+
function j(s, r = null, e = !1) {
|
|
7
7
|
const a = { x: t(s, "x", "min") }, u = { axis: r, keepDims: e };
|
|
8
|
-
return
|
|
8
|
+
return i.runKernel(y, a, u);
|
|
9
9
|
}
|
|
10
|
-
const q = /* @__PURE__ */
|
|
11
|
-
function
|
|
10
|
+
const q = /* @__PURE__ */ o({ min_: j });
|
|
11
|
+
function C(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 = Z(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), D(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(z(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 ie = /* @__PURE__ */ o({ norm_: C });
|
|
51
|
+
function F(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 i.runKernel(I, a);
|
|
56
56
|
}
|
|
57
|
-
const ue = /* @__PURE__ */
|
|
58
|
-
function
|
|
57
|
+
const ue = /* @__PURE__ */ o({ greater_: F });
|
|
58
|
+
function H(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 i.runKernel(w, a);
|
|
63
63
|
}
|
|
64
|
-
const le = /* @__PURE__ */
|
|
65
|
-
function
|
|
64
|
+
const le = /* @__PURE__ */ o({ greaterEqual_: H });
|
|
65
|
+
function J(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 i.runKernel(B, a);
|
|
70
70
|
}
|
|
71
|
-
const ce = /* @__PURE__ */
|
|
71
|
+
const ce = /* @__PURE__ */ o({ less_: J });
|
|
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 i.runKernel(v, a);
|
|
77
77
|
}
|
|
78
|
-
const fe = /* @__PURE__ */
|
|
78
|
+
const fe = /* @__PURE__ */ o({ lessEqual_: O });
|
|
79
79
|
function Q(s) {
|
|
80
80
|
const e = { x: t(s, "x", "log1p") };
|
|
81
|
-
return
|
|
81
|
+
return i.runKernel(T, e);
|
|
82
82
|
}
|
|
83
|
-
const me = /* @__PURE__ */
|
|
83
|
+
const me = /* @__PURE__ */ o({ 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 i.runKernel(L, a);
|
|
89
89
|
}
|
|
90
|
-
const pe = /* @__PURE__ */
|
|
90
|
+
const pe = /* @__PURE__ */ o({ 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 i.runKernel(G, a);
|
|
96
96
|
}
|
|
97
|
-
const he = /* @__PURE__ */
|
|
97
|
+
const he = /* @__PURE__ */ o({ minimum_: W });
|
|
98
98
|
function X(s) {
|
|
99
99
|
const e = { x: t(s, "x", "round") };
|
|
100
|
-
return
|
|
100
|
+
return i.runKernel(S, e);
|
|
101
101
|
}
|
|
102
|
-
const be = /* @__PURE__ */
|
|
102
|
+
const be = /* @__PURE__ */ o({ 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 i.runKernel(M, a, u);
|
|
108
108
|
}
|
|
109
|
-
const ge = /* @__PURE__ */
|
|
109
|
+
const ge = /* @__PURE__ */ o({ 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 i.runKernel(R, n, a);
|
|
115
115
|
}
|
|
116
|
-
const _e = /* @__PURE__ */
|
|
116
|
+
const _e = /* @__PURE__ */ o({ 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 = i.runKernel(P, _, $);
|
|
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__ */ o({ 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 = i.runKernel(U, _, $);
|
|
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__ */ o({ 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
|
+
ie 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 { e as p, h as s } from "./index-CUXkjxiT.js";
|
|
2
2
|
import "./ops/cpu/rope.js";
|
|
3
3
|
import "./ops/webgl/rope.js";
|
|
4
4
|
const u = {
|
|
@@ -6,13 +6,13 @@ 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 = i(e, o, 0, !0);
|
|
10
10
|
return { x: () => a };
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
p(u);
|
|
14
|
-
function
|
|
15
|
-
return n.ensureRopeCache(e.shape[
|
|
14
|
+
function i(e, n, r, o = !1) {
|
|
15
|
+
return n.ensureRopeCache(e.shape[2] + r), s().runKernel("Rope", { x: e }, {
|
|
16
16
|
pastLen: r,
|
|
17
17
|
negSin: o,
|
|
18
18
|
ropeCache: n
|
|
@@ -20,5 +20,5 @@ function c(e, n, r, o = !1) {
|
|
|
20
20
|
}
|
|
21
21
|
export {
|
|
22
22
|
u as a,
|
|
23
|
-
|
|
23
|
+
i as r
|
|
24
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as p, a9 as w } from "./index-CUXkjxiT.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-GaFarB78.js";
|
|
2
|
+
import { a8 as f } from "./index-CUXkjxiT.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-CUXkjxiT.js";
|
|
2
|
+
import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-BTxPtq1r.js";
|
|
3
|
+
import { r as m } from "./relu-J_X6MUzx.js";
|
|
4
|
+
import { r as d } from "./reshape-BDOuCSNW.js";
|
|
5
|
+
import { s as g } from "./sum-BpiwSWvg.js";
|
|
6
6
|
function L(e, r, s) {
|
|
7
7
|
if (s == null || s === "linear")
|
|
8
8
|
return e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as l } from "./shared-
|
|
1
|
+
import { s as l } from "./shared-CagdqkLh.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,
|
|
@@ -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 { x as Lt, bP as Ce, U as V, _ as Pt, a9 as H, af as et, ad as ht, bQ as dt, bR as at, a7 as De, Q 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-CUXkjxiT.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-GaFarB78.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-GTVlo58H.js";
|
|
5
|
+
import { b as xn } from "./broadcast_to-eS93CCN_.js";
|
|
6
|
+
import { r as En } from "./reshape-BDOuCSNW.js";
|
|
7
|
+
import { p as Fn, a as yn, i as kn, c as Nn } from "./slice_util-CC35pLmT.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++) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { o as c, q as e, E as a, S as l } from "./index-CUXkjxiT.js";
|
|
2
|
+
function p(r, n, o) {
|
|
3
|
+
const s = e(r, "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: n, 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 { x as b } from "./index-CUXkjxiT.js";
|
|
2
2
|
const y = -2, N = -1;
|
|
3
|
-
function
|
|
3
|
+
function L(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 v(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
|
+
L as a,
|
|
148
|
+
v 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, q as i, E as a, J as c } from "./index-CUXkjxiT.js";
|
|
2
|
+
function e(t, s, o = 0) {
|
|
3
|
+
const n = { x: i(t, "x", "split") }, r = { numOrSizeSplits: s, axis: o };
|
|
4
|
+
return a.runKernel(c, n, 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, n,
|
|
2
|
-
import { r as t } from "./reshape-
|
|
1
|
+
import { o as r, q as n, K as a } from "./index-CUXkjxiT.js";
|
|
2
|
+
import { r as t } from "./reshape-BDOuCSNW.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, y as c, x as n, E as k, P as i } from "./index-CUXkjxiT.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 { x as _, aE as P, o as A, q as I, E as v, aF as G, aG as q, aH as J, aI as X, aJ as Q, aK as Y } from "./index-CUXkjxiT.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(q, 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(J, 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(X, 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, q as u, L as c, E as l, N as m } from "./index-CUXkjxiT.js";
|
|
2
|
+
function i(t, o = null, n = !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: o, keepDims: n };
|
|
6
6
|
return l.runKernel(m, r, a);
|
|
7
7
|
}
|
|
8
8
|
const f = /* @__PURE__ */ e({ sum_: i });
|