@genai-fi/nanogpt 0.10.2 → 0.11.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 +10 -5
- package/dist/Generator.js +11760 -146
- package/dist/{RealDiv-zz7FpkKX.js → RealDiv-Ds-jvL09.js} +28 -30
- package/dist/Reshape-Cd6e-Otn.js +14 -0
- package/dist/{Reshape-CHdUjC72.js → Reshape-Ct266DEk.js} +21 -23
- package/dist/TeachableLLM.d.ts +4 -3
- package/dist/TeachableLLM.js +15 -16
- package/dist/Trainer.d.ts +2 -2
- package/dist/Trainer.js +6 -6
- package/dist/{axis_util-BsIr9ZNu.js → axis_util-DofAuy0p.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-B1XRLuq9.js → backend_util-C7NWHpv7.js} +72 -73
- package/dist/{backend_webgpu-CqpfEImu.js → backend_webgpu-B0Vls736.js} +52 -54
- package/dist/broadcast_to-DDaNMbX7.js +28 -0
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +3 -3
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/matMulGelu.js +7 -11
- package/dist/checks/normRMS.js +9 -9
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.js +2 -2
- package/dist/checks/qkv.js +11 -12
- package/dist/checks/rope.js +2 -2
- package/dist/clip_by_value-Dn5tzexi.js +12 -0
- package/dist/complex-DClmWqJt.js +11 -0
- package/dist/concat-C6X3AAlQ.js +17 -0
- package/dist/{concat_util-iBYIyuQe.js → concat_util-CHsJFZJJ.js} +1 -1
- package/dist/{dataset-D2P7rHAw.js → dataset-DcjWqUVQ.js} +135 -137
- package/dist/dropout-OxuaJz6z.js +92 -0
- package/dist/expand_dims-BzfJK2uc.js +11 -0
- package/dist/{exports_initializers-CZSUJoVE.js → exports_initializers-eS9QJ6ut.js} +1 -1
- package/dist/floor-DIb-lN_u.js +9 -0
- package/dist/gather-BcO5UQNJ.js +9 -0
- package/dist/{gelu-Bmhopi0J.js → gelu-DqTbCx5x.js} +10 -11
- package/dist/{gpgpu_math-DsCcikas.js → gpgpu_math-CJcbnKPC.js} +841 -1015
- package/dist/index-D0RBWjq8.js +3520 -0
- package/dist/{index-DRyE072i.js → index-Dj5TkmPY.js} +330 -331
- package/dist/{kernel_funcs_utils-CWfOAPGO.js → kernel_funcs_utils-CSaumNDs.js} +132 -134
- package/dist/layers/BaseLayer.js +15 -16
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +4 -4
- package/dist/layers/PositionEmbedding.js +7 -7
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +9 -9
- package/dist/layers/TiedEmbedding.js +6 -6
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +21 -22
- package/dist/log_sum_exp-VLZgbFAH.js +39 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +49 -50
- package/dist/{matMul16-fEAJ4smh.js → matMul16-cDxwemKj.js} +14 -15
- package/dist/matMulGelu-B2s_80-H.js +163 -0
- package/dist/mat_mul-DxpNTCRz.js +11 -0
- package/dist/mod-PrOKlFxH.js +11 -0
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/model.js +13 -14
- package/dist/ones-BX_wEgzB.js +14 -0
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.js +1 -1
- package/dist/ops/add16.js +1 -1
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/concat16.js +2 -2
- package/dist/ops/cpu/adamAdjust.js +12 -13
- package/dist/ops/cpu/adamMoments.js +6 -7
- package/dist/ops/cpu/appendCache.js +7 -8
- package/dist/ops/cpu/attentionMask.js +11 -11
- package/dist/ops/cpu/fusedSoftmax.js +10 -11
- package/dist/ops/cpu/gatherSub.js +10 -11
- package/dist/ops/cpu/gelu.js +14 -15
- package/dist/ops/cpu/matMul16.js +6 -7
- package/dist/ops/cpu/matMulGelu.js +5 -6
- package/dist/ops/cpu/matMulMul.js +3 -4
- package/dist/ops/cpu/mulDropout.js +3 -4
- package/dist/ops/cpu/normRMS.js +11 -12
- package/dist/ops/cpu/qkv.js +8 -9
- package/dist/ops/cpu/rope.js +9 -10
- package/dist/ops/cpu/scatterSub.js +14 -16
- package/dist/ops/dot16.js +2 -2
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/add16.js +10 -11
- package/dist/ops/grads/attentionMask.js +5 -6
- package/dist/ops/grads/gelu.js +3 -4
- package/dist/ops/grads/matMul16.js +4 -5
- package/dist/ops/grads/matMulGelu.js +8 -9
- package/dist/ops/grads/normRMS.js +9 -10
- package/dist/ops/grads/pack16.js +4 -5
- package/dist/ops/grads/qkv.js +17 -19
- package/dist/ops/grads/rope.js +3 -5
- package/dist/ops/grads/softmax16.js +3 -4
- package/dist/ops/grads/unpack16.js +3 -4
- package/dist/ops/grads/utils.d.ts +1 -0
- package/dist/ops/grads/utils.js +8 -4
- package/dist/ops/matMul16.js +3 -3
- package/dist/ops/matMulGelu.js +2 -2
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mul16.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/pack16.js +3 -4
- package/dist/ops/qkv.js +4 -8
- package/dist/ops/reshape16.js +16 -18
- package/dist/ops/rope.d.ts +1 -1
- package/dist/ops/rope.js +3 -8
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/slice16.js +2 -2
- package/dist/ops/softmax16.js +5 -8
- package/dist/ops/sub16.js +1 -1
- package/dist/ops/sum16.js +2 -2
- package/dist/ops/transpose16.js +23 -24
- package/dist/ops/unpack16.js +2 -2
- package/dist/ops/webgl/adamAdjust.js +2 -3
- package/dist/ops/webgl/adamMoments.js +1 -2
- package/dist/ops/webgl/appendCache.js +1 -2
- package/dist/ops/webgl/attentionMask.js +5 -6
- package/dist/ops/webgl/fusedSoftmax.js +6 -8
- package/dist/ops/webgl/gatherSub.js +6 -7
- package/dist/ops/webgl/gelu.js +2 -3
- package/dist/ops/webgl/log.js +11 -12
- package/dist/ops/webgl/matMul16.js +15 -16
- package/dist/ops/webgl/matMulGelu.js +7 -111
- package/dist/ops/webgl/matMulMul.js +14 -15
- package/dist/ops/webgl/mulDropout.js +8 -9
- package/dist/ops/webgl/normRMS.js +7 -8
- package/dist/ops/webgl/qkv.js +5 -6
- package/dist/ops/webgl/rope.js +7 -8
- package/dist/ops/webgl/scatterSub.js +5 -6
- package/dist/ops/webgpu/adamAdjust.js +10 -12
- package/dist/ops/webgpu/adamMoments.js +8 -10
- package/dist/ops/webgpu/add16.js +8 -9
- package/dist/ops/webgpu/appendCache.js +23 -25
- package/dist/ops/webgpu/attentionMask.js +10 -12
- package/dist/ops/webgpu/attentionMask32_program.js +2 -2
- package/dist/ops/webgpu/concat16.js +12 -14
- package/dist/ops/webgpu/gatherSub.js +9 -11
- package/dist/ops/webgpu/gelu.js +28 -29
- package/dist/ops/webgpu/matMul16.js +26 -28
- package/dist/ops/webgpu/matMul16_program.js +4 -5
- package/dist/ops/webgpu/mul16.js +7 -8
- package/dist/ops/webgpu/normRMS.js +17 -19
- package/dist/ops/webgpu/normRMSGrad.js +21 -28
- package/dist/ops/webgpu/pack16.js +12 -13
- package/dist/ops/webgpu/pack16_program.js +2 -2
- package/dist/ops/webgpu/qkv.js +13 -15
- package/dist/ops/webgpu/rope.js +25 -27
- package/dist/ops/webgpu/scatterSub.js +7 -9
- package/dist/ops/webgpu/slice16.js +21 -23
- package/dist/ops/webgpu/softmax16.js +17 -19
- 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 +7 -8
- package/dist/ops/webgpu/sub16.js +8 -9
- package/dist/ops/webgpu/sum16.js +19 -21
- package/dist/ops/webgpu/transpose16.js +19 -20
- package/dist/ops/webgpu/transpose16_program.js +2 -2
- package/dist/ops/webgpu/transpose16_shared_program.js +11 -12
- package/dist/ops/webgpu/unpack16.js +3 -4
- package/dist/ops/webgpu/utils/binary_op.js +7 -8
- package/dist/ops/webgpu/utils/reductions.js +14 -22
- package/dist/ops-FJapAPfm.js +476 -0
- package/dist/pack16-k4jq6aMX.js +39 -0
- package/dist/patches/webgpu_backend.js +19 -20
- package/dist/patches/webgpu_base.js +1 -1
- package/dist/patches/webgpu_program.js +15 -16
- package/dist/{random_width-BVV9HveY.js → random_width-UGQn4OWb.js} +2506 -2761
- package/dist/range-CuGvVN2c.js +10 -0
- package/dist/relu-Cf80uA2p.js +9 -0
- package/dist/reshape-CkjKPPqB.js +9 -0
- package/dist/resize_nearest_neighbor-DB8k9KN_.js +175 -0
- package/dist/rope-BmZmp9uP.js +24 -0
- package/dist/{scatter_nd_util-C7zXRT_h.js → scatter_nd_util-BY22Cc-C.js} +1 -1
- package/dist/selu_util-BuLbmbrl.js +44 -0
- package/dist/{shared-CHhxz-O5.js → shared-B7USJZgw.js} +1 -1
- package/dist/{shared-D2NP_CpY.js → shared-BQboIImQ.js} +379 -381
- package/dist/slice-Aqy7KbJh.js +12 -0
- package/dist/{slice_util-DyjSAD0u.js → slice_util-D8CQRenR.js} +7 -7
- package/dist/{softmax-C9JQEtnO.js → softmax-faLoUZVT.js} +4 -5
- package/dist/split-BNz5jcGc.js +9 -0
- package/dist/squeeze--YMgaAAf.js +10 -0
- package/dist/stack-WJK22CFn.js +11 -0
- package/dist/step-dXR33iOg.js +261 -0
- package/dist/sum-BdplSvq_.js +11 -0
- package/dist/{tensor-0r5yOo2R.js → tensor-BQqrDvpx.js} +1 -1
- package/dist/tensor1d-LxP9asMm.js +11 -0
- package/dist/{tensor2d-CSB4KOb0.js → tensor2d-BN1sSfQO.js} +6 -7
- package/dist/{tensor4d-D7bLqGqz.js → tensor4d-DVwr7pLF.js} +6 -7
- package/dist/{tfjs_backend-CNkSTL0c.js → tfjs_backend-Vi4JfLzT.js} +256 -265
- package/dist/tile-CvN_LyVr.js +11 -0
- package/dist/tokeniser/BaseTokeniser.d.ts +27 -0
- package/dist/tokeniser/BaseTokeniser.js +94 -0
- package/dist/tokeniser/CharTokeniser.d.ts +4 -3
- package/dist/tokeniser/CharTokeniser.js +46 -32
- package/dist/tokeniser/bpe.d.ts +4 -3
- package/dist/tokeniser/bpe.js +60 -45
- package/dist/tokeniser/type.d.ts +11 -0
- package/dist/training/Adam.js +2 -2
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.d.ts +2 -2
- package/dist/training/DatasetBuilder.js +32 -36
- package/dist/training/FullTrainer.js +1 -1
- package/dist/training/Trainer.d.ts +3 -3
- package/dist/training/Trainer.js +2 -2
- package/dist/training/sparseCrossEntropy.js +5 -5
- package/dist/transpose-JawVKyZy.js +36 -0
- package/dist/unsorted_segment_sum-LAbmE9G4.js +277 -0
- package/dist/utilities/dummy.js +3 -3
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/packed.d.ts +1 -4
- package/dist/utilities/packed.js +10 -745
- 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-DzfrwYuP.js → variable-DQ9yYgEU.js} +1 -1
- package/dist/{webgpu_program-DzaQiqel.js → webgpu_program-CAE4RICo.js} +177 -171
- package/dist/{webgpu_util-0_ubCEHJ.js → webgpu_util-BdovYhXr.js} +34 -35
- package/dist/zeros-DeiE2zTa.js +13 -0
- package/dist/zeros_like-BAz3iKru.js +721 -0
- package/package.json +4 -2
- package/dist/Reshape-CDVLyVfz.js +0 -16
- package/dist/broadcast_to-B0ChcDaz.js +0 -30
- package/dist/complex-BBiRlsVq.js +0 -13
- package/dist/concat-DmBLPVGC.js +0 -19
- package/dist/dropout-B1x1kYMa.js +0 -99
- package/dist/expand_dims-ouvfxQ1n.js +0 -13
- package/dist/gather-CH9sdacz.js +0 -10
- package/dist/index-D6Q1lPZO.js +0 -2157
- package/dist/log_sum_exp-D3ftBNY5.js +0 -41
- package/dist/mat_mul-C59XWcJd.js +0 -12
- package/dist/mod-DESSvHIU.js +0 -12
- package/dist/mulmat_packed_gpu-Coh6qbJk.js +0 -55
- package/dist/ones-jU9jlQvM.js +0 -15
- package/dist/ops-BFDtP6th.js +0 -645
- package/dist/pack16-CmVZs6af.js +0 -41
- package/dist/patches/PackedTensor.d.ts +0 -12
- package/dist/patches/PackedTensor.js +0 -11
- package/dist/patches/engine.d.ts +0 -261
- package/dist/patches/engine.js +0 -12
- package/dist/patches/tape.d.ts +0 -12
- package/dist/patches/tape.js +0 -5
- package/dist/range-ZZZD60Fx.js +0 -11
- package/dist/reciprocal-CrYlsAGD.js +0 -10
- package/dist/register_all_kernels-nvj2k7OC.js +0 -12307
- package/dist/relu-BYDneVPn.js +0 -10
- package/dist/reshape-CaPQzFvz.js +0 -10
- package/dist/rope-s4W2XO9B.js +0 -32
- package/dist/selu_util-BGPXmd4B.js +0 -303
- package/dist/sin-Djs4aQiu.js +0 -16
- package/dist/slice-DvovR5wq.js +0 -13
- package/dist/split-DBck65sX.js +0 -10
- package/dist/squeeze-C00Ipm_7.js +0 -11
- package/dist/stack-ChnHwRpX.js +0 -13
- package/dist/sum-ywRJj3Zr.js +0 -12
- package/dist/tensor-CzmOBsdf.js +0 -909
- package/dist/tensor1d-BlUT89BP.js +0 -12
- package/dist/tensor_util-DfwaWayG.js +0 -523
- package/dist/tile-CR074jmp.js +0 -13
- package/dist/transpose-DH4gmHvu.js +0 -38
- package/dist/zeros-DBFVbpv5.js +0 -14
package/dist/relu-BYDneVPn.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { A as e, B as n, E as s } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { e as t } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
function u(r) {
|
|
4
|
-
const o = { x: n(r, "x", "relu") };
|
|
5
|
-
return s.runKernel(t, o);
|
|
6
|
-
}
|
|
7
|
-
const p = /* @__PURE__ */ e({ relu_: u });
|
|
8
|
-
export {
|
|
9
|
-
p as r
|
|
10
|
-
};
|
package/dist/reshape-CaPQzFvz.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { A as n, B as t, E as a } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { b as p } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
function c(r, s) {
|
|
4
|
-
const e = { x: t(r, "x", "reshape", "string_or_numeric") }, o = { shape: s };
|
|
5
|
-
return a.runKernel(p, e, o);
|
|
6
|
-
}
|
|
7
|
-
const x = /* @__PURE__ */ n({ reshape_: c });
|
|
8
|
-
export {
|
|
9
|
-
x as r
|
|
10
|
-
};
|
package/dist/rope-s4W2XO9B.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { e as i } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import "./random_width-BVV9HveY.js";
|
|
3
|
-
import "./register_all_kernels-nvj2k7OC.js";
|
|
4
|
-
import "./index-Cp39cXWe.js";
|
|
5
|
-
import "./dataset-D2P7rHAw.js";
|
|
6
|
-
import "./ops/cpu/rope.js";
|
|
7
|
-
import "./ops/webgl/rope.js";
|
|
8
|
-
import { isPackedTensor as a, packTensor as s } from "./utilities/packed.js";
|
|
9
|
-
import { a as m } from "./tensor_util-DfwaWayG.js";
|
|
10
|
-
const c = {
|
|
11
|
-
kernelName: "Rope",
|
|
12
|
-
inputsToSave: [],
|
|
13
|
-
outputsToSave: [],
|
|
14
|
-
gradFunc: (e, t, r) => {
|
|
15
|
-
const { ropeCache: n } = r, o = a(e), p = u(e, n, 0, !0);
|
|
16
|
-
return { x: () => o ? s(p) : p };
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
m(c);
|
|
20
|
-
function u(e, t, r, n = !1) {
|
|
21
|
-
t.ensureRopeCache(e.shape[1] + r);
|
|
22
|
-
const o = i().runKernel("Rope", { x: e }, {
|
|
23
|
-
pastLen: r,
|
|
24
|
-
negSin: n,
|
|
25
|
-
ropeCache: t
|
|
26
|
-
});
|
|
27
|
-
return a(e) ? s(o) : o;
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
c as a,
|
|
31
|
-
u as r
|
|
32
|
-
};
|
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { a as K, G as P } from "./tensor-CzmOBsdf.js";
|
|
2
|
-
import { A as I, B as b, E as U, m as G, q } from "./index-D6Q1lPZO.js";
|
|
3
|
-
import { U as X, V as Y, W as Z, X as J, Y as Q, Z as S } from "./tensor_util-DfwaWayG.js";
|
|
4
|
-
import { r as d } from "./relu-BYDneVPn.js";
|
|
5
|
-
import { r as z } from "./reshape-CaPQzFvz.js";
|
|
6
|
-
import { s as tt } from "./sum-ywRJj3Zr.js";
|
|
7
|
-
function Ct(t, n, e, o, s = "NHWC", i) {
|
|
8
|
-
const l = t[3], r = [...n, l], u = lt(s);
|
|
9
|
-
return B(t, r, e, i, o, null, null, u);
|
|
10
|
-
}
|
|
11
|
-
function Mt(t, n, e, o, s, i, l = "channelsLast") {
|
|
12
|
-
const [r, u] = R(n);
|
|
13
|
-
let c;
|
|
14
|
-
if (l === "channelsLast")
|
|
15
|
-
c = [r, u, t[3], t[3]];
|
|
16
|
-
else if (l === "channelsFirst")
|
|
17
|
-
c = [r, u, t[1], t[1]];
|
|
18
|
-
else
|
|
19
|
-
throw new Error(`Unknown dataFormat ${l}`);
|
|
20
|
-
return B(t, c, e, o, s, i, !1, l);
|
|
21
|
-
}
|
|
22
|
-
function kt(t, n, e, o, s, i, l = "NDHWC") {
|
|
23
|
-
const [r, u, c] = v(n);
|
|
24
|
-
let h, f;
|
|
25
|
-
if (l === "NDHWC")
|
|
26
|
-
f = "channelsLast", h = [r, u, c, t[4], t[4]];
|
|
27
|
-
else if (l === "NCDHW")
|
|
28
|
-
f = "channelsFirst", h = [r, u, c, t[1], t[1]];
|
|
29
|
-
else
|
|
30
|
-
throw new Error(`Unknown dataFormat ${l}`);
|
|
31
|
-
return nt(t, h, e, o, s, !1, f, i);
|
|
32
|
-
}
|
|
33
|
-
function B(t, n, e, o, s, i, l = !1, r = "channelsLast") {
|
|
34
|
-
let [u, c, h, f] = [-1, -1, -1, -1];
|
|
35
|
-
if (r === "channelsLast")
|
|
36
|
-
[u, c, h, f] = t;
|
|
37
|
-
else if (r === "channelsFirst")
|
|
38
|
-
[u, f, c, h] = t;
|
|
39
|
-
else
|
|
40
|
-
throw new Error(`Unknown dataFormat ${r}`);
|
|
41
|
-
const [a, p, , g] = n, [$, w] = R(e), [m, y] = R(o), D = k(a, m), A = k(p, y), { padInfo: x, outHeight: E, outWidth: L } = st(s, c, h, $, w, D, A, i, r), C = l ? g * f : g;
|
|
42
|
-
let M;
|
|
43
|
-
return r === "channelsFirst" ? M = [u, C, E, L] : r === "channelsLast" && (M = [u, E, L, C]), {
|
|
44
|
-
batchSize: u,
|
|
45
|
-
dataFormat: r,
|
|
46
|
-
inHeight: c,
|
|
47
|
-
inWidth: h,
|
|
48
|
-
inChannels: f,
|
|
49
|
-
outHeight: E,
|
|
50
|
-
outWidth: L,
|
|
51
|
-
outChannels: C,
|
|
52
|
-
padInfo: x,
|
|
53
|
-
strideHeight: $,
|
|
54
|
-
strideWidth: w,
|
|
55
|
-
filterHeight: a,
|
|
56
|
-
filterWidth: p,
|
|
57
|
-
effectiveFilterHeight: D,
|
|
58
|
-
effectiveFilterWidth: A,
|
|
59
|
-
dilationHeight: m,
|
|
60
|
-
dilationWidth: y,
|
|
61
|
-
inShape: t,
|
|
62
|
-
outShape: M,
|
|
63
|
-
filterShape: n
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function nt(t, n, e, o, s, i = !1, l = "channelsLast", r) {
|
|
67
|
-
let [u, c, h, f, a] = [-1, -1, -1, -1, -1];
|
|
68
|
-
if (l === "channelsLast")
|
|
69
|
-
[u, c, h, f, a] = t;
|
|
70
|
-
else if (l === "channelsFirst")
|
|
71
|
-
[u, a, c, h, f] = t;
|
|
72
|
-
else
|
|
73
|
-
throw new Error(`Unknown dataFormat ${l}`);
|
|
74
|
-
const [p, g, $, , w] = n, [m, y, D] = v(e), [A, x, E] = v(o), L = k(p, A), C = k(g, x), M = k($, E), { padInfo: j, outDepth: W, outHeight: N, outWidth: H } = rt(s, c, h, f, m, y, D, L, C, M, r), O = i ? w * a : w;
|
|
75
|
-
let _;
|
|
76
|
-
return l === "channelsFirst" ? _ = [u, O, W, N, H] : l === "channelsLast" && (_ = [u, W, N, H, O]), {
|
|
77
|
-
batchSize: u,
|
|
78
|
-
dataFormat: l,
|
|
79
|
-
inDepth: c,
|
|
80
|
-
inHeight: h,
|
|
81
|
-
inWidth: f,
|
|
82
|
-
inChannels: a,
|
|
83
|
-
outDepth: W,
|
|
84
|
-
outHeight: N,
|
|
85
|
-
outWidth: H,
|
|
86
|
-
outChannels: O,
|
|
87
|
-
padInfo: j,
|
|
88
|
-
strideDepth: m,
|
|
89
|
-
strideHeight: y,
|
|
90
|
-
strideWidth: D,
|
|
91
|
-
filterDepth: p,
|
|
92
|
-
filterHeight: g,
|
|
93
|
-
filterWidth: $,
|
|
94
|
-
effectiveFilterDepth: L,
|
|
95
|
-
effectiveFilterHeight: C,
|
|
96
|
-
effectiveFilterWidth: M,
|
|
97
|
-
dilationDepth: A,
|
|
98
|
-
dilationHeight: x,
|
|
99
|
-
dilationWidth: E,
|
|
100
|
-
inShape: t,
|
|
101
|
-
outShape: _,
|
|
102
|
-
filterShape: n
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function et(t, n, e, o, s) {
|
|
106
|
-
o == null && (o = F(t, n, e));
|
|
107
|
-
const i = t[0], l = t[1], r = T((i - n + 2 * o) / e + 1, s), u = T((l - n + 2 * o) / e + 1, s);
|
|
108
|
-
return [r, u];
|
|
109
|
-
}
|
|
110
|
-
function ot(t, n, e, o, s, i) {
|
|
111
|
-
s == null && (s = F(t, n[0], o[0]));
|
|
112
|
-
const l = [0, 0, 0, e];
|
|
113
|
-
for (let r = 0; r < 3; r++)
|
|
114
|
-
t[r] + 2 * s >= n[r] && (l[r] = T((t[r] - n[r] + 2 * s) / o[r] + 1, i));
|
|
115
|
-
return l;
|
|
116
|
-
}
|
|
117
|
-
function F(t, n, e, o = 1) {
|
|
118
|
-
const s = k(n, o);
|
|
119
|
-
return Math.floor((t[0] * (e - 1) - e + s) / 2);
|
|
120
|
-
}
|
|
121
|
-
function R(t) {
|
|
122
|
-
return typeof t == "number" ? [t, t, t] : t.length === 2 ? [t[0], t[1], 1] : t;
|
|
123
|
-
}
|
|
124
|
-
function v(t) {
|
|
125
|
-
return typeof t == "number" ? [t, t, t] : t;
|
|
126
|
-
}
|
|
127
|
-
function k(t, n) {
|
|
128
|
-
return n <= 1 ? t : t + (t - 1) * (n - 1);
|
|
129
|
-
}
|
|
130
|
-
function st(t, n, e, o, s, i, l, r, u) {
|
|
131
|
-
let c, h, f;
|
|
132
|
-
if (typeof t == "number") {
|
|
133
|
-
c = { top: t, bottom: t, left: t, right: t, type: t === 0 ? "VALID" : "NUMBER" };
|
|
134
|
-
const p = et([n, e], i, o, t, r);
|
|
135
|
-
h = p[0], f = p[1];
|
|
136
|
-
} else if (t === "same") {
|
|
137
|
-
h = Math.ceil(n / o), f = Math.ceil(e / s);
|
|
138
|
-
const a = Math.max(0, (h - 1) * o + i - n), p = Math.max(0, (f - 1) * s + l - e), g = Math.floor(a / 2), $ = a - g, w = Math.floor(p / 2), m = p - w;
|
|
139
|
-
c = { top: g, bottom: $, left: w, right: m, type: "SAME" };
|
|
140
|
-
} else if (t === "valid")
|
|
141
|
-
c = { top: 0, bottom: 0, left: 0, right: 0, type: "VALID" }, h = Math.ceil((n - i + 1) / o), f = Math.ceil((e - l + 1) / s);
|
|
142
|
-
else if (typeof t == "object") {
|
|
143
|
-
const a = u === "channelsLast" ? t[1][0] : t[2][0], p = u === "channelsLast" ? t[1][1] : t[2][1], g = u === "channelsLast" ? t[2][0] : t[3][0], $ = u === "channelsLast" ? t[2][1] : t[3][1];
|
|
144
|
-
c = { top: a, bottom: p, left: g, right: $, type: a === 0 && p === 0 && g === 0 && $ === 0 ? "VALID" : "EXPLICIT" }, h = T((n - i + a + p) / o + 1, r), f = T((e - l + g + $) / s + 1, r);
|
|
145
|
-
} else
|
|
146
|
-
throw Error(`Unknown padding parameter: ${t}`);
|
|
147
|
-
return { padInfo: c, outHeight: h, outWidth: f };
|
|
148
|
-
}
|
|
149
|
-
function rt(t, n, e, o, s, i, l, r, u, c, h) {
|
|
150
|
-
let f, a, p, g;
|
|
151
|
-
if (t === "valid" && (t = 0), typeof t == "number") {
|
|
152
|
-
f = {
|
|
153
|
-
top: t,
|
|
154
|
-
bottom: t,
|
|
155
|
-
left: t,
|
|
156
|
-
right: t,
|
|
157
|
-
front: t,
|
|
158
|
-
back: t,
|
|
159
|
-
type: t === 0 ? "VALID" : "NUMBER"
|
|
160
|
-
};
|
|
161
|
-
const w = ot([n, e, o, 1], [r, u, c], 1, [s, i, l], t, h);
|
|
162
|
-
a = w[0], p = w[1], g = w[2];
|
|
163
|
-
} else if (t === "same") {
|
|
164
|
-
a = Math.ceil(n / s), p = Math.ceil(e / i), g = Math.ceil(o / l);
|
|
165
|
-
const $ = (a - 1) * s + r - n, w = (p - 1) * i + u - e, m = (g - 1) * l + c - o, y = Math.floor($ / 2), D = $ - y, A = Math.floor(w / 2), x = w - A, E = Math.floor(m / 2), L = m - E;
|
|
166
|
-
f = { top: A, bottom: x, left: E, right: L, front: y, back: D, type: "SAME" };
|
|
167
|
-
} else
|
|
168
|
-
throw Error(`Unknown padding parameter: ${t}`);
|
|
169
|
-
return { padInfo: f, outDepth: a, outHeight: p, outWidth: g };
|
|
170
|
-
}
|
|
171
|
-
function T(t, n) {
|
|
172
|
-
if (!n)
|
|
173
|
-
return Math.trunc(t);
|
|
174
|
-
switch (n) {
|
|
175
|
-
case "round":
|
|
176
|
-
return Math.round(t);
|
|
177
|
-
case "ceil":
|
|
178
|
-
return Math.ceil(t);
|
|
179
|
-
case "floor":
|
|
180
|
-
return Math.floor(t);
|
|
181
|
-
default:
|
|
182
|
-
throw new Error(`Unknown roundingMode ${n}`);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
function V(t) {
|
|
186
|
-
const [n, e, o] = R(t);
|
|
187
|
-
return n === 1 && e === 1 && o === 1;
|
|
188
|
-
}
|
|
189
|
-
function It(t, n) {
|
|
190
|
-
return V(t) || V(n);
|
|
191
|
-
}
|
|
192
|
-
function Ut(t) {
|
|
193
|
-
return R(t).every((n) => n > 0);
|
|
194
|
-
}
|
|
195
|
-
function lt(t) {
|
|
196
|
-
if (t === "NHWC")
|
|
197
|
-
return "channelsLast";
|
|
198
|
-
if (t === "NCHW")
|
|
199
|
-
return "channelsFirst";
|
|
200
|
-
throw new Error(`Unknown dataFormat ${t}`);
|
|
201
|
-
}
|
|
202
|
-
function Rt(t, n, e) {
|
|
203
|
-
if (e != null) {
|
|
204
|
-
if (typeof n == "string")
|
|
205
|
-
throw Error(`Error in ${t}: pad must be an integer when using dimRoundingMode ${e} but got pad ${n}.`);
|
|
206
|
-
if (typeof n == "number")
|
|
207
|
-
K(P(n), () => `Error in ${t}: pad must be an integer when using dimRoundingMode ${e} but got pad ${n}.`);
|
|
208
|
-
else if (typeof n == "object")
|
|
209
|
-
n.forEach((o) => {
|
|
210
|
-
o.forEach((s) => {
|
|
211
|
-
K(P(s), () => `Error in ${t}: pad must be an integer when using dimRoundingMode ${e} but got pad ${s}.`);
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
else
|
|
215
|
-
throw Error(`Error in ${t}: Unknown padding parameter: ${n}`);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
function ut(t) {
|
|
219
|
-
const e = { x: b(t, "x", "sigmoid", "float32") };
|
|
220
|
-
return U.runKernel(X, e);
|
|
221
|
-
}
|
|
222
|
-
const ct = /* @__PURE__ */ I({ sigmoid_: ut });
|
|
223
|
-
function ft(t) {
|
|
224
|
-
const e = { x: b(t, "x", "elu", "float32") };
|
|
225
|
-
return U.runKernel(Y, e);
|
|
226
|
-
}
|
|
227
|
-
const it = /* @__PURE__ */ I({ elu_: ft });
|
|
228
|
-
function ht(t, n = 0.2) {
|
|
229
|
-
const o = { x: b(t, "x", "leakyRelu") }, s = { alpha: n };
|
|
230
|
-
return U.runKernel(Z, o, s);
|
|
231
|
-
}
|
|
232
|
-
const at = /* @__PURE__ */ I({ leakyRelu_: ht });
|
|
233
|
-
function pt(t, n) {
|
|
234
|
-
const e = b(t, "x", "prelu"), o = b(n, "alpha", "prelu"), s = { x: e, alpha: o };
|
|
235
|
-
return U.runKernel(J, s);
|
|
236
|
-
}
|
|
237
|
-
const gt = /* @__PURE__ */ I({ prelu_: pt });
|
|
238
|
-
function wt(t) {
|
|
239
|
-
const e = { x: b(t, "x", "relu6") };
|
|
240
|
-
return U.runKernel(Q, e);
|
|
241
|
-
}
|
|
242
|
-
const $t = /* @__PURE__ */ I({ relu6_: wt });
|
|
243
|
-
function mt(t, n = 0) {
|
|
244
|
-
const o = { x: b(t, "x", "step") }, s = { alpha: n };
|
|
245
|
-
return U.runKernel(S, o, s);
|
|
246
|
-
}
|
|
247
|
-
const Et = /* @__PURE__ */ I({ step_: mt });
|
|
248
|
-
function Tt(t, n, e) {
|
|
249
|
-
if (e == null || e === "linear")
|
|
250
|
-
return t;
|
|
251
|
-
if (e === "relu")
|
|
252
|
-
return G(t, Et(n));
|
|
253
|
-
throw new Error(`Cannot compute gradient for fused activation ${e}.`);
|
|
254
|
-
}
|
|
255
|
-
function Wt(t, n) {
|
|
256
|
-
let e = n;
|
|
257
|
-
const o = q(t.shape, n.shape);
|
|
258
|
-
return o.length > 0 && (e = tt(e, o)), z(e, t.shape);
|
|
259
|
-
}
|
|
260
|
-
function Nt(t, n, e, o) {
|
|
261
|
-
if (n === "linear")
|
|
262
|
-
return t;
|
|
263
|
-
if (n === "relu")
|
|
264
|
-
return d(t);
|
|
265
|
-
if (n === "elu")
|
|
266
|
-
return it(t);
|
|
267
|
-
if (n === "relu6")
|
|
268
|
-
return $t(t);
|
|
269
|
-
if (n === "prelu")
|
|
270
|
-
return gt(t, e);
|
|
271
|
-
if (n === "leakyrelu")
|
|
272
|
-
return at(t, o);
|
|
273
|
-
if (n === "sigmoid")
|
|
274
|
-
return ct(t);
|
|
275
|
-
throw new Error(`Unknown fused activation ${n}.`);
|
|
276
|
-
}
|
|
277
|
-
const Ht = (t, n) => !(t > 0) || n === "linear";
|
|
278
|
-
const Ot = 1.7580993408473768, _t = 1.0507009873554805;
|
|
279
|
-
export {
|
|
280
|
-
_t as S,
|
|
281
|
-
Ot as a,
|
|
282
|
-
Nt as b,
|
|
283
|
-
Rt as c,
|
|
284
|
-
B as d,
|
|
285
|
-
nt as e,
|
|
286
|
-
F as f,
|
|
287
|
-
Ct as g,
|
|
288
|
-
Mt as h,
|
|
289
|
-
kt as i,
|
|
290
|
-
lt as j,
|
|
291
|
-
It as k,
|
|
292
|
-
Wt as l,
|
|
293
|
-
Tt as m,
|
|
294
|
-
Ut as n,
|
|
295
|
-
it as o,
|
|
296
|
-
Et as p,
|
|
297
|
-
ct as q,
|
|
298
|
-
at as r,
|
|
299
|
-
Ht as s,
|
|
300
|
-
V as t,
|
|
301
|
-
gt as u,
|
|
302
|
-
$t as v
|
|
303
|
-
};
|
package/dist/sin-Djs4aQiu.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { A as o, B as t, E as r } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { l as i, n as a } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
function e(n) {
|
|
4
|
-
const s = { x: t(n, "x", "cos", "float32") };
|
|
5
|
-
return r.runKernel(i, s);
|
|
6
|
-
}
|
|
7
|
-
const p = /* @__PURE__ */ o({ cos_: e });
|
|
8
|
-
function x(n) {
|
|
9
|
-
const s = { x: t(n, "x", "sin", "float32") };
|
|
10
|
-
return r.runKernel(a, s);
|
|
11
|
-
}
|
|
12
|
-
const l = /* @__PURE__ */ o({ sin_: x });
|
|
13
|
-
export {
|
|
14
|
-
p as c,
|
|
15
|
-
l as s
|
|
16
|
-
};
|
package/dist/slice-DvovR5wq.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { A as c, B as e, E as a } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { f as l } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
function p(s, o, n) {
|
|
4
|
-
const r = e(s, "x", "slice", "string_or_numeric");
|
|
5
|
-
if (r.rank === 0)
|
|
6
|
-
throw new Error("Slicing scalar is not possible");
|
|
7
|
-
const t = { x: r }, i = { begin: o, size: n };
|
|
8
|
-
return a.runKernel(l, t, i);
|
|
9
|
-
}
|
|
10
|
-
const u = /* @__PURE__ */ c({ slice_: p });
|
|
11
|
-
export {
|
|
12
|
-
u as s
|
|
13
|
-
};
|
package/dist/split-DBck65sX.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { A as p, B as i, E as c } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { c as a } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
function e(t, s, o = 0) {
|
|
4
|
-
const n = { x: i(t, "x", "split") }, r = { numOrSizeSplits: s, axis: o };
|
|
5
|
-
return c.runKernel(a, n, r);
|
|
6
|
-
}
|
|
7
|
-
const u = /* @__PURE__ */ p({ split_: e });
|
|
8
|
-
export {
|
|
9
|
-
u as s
|
|
10
|
-
};
|
package/dist/squeeze-C00Ipm_7.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { A as o, B as n } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { r as t } from "./reshape-CaPQzFvz.js";
|
|
3
|
-
import { h as a } from "./tensor-CzmOBsdf.js";
|
|
4
|
-
function p(r, s) {
|
|
5
|
-
const e = n(r, "x", "squeeze", "string_or_numeric");
|
|
6
|
-
return t(e, a(e.shape, s).newShape);
|
|
7
|
-
}
|
|
8
|
-
const c = /* @__PURE__ */ o({ squeeze_: p });
|
|
9
|
-
export {
|
|
10
|
-
c as s
|
|
11
|
-
};
|
package/dist/stack-ChnHwRpX.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { A as e, C as c, E as i } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { P as m } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
import { a as r } from "./tensor-CzmOBsdf.js";
|
|
4
|
-
function f(o, s = 0) {
|
|
5
|
-
const t = c(o, "tensors", "stack", "string_or_numeric");
|
|
6
|
-
r(t.length >= 1, () => "Pass at least one tensor to tf.stack"), t.length > 0 && r(s <= t[0].rank, () => "Axis must be <= rank of the tensor");
|
|
7
|
-
const n = t, a = { axis: s };
|
|
8
|
-
return i.runKernel(m, n, a);
|
|
9
|
-
}
|
|
10
|
-
const l = /* @__PURE__ */ e({ stack_: f });
|
|
11
|
-
export {
|
|
12
|
-
l as s
|
|
13
|
-
};
|
package/dist/sum-ywRJj3Zr.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { A as e, B as u, G as m, E as c } from "./index-D6Q1lPZO.js";
|
|
2
|
-
import { g as i } from "./tensor_util-DfwaWayG.js";
|
|
3
|
-
function l(t, o = null, n = !1) {
|
|
4
|
-
let s = u(t, "x", "sum");
|
|
5
|
-
s.dtype === "bool" && (s = m(s, "int32"));
|
|
6
|
-
const r = { x: s }, a = { axis: o, keepDims: n };
|
|
7
|
-
return c.runKernel(i, r, a);
|
|
8
|
-
}
|
|
9
|
-
const x = /* @__PURE__ */ e({ sum_: l });
|
|
10
|
-
export {
|
|
11
|
-
x as s
|
|
12
|
-
};
|