@genai-fi/nanogpt 1.5.0 → 1.6.1
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/{DatasetBuilder-DU1G1OKX.js → DatasetBuilder-DRDW8tcM.js} +85 -86
- package/dist/Generator-8IK28IWR.js +316 -0
- package/dist/{RealDiv-CSnvtN2E.js → RealDiv-Cl8k3YTx.js} +54 -62
- package/dist/{Reshape-BlylqwWy.js → Reshape-CKxKPKqi.js} +9 -12
- package/dist/Reshape-H5zZRgr9.js +16 -0
- package/dist/RoPECache-dYscFINl.js +722 -0
- package/dist/TeachableLLM.js +29 -34
- package/dist/api/beamer.js +5 -6
- package/dist/api/responses.js +11 -12
- package/dist/api/training.js +12 -14
- package/dist/axis_util-rF9RnwKE.js +37 -0
- package/dist/backend.js +5 -6
- package/dist/{backend_util-DAV0I34P.js → backend_util-Cpp0Gwlp.js} +180 -185
- package/dist/{binary_op_util-CrYk9LXL.js → binary_op_util-WY9YIl0q.js} +3 -7
- package/dist/broadcast_to-CGvLNiQ0.js +20 -0
- package/dist/checks/appendCache.js +7 -7
- package/dist/checks/attentionMask.js +9 -8
- package/dist/checks/check.js +1 -2
- package/dist/checks/gelu.js +6 -6
- package/dist/checks/index.js +24 -25
- package/dist/checks/matMulGelu.js +7 -7
- package/dist/checks/normRMS.js +14 -12
- package/dist/checks/normRMSGrad.js +9 -8
- package/dist/checks/packUnpack.js +7 -7
- package/dist/checks/qkv.js +1 -34
- package/dist/checks/rope.js +6 -6
- package/dist/checks/weights.js +1 -2
- package/dist/clip_by_value-D-UX9am5.js +13 -0
- package/dist/complex-Cl904TqN.js +13 -0
- package/dist/{complex_util-CkazZsaH.js → complex_util-BBlPAm-s.js} +1 -2
- package/dist/concat-Oip5acVY.js +14 -0
- package/dist/{concat_util-CWzvQQlK.js → concat_util-CY45Hf4F.js} +2 -3
- package/dist/data/docx.js +3 -4
- package/dist/data/pdf.js +11 -14
- package/dist/data/stream.js +1 -2
- package/dist/data/textLoader.js +16 -15
- package/dist/data-CV_i_H6B.js +11 -0
- package/dist/data.js +5 -12
- package/dist/dist-CMMLi-qO.js +2675 -0
- package/dist/{dist-BGVm64AY.js → dist-DeVH1nGn.js} +1465 -1573
- package/dist/{dist-CwK5S7Ls.js → dist-DyL7qSLJ.js} +2664 -2400
- package/dist/dropout16-CA31Ud5a.js +20 -0
- package/dist/dropout_util-SiFMbFXz.js +22 -0
- package/dist/{eventemitter3-D_qV3Lof.js → eventemitter3-wmfmOP_f.js} +2 -3
- package/dist/expand_dims-Dh3Fulyn.js +10 -0
- package/dist/floor-BwjmUb7X.js +8 -0
- package/dist/gather-B5Z1RFt5.js +14 -0
- package/dist/gatherSub-CRUfUzBa.js +22 -0
- package/dist/gelu-Xx9-ohH9.js +25 -0
- package/dist/{gpgpu_math-20tPK8LM.js → gpgpu_math-48m8q3jI.js} +265 -286
- package/dist/inference/Beamer.js +34 -27
- package/dist/inference/Generator.js +1 -273
- package/dist/inference/tokenisePrompt.js +5 -4
- package/dist/inference/types.d.ts +6 -0
- package/dist/inference/utilities.js +1 -2
- package/dist/{jszip.min-DKa1Rjyn.js → jszip.min-Btv48m44.js} +68 -64
- package/dist/{kernel_funcs_utils-ql8Y8qPn.js → kernel_funcs_utils-BYRpSfV_.js} +39 -42
- package/dist/layers/BaseLayer.js +9 -10
- package/dist/layers/GQA.js +45 -44
- package/dist/layers/HeadLayer.js +13 -13
- package/dist/layers/LoRA.js +17 -20
- package/dist/layers/MHA.d.ts +2 -2
- package/dist/layers/MHA.js +46 -45
- package/dist/layers/MLP.js +22 -21
- package/dist/layers/PositionEmbedding.js +14 -13
- package/dist/layers/RMSNorm.js +14 -13
- package/dist/layers/RoPECache.js +1 -338
- package/dist/layers/TiedEmbedding.js +15 -14
- package/dist/layers/TransformerBlock.d.ts +3 -9
- package/dist/layers/TransformerBlock.js +29 -30
- package/dist/layers/WeightStore.js +4 -5
- package/dist/layers-CFqEip3s.js +13 -0
- package/dist/layers.js +3 -11
- package/dist/loader/load.js +27 -24
- package/dist/loader/loadHF.js +3 -3
- package/dist/loader/loadTransformers.js +5 -6
- package/dist/loader/loadZipMeta.js +1 -2
- package/dist/loader/newZipLoad.js +1 -2
- package/dist/loader/oldZipLoad.js +8 -9
- package/dist/loader/save.js +15 -16
- package/dist/main.js +3281 -3463
- package/dist/{matMul16-CO1QhsRt.js → matMul16-tE26fnhf.js} +29 -27
- package/dist/{matMulGelu-CBoqTZM7.js → matMulGelu-ASUWlKqu.js} +33 -33
- package/dist/mat_mul-R9_DWmIT.js +16 -0
- package/dist/models/Llama.js +48 -49
- package/dist/models/NanoGPTV1.js +53 -54
- package/dist/models/NanoGPTV2.js +48 -49
- package/dist/models/Qwen3.js +48 -49
- package/dist/models/config.js +3 -8
- package/dist/models/factory.js +7 -8
- package/dist/models/model.d.ts +5 -7
- package/dist/models/model.js +1 -2
- package/dist/models-DyBpJJwM.js +13 -0
- package/dist/models.js +6 -14
- package/dist/mul16-C7sqgqik.js +41 -0
- package/dist/non_max_suppression_impl-B0H318rb.js +72 -0
- package/dist/not_equal-Bu3O8rh_.js +67 -0
- package/dist/one_hot-TEMPumJj.js +14 -0
- package/dist/ones-DpPXWa6A.js +13 -0
- package/dist/ops/adamAdjust.js +2 -3
- package/dist/ops/adamMoments.js +2 -3
- package/dist/ops/add16.js +2 -3
- package/dist/ops/appendCache.js +9 -8
- package/dist/ops/attentionMask.d.ts +1 -1
- package/dist/ops/attentionMask.js +8 -5
- package/dist/ops/concat16.js +5 -5
- package/dist/ops/cpu/adamAdjust.js +7 -8
- package/dist/ops/cpu/adamMoments.js +5 -5
- package/dist/ops/cpu/appendCache.js +3 -3
- package/dist/ops/cpu/attentionMask.js +12 -8
- package/dist/ops/cpu/fusedSoftmax.js +3 -3
- package/dist/ops/cpu/gatherSub.js +1 -12
- package/dist/ops/cpu/gelu.js +12 -13
- package/dist/ops/cpu/matMul16.js +7 -7
- package/dist/ops/cpu/matMulGelu.js +21 -18
- package/dist/ops/cpu/matMulMul.js +8 -9
- package/dist/ops/cpu/mulDropout.js +8 -9
- package/dist/ops/cpu/normRMS.js +12 -13
- package/dist/ops/cpu/qkv.js +14 -13
- package/dist/ops/cpu/rope.js +11 -8
- package/dist/ops/cpu/scatterSub.js +1 -12
- package/dist/ops/dot16.js +16 -17
- package/dist/ops/dropout.js +9 -8
- package/dist/ops/dropout16.js +1 -22
- package/dist/ops/gatherSub.js +3 -4
- package/dist/ops/gelu.js +1 -2
- package/dist/ops/globalNorm.js +10 -10
- package/dist/ops/grads/add16.js +16 -17
- package/dist/ops/grads/attentionMask.js +6 -7
- package/dist/ops/grads/dropout16.js +1 -1
- package/dist/ops/grads/gelu.js +1 -2
- package/dist/ops/grads/matMul16.js +1 -2
- package/dist/ops/grads/matMulGelu.js +6 -7
- package/dist/ops/grads/mul16.js +1 -1
- package/dist/ops/grads/normRMS.js +8 -9
- package/dist/ops/grads/pack16.js +1 -2
- package/dist/ops/grads/qkv.js +10 -10
- package/dist/ops/grads/rope.js +1 -2
- package/dist/ops/grads/silu.js +1 -2
- package/dist/ops/grads/softmax16.js +6 -7
- package/dist/ops/grads/unpack16.js +1 -2
- package/dist/ops/grads/utils.js +1 -2
- package/dist/ops/matMul16.d.ts +1 -1
- package/dist/ops/matMul16.js +1 -2
- package/dist/ops/matMulGelu.js +3 -4
- package/dist/ops/matMulMul.js +2 -3
- package/dist/ops/mul16.js +1 -43
- package/dist/ops/mulDrop.js +2 -3
- package/dist/ops/normRMS.js +2 -3
- package/dist/ops/pack16.js +1 -2
- package/dist/ops/qkv.js +2 -3
- package/dist/ops/reshape16.js +11 -11
- package/dist/ops/rope.js +1 -2
- package/dist/ops/scatterSub.js +3 -4
- package/dist/ops/silu.js +1 -2
- package/dist/ops/slice16.js +5 -5
- package/dist/ops/softmax16.js +3 -4
- package/dist/ops/sub16.js +3 -4
- package/dist/ops/sum16.js +3 -3
- package/dist/ops/transpose16.js +16 -15
- package/dist/ops/unpack16.js +1 -2
- package/dist/ops/webgl/adamAdjust.js +8 -9
- package/dist/ops/webgl/adamMoments.js +2 -3
- package/dist/ops/webgl/appendCache.js +2 -3
- package/dist/ops/webgl/attentionMask.js +2 -3
- package/dist/ops/webgl/dropout16.js +2 -3
- package/dist/ops/webgl/fusedSoftmax.js +13 -13
- package/dist/ops/webgl/gatherSub.js +2 -3
- package/dist/ops/webgl/gelu.js +11 -12
- package/dist/ops/webgl/log.js +10 -10
- package/dist/ops/webgl/matMul16.js +31 -24
- package/dist/ops/webgl/matMulGelu.js +1 -2
- package/dist/ops/webgl/matMulMul.js +3 -4
- package/dist/ops/webgl/mulDropout.js +2 -3
- package/dist/ops/webgl/normRMS.js +11 -10
- package/dist/ops/webgl/qkv.js +2 -3
- package/dist/ops/webgl/rope.js +4 -5
- package/dist/ops/webgl/scatterSub.js +2 -3
- package/dist/ops/webgpu/adamAdjust.js +13 -14
- package/dist/ops/webgpu/adamMoments.js +13 -14
- package/dist/ops/webgpu/add16.js +3 -4
- package/dist/ops/webgpu/appendCache.js +20 -21
- package/dist/ops/webgpu/attentionMask.js +18 -19
- package/dist/ops/webgpu/attentionMask32_program.js +7 -8
- package/dist/ops/webgpu/clipScale.js +11 -12
- package/dist/ops/webgpu/concat16.js +17 -18
- package/dist/ops/webgpu/dropout16.js +6 -7
- package/dist/ops/webgpu/gatherSub.js +11 -12
- package/dist/ops/webgpu/gelu.js +10 -11
- package/dist/ops/webgpu/index.js +17 -17
- package/dist/ops/webgpu/matMul16.js +74 -63
- package/dist/ops/webgpu/matMul16_program.d.ts +2 -1
- package/dist/ops/webgpu/matMul16_program.js +29 -21
- package/dist/ops/webgpu/mul16.js +3 -4
- package/dist/ops/webgpu/norm2.js +9 -10
- package/dist/ops/webgpu/normRMS.js +9 -10
- package/dist/ops/webgpu/normRMS16_program.js +1 -2
- package/dist/ops/webgpu/normRMS32_program.js +1 -2
- package/dist/ops/webgpu/normRMSGrad.js +30 -30
- package/dist/ops/webgpu/pack16.js +2 -3
- package/dist/ops/webgpu/pack16_program.js +3 -4
- package/dist/ops/webgpu/qkv.js +10 -11
- package/dist/ops/webgpu/rope.js +26 -27
- package/dist/ops/webgpu/scatterSub.js +12 -13
- package/dist/ops/webgpu/silu.js +10 -11
- package/dist/ops/webgpu/slice16.js +17 -18
- package/dist/ops/webgpu/softmax16.js +9 -9
- package/dist/ops/webgpu/softmax16_program.js +9 -10
- package/dist/ops/webgpu/softmax16_subgroup_program.js +11 -12
- package/dist/ops/webgpu/softmax16grad.js +8 -9
- package/dist/ops/webgpu/sub16.js +3 -4
- package/dist/ops/webgpu/sum16.js +16 -15
- package/dist/ops/webgpu/transpose16.js +13 -12
- package/dist/ops/webgpu/transpose16_program.js +3 -4
- package/dist/ops/webgpu/transpose16_shared_program.js +17 -18
- package/dist/ops/webgpu/unpack16.js +8 -9
- package/dist/ops/webgpu/utils/binary_op.js +20 -21
- package/dist/ops/webgpu/utils/deviceInfo.js +1 -2
- package/dist/ops/webgpu/utils/reductions.js +21 -20
- package/dist/ops-Be5ACU5R.js +13 -0
- package/dist/ops-C1UpdEYM.js +509 -0
- package/dist/{pack16-BhuXNUS7.js → pack16-BHO4t1-M.js} +14 -17
- package/dist/pad-Dy-1IP3A.js +13 -0
- package/dist/patches/webgpu_backend.js +18 -19
- package/dist/patches/webgpu_base.js +2 -3
- package/dist/patches/webgpu_program.js +21 -22
- package/dist/{pdf-Bzuk68Vy.js → pdf-CbnQ75VG.js} +380 -701
- package/dist/{picomatch-BO4HbNfo.js → picomatch--TW6gyBJ.js} +229 -291
- package/dist/qkv-BQfNPucX.js +42 -0
- package/dist/rand_util-_vCY93Uw.js +44 -0
- package/dist/random_normal-DUIT8kyC.js +11 -0
- package/dist/range-CYvQC3fW.js +13 -0
- package/dist/relu-C4XULT8A.js +8 -0
- package/dist/reshape-DJb1jgMt.js +8 -0
- package/dist/resize_nearest_neighbor-DAqcTYUe.js +188 -0
- package/dist/{chunk-CWhphoD1.js → rolldown-runtime-CwxnZyOB.js} +4 -5
- package/dist/{rope-BPu_uooz.js → rope-JjBVufF_.js} +6 -8
- package/dist/scatterSub-BOnqk-uY.js +27 -0
- package/dist/scatter_nd_util-BepMCpLY.js +34 -0
- package/dist/seedrandom-SHEGFK6H.js +282 -0
- package/dist/selu_util-DeOTf-sc.js +27 -0
- package/dist/shared-BIDMUBCs.js +1864 -0
- package/dist/{shared-CfTzpULd.js → shared-CX_iPI5K.js} +2 -3
- package/dist/silu-DsAE2cJ5.js +23 -0
- package/dist/slice-Dlb1FlzG.js +13 -0
- package/dist/{slice_util-Dve4TkDn.js → slice_util-BVgPRoij.js} +3 -4
- package/dist/softmax-Dpav_dWw.js +10 -0
- package/dist/split-DYnT8chz.js +11 -0
- package/dist/squeeze-B3XYGAlg.js +9 -0
- package/dist/stack-Dbbt9mIk.js +10 -0
- package/dist/step-DA-5DNu9.js +348 -0
- package/dist/{stream-BpAwcvHz.js → stream-BBe2apn4.js} +68 -88
- package/dist/sum-C8qNbFNp.js +13 -0
- package/dist/tensor-ALxWZfmz.js +7 -0
- package/dist/tensor1d-BHgkkhTE.js +9 -0
- package/dist/tensor2d-ARItvqVn.js +10 -0
- package/dist/tensor4d-D1zRBipJ.js +10 -0
- package/dist/tfjs_backend-CsXOum0h.js +685 -0
- package/dist/tile-DfyQ0KX-.js +10 -0
- package/dist/tokenise-DbS2Ea-T.js +14 -0
- package/dist/tokenise.js +6 -15
- package/dist/tokeniser/BaseTokeniser.js +5 -9
- package/dist/tokeniser/CharTokeniser.js +1 -2
- package/dist/tokeniser/bpe.js +19 -20
- package/dist/topk-BrU2pkrR.js +19 -0
- package/dist/training/AdamW.js +35 -31
- package/dist/training/BasicTrainer.js +56 -56
- package/dist/training/DatasetBuilder.js +1 -2
- package/dist/training/Evaluator.js +4 -4
- package/dist/training/LRScheduler.js +1 -2
- package/dist/training/PreTrainer.js +7 -8
- package/dist/training/SFTTrainer.js +7 -8
- package/dist/training/configure.js +16 -15
- package/dist/training/factory.js +1 -2
- package/dist/training/loss.js +1 -2
- package/dist/training/orthoGrad.js +2 -3
- package/dist/training/prepareData.js +18 -17
- package/dist/training/sparseCrossEntropy.js +38 -32
- package/dist/training/tasks/TokenStore.js +21 -22
- package/dist/training/tasks/tokenStream.js +1 -2
- package/dist/training/validateOptions.js +1 -2
- package/dist/training/validation.js +1 -2
- package/dist/transpose-BC-M_OoT.js +34 -0
- package/dist/unsorted_segment_sum-BelC7R-q.js +408 -0
- package/dist/utilities/arrayClose.js +5 -4
- package/dist/utilities/arrayShape.js +1 -2
- package/dist/utilities/datasetID.js +1 -2
- package/dist/utilities/dummy.js +15 -15
- package/dist/utilities/float16.js +10 -10
- package/dist/utilities/maxHeap.js +1 -2
- package/dist/utilities/multinomialCPU.d.ts +1 -2
- package/dist/utilities/multinomialCPU.js +6 -8
- package/dist/utilities/packed.js +2 -3
- package/dist/utilities/parameters.js +3 -4
- package/dist/utilities/performance.js +2 -3
- package/dist/utilities/profile.js +3 -4
- package/dist/utilities/random.js +1 -2
- package/dist/utilities/safetensors.js +14 -14
- package/dist/utilities/sentences.js +16 -13
- package/dist/utilities/tokenParse.js +1 -2
- package/dist/utilities/tokens.js +5 -6
- package/dist/utilities/topP.d.ts +1 -0
- package/dist/utilities/topP.js +20 -13
- package/dist/utilities/waitForModel.js +1 -2
- package/dist/utilities/weights.js +4 -4
- package/dist/utilities/yielder.js +1 -2
- package/dist/{v4-BK7K-jy_.js → v4-YCkfo8OR.js} +4 -7
- package/dist/{webgpu-IAn9VotJ.js → webgpu-BHX-uBym.js} +156 -163
- package/dist/{webgpu_program-B0PokuRJ.js → webgpu_program-DvkFqRlR.js} +28 -29
- package/dist/{webgpu_util-DfODg6XI.js → webgpu_util-5QTyovaf.js} +2 -3
- package/dist/zeros-hxKGkRfl.js +12 -0
- package/package.json +3 -3
- package/dist/Reshape-CwxdaU8n.js +0 -17
- package/dist/dist-Da20xy8E.js +0 -6375
- package/dist/gelu-B6637MKa.js +0 -27
- package/dist/selu_util-B_AFEfoz.js +0 -24
- package/dist/shared-24EoeHJl.js +0 -1314
- package/dist/silu-B6bvCgJ7.js +0 -25
- package/dist/tfjs_backend-h5weiy1O.js +0 -614
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { H as e, J as t, X as n, et as r, xi as i } from "./dist-CMMLi-qO.js";
|
|
2
|
+
import { t as a } from "./tensor2d-ARItvqVn.js";
|
|
3
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/tensor3d.js
|
|
4
|
+
function o(e, t, a) {
|
|
5
|
+
if (i(e), t != null && t.length !== 3) throw Error("tensor3d() requires shape to have three numbers");
|
|
6
|
+
let o = r(e, a);
|
|
7
|
+
if (o.length !== 3 && o.length !== 1) throw Error("tensor3d() requires values to be number[][][] or flat/TypedArray");
|
|
8
|
+
if (o.length === 1 && t == null) throw Error("tensor3d() requires shape to be provided when `values` are a flat array");
|
|
9
|
+
return n(e, t, o, a);
|
|
10
|
+
}
|
|
11
|
+
// lib/checks/qkv.ts
|
|
12
|
+
async function s(n) {
|
|
13
|
+
await t(n);
|
|
14
|
+
let r = o([[[.1, .2], [.3, .4]]], [
|
|
15
|
+
1,
|
|
16
|
+
2,
|
|
17
|
+
2
|
|
18
|
+
]), i = a([[
|
|
19
|
+
.5,
|
|
20
|
+
.6,
|
|
21
|
+
.9,
|
|
22
|
+
1,
|
|
23
|
+
1.3,
|
|
24
|
+
1.4
|
|
25
|
+
], [
|
|
26
|
+
.7,
|
|
27
|
+
.8,
|
|
28
|
+
1.1,
|
|
29
|
+
1.2,
|
|
30
|
+
1.5,
|
|
31
|
+
1.6
|
|
32
|
+
]], [2, 6]), s = e().runKernel("QKV", {
|
|
33
|
+
x: r,
|
|
34
|
+
kernel: i
|
|
35
|
+
}, { heads: 1 });
|
|
36
|
+
return [
|
|
37
|
+
await s[0].array(),
|
|
38
|
+
await s[1].array(),
|
|
39
|
+
await s[2].array()
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
export { s as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { i as e } from "./rolldown-runtime-CwxnZyOB.js";
|
|
2
|
+
import { t } from "./seedrandom-SHEGFK6H.js";
|
|
3
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/rand_util.js
|
|
4
|
+
var n = /* @__PURE__ */ e(t()), r = class {
|
|
5
|
+
constructor(e, t, r, i, a) {
|
|
6
|
+
this.mean = e, this.stdDev = t, this.dtype = r, this.nextVal = NaN, this.truncated = i, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
|
|
7
|
+
let o = a || Math.random();
|
|
8
|
+
this.random = n.alea(o.toString());
|
|
9
|
+
}
|
|
10
|
+
nextValue() {
|
|
11
|
+
if (!isNaN(this.nextVal)) {
|
|
12
|
+
let e = this.nextVal;
|
|
13
|
+
return this.nextVal = NaN, e;
|
|
14
|
+
}
|
|
15
|
+
let e, t, n = !1;
|
|
16
|
+
for (; !n;) {
|
|
17
|
+
let r, i, a;
|
|
18
|
+
do
|
|
19
|
+
r = 2 * this.random() - 1, i = 2 * this.random() - 1, a = r * r + i * i;
|
|
20
|
+
while (a >= 1 || a === 0);
|
|
21
|
+
let o = Math.sqrt(-2 * Math.log(a) / a);
|
|
22
|
+
e = this.mean + this.stdDev * r * o, t = this.mean + this.stdDev * i * o, (!this.truncated || this.isValidTruncated(e)) && (n = !0);
|
|
23
|
+
}
|
|
24
|
+
return (!this.truncated || this.isValidTruncated(t)) && (this.nextVal = this.convertValue(t)), this.convertValue(e);
|
|
25
|
+
}
|
|
26
|
+
convertValue(e) {
|
|
27
|
+
return this.dtype == null || this.dtype === "float32" ? e : Math.round(e);
|
|
28
|
+
}
|
|
29
|
+
isValidTruncated(e) {
|
|
30
|
+
return e <= this.upper && e >= this.lower;
|
|
31
|
+
}
|
|
32
|
+
}, i = class {
|
|
33
|
+
constructor(e = 0, t = 1, r, i) {
|
|
34
|
+
if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = e, this.range = t - e, this.dtype = r, i ??= Math.random(), typeof i == "number" && (i = i.toString()), !this.canReturnFloat() && this.range <= 1) throw Error(`The difference between ${e} - ${t} <= 1 and dtype is not float`);
|
|
35
|
+
this.random = n.alea(i);
|
|
36
|
+
}
|
|
37
|
+
convertValue(e) {
|
|
38
|
+
return this.canReturnFloat() ? e : Math.round(e);
|
|
39
|
+
}
|
|
40
|
+
nextValue() {
|
|
41
|
+
return this.convertValue(this.min + this.range * this.random());
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export { i as n, r as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { P as e, Z as t, bi as n } from "./dist-CMMLi-qO.js";
|
|
2
|
+
import { t as r } from "./rand_util-_vCY93Uw.js";
|
|
3
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/random_normal.js
|
|
4
|
+
function i(t, i = 0, a = 1, o, s) {
|
|
5
|
+
if (n(t), o != null && o === "bool") throw Error(`Unsupported data type ${o}`);
|
|
6
|
+
let c = new r(i, a, o, !1, s), l = e(t, o);
|
|
7
|
+
for (let e = 0; e < l.values.length; e++) l.values[e] = c.nextValue();
|
|
8
|
+
return l.toTensor();
|
|
9
|
+
}
|
|
10
|
+
var a = /* @__PURE__ */ t({ randomNormal_: i });
|
|
11
|
+
export { a as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { rt as e, yr as t } from "./dist-CMMLi-qO.js";
|
|
2
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/range.js
|
|
3
|
+
function n(n, r, i = 1, a = "float32") {
|
|
4
|
+
if (i === 0) throw Error("Cannot have a step of zero");
|
|
5
|
+
let o = {
|
|
6
|
+
start: n,
|
|
7
|
+
stop: r,
|
|
8
|
+
step: i,
|
|
9
|
+
dtype: a
|
|
10
|
+
};
|
|
11
|
+
return e.runKernel(t, {}, o);
|
|
12
|
+
}
|
|
13
|
+
export { n as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Cr as e, Q as t, Z as n, rt as r } from "./dist-CMMLi-qO.js";
|
|
2
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/relu.js
|
|
3
|
+
function i(n) {
|
|
4
|
+
let i = { x: t(n, "x", "relu") };
|
|
5
|
+
return r.runKernel(e, i);
|
|
6
|
+
}
|
|
7
|
+
var a = /* @__PURE__ */ n({ relu_: i });
|
|
8
|
+
export { a as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Q as e, Tr as t, Z as n, rt as r } from "./dist-CMMLi-qO.js";
|
|
2
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/reshape.js
|
|
3
|
+
function i(n, i) {
|
|
4
|
+
let a = { x: e(n, "x", "reshape", "string_or_numeric") }, o = { shape: i };
|
|
5
|
+
return r.runKernel(t, a, o);
|
|
6
|
+
}
|
|
7
|
+
var a = /* @__PURE__ */ n({ reshape_: i });
|
|
8
|
+
export { a as t };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { $r as e, C as t, D as n, Er as r, Hn as i, Kn as a, Mn as o, Mr as s, N as c, Or as l, Q as u, Ui as d, Vn as f, Wn as p, Z as m, b as h, jn as g, nr as _, pi as v, rt as y, st as b, v as x, x as S, y as C, yi as w } from "./dist-CMMLi-qO.js";
|
|
2
|
+
import { t as T } from "./reshape-DJb1jgMt.js";
|
|
3
|
+
import { o as E } from "./not_equal-Bu3O8rh_.js";
|
|
4
|
+
import { a as D } from "./axis_util-rF9RnwKE.js";
|
|
5
|
+
import { t as O } from "./sum-C8qNbFNp.js";
|
|
6
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/min.js
|
|
7
|
+
function k(e, t = null, n = !1) {
|
|
8
|
+
let r = { x: u(e, "x", "min") }, i = {
|
|
9
|
+
axis: t,
|
|
10
|
+
keepDims: n
|
|
11
|
+
};
|
|
12
|
+
return y.runKernel("Min", r, i);
|
|
13
|
+
}
|
|
14
|
+
var A = /* @__PURE__ */ m({ min_: k });
|
|
15
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/norm.js
|
|
16
|
+
function j(e, t = "euclidean", n = null, r = !1) {
|
|
17
|
+
e = u(e, "x", "norm");
|
|
18
|
+
let i = M(e, t, n), a = i.shape;
|
|
19
|
+
if (r) {
|
|
20
|
+
let t = d(n, e.shape);
|
|
21
|
+
a = D(i.shape, t);
|
|
22
|
+
}
|
|
23
|
+
return T(i, a);
|
|
24
|
+
}
|
|
25
|
+
function M(e, t, r = null) {
|
|
26
|
+
if (e.rank === 0) return n(e);
|
|
27
|
+
if (e.rank !== 1 && r === null) return M(T(e, [-1]), t, r);
|
|
28
|
+
if (e.rank === 1 || typeof r == "number" || Array.isArray(r) && r.length === 1) {
|
|
29
|
+
if (t === 1) return O(n(e), r);
|
|
30
|
+
if (t === Infinity) return E(n(e), r);
|
|
31
|
+
if (t === -Infinity) return A(n(e), r);
|
|
32
|
+
if (t === "euclidean" || t === 2) return C(O(S(n(e), h(2, "int32")), r));
|
|
33
|
+
throw Error(`Error in norm: invalid ord value: ${t}`);
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(r) && r.length === 2) {
|
|
36
|
+
if (t === 1) return E(O(n(e), r[0]), r[1] - 1);
|
|
37
|
+
if (t === Infinity) return E(O(n(e), r[1]), r[0]);
|
|
38
|
+
if (t === -Infinity) return A(O(n(e), r[1]), r[0]);
|
|
39
|
+
if (t === "fro" || t === "euclidean") return C(O(x(e), r));
|
|
40
|
+
throw Error(`Error in norm: invalid ord value: ${t}`);
|
|
41
|
+
}
|
|
42
|
+
throw Error(`Error in norm: invalid axis: ${r}`);
|
|
43
|
+
}
|
|
44
|
+
var N = /* @__PURE__ */ m({ norm_: j });
|
|
45
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/greater.js
|
|
46
|
+
function P(e, n) {
|
|
47
|
+
let r = u(e, "a", "greater", "string_or_numeric"), i = u(n, "b", "greater", "string_or_numeric");
|
|
48
|
+
[r, i] = b(r, i), t(r.shape, i.shape);
|
|
49
|
+
let a = {
|
|
50
|
+
a: r,
|
|
51
|
+
b: i
|
|
52
|
+
};
|
|
53
|
+
return y.runKernel(g, a);
|
|
54
|
+
}
|
|
55
|
+
var F = /* @__PURE__ */ m({ greater_: P });
|
|
56
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/greater_equal.js
|
|
57
|
+
function I(e, n) {
|
|
58
|
+
let r = u(e, "a", "greaterEqual", "string_or_numeric"), i = u(n, "b", "greaterEqual", "string_or_numeric");
|
|
59
|
+
[r, i] = b(r, i), t(r.shape, i.shape);
|
|
60
|
+
let a = {
|
|
61
|
+
a: r,
|
|
62
|
+
b: i
|
|
63
|
+
};
|
|
64
|
+
return y.runKernel(o, a);
|
|
65
|
+
}
|
|
66
|
+
var L = /* @__PURE__ */ m({ greaterEqual_: I });
|
|
67
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/less.js
|
|
68
|
+
function R(e, n) {
|
|
69
|
+
let r = u(e, "a", "less", "string_or_numeric"), i = u(n, "b", "less", "string_or_numeric");
|
|
70
|
+
[r, i] = b(r, i), t(r.shape, i.shape);
|
|
71
|
+
let a = {
|
|
72
|
+
a: r,
|
|
73
|
+
b: i
|
|
74
|
+
};
|
|
75
|
+
return y.runKernel(f, a);
|
|
76
|
+
}
|
|
77
|
+
var ee = /* @__PURE__ */ m({ less_: R });
|
|
78
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/less_equal.js
|
|
79
|
+
function z(e, n) {
|
|
80
|
+
let r = u(e, "a", "lessEqual", "string_or_numeric"), a = u(n, "b", "lessEqual", "string_or_numeric");
|
|
81
|
+
[r, a] = b(r, a), t(r.shape, a.shape);
|
|
82
|
+
let o = {
|
|
83
|
+
a: r,
|
|
84
|
+
b: a
|
|
85
|
+
};
|
|
86
|
+
return y.runKernel(i, o);
|
|
87
|
+
}
|
|
88
|
+
var B = /* @__PURE__ */ m({ lessEqual_: z });
|
|
89
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/log1p.js
|
|
90
|
+
function V(e) {
|
|
91
|
+
let t = { x: u(e, "x", "log1p") };
|
|
92
|
+
return y.runKernel(p, t);
|
|
93
|
+
}
|
|
94
|
+
var H = /* @__PURE__ */ m({ log1p_: V });
|
|
95
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/logical_and.js
|
|
96
|
+
function U(e, n) {
|
|
97
|
+
let r = u(e, "a", "logicalAnd", "bool"), i = u(n, "b", "logicalAnd", "bool");
|
|
98
|
+
t(r.shape, i.shape);
|
|
99
|
+
let o = {
|
|
100
|
+
a: r,
|
|
101
|
+
b: i
|
|
102
|
+
};
|
|
103
|
+
return y.runKernel(a, o);
|
|
104
|
+
}
|
|
105
|
+
var W = /* @__PURE__ */ m({ logicalAnd_: U });
|
|
106
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/minimum.js
|
|
107
|
+
function G(e, n) {
|
|
108
|
+
let r = u(e, "a", "minimum"), i = u(n, "b", "minimum");
|
|
109
|
+
[r, i] = b(r, i), r.dtype === "bool" && (r = c(r, "int32"), i = c(i, "int32")), t(r.shape, i.shape);
|
|
110
|
+
let a = {
|
|
111
|
+
a: r,
|
|
112
|
+
b: i
|
|
113
|
+
};
|
|
114
|
+
return y.runKernel(_, a);
|
|
115
|
+
}
|
|
116
|
+
var K = /* @__PURE__ */ m({ minimum_: G });
|
|
117
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/round.js
|
|
118
|
+
function q(e) {
|
|
119
|
+
let t = { x: u(e, "x", "round") };
|
|
120
|
+
return y.runKernel(s, t);
|
|
121
|
+
}
|
|
122
|
+
var J = /* @__PURE__ */ m({ round_: q });
|
|
123
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/squared_difference.js
|
|
124
|
+
function Y(n, r) {
|
|
125
|
+
let i = u(n, "a", "squaredDifference"), a = u(r, "b", "squaredDifference");
|
|
126
|
+
[i, a] = b(i, a), t(i.shape, a.shape);
|
|
127
|
+
let o = {
|
|
128
|
+
a: i,
|
|
129
|
+
b: a
|
|
130
|
+
};
|
|
131
|
+
return y.runKernel(e, o, {});
|
|
132
|
+
}
|
|
133
|
+
var X = /* @__PURE__ */ m({ squaredDifference_: Y });
|
|
134
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/unstack.js
|
|
135
|
+
function Z(e, t = 0) {
|
|
136
|
+
let n = u(e, "x", "unstack", "string_or_numeric");
|
|
137
|
+
w(t >= -n.shape.length && t < n.shape.length, () => `Axis = ${t} is not in [-${n.shape.length}, ${n.shape.length})`);
|
|
138
|
+
let r = { value: n }, i = { axis: t };
|
|
139
|
+
return y.runKernel(v, r, i);
|
|
140
|
+
}
|
|
141
|
+
var Q = /* @__PURE__ */ m({ unstack_: Z });
|
|
142
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/image/resize_bilinear.js
|
|
143
|
+
function $(e, t, n = !1, i = !1) {
|
|
144
|
+
let a = u(e, "images", "resizeBilinear");
|
|
145
|
+
w(a.rank === 3 || a.rank === 4, () => `Error in resizeBilinear: x must be rank 3 or 4, but got rank ${a.rank}.`), w(t.length === 2, () => `Error in resizeBilinear: new shape must 2D, but got shape ${t}.`), w(i === !1 || n === !1, () => "Error in resizeBilinear: If halfPixelCenters is true, alignCorners must be false.");
|
|
146
|
+
let o = a, s = !1;
|
|
147
|
+
a.rank === 3 && (s = !0, o = T(a, [
|
|
148
|
+
1,
|
|
149
|
+
a.shape[0],
|
|
150
|
+
a.shape[1],
|
|
151
|
+
a.shape[2]
|
|
152
|
+
]));
|
|
153
|
+
let [] = t, c = { images: o }, l = {
|
|
154
|
+
alignCorners: n,
|
|
155
|
+
halfPixelCenters: i,
|
|
156
|
+
size: t
|
|
157
|
+
}, d = y.runKernel(r, c, l);
|
|
158
|
+
return s ? T(d, [
|
|
159
|
+
d.shape[1],
|
|
160
|
+
d.shape[2],
|
|
161
|
+
d.shape[3]
|
|
162
|
+
]) : d;
|
|
163
|
+
}
|
|
164
|
+
var te = /* @__PURE__ */ m({ resizeBilinear_: $ });
|
|
165
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/image/resize_nearest_neighbor.js
|
|
166
|
+
function ne(e, t, n = !1, r = !1) {
|
|
167
|
+
let i = u(e, "images", "resizeNearestNeighbor");
|
|
168
|
+
w(i.rank === 3 || i.rank === 4, () => `Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank ${i.rank}.`), w(t.length === 2, () => `Error in resizeNearestNeighbor: new shape must 2D, but got shape ${t}.`), w(i.dtype === "float32" || i.dtype === "int32", () => "`images` must have `int32` or `float32` as dtype"), w(r === !1 || n === !1, () => "Error in resizeNearestNeighbor: If halfPixelCenters is true, alignCorners must be false.");
|
|
169
|
+
let a = i, o = !1;
|
|
170
|
+
i.rank === 3 && (o = !0, a = T(i, [
|
|
171
|
+
1,
|
|
172
|
+
i.shape[0],
|
|
173
|
+
i.shape[1],
|
|
174
|
+
i.shape[2]
|
|
175
|
+
]));
|
|
176
|
+
let [] = t, s = { images: a }, c = {
|
|
177
|
+
alignCorners: n,
|
|
178
|
+
halfPixelCenters: r,
|
|
179
|
+
size: t
|
|
180
|
+
}, d = y.runKernel(l, s, c);
|
|
181
|
+
return o ? T(d, [
|
|
182
|
+
d.shape[1],
|
|
183
|
+
d.shape[2],
|
|
184
|
+
d.shape[3]
|
|
185
|
+
]) : d;
|
|
186
|
+
}
|
|
187
|
+
var re = /* @__PURE__ */ m({ resizeNearestNeighbor_: ne });
|
|
188
|
+
export { J as a, H as c, L as d, F as f, X as i, B as l, A as m, te as n, K as o, N as p, Q as r, W as s, re as t, ee as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, n) => {
|
|
3
3
|
let r = {};
|
|
4
4
|
for (var i in e) t(r, i, {
|
|
5
5
|
get: e[i],
|
|
@@ -12,12 +12,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
12
12
|
enumerable: !(s = n(i, d)) || s.enumerable
|
|
13
13
|
});
|
|
14
14
|
return e;
|
|
15
|
-
}, l = (n, r,
|
|
15
|
+
}, l = (n, r, o) => (o = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
|
|
16
16
|
value: n,
|
|
17
17
|
enumerable: !0
|
|
18
|
-
}) :
|
|
18
|
+
}) : o, n)), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
19
19
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
20
20
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
21
21
|
});
|
|
22
|
-
//#endregion
|
|
23
22
|
export { l as i, s as n, u as r, o as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { H as e, bt as t } from "./dist-CMMLi-qO.js";
|
|
2
2
|
import "./ops/cpu/rope.js";
|
|
3
3
|
import "./ops/webgl/rope.js";
|
|
4
|
-
|
|
4
|
+
// lib/ops/grads/rope.ts
|
|
5
5
|
var n = {
|
|
6
6
|
kernelName: "Rope",
|
|
7
7
|
inputsToSave: [],
|
|
@@ -11,16 +11,14 @@ var n = {
|
|
|
11
11
|
return { x: () => o };
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return n.ensureRopeCache(e.shape[2] + r), t().runKernel("Rope", { x: e }, {
|
|
14
|
+
t(n);
|
|
15
|
+
// lib/ops/rope.ts
|
|
16
|
+
function r(t, n, r, i = !1, a = !0) {
|
|
17
|
+
return n.ensureRopeCache(t.shape[2] + r), e().runKernel("Rope", { x: t }, {
|
|
19
18
|
pastLen: r,
|
|
20
19
|
negSin: i,
|
|
21
20
|
ropeCache: n,
|
|
22
21
|
interleaved: a
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
|
-
//#endregion
|
|
26
24
|
export { n, r as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { O as e, Pr as t, Q as n, Z as r, bi as i, p as a, rt as o, xt as s } from "./dist-CMMLi-qO.js";
|
|
2
|
+
import { t as c } from "./ones-DpPXWa6A.js";
|
|
3
|
+
import { t as l } from "./range-CYvQC3fW.js";
|
|
4
|
+
import { t as u } from "./stack-Dbbt9mIk.js";
|
|
5
|
+
import { n as d } from "./scatter_nd_util-BepMCpLY.js";
|
|
6
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/scatter_nd.js
|
|
7
|
+
function f(e, r, a) {
|
|
8
|
+
i(a);
|
|
9
|
+
let s = n(e, "indices", "scatterND", "int32"), c = n(r, "updates", "scatterND");
|
|
10
|
+
d(c, s, a);
|
|
11
|
+
let l = {
|
|
12
|
+
indices: s,
|
|
13
|
+
updates: c
|
|
14
|
+
}, u = { shape: a };
|
|
15
|
+
return o.runKernel(t, l, u);
|
|
16
|
+
}
|
|
17
|
+
var p = /* @__PURE__ */ r({ scatterND_: f });
|
|
18
|
+
// lib/ops/cpu/scatterSub.ts
|
|
19
|
+
function m(t) {
|
|
20
|
+
let { logits: n, labels: r, dy: i } = t.inputs, o = r.shape[0], s = n.shape[1], d = l(0, o, 1, "int32"), f = p(u([d, r], 1), c([o]), [o, s]), m = a(n, f), h = i.reshape([o, 1]);
|
|
21
|
+
return e(m, h);
|
|
22
|
+
}
|
|
23
|
+
s({
|
|
24
|
+
kernelName: "EfficientScatterSub",
|
|
25
|
+
backendName: "cpu",
|
|
26
|
+
kernelFunc: m
|
|
27
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Ti as e, qi as t } from "./dist-CMMLi-qO.js";
|
|
2
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/scatter_nd_util.js
|
|
3
|
+
function n(e, t, n) {
|
|
4
|
+
let r = t.rank > 1 ? t.shape[t.rank - 1] : 1, i = t.rank > 1 ? t.rank - 1 : 1, a = `Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: ${n.shape}, indices.shape: ${t.shape}, shape: ${e}, sliceDim: ${r}, and batchDim: ${i}.`;
|
|
5
|
+
if (n.rank < i) throw Error(a + ` update.rank < ${i}. `);
|
|
6
|
+
if (e.length < r + (n.rank - i)) throw Error(a + ` Output shape length < ${r + (n.rank - i)}`);
|
|
7
|
+
if (n.rank !== i + e.length - r) throw Error(a + ` update.rank != ${i + e.length - r}`);
|
|
8
|
+
for (let e = 0; e < i; ++e) if (n.shape[e] !== t.shape[e]) throw Error(a + ` updates.shape[${e}] (${n.shape[e]}) != indices.shape[${e}] (${t.shape[e]}).`);
|
|
9
|
+
for (let t = 0; t < n.rank - i; ++t) if (n.shape[t + i] !== e[t + r]) throw Error(a + ` updates.shape[${t + i}] (${n.shape[t + i]}) != shape[${t + i}] (${e[t + i]})`);
|
|
10
|
+
}
|
|
11
|
+
function r(e, t, r) {
|
|
12
|
+
if (t.rank < 1) throw Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);
|
|
13
|
+
if (e.rank < 1) throw Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);
|
|
14
|
+
if (t.dtype !== "int32") throw Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);
|
|
15
|
+
if (r.length < 1) throw Error(`Output rank must be greater or equal to 1, but got shape: ${r}`);
|
|
16
|
+
if (r.length === 0) {
|
|
17
|
+
if (t.size === 0) throw Error(`Indices specified for empty output. indices shape: ${t.shape}`);
|
|
18
|
+
if (e.size === 0) throw Error(`Updates specified for empty output. updates shape: ${e.shape}`);
|
|
19
|
+
}
|
|
20
|
+
n(r, t, e);
|
|
21
|
+
}
|
|
22
|
+
function i(n, r, i) {
|
|
23
|
+
let a = r.shape.length, o = a > 1 ? r.shape[a - 1] : 1, s = i.length, c = 1;
|
|
24
|
+
for (let e = o; e < s; ++e) c *= i[e];
|
|
25
|
+
let l = o < 1 ? 1 : o, u = t(r.shape) / l, d = [...e(i.slice(0, o)), 1], f = t(i);
|
|
26
|
+
return {
|
|
27
|
+
sliceRank: o,
|
|
28
|
+
numUpdates: u,
|
|
29
|
+
sliceSize: c,
|
|
30
|
+
strides: d,
|
|
31
|
+
outputSize: f
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export { r as n, n as r, i as t };
|