@genai-fi/nanogpt 1.6.1 → 1.7.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/{binary_op_util-WY9YIl0q.js → Reshape-CqftURg0.js} +75 -60
- package/dist/TeachableLLM.d.ts +12 -12
- package/dist/api/beamer.d.ts +4 -4
- package/dist/api/responses.d.ts +4 -4
- package/dist/api/training.d.ts +9 -9
- package/dist/backend.d.ts +1 -1
- package/dist/backend_util-DZIc6pyV.js +1081 -0
- package/dist/checks/index.d.ts +11 -11
- package/dist/checks/weights.d.ts +1 -1
- package/dist/data/docx.d.ts +1 -1
- package/dist/data/pdf.d.ts +1 -1
- package/dist/data/stream.d.ts +1 -1
- package/dist/data/textLoader.d.ts +1 -1
- package/dist/data.d.ts +3 -3
- package/dist/device-CZPGtQBU.js +9 -0
- package/dist/device.d.ts +2 -0
- package/dist/{dist-DeVH1nGn.js → dist-DiszGjH-.js} +1833 -1844
- package/dist/{dist-CMMLi-qO.js → dist-JOPw9zTN.js} +69 -11
- package/dist/inference/Beamer.d.ts +3 -3
- package/dist/inference/Generator.d.ts +4 -4
- package/dist/inference/tokenisePrompt.d.ts +2 -2
- package/dist/inference/types.d.ts +1 -1
- package/dist/inference/utilities.d.ts +1 -1
- package/dist/layers/BaseLayer.d.ts +5 -4
- package/dist/layers/GQA.d.ts +24 -26
- package/dist/layers/HeadLayer.d.ts +2 -2
- package/dist/layers/LoRA.d.ts +1 -1
- package/dist/layers/MHA.d.ts +3 -4
- package/dist/layers/MLP.d.ts +2 -2
- package/dist/layers/PositionEmbedding.d.ts +3 -3
- package/dist/layers/RMSNorm.d.ts +2 -2
- package/dist/layers/RoPECache.d.ts +2 -1
- package/dist/layers/TiedEmbedding.d.ts +2 -2
- package/dist/layers/TransformerBlock.d.ts +9 -6
- package/dist/layers.d.ts +4 -4
- package/dist/loader/load.d.ts +1 -1
- package/dist/loader/loadHF.d.ts +3 -3
- package/dist/loader/loadTransformers.d.ts +2 -2
- package/dist/loader/loadZipMeta.d.ts +2 -2
- package/dist/loader/newZipLoad.d.ts +2 -2
- package/dist/loader/oldZipLoad.d.ts +4 -4
- package/dist/loader/save.d.ts +5 -5
- package/dist/loader/types.d.ts +23 -10
- package/dist/main.d.ts +40 -24
- package/dist/matMul16-CiMKJM8v.js +2610 -0
- package/dist/models/Llama.d.ts +2 -2
- package/dist/models/LoopNano.d.ts +16 -0
- package/dist/models/NanoGPTV1.d.ts +2 -2
- package/dist/models/NanoGPTV2.d.ts +2 -2
- package/dist/models/Qwen3.d.ts +2 -2
- package/dist/models/config.d.ts +11 -1
- package/dist/models/factory.d.ts +2 -2
- package/dist/models/model.d.ts +6 -6
- package/dist/models.d.ts +4 -4
- package/dist/nanogpt.js +37041 -0
- package/dist/ops/adamAdjust.d.ts +2 -0
- package/dist/ops/adamMoments.d.ts +2 -0
- package/dist/ops/adamW.d.ts +2 -0
- package/dist/ops/add16.d.ts +1 -0
- package/dist/ops/appendCache.d.ts +2 -0
- package/dist/ops/attentionMask.d.ts +11 -1
- package/dist/ops/dropout16.d.ts +2 -0
- package/dist/ops/gatherSub.d.ts +2 -0
- package/dist/ops/gelu.d.ts +3 -0
- package/dist/ops/log.d.ts +1 -0
- package/dist/ops/matMul16.d.ts +4 -0
- package/dist/ops/matMulGelu.d.ts +3 -0
- package/dist/ops/matMulMul.d.ts +2 -0
- package/dist/ops/mul16.d.ts +1 -0
- package/dist/ops/mulDrop.d.ts +2 -0
- package/dist/ops/normRMS.d.ts +3 -0
- package/dist/ops/pack16.d.ts +1 -0
- package/dist/ops/qkv.d.ts +13 -1
- package/dist/ops/rope.d.ts +4 -1
- package/dist/ops/scatterSub.d.ts +4 -1
- package/dist/ops/silu.d.ts +1 -0
- package/dist/ops/softmax16.d.ts +1 -0
- package/dist/ops/sparseCrossEntropy.d.ts +15 -0
- package/dist/ops/unpack16.d.ts +1 -0
- package/dist/ops/webgl/sparseCrossEntropy.d.ts +1 -0
- package/dist/ops/webgpu/adamW.d.ts +1 -0
- package/dist/ops/webgpu/concat16.d.ts +16 -0
- package/dist/ops/webgpu/index.d.ts +29 -0
- package/dist/ops/webgpu/normRMS16_program.d.ts +2 -2
- package/dist/ops/webgpu/normRMS32_program.d.ts +2 -2
- package/dist/ops/webgpu/pack16_program.d.ts +1 -1
- package/dist/ops/webgpu/softmax16_program.d.ts +16 -0
- package/dist/ops/webgpu/sparseCrossEntropy.d.ts +1 -0
- package/dist/ops/webgpu/utils/binary_op.d.ts +16 -0
- package/dist/ops/webgpu/utils/deviceInfo.d.ts +1 -1
- package/dist/ops/webgpu/utils/reductions.d.ts +1 -1
- package/dist/patches/webgpu_backend.d.ts +2 -1
- package/dist/patches/webgpu_base.d.ts +0 -1
- package/dist/patches/webgpu_program.d.ts +21 -0
- package/dist/{shared-BIDMUBCs.js → shared-BARkvvG4.js} +587 -505
- package/dist/tokenise.d.ts +4 -4
- package/dist/tokeniser/BaseTokeniser.d.ts +3 -3
- package/dist/tokeniser/CharTokeniser.d.ts +2 -2
- package/dist/tokeniser/bpe.d.ts +2 -2
- package/dist/tokeniser/type.d.ts +2 -2
- package/dist/training/AdamW.d.ts +19 -2
- package/dist/training/BasicTrainer.d.ts +5 -5
- package/dist/training/DatasetBuilder.d.ts +2 -2
- package/dist/training/Evaluator.d.ts +1 -1
- package/dist/training/LRScheduler.d.ts +1 -1
- package/dist/training/PreTrainer.d.ts +6 -6
- package/dist/training/SFTTrainer.d.ts +6 -6
- package/dist/training/configure.d.ts +2 -2
- package/dist/training/factory.d.ts +6 -5
- package/dist/training/prepareData.d.ts +6 -6
- package/dist/training/tasks/tokenStream.d.ts +3 -3
- package/dist/training/types.d.ts +6 -5
- package/dist/training/validateOptions.d.ts +1 -1
- package/dist/training/validation.d.ts +3 -3
- package/dist/utilities/datasetID.d.ts +1 -1
- package/dist/utilities/dummy.d.ts +1 -1
- package/dist/utilities/packed.d.ts +1 -1
- package/dist/utilities/parameters.d.ts +1 -1
- package/dist/utilities/sentences.d.ts +1 -1
- package/dist/utilities/waitForModel.d.ts +1 -1
- package/dist/webgpu-D4syGmzo.js +3221 -0
- package/dist/webgpu-wUCQopBN.js +1007 -0
- package/dist/{webgpu_program-DvkFqRlR.js → webgpu_backend-CzY9TzvA.js} +174 -223
- package/dist/{patches/webgpu_base.js → webgpu_base-Bjg7okYf.js} +6 -9
- package/package.json +12 -9
- package/dist/DatasetBuilder-DRDW8tcM.js +0 -731
- package/dist/Generator-8IK28IWR.js +0 -316
- package/dist/RealDiv-Cl8k3YTx.js +0 -354
- package/dist/Reshape-CKxKPKqi.js +0 -91
- package/dist/Reshape-H5zZRgr9.js +0 -16
- package/dist/RoPECache-dYscFINl.js +0 -722
- package/dist/TeachableLLM.js +0 -220
- package/dist/api/beamer.js +0 -61
- package/dist/api/responses.js +0 -177
- package/dist/api/training.js +0 -215
- package/dist/axis_util-rF9RnwKE.js +0 -37
- package/dist/backend.js +0 -12
- package/dist/backend_util-Cpp0Gwlp.js +0 -394
- package/dist/broadcast_to-CGvLNiQ0.js +0 -20
- package/dist/checks/appendCache.js +0 -55
- package/dist/checks/attentionMask.js +0 -57
- package/dist/checks/check.js +0 -31
- package/dist/checks/gelu.js +0 -46
- package/dist/checks/index.js +0 -27
- package/dist/checks/matMulGelu.js +0 -84
- package/dist/checks/normRMS.js +0 -30
- package/dist/checks/normRMSGrad.js +0 -23
- package/dist/checks/packUnpack.js +0 -46
- package/dist/checks/qkv.js +0 -1
- package/dist/checks/rope.js +0 -30
- package/dist/checks/weights.js +0 -26
- package/dist/clip_by_value-D-UX9am5.js +0 -13
- package/dist/complex-Cl904TqN.js +0 -13
- package/dist/complex_util-BBlPAm-s.js +0 -59
- package/dist/concat-Oip5acVY.js +0 -14
- package/dist/concat_util-CY45Hf4F.js +0 -18
- package/dist/data/docx.js +0 -17
- package/dist/data/pdf.js +0 -14
- package/dist/data/stream.js +0 -1
- package/dist/data/textLoader.js +0 -575
- package/dist/data-CV_i_H6B.js +0 -11
- package/dist/data.js +0 -5
- package/dist/dist-DyL7qSLJ.js +0 -7809
- package/dist/dropout16-CA31Ud5a.js +0 -20
- package/dist/dropout_util-SiFMbFXz.js +0 -22
- package/dist/eventemitter3-wmfmOP_f.js +0 -90
- package/dist/expand_dims-Dh3Fulyn.js +0 -10
- package/dist/floor-BwjmUb7X.js +0 -8
- package/dist/gather-B5Z1RFt5.js +0 -14
- package/dist/gatherSub-CRUfUzBa.js +0 -22
- package/dist/gelu-Xx9-ohH9.js +0 -25
- package/dist/gpgpu_math-48m8q3jI.js +0 -1591
- package/dist/inference/Beamer.js +0 -215
- package/dist/inference/Generator.js +0 -1
- package/dist/inference/tokenisePrompt.js +0 -17
- package/dist/inference/types.js +0 -0
- package/dist/inference/utilities.js +0 -31
- package/dist/jszip.min-Btv48m44.js +0 -3037
- package/dist/kernel_funcs_utils-BYRpSfV_.js +0 -229
- package/dist/layers/BaseLayer.js +0 -75
- package/dist/layers/GQA.js +0 -102
- package/dist/layers/HeadLayer.js +0 -28
- package/dist/layers/LoRA.js +0 -45
- package/dist/layers/MHA.js +0 -102
- package/dist/layers/MLP.js +0 -47
- package/dist/layers/PositionEmbedding.js +0 -28
- package/dist/layers/RMSNorm.js +0 -25
- package/dist/layers/RoPECache.js +0 -1
- package/dist/layers/TiedEmbedding.js +0 -33
- package/dist/layers/TransformerBlock.js +0 -50
- package/dist/layers/WeightStore.js +0 -68
- package/dist/layers-CFqEip3s.js +0 -13
- package/dist/layers.js +0 -6
- package/dist/loader/load.js +0 -63
- package/dist/loader/loadHF.js +0 -17
- package/dist/loader/loadTransformers.js +0 -61
- package/dist/loader/loadZipMeta.js +0 -15
- package/dist/loader/newZipLoad.js +0 -24
- package/dist/loader/oldZipLoad.js +0 -36
- package/dist/loader/save.js +0 -89
- package/dist/loader/types.js +0 -0
- package/dist/main.js +0 -12145
- package/dist/matMul16-tE26fnhf.js +0 -87
- package/dist/matMulGelu-ASUWlKqu.js +0 -162
- package/dist/mat_mul-R9_DWmIT.js +0 -16
- package/dist/models/Llama.js +0 -88
- package/dist/models/NanoGPTV1.js +0 -94
- package/dist/models/NanoGPTV2.js +0 -85
- package/dist/models/Qwen3.js +0 -88
- package/dist/models/config.js +0 -32
- package/dist/models/factory.js +0 -16
- package/dist/models/model.js +0 -75
- package/dist/models-DyBpJJwM.js +0 -13
- package/dist/models.js +0 -6
- package/dist/mul16-C7sqgqik.js +0 -41
- package/dist/non_max_suppression_impl-B0H318rb.js +0 -72
- package/dist/not_equal-Bu3O8rh_.js +0 -67
- package/dist/one_hot-TEMPumJj.js +0 -14
- package/dist/ones-DpPXWa6A.js +0 -13
- package/dist/ops/adamAdjust.js +0 -17
- package/dist/ops/adamMoments.js +0 -15
- package/dist/ops/add16.js +0 -11
- package/dist/ops/appendCache.js +0 -26
- package/dist/ops/attentionMask.js +0 -19
- package/dist/ops/concat16.js +0 -8
- package/dist/ops/cpu/adamAdjust.js +0 -15
- package/dist/ops/cpu/adamMoments.js +0 -16
- package/dist/ops/cpu/appendCache.js +0 -65
- package/dist/ops/cpu/attentionMask.js +0 -20
- package/dist/ops/cpu/fusedSoftmax.js +0 -22
- package/dist/ops/cpu/gatherSub.js +0 -1
- package/dist/ops/cpu/gelu.js +0 -35
- package/dist/ops/cpu/matMul16.js +0 -14
- package/dist/ops/cpu/matMulGelu.js +0 -44
- package/dist/ops/cpu/matMulMul.js +0 -19
- package/dist/ops/cpu/mulDropout.js +0 -19
- package/dist/ops/cpu/normRMS.js +0 -34
- package/dist/ops/cpu/qkv.js +0 -74
- package/dist/ops/cpu/rope.js +0 -84
- package/dist/ops/cpu/scatterSub.js +0 -1
- package/dist/ops/dot16.js +0 -28
- package/dist/ops/dropout.js +0 -12
- package/dist/ops/dropout16.js +0 -1
- package/dist/ops/gatherSub.js +0 -12
- package/dist/ops/gelu.js +0 -1
- package/dist/ops/globalNorm.js +0 -19
- package/dist/ops/grads/add16.js +0 -26
- package/dist/ops/grads/attentionMask.js +0 -25
- package/dist/ops/grads/dropout16.js +0 -1
- package/dist/ops/grads/gelu.js +0 -1
- package/dist/ops/grads/matMul16.js +0 -1
- package/dist/ops/grads/matMulGelu.js +0 -21
- package/dist/ops/grads/mul16.js +0 -1
- package/dist/ops/grads/normRMS.js +0 -36
- package/dist/ops/grads/pack16.js +0 -1
- package/dist/ops/grads/qkv.js +0 -46
- package/dist/ops/grads/rope.js +0 -1
- package/dist/ops/grads/silu.js +0 -1
- package/dist/ops/grads/softmax16.js +0 -22
- package/dist/ops/grads/unpack16.js +0 -1
- package/dist/ops/grads/utils.js +0 -11
- package/dist/ops/log.js +0 -1
- package/dist/ops/matMul16.js +0 -1
- package/dist/ops/matMulGelu.js +0 -19
- package/dist/ops/matMulMul.js +0 -15
- package/dist/ops/mul16.js +0 -1
- package/dist/ops/mulDrop.js +0 -14
- package/dist/ops/normRMS.js +0 -21
- package/dist/ops/pack16.js +0 -1
- package/dist/ops/qkv.js +0 -15
- package/dist/ops/reshape16.js +0 -33
- package/dist/ops/rope.js +0 -1
- package/dist/ops/scatterSub.js +0 -12
- package/dist/ops/silu.js +0 -1
- package/dist/ops/slice16.js +0 -11
- package/dist/ops/softmax16.js +0 -8
- package/dist/ops/sub16.js +0 -10
- package/dist/ops/sum16.js +0 -13
- package/dist/ops/transpose16.js +0 -33
- package/dist/ops/unpack16.js +0 -1
- package/dist/ops/webgl/adamAdjust.js +0 -81
- package/dist/ops/webgl/adamMoments.js +0 -43
- package/dist/ops/webgl/appendCache.js +0 -52
- package/dist/ops/webgl/attentionMask.js +0 -63
- package/dist/ops/webgl/dropout16.js +0 -11
- package/dist/ops/webgl/fusedSoftmax.js +0 -70
- package/dist/ops/webgl/gatherSub.js +0 -27
- package/dist/ops/webgl/gelu.js +0 -47
- package/dist/ops/webgl/log.js +0 -14
- package/dist/ops/webgl/matMul16.js +0 -48
- package/dist/ops/webgl/matMulGelu.js +0 -1
- package/dist/ops/webgl/matMulMul.js +0 -23
- package/dist/ops/webgl/mulDropout.js +0 -31
- package/dist/ops/webgl/normRMS.js +0 -115
- package/dist/ops/webgl/qkv.js +0 -53
- package/dist/ops/webgl/rope.js +0 -73
- package/dist/ops/webgl/scatterSub.js +0 -27
- package/dist/ops/webgpu/adamAdjust.js +0 -76
- package/dist/ops/webgpu/adamMoments.js +0 -75
- package/dist/ops/webgpu/add16.js +0 -13
- package/dist/ops/webgpu/appendCache.js +0 -129
- package/dist/ops/webgpu/attentionMask.js +0 -41
- package/dist/ops/webgpu/attentionMask32_program.js +0 -61
- package/dist/ops/webgpu/clipScale.js +0 -44
- package/dist/ops/webgpu/concat16.js +0 -110
- package/dist/ops/webgpu/dropout16.js +0 -58
- package/dist/ops/webgpu/gatherSub.js +0 -51
- package/dist/ops/webgpu/gelu.js +0 -146
- package/dist/ops/webgpu/index.js +0 -27
- package/dist/ops/webgpu/matMul16.js +0 -91
- package/dist/ops/webgpu/matMul16_program.js +0 -311
- package/dist/ops/webgpu/mul16.js +0 -13
- package/dist/ops/webgpu/norm2.js +0 -45
- package/dist/ops/webgpu/normRMS.js +0 -25
- package/dist/ops/webgpu/normRMS16_program.js +0 -28
- package/dist/ops/webgpu/normRMS32_program.js +0 -28
- package/dist/ops/webgpu/normRMSGrad.js +0 -225
- package/dist/ops/webgpu/pack16.js +0 -20
- package/dist/ops/webgpu/pack16_program.js +0 -92
- package/dist/ops/webgpu/qkv.js +0 -63
- package/dist/ops/webgpu/rope.js +0 -227
- package/dist/ops/webgpu/scatterSub.js +0 -52
- package/dist/ops/webgpu/silu.js +0 -117
- package/dist/ops/webgpu/slice16.js +0 -73
- package/dist/ops/webgpu/softmax16.js +0 -18
- package/dist/ops/webgpu/softmax16_program.js +0 -88
- package/dist/ops/webgpu/softmax16_subgroup_program.js +0 -69
- package/dist/ops/webgpu/softmax16grad.js +0 -30
- package/dist/ops/webgpu/sub16.js +0 -13
- package/dist/ops/webgpu/sum16.js +0 -30
- package/dist/ops/webgpu/transpose16.js +0 -38
- package/dist/ops/webgpu/transpose16_program.js +0 -50
- package/dist/ops/webgpu/transpose16_shared_program.js +0 -78
- package/dist/ops/webgpu/unpack16.js +0 -59
- package/dist/ops/webgpu/utils/binary_op.js +0 -140
- package/dist/ops/webgpu/utils/deviceInfo.js +0 -10
- package/dist/ops/webgpu/utils/reductions.js +0 -264
- package/dist/ops-Be5ACU5R.js +0 -13
- package/dist/ops-C1UpdEYM.js +0 -509
- package/dist/pack16-BHO4t1-M.js +0 -36
- package/dist/pad-Dy-1IP3A.js +0 -13
- package/dist/patches/webgpu_backend.js +0 -42
- package/dist/patches/webgpu_program.js +0 -292
- package/dist/picomatch--TW6gyBJ.js +0 -999
- package/dist/qkv-BQfNPucX.js +0 -42
- package/dist/rand_util-_vCY93Uw.js +0 -44
- package/dist/random_normal-DUIT8kyC.js +0 -11
- package/dist/range-CYvQC3fW.js +0 -13
- package/dist/relu-C4XULT8A.js +0 -8
- package/dist/reshape-DJb1jgMt.js +0 -8
- package/dist/resize_nearest_neighbor-DAqcTYUe.js +0 -188
- package/dist/rope-JjBVufF_.js +0 -24
- package/dist/scatterSub-BOnqk-uY.js +0 -27
- package/dist/scatter_nd_util-BepMCpLY.js +0 -34
- package/dist/seedrandom-SHEGFK6H.js +0 -282
- package/dist/selu_util-DeOTf-sc.js +0 -27
- package/dist/shared-CX_iPI5K.js +0 -4
- package/dist/silu-DsAE2cJ5.js +0 -23
- package/dist/slice-Dlb1FlzG.js +0 -13
- package/dist/slice_util-BVgPRoij.js +0 -207
- package/dist/softmax-Dpav_dWw.js +0 -10
- package/dist/split-DYnT8chz.js +0 -11
- package/dist/squeeze-B3XYGAlg.js +0 -9
- package/dist/stack-Dbbt9mIk.js +0 -10
- package/dist/step-DA-5DNu9.js +0 -348
- package/dist/stream-BBe2apn4.js +0 -2280
- package/dist/sum-C8qNbFNp.js +0 -13
- package/dist/tensor-ALxWZfmz.js +0 -7
- package/dist/tensor1d-BHgkkhTE.js +0 -9
- package/dist/tensor2d-ARItvqVn.js +0 -10
- package/dist/tensor4d-D1zRBipJ.js +0 -10
- package/dist/tfjs_backend-CsXOum0h.js +0 -685
- package/dist/tile-DfyQ0KX-.js +0 -10
- package/dist/tokenise-DbS2Ea-T.js +0 -14
- package/dist/tokenise.js +0 -6
- package/dist/tokeniser/BaseTokeniser.js +0 -137
- package/dist/tokeniser/CharTokeniser.js +0 -85
- package/dist/tokeniser/bpe.js +0 -156
- package/dist/tokeniser/messages.js +0 -0
- package/dist/tokeniser/type.js +0 -0
- package/dist/topk-BrU2pkrR.js +0 -19
- package/dist/training/AdamW.js +0 -132
- package/dist/training/BasicTrainer.js +0 -274
- package/dist/training/DatasetBuilder.js +0 -1
- package/dist/training/Evaluator.js +0 -51
- package/dist/training/LRScheduler.js +0 -37
- package/dist/training/PreTrainer.js +0 -21
- package/dist/training/SFTTrainer.js +0 -23
- package/dist/training/configure.js +0 -33
- package/dist/training/factory.js +0 -7
- package/dist/training/loss.js +0 -18
- package/dist/training/orthoGrad.js +0 -9
- package/dist/training/prepareData.js +0 -51
- package/dist/training/sparseCrossEntropy.js +0 -53
- package/dist/training/tasks/TokenStore.js +0 -217
- package/dist/training/tasks/tokenStream.js +0 -45
- package/dist/training/types.js +0 -0
- package/dist/training/validateOptions.js +0 -18
- package/dist/training/validation.js +0 -30
- package/dist/transpose-BC-M_OoT.js +0 -34
- package/dist/unsorted_segment_sum-BelC7R-q.js +0 -408
- package/dist/utilities/arrayClose.js +0 -29
- package/dist/utilities/arrayShape.js +0 -7
- package/dist/utilities/datasetID.js +0 -17
- package/dist/utilities/dummy.js +0 -36
- package/dist/utilities/float16.js +0 -46
- package/dist/utilities/maxHeap.js +0 -54
- package/dist/utilities/multinomialCPU.js +0 -7
- package/dist/utilities/naming.js +0 -0
- package/dist/utilities/packed.js +0 -12
- package/dist/utilities/parameters.js +0 -53
- package/dist/utilities/performance.js +0 -15
- package/dist/utilities/profile.js +0 -32
- package/dist/utilities/random.js +0 -18
- package/dist/utilities/safetensors.js +0 -63
- package/dist/utilities/sentences.js +0 -35
- package/dist/utilities/tokenParse.js +0 -16
- package/dist/utilities/tokens.js +0 -39
- package/dist/utilities/topP.js +0 -25
- package/dist/utilities/waitForModel.js +0 -11
- package/dist/utilities/weights.js +0 -40
- package/dist/utilities/yielder.js +0 -6
- package/dist/v4-YCkfo8OR.js +0 -27
- package/dist/webgpu-BHX-uBym.js +0 -518
- package/dist/webgpu_util-5QTyovaf.js +0 -105
- package/dist/zeros-hxKGkRfl.js +0 -12
|
@@ -1,722 +0,0 @@
|
|
|
1
|
-
import { A as e, At as t, C as n, D as r, Gt as i, In as a, Jn as o, Ln as s, Mt as c, N as l, Ni as u, Nn as d, Nt as f, O as p, Ot as ee, Q as m, Rn as h, S as g, Sr as _, Tt as v, W as y, Y as b, Z as x, b as S, bn as te, f as ne, fi as re, fn as ie, ft as C, hr as ae, j as oe, jt as se, k as w, kt as ce, m as le, ni as ue, p as de, rr as fe, rt as T, sn as pe, st as E, ut as D, v as me, wt as he, x as O, y as ge, yi as k, zr as _e } from "./dist-CMMLi-qO.js";
|
|
2
|
-
import { A as ve, C as ye, D as be, E as A, O as j, T as xe, _ as Se, a as Ce, b as M, c as N, d as P, f as we, g as Te, h as F, i as Ee, j as De, k as Oe, l as ke, m as Ae, n as je, o as Me, p as I, r as L, s as R, t as Ne, u as z, v as Pe, w as Fe, x as Ie, y as Le } from "./unsorted_segment_sum-BelC7R-q.js";
|
|
3
|
-
import { t as B } from "./reshape-DJb1jgMt.js";
|
|
4
|
-
import { t as Re } from "./broadcast_to-CGvLNiQ0.js";
|
|
5
|
-
import { t as ze } from "./clip_by_value-D-UX9am5.js";
|
|
6
|
-
import { t as V } from "./concat-Oip5acVY.js";
|
|
7
|
-
import { a as Be, i as Ve, n as He, o as Ue, r as We, s as H, t as Ge } from "./not_equal-Bu3O8rh_.js";
|
|
8
|
-
import { t as U } from "./mat_mul-R9_DWmIT.js";
|
|
9
|
-
import { a as Ke, f as qe, h as Je, i as Ye, n as Xe, o as W, r as Ze, t as Qe } from "./step-DA-5DNu9.js";
|
|
10
|
-
import { a as $e, c as et, d as tt, f as nt, i as rt, l as it, m as at, n as ot, o as st, p as G, r as ct, s as K, t as lt, u as ut } from "./resize_nearest_neighbor-DAqcTYUe.js";
|
|
11
|
-
import { t as dt } from "./expand_dims-Dh3Fulyn.js";
|
|
12
|
-
import { t as ft } from "./floor-BwjmUb7X.js";
|
|
13
|
-
import { t as pt } from "./gather-B5Z1RFt5.js";
|
|
14
|
-
import { t as q } from "./complex-Cl904TqN.js";
|
|
15
|
-
import { i as mt, n as J, r as Y, t as ht } from "./transpose-BC-M_OoT.js";
|
|
16
|
-
import { t as X } from "./slice-Dlb1FlzG.js";
|
|
17
|
-
import { t as gt } from "./ops-Be5ACU5R.js";
|
|
18
|
-
import { t as _t } from "./one_hot-TEMPumJj.js";
|
|
19
|
-
import { t as vt } from "./pad-Dy-1IP3A.js";
|
|
20
|
-
import { t as yt } from "./relu-C4XULT8A.js";
|
|
21
|
-
import { t as Z } from "./split-DYnT8chz.js";
|
|
22
|
-
import { t as bt } from "./zeros-hxKGkRfl.js";
|
|
23
|
-
import { t as xt } from "./range-CYvQC3fW.js";
|
|
24
|
-
import { t as St } from "./softmax-Dpav_dWw.js";
|
|
25
|
-
import { t as Ct } from "./squeeze-B3XYGAlg.js";
|
|
26
|
-
import { t as wt } from "./stack-Dbbt9mIk.js";
|
|
27
|
-
import { t as Tt } from "./sum-C8qNbFNp.js";
|
|
28
|
-
import { t as Et } from "./tile-DfyQ0KX-.js";
|
|
29
|
-
import { t as Dt } from "./topk-BrU2pkrR.js";
|
|
30
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/acos.js
|
|
31
|
-
function Ot(e) {
|
|
32
|
-
let t = { x: m(e, "x", "acos") };
|
|
33
|
-
return T.runKernel(he, t);
|
|
34
|
-
}
|
|
35
|
-
var kt = /* @__PURE__ */ x({ acos_: Ot });
|
|
36
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/acosh.js
|
|
37
|
-
function At(e) {
|
|
38
|
-
let t = { x: m(e, "x", "acosh") };
|
|
39
|
-
return T.runKernel(v, t);
|
|
40
|
-
}
|
|
41
|
-
var jt = /* @__PURE__ */ x({ acosh_: At });
|
|
42
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/arg_min.js
|
|
43
|
-
function Mt(e, t = 0) {
|
|
44
|
-
let n = { x: m(e, "x", "argMin") }, r = { axis: t };
|
|
45
|
-
return T.runKernel(ee, n, r);
|
|
46
|
-
}
|
|
47
|
-
var Nt = /* @__PURE__ */ x({ argMin_: Mt });
|
|
48
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/asin.js
|
|
49
|
-
function Pt(e) {
|
|
50
|
-
let t = { x: m(e, "x", "asin") };
|
|
51
|
-
return T.runKernel(ce, t);
|
|
52
|
-
}
|
|
53
|
-
var Ft = /* @__PURE__ */ x({ asin_: Pt });
|
|
54
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/asinh.js
|
|
55
|
-
function It(e) {
|
|
56
|
-
let n = { x: m(e, "x", "asinh") };
|
|
57
|
-
return T.runKernel(t, n);
|
|
58
|
-
}
|
|
59
|
-
var Lt = /* @__PURE__ */ x({ asinh_: It });
|
|
60
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/atan.js
|
|
61
|
-
function Rt(e) {
|
|
62
|
-
let t = { x: m(e, "x", "atan") };
|
|
63
|
-
return T.runKernel(se, t);
|
|
64
|
-
}
|
|
65
|
-
var zt = /* @__PURE__ */ x({ atan_: Rt });
|
|
66
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/atan2.js
|
|
67
|
-
function Bt(e, t) {
|
|
68
|
-
let n = m(e, "a", "atan2"), r = m(t, "b", "atan2");
|
|
69
|
-
[n, r] = E(n, r);
|
|
70
|
-
let i = {
|
|
71
|
-
a: n,
|
|
72
|
-
b: r
|
|
73
|
-
};
|
|
74
|
-
return T.runKernel(c, i);
|
|
75
|
-
}
|
|
76
|
-
var Vt = /* @__PURE__ */ x({ atan2_: Bt });
|
|
77
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/atanh.js
|
|
78
|
-
function Ht(e) {
|
|
79
|
-
let t = { x: m(e, "x", "atanh") };
|
|
80
|
-
return T.runKernel(f, t);
|
|
81
|
-
}
|
|
82
|
-
var Ut = /* @__PURE__ */ x({ atanh_: Ht });
|
|
83
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/ceil.js
|
|
84
|
-
function Wt(e) {
|
|
85
|
-
let t = { x: m(e, "x", "ceil", "float32") };
|
|
86
|
-
return T.runKernel(i, t);
|
|
87
|
-
}
|
|
88
|
-
var Gt = /* @__PURE__ */ x({ ceil_: Wt });
|
|
89
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/depth_to_space.js
|
|
90
|
-
function Kt(e, t, n = "NHWC") {
|
|
91
|
-
let r = m(e, "x", "depthToSpace", "float32"), i = n === "NHWC" ? r.shape[1] : r.shape[2], a = n === "NHWC" ? r.shape[2] : r.shape[3], o = n === "NHWC" ? r.shape[3] : r.shape[1];
|
|
92
|
-
k(t > 1, () => `blockSize should be > 1 for depthToSpace, but was: ${t}`), k(i * t >= 0, () => `Negative dimension size caused by overflow when multiplying
|
|
93
|
-
${i} and ${t} for depthToSpace with input shape
|
|
94
|
-
${r.shape}`), k(a * t >= 0, () => `Negative dimension size caused by overflow when multiplying
|
|
95
|
-
${a} and ${t} for depthToSpace with input shape
|
|
96
|
-
${r.shape}`), k(o % (t * t) === 0, () => `Dimension size must be evenly divisible by ${t * t} but is ${o} for depthToSpace with input shape ${r.shape}`);
|
|
97
|
-
let s = { x: r }, c = {
|
|
98
|
-
blockSize: t,
|
|
99
|
-
dataFormat: n
|
|
100
|
-
};
|
|
101
|
-
return T.runKernel(pe, s, c);
|
|
102
|
-
}
|
|
103
|
-
var qt = /* @__PURE__ */ x({ depthToSpace_: Kt });
|
|
104
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/dilation2d.js
|
|
105
|
-
function Jt(e, t, n, r, i = [1, 1], a = "NHWC") {
|
|
106
|
-
let o = m(e, "x", "dilation2d"), s = m(t, "filter", "dilation2d");
|
|
107
|
-
k(o.rank === 3 || o.rank === 4, () => `Error in dilation2d: input must be rank 3 or 4, but got rank ${o.rank}.`), k(s.rank === 3, () => `Error in dilation2d: filter must be rank 3, but got rank ${s.rank}.`), k(a === "NHWC", () => `Error in dilation2d: Only NHWC is currently supported, but got dataFormat of ${a}`);
|
|
108
|
-
let c = o, l = !1;
|
|
109
|
-
o.rank === 3 && (c = B(o, [
|
|
110
|
-
1,
|
|
111
|
-
o.shape[0],
|
|
112
|
-
o.shape[1],
|
|
113
|
-
o.shape[2]
|
|
114
|
-
]), l = !0), k(c.shape[3] === s.shape[2], () => `Error in dilation2d: input and filter must have the same depth: ${c.shape[3]} vs ${s.shape[2]}`);
|
|
115
|
-
let u = {
|
|
116
|
-
x: c,
|
|
117
|
-
filter: s
|
|
118
|
-
}, d = {
|
|
119
|
-
strides: n,
|
|
120
|
-
pad: r,
|
|
121
|
-
dilations: i
|
|
122
|
-
}, f = T.runKernel(ie, u, d);
|
|
123
|
-
return l ? B(f, [
|
|
124
|
-
f.shape[1],
|
|
125
|
-
f.shape[2],
|
|
126
|
-
f.shape[3]
|
|
127
|
-
]) : f;
|
|
128
|
-
}
|
|
129
|
-
var Yt = /* @__PURE__ */ x({ dilation2d_: Jt });
|
|
130
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/div_no_nan.js
|
|
131
|
-
function Xt(e, t) {
|
|
132
|
-
let n = m(e, "a", "div"), r = m(t, "b", "div");
|
|
133
|
-
[n, r] = E(n, r);
|
|
134
|
-
let i = w(n, r), a = g(i), o = F(r, a);
|
|
135
|
-
return H(o, a, i);
|
|
136
|
-
}
|
|
137
|
-
var Zt = /* @__PURE__ */ x({ divNoNan_: Xt });
|
|
138
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/dot.js
|
|
139
|
-
function Qt(e, t) {
|
|
140
|
-
let n = m(e, "t1", "dot"), r = m(t, "t2", "dot");
|
|
141
|
-
k((n.rank === 1 || n.rank === 2) && (r.rank === 1 || r.rank === 2), () => `Error in dot: inputs must all be rank 1 or 2, but got ranks ${n.rank} and ${r.rank}.`);
|
|
142
|
-
let i = n.rank === 1 ? n.size : n.shape[1], a = r.rank === 1 ? r.size : r.shape[0];
|
|
143
|
-
if (k(i === a, () => `Error in dot: inner dimensions of inputs must match, but got ${i} and ${a}.`), n.rank === 1 && r.rank === 1) {
|
|
144
|
-
let e = B(n, [1, -1]), t = B(r, [-1, 1]), i = U(e, t);
|
|
145
|
-
return B(i, []);
|
|
146
|
-
}
|
|
147
|
-
if (n.rank === 1 && r.rank === 2) {
|
|
148
|
-
let e = B(n, [1, -1]), t = B(r, [r.shape[0], r.shape[1]]), i = U(e, t);
|
|
149
|
-
return B(i, [i.size]);
|
|
150
|
-
}
|
|
151
|
-
if (n.rank === 2 && r.rank === 1) {
|
|
152
|
-
let e = B(r, [-1, 1]), t = U(n, e);
|
|
153
|
-
return B(t, [t.size]);
|
|
154
|
-
}
|
|
155
|
-
{
|
|
156
|
-
let e = B(r, [r.shape[0], r.shape[1]]);
|
|
157
|
-
return U(n, e);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
var $t = /* @__PURE__ */ x({ dot_: Qt });
|
|
161
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/euclidean_norm.js
|
|
162
|
-
function en(e, t = null, n = !1) {
|
|
163
|
-
return G(e, "euclidean", t, n);
|
|
164
|
-
}
|
|
165
|
-
var tn = /* @__PURE__ */ x({ euclideanNorm_: en });
|
|
166
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/expm1.js
|
|
167
|
-
function nn(e) {
|
|
168
|
-
let t = { x: m(e, "x", "expm1") };
|
|
169
|
-
return T.runKernel(te, t);
|
|
170
|
-
}
|
|
171
|
-
var rn = /* @__PURE__ */ x({ expm1_: nn });
|
|
172
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/is_finite.js
|
|
173
|
-
function an(e) {
|
|
174
|
-
let t = { x: m(e, "x", "isFinite") };
|
|
175
|
-
return T.runKernel(a, t);
|
|
176
|
-
}
|
|
177
|
-
var on = /* @__PURE__ */ x({ isFinite_: an });
|
|
178
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/is_inf.js
|
|
179
|
-
function sn(e) {
|
|
180
|
-
let t = { x: m(e, "x", "isInf") };
|
|
181
|
-
return T.runKernel(s, t);
|
|
182
|
-
}
|
|
183
|
-
var cn = /* @__PURE__ */ x({ isInf_: sn });
|
|
184
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/is_nan.js
|
|
185
|
-
function ln(e) {
|
|
186
|
-
let t = { x: m(e, "x", "isNaN") };
|
|
187
|
-
return T.runKernel(h, t);
|
|
188
|
-
}
|
|
189
|
-
var un = /* @__PURE__ */ x({ isNaN_: ln });
|
|
190
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/local_response_normalization.js
|
|
191
|
-
function dn(e, t = 5, n = 1, r = 1, i = .5) {
|
|
192
|
-
let a = m(e, "x", "localResponseNormalization");
|
|
193
|
-
k(a.rank === 4 || a.rank === 3, () => `Error in localResponseNormalization: x must be rank 3 or 4 but got
|
|
194
|
-
rank ${a.rank}.`), k(u(t), () => `Error in localResponseNormalization: depthRadius must be an integer but got depthRadius ${t}.`);
|
|
195
|
-
let o = a, s = !1;
|
|
196
|
-
a.rank === 3 && (s = !0, o = B(a, [
|
|
197
|
-
1,
|
|
198
|
-
a.shape[0],
|
|
199
|
-
a.shape[1],
|
|
200
|
-
a.shape[2]
|
|
201
|
-
]));
|
|
202
|
-
let c = { x: o }, l = {
|
|
203
|
-
depthRadius: t,
|
|
204
|
-
bias: n,
|
|
205
|
-
alpha: r,
|
|
206
|
-
beta: i
|
|
207
|
-
}, d = T.runKernel("LRN", c, l);
|
|
208
|
-
return s ? B(d, [
|
|
209
|
-
d.shape[1],
|
|
210
|
-
d.shape[2],
|
|
211
|
-
d.shape[3]
|
|
212
|
-
]) : d;
|
|
213
|
-
}
|
|
214
|
-
var fn = /* @__PURE__ */ x({ localResponseNormalization_: dn });
|
|
215
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/log_sigmoid.js
|
|
216
|
-
function pn(e) {
|
|
217
|
-
let t = m(e, "x", "logSigmoid");
|
|
218
|
-
return le((e) => ({
|
|
219
|
-
value: Y(I(Y(e))),
|
|
220
|
-
gradFunc: (t) => p(t, W(Y(e)))
|
|
221
|
-
}))(t);
|
|
222
|
-
}
|
|
223
|
-
var mn = /* @__PURE__ */ x({ logSigmoid_: pn });
|
|
224
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/logical_or.js
|
|
225
|
-
function hn(e, t) {
|
|
226
|
-
let r = m(e, "a", "logicalOr", "bool"), i = m(t, "b", "logicalOr", "bool");
|
|
227
|
-
n(r.shape, i.shape);
|
|
228
|
-
let a = {
|
|
229
|
-
a: r,
|
|
230
|
-
b: i
|
|
231
|
-
};
|
|
232
|
-
return T.runKernel(o, a);
|
|
233
|
-
}
|
|
234
|
-
var Q = /* @__PURE__ */ x({ logicalOr_: hn });
|
|
235
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/logical_xor.js
|
|
236
|
-
function gn(e, t) {
|
|
237
|
-
let r = m(e, "a", "logicalXor", "bool"), i = m(t, "b", "logicalXor", "bool");
|
|
238
|
-
return n(r.shape, i.shape), K(Q(e, t), P(K(e, t)));
|
|
239
|
-
}
|
|
240
|
-
var _n = /* @__PURE__ */ x({ logicalXor_: gn });
|
|
241
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/mirror_pad.js
|
|
242
|
-
function vn(e, t, n) {
|
|
243
|
-
k(n === "reflect" || n === "symmetric", () => `Invalid mode. Mode must be either reflect or symmetric. Got ${n}.`);
|
|
244
|
-
let r = m(e, "x", "mirrorPad");
|
|
245
|
-
if (r.rank === 0) throw Error("mirrorPad(scalar) is not defined. Pass non-scalar to mirrorPad");
|
|
246
|
-
k(t.length === r.rank, () => `Padding doesn't match input. Must be ${r.rank}. Got ${t.length}.`);
|
|
247
|
-
let i = +(n === "reflect");
|
|
248
|
-
for (let e = 0; e < r.rank; e++) k(t[e].length === 2, () => "Invalid number of paddings. Must be length of 2 each."), k(t[e][0] >= 0 && t[e][0] <= r.shape[e] - i && t[e][1] >= 0 && t[e][1] <= r.shape[e] - i, () => `Padding in dimension ${e} cannot be greater than or equal to ${r.shape[e] - i} or less than 0 for input of shape ${r.shape}`);
|
|
249
|
-
let a = {
|
|
250
|
-
paddings: t,
|
|
251
|
-
mode: n
|
|
252
|
-
}, o = { x: r };
|
|
253
|
-
return T.runKernel(fe, o, a);
|
|
254
|
-
}
|
|
255
|
-
var yn = /* @__PURE__ */ x({ mirrorPad_: vn });
|
|
256
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/pool.js
|
|
257
|
-
function bn(e, t, n, r, i, a, o) {
|
|
258
|
-
i ??= [1, 1], a ??= 1, r === 0 && (r = "valid");
|
|
259
|
-
let s = m(e, "x", "maxPool"), c = s, l = !1;
|
|
260
|
-
s.rank === 3 && (l = !0, c = B(s, [
|
|
261
|
-
1,
|
|
262
|
-
s.shape[0],
|
|
263
|
-
s.shape[1],
|
|
264
|
-
s.shape[2]
|
|
265
|
-
])), k(Je(a, i), () => `Error in pool: Either strides or dilations must be 1. Got strides ${a} and dilations '${i}'`);
|
|
266
|
-
let u = qe(c.shape, t, a, i, r), d = [u.dilationHeight, u.dilationWidth], f;
|
|
267
|
-
f = r === "same" ? Sn([u.filterHeight, u.filterWidth], d) : [[0, 0], [0, 0]];
|
|
268
|
-
let p = d[0] === 1 && d[1] === 1, [ee, h] = xn([u.inHeight, u.inWidth], d, f), g = p ? r : "valid", _ = p ? c : N(c, d, ee), v = (n === "avg" ? () => j(_, t, a, g, o) : () => z(_, t, a, g, o))(), y = p ? v : A(v, d, h);
|
|
269
|
-
return l ? B(y, [
|
|
270
|
-
y.shape[1],
|
|
271
|
-
y.shape[2],
|
|
272
|
-
y.shape[3]
|
|
273
|
-
]) : y;
|
|
274
|
-
}
|
|
275
|
-
function xn(e, t, n) {
|
|
276
|
-
let r = n.map((e) => e[0]), i = n.map((e) => e[1]), a = e.concat(r, i), o = t.map((e, t) => (e - a[t] % e) % e), s = i.map((e, t) => e + o[t]);
|
|
277
|
-
return [t.map((e, t) => [r[t], s[t]]), t.map((e, t) => [0, o[t]])];
|
|
278
|
-
}
|
|
279
|
-
function Sn(e, t) {
|
|
280
|
-
let n = e.map((e, n) => e + (e - 1) * (t[n] - 1)).map((e) => e - 1), r = n.map((e) => Math.floor(e / 2)), i = n.map((e, t) => e - r[t]);
|
|
281
|
-
return n.map((e, t) => [r[t], i[t]]);
|
|
282
|
-
}
|
|
283
|
-
var Cn = /* @__PURE__ */ x({ pool_: bn });
|
|
284
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/prod.js
|
|
285
|
-
function wn(e, t = null, n = !1) {
|
|
286
|
-
let r = m(e, "x", "prod");
|
|
287
|
-
r.dtype === "bool" && (r = l(r, "int32"));
|
|
288
|
-
let i = { x: r }, a = {
|
|
289
|
-
axis: t,
|
|
290
|
-
keepDims: n
|
|
291
|
-
};
|
|
292
|
-
return T.runKernel(ae, i, a);
|
|
293
|
-
}
|
|
294
|
-
var Tn = /* @__PURE__ */ x({ prod_: wn });
|
|
295
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/reciprocal.js
|
|
296
|
-
function En(e) {
|
|
297
|
-
let t = { x: m(e, "x", "reciprocal") };
|
|
298
|
-
return T.runKernel(_, t);
|
|
299
|
-
}
|
|
300
|
-
var Dn = /* @__PURE__ */ x({ reciprocal_: En });
|
|
301
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/sign.js
|
|
302
|
-
function On(e) {
|
|
303
|
-
let t = { x: m(e, "x", "sign") };
|
|
304
|
-
return T.runKernel(_e, t);
|
|
305
|
-
}
|
|
306
|
-
var kn = /* @__PURE__ */ x({ sign_: On });
|
|
307
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/spectral/fft.js
|
|
308
|
-
function An(e) {
|
|
309
|
-
k(e.dtype === "complex64", () => `The dtype for tf.spectral.fft() must be complex64 but got ${e.dtype}.`);
|
|
310
|
-
let t = { input: e };
|
|
311
|
-
return T.runKernel("FFT", t);
|
|
312
|
-
}
|
|
313
|
-
var jn = /* @__PURE__ */ x({ fft_: An });
|
|
314
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/spectral/ifft.js
|
|
315
|
-
function Mn(e) {
|
|
316
|
-
k(e.dtype === "complex64", () => `The dtype for tf.spectral.ifft() must be complex64 but got ${e.dtype}.`);
|
|
317
|
-
let t = { input: e };
|
|
318
|
-
return T.runKernel(d, t);
|
|
319
|
-
}
|
|
320
|
-
var $ = /* @__PURE__ */ x({ ifft_: Mn });
|
|
321
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/spectral/irfft.js
|
|
322
|
-
function Nn(e) {
|
|
323
|
-
let t = e.shape[e.shape.length - 1], n = e.size / t, r;
|
|
324
|
-
if (t <= 2) r = $(B(e, [n, t]));
|
|
325
|
-
else {
|
|
326
|
-
let i = [n, 2 * (t - 1)], a = B(J(e), [n, t]), o = B(mt(e), [n, t]), s = R(X(a, [0, 1], [n, t - 2]), 1), c = p(R(X(o, [0, 1], [n, t - 2]), 1), S(-1)), l = V([a, s], 1), u = V([o, c], 1);
|
|
327
|
-
r = $(B(q(l, u), [i[0], i[1]]));
|
|
328
|
-
}
|
|
329
|
-
if (r = J(r), e.rank === 3 && e.shape[0] !== 0) {
|
|
330
|
-
let t = r, n = e.shape[0];
|
|
331
|
-
r = B(r, [
|
|
332
|
-
n,
|
|
333
|
-
r.shape[0] / n,
|
|
334
|
-
r.shape[1]
|
|
335
|
-
]), t.dispose();
|
|
336
|
-
}
|
|
337
|
-
return r;
|
|
338
|
-
}
|
|
339
|
-
var Pn = /* @__PURE__ */ x({ irfft_: Nn });
|
|
340
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/spectral/rfft.js
|
|
341
|
-
function Fn(e, t) {
|
|
342
|
-
k(e.dtype === "float32", () => `The dtype for rfft() must be real value but got ${e.dtype}`);
|
|
343
|
-
let n = e.shape[e.shape.length - 1], r = e.size / n, i;
|
|
344
|
-
if (t != null && t < n) {
|
|
345
|
-
let r = e.shape.map((e) => 0), a = e.shape.map((e) => e);
|
|
346
|
-
a[e.shape.length - 1] = t, i = X(e, r, a), n = t;
|
|
347
|
-
} else if (t != null && t > n) {
|
|
348
|
-
let r = e.shape.map((e) => e);
|
|
349
|
-
r[e.shape.length - 1] = t - n, i = V([e, bt(r)], e.shape.length - 1), n = t;
|
|
350
|
-
} else i = e;
|
|
351
|
-
let a = g(i), o = jn(B(q(i, a), [r, n])), s = Math.floor(n / 2) + 1, c = J(o), l = mt(o), u = Z(c, [s, n - s], c.shape.length - 1), d = Z(l, [s, n - s], l.shape.length - 1), f = i.shape.slice();
|
|
352
|
-
return f[i.shape.length - 1] = s, B(q(u[0], d[0]), f);
|
|
353
|
-
}
|
|
354
|
-
var In = /* @__PURE__ */ x({ rfft_: Fn });
|
|
355
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/strided_slice.js
|
|
356
|
-
function Ln(e, t, n, r, i = 0, a = 0, o = 0, s = 0, c = 0) {
|
|
357
|
-
let l = { x: m(e, "x", "stridedSlice", "string_or_numeric") }, u = {
|
|
358
|
-
begin: t,
|
|
359
|
-
end: n,
|
|
360
|
-
strides: r,
|
|
361
|
-
beginMask: i,
|
|
362
|
-
endMask: a,
|
|
363
|
-
ellipsisMask: o,
|
|
364
|
-
newAxisMask: s,
|
|
365
|
-
shrinkAxisMask: c
|
|
366
|
-
};
|
|
367
|
-
return T.runKernel(ue, l, u);
|
|
368
|
-
}
|
|
369
|
-
var Rn = /* @__PURE__ */ x({ stridedSlice_: Ln });
|
|
370
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/tan.js
|
|
371
|
-
function zn(e) {
|
|
372
|
-
let t = { x: m(e, "x", "tan", "float32") };
|
|
373
|
-
return T.runKernel("Tan", t);
|
|
374
|
-
}
|
|
375
|
-
var Bn = /* @__PURE__ */ x({ tan_: zn });
|
|
376
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/unique.js
|
|
377
|
-
function Vn(e, t = 0) {
|
|
378
|
-
let n = m(e, "x", "unique", "string_or_numeric");
|
|
379
|
-
k(n.rank > 0, () => "The input tensor must be at least 1D");
|
|
380
|
-
let r = { x: n }, i = { axis: t }, [a, o] = T.runKernel(re, r, i);
|
|
381
|
-
return {
|
|
382
|
-
values: a,
|
|
383
|
-
indices: o
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
var Hn = /* @__PURE__ */ x({ unique_: Vn });
|
|
387
|
-
// node_modules/@tensorflow/tfjs-core/dist/public/chained_ops/zeros_like.js
|
|
388
|
-
C().prototype.abs = function() {
|
|
389
|
-
return this.throwIfDisposed(), r(this);
|
|
390
|
-
}, C().prototype.acos = function() {
|
|
391
|
-
return this.throwIfDisposed(), kt(this);
|
|
392
|
-
}, C().prototype.acosh = function() {
|
|
393
|
-
return this.throwIfDisposed(), jt(this);
|
|
394
|
-
}, C().prototype.add = function(e) {
|
|
395
|
-
return this.throwIfDisposed(), oe(this, e);
|
|
396
|
-
}, C().prototype.all = function(e, t) {
|
|
397
|
-
return this.throwIfDisposed(), De(this, e, t);
|
|
398
|
-
}, C().prototype.any = function(e, t) {
|
|
399
|
-
return this.throwIfDisposed(), ve(this, e, t);
|
|
400
|
-
}, C().prototype.argMax = function(e) {
|
|
401
|
-
return this.throwIfDisposed(), Oe(this, e);
|
|
402
|
-
}, C().prototype.argMin = function(e) {
|
|
403
|
-
return this.throwIfDisposed(), Nt(this, e);
|
|
404
|
-
}, C().prototype.asScalar = function() {
|
|
405
|
-
return this.throwIfDisposed(), k(this.size === 1, () => "The array must have only 1 element."), B(this, []);
|
|
406
|
-
}, C().prototype.asType = function(e) {
|
|
407
|
-
return this.throwIfDisposed(), l(this, e);
|
|
408
|
-
}, C().prototype.as1D = function() {
|
|
409
|
-
return this.throwIfDisposed(), B(this, [this.size]);
|
|
410
|
-
}, C().prototype.as2D = function(e, t) {
|
|
411
|
-
return this.throwIfDisposed(), B(this, [e, t]);
|
|
412
|
-
}, C().prototype.as3D = function(e, t, n) {
|
|
413
|
-
return this.throwIfDisposed(), B(this, [
|
|
414
|
-
e,
|
|
415
|
-
t,
|
|
416
|
-
n
|
|
417
|
-
]);
|
|
418
|
-
}, C().prototype.as4D = function(e, t, n, r) {
|
|
419
|
-
return this.throwIfDisposed(), B(this, [
|
|
420
|
-
e,
|
|
421
|
-
t,
|
|
422
|
-
n,
|
|
423
|
-
r
|
|
424
|
-
]);
|
|
425
|
-
}, C().prototype.as5D = function(e, t, n, r, i) {
|
|
426
|
-
return this.throwIfDisposed(), B(this, [
|
|
427
|
-
e,
|
|
428
|
-
t,
|
|
429
|
-
n,
|
|
430
|
-
r,
|
|
431
|
-
i
|
|
432
|
-
]);
|
|
433
|
-
}, C().prototype.asin = function() {
|
|
434
|
-
return this.throwIfDisposed(), Ft(this);
|
|
435
|
-
}, C().prototype.asinh = function() {
|
|
436
|
-
return this.throwIfDisposed(), Lt(this);
|
|
437
|
-
}, C().prototype.atan = function() {
|
|
438
|
-
return this.throwIfDisposed(), zt(this);
|
|
439
|
-
}, C().prototype.atan2 = function(e) {
|
|
440
|
-
return this.throwIfDisposed(), Vt(this, e);
|
|
441
|
-
}, C().prototype.atanh = function() {
|
|
442
|
-
return this.throwIfDisposed(), Ut(this);
|
|
443
|
-
}, C().prototype.avgPool = function(e, t, n, r) {
|
|
444
|
-
return this.throwIfDisposed(), j(this, e, t, n, r);
|
|
445
|
-
}, C().prototype.batchToSpaceND = function(e, t) {
|
|
446
|
-
return this.throwIfDisposed(), A(this, e, t);
|
|
447
|
-
}, C().prototype.batchNorm = function(e, t, n, r, i) {
|
|
448
|
-
return this.throwIfDisposed(), xe(this, e, t, n, r, i);
|
|
449
|
-
}, C().prototype.broadcastTo = function(e) {
|
|
450
|
-
return this.throwIfDisposed(), Re(this, e);
|
|
451
|
-
}, C().prototype.cast = function(e) {
|
|
452
|
-
return this.throwIfDisposed(), l(this, e);
|
|
453
|
-
}, C().prototype.ceil = function() {
|
|
454
|
-
return this.throwIfDisposed(), Gt(this);
|
|
455
|
-
}, C().prototype.clipByValue = function(e, t) {
|
|
456
|
-
return this.throwIfDisposed(), ze(this, e, t);
|
|
457
|
-
}, C().prototype.concat = function(e, t) {
|
|
458
|
-
return this.throwIfDisposed(), e instanceof D && (e = [e]), V([this, ...e], t);
|
|
459
|
-
}, C().prototype.conv1d = function(e, t, n, r, i, a) {
|
|
460
|
-
return this.throwIfDisposed(), ye(this, e, t, n, r, i, a);
|
|
461
|
-
}, C().prototype.conv2dTranspose = function(e, t, n, r, i) {
|
|
462
|
-
return this.throwIfDisposed(), Ie(this, e, t, n, r, i);
|
|
463
|
-
}, C().prototype.conv2d = function(e, t, n, r, i, a) {
|
|
464
|
-
return this.throwIfDisposed(), Fe(this, e, t, n, r, i, a);
|
|
465
|
-
}, C().prototype.cos = function() {
|
|
466
|
-
return this.throwIfDisposed(), M(this);
|
|
467
|
-
}, C().prototype.cosh = function() {
|
|
468
|
-
return this.throwIfDisposed(), Le(this);
|
|
469
|
-
}, C().prototype.cumprod = function(e, t, n) {
|
|
470
|
-
return this.throwIfDisposed(), Pe(this, e, t, n);
|
|
471
|
-
}, C().prototype.cumsum = function(e, t, n) {
|
|
472
|
-
return this.throwIfDisposed(), Se(this, e, t, n);
|
|
473
|
-
}, C().prototype.depthToSpace = function(e, t) {
|
|
474
|
-
return this.throwIfDisposed(), qt(this, e, t);
|
|
475
|
-
}, C().prototype.depthwiseConv2d = function(e, t, n, r, i, a) {
|
|
476
|
-
return this.throwIfDisposed(), Te(this, e, t, n, r, i, a);
|
|
477
|
-
}, C().prototype.dilation2d = function(e, t, n, r, i) {
|
|
478
|
-
return this.throwIfDisposed(), Yt(this, e, t, n, r, i);
|
|
479
|
-
}, C().prototype.divNoNan = function(e) {
|
|
480
|
-
return this.throwIfDisposed(), Zt(this, e);
|
|
481
|
-
}, C().prototype.div = function(e) {
|
|
482
|
-
return this.throwIfDisposed(), w(this, e);
|
|
483
|
-
}, C().prototype.dot = function(e) {
|
|
484
|
-
return this.throwIfDisposed(), $t(this, e);
|
|
485
|
-
}, C().prototype.elu = function() {
|
|
486
|
-
return this.throwIfDisposed(), Ke(this);
|
|
487
|
-
}, C().prototype.equal = function(e) {
|
|
488
|
-
return this.throwIfDisposed(), F(this, e);
|
|
489
|
-
}, C().prototype.erf = function() {
|
|
490
|
-
return this.throwIfDisposed(), Ae(this);
|
|
491
|
-
}, C().prototype.euclideanNorm = function(e, t) {
|
|
492
|
-
return this.throwIfDisposed(), tn(this, e, t);
|
|
493
|
-
}, C().prototype.exp = function() {
|
|
494
|
-
return this.throwIfDisposed(), Be(this);
|
|
495
|
-
}, C().prototype.expandDims = function(e) {
|
|
496
|
-
return this.throwIfDisposed(), dt(this, e);
|
|
497
|
-
}, C().prototype.expm1 = function() {
|
|
498
|
-
return this.throwIfDisposed(), rn(this);
|
|
499
|
-
}, C().prototype.fft = function() {
|
|
500
|
-
return this.throwIfDisposed(), jn(this);
|
|
501
|
-
}, C().prototype.flatten = function() {
|
|
502
|
-
return this.throwIfDisposed(), B(this, [this.size]);
|
|
503
|
-
}, C().prototype.floor = function() {
|
|
504
|
-
return this.throwIfDisposed(), ft(this);
|
|
505
|
-
}, C().prototype.floorDiv = function(t) {
|
|
506
|
-
return this.throwIfDisposed(), e(this, t);
|
|
507
|
-
}, C().prototype.gather = function(e, t, n) {
|
|
508
|
-
return this.throwIfDisposed(), pt(this, e, t, n);
|
|
509
|
-
}, C().prototype.greaterEqual = function(e) {
|
|
510
|
-
return this.throwIfDisposed(), tt(this, e);
|
|
511
|
-
}, C().prototype.greater = function(e) {
|
|
512
|
-
return this.throwIfDisposed(), nt(this, e);
|
|
513
|
-
}, C().prototype.ifft = function() {
|
|
514
|
-
return this.throwIfDisposed(), $(this);
|
|
515
|
-
}, C().prototype.irfft = function() {
|
|
516
|
-
return this.throwIfDisposed(), Pn(this);
|
|
517
|
-
}, C().prototype.isFinite = function() {
|
|
518
|
-
return this.throwIfDisposed(), on(this);
|
|
519
|
-
}, C().prototype.isInf = function() {
|
|
520
|
-
return this.throwIfDisposed(), cn(this);
|
|
521
|
-
}, C().prototype.isNaN = function() {
|
|
522
|
-
return this.throwIfDisposed(), un(this);
|
|
523
|
-
}, C().prototype.leakyRelu = function(e) {
|
|
524
|
-
return this.throwIfDisposed(), Ye(this, e);
|
|
525
|
-
}, C().prototype.lessEqual = function(e) {
|
|
526
|
-
return this.throwIfDisposed(), it(this, e);
|
|
527
|
-
}, C().prototype.less = function(e) {
|
|
528
|
-
return this.throwIfDisposed(), ut(this, e);
|
|
529
|
-
}, C().prototype.localResponseNormalization = function(e, t, n, r) {
|
|
530
|
-
return this.throwIfDisposed(), fn(this, e, t, n, r);
|
|
531
|
-
}, C().prototype.logSigmoid = function() {
|
|
532
|
-
return this.throwIfDisposed(), mn(this);
|
|
533
|
-
}, C().prototype.logSoftmax = function(e) {
|
|
534
|
-
return this.throwIfDisposed(), we(this, e);
|
|
535
|
-
}, C().prototype.logSumExp = function(e, t) {
|
|
536
|
-
return this.throwIfDisposed(), We(this, e, t);
|
|
537
|
-
}, C().prototype.log = function() {
|
|
538
|
-
return this.throwIfDisposed(), Ve(this);
|
|
539
|
-
}, C().prototype.log1p = function() {
|
|
540
|
-
return this.throwIfDisposed(), et(this);
|
|
541
|
-
}, C().prototype.logicalAnd = function(e) {
|
|
542
|
-
return this.throwIfDisposed(), K(this, e);
|
|
543
|
-
}, C().prototype.logicalNot = function() {
|
|
544
|
-
return this.throwIfDisposed(), P(this);
|
|
545
|
-
}, C().prototype.logicalOr = function(e) {
|
|
546
|
-
return this.throwIfDisposed(), Q(this, e);
|
|
547
|
-
}, C().prototype.logicalXor = function(e) {
|
|
548
|
-
return this.throwIfDisposed(), _n(this, e);
|
|
549
|
-
}, C().prototype.matMul = function(e, t, n) {
|
|
550
|
-
return this.throwIfDisposed(), U(this, e, t, n);
|
|
551
|
-
}, C().prototype.maxPool = function(e, t, n, r) {
|
|
552
|
-
return this.throwIfDisposed(), z(this, e, t, n, r);
|
|
553
|
-
}, C().prototype.max = function(e, t) {
|
|
554
|
-
return this.throwIfDisposed(), Ue(this, e, t);
|
|
555
|
-
}, C().prototype.maximum = function(e) {
|
|
556
|
-
return this.throwIfDisposed(), ne(this, e);
|
|
557
|
-
}, C().prototype.mean = function(e, t) {
|
|
558
|
-
return this.throwIfDisposed(), He(this, e, t);
|
|
559
|
-
}, C().prototype.min = function(e, t) {
|
|
560
|
-
return this.throwIfDisposed(), at(this, e, t);
|
|
561
|
-
}, C().prototype.minimum = function(e) {
|
|
562
|
-
return this.throwIfDisposed(), st(this, e);
|
|
563
|
-
}, C().prototype.mirrorPad = function(e, t) {
|
|
564
|
-
return this.throwIfDisposed(), yn(this, e, t);
|
|
565
|
-
}, C().prototype.mod = function(e) {
|
|
566
|
-
return this.throwIfDisposed(), gt(this, e);
|
|
567
|
-
}, C().prototype.mul = function(e) {
|
|
568
|
-
return this.throwIfDisposed(), p(this, e);
|
|
569
|
-
}, C().prototype.neg = function() {
|
|
570
|
-
return this.throwIfDisposed(), Y(this);
|
|
571
|
-
}, C().prototype.norm = function(e, t, n) {
|
|
572
|
-
return this.throwIfDisposed(), G(this, e, t, n);
|
|
573
|
-
}, C().prototype.notEqual = function(e) {
|
|
574
|
-
return this.throwIfDisposed(), Ge(this, e);
|
|
575
|
-
}, C().prototype.oneHot = function(e, t = 1, n = 0) {
|
|
576
|
-
return this.throwIfDisposed(), _t(this, e, t, n);
|
|
577
|
-
}, C().prototype.onesLike = function() {
|
|
578
|
-
return this.throwIfDisposed(), ke(this);
|
|
579
|
-
}, C().prototype.pad = function(e, t) {
|
|
580
|
-
return this.throwIfDisposed(), vt(this, e, t);
|
|
581
|
-
}, C().prototype.pool = function(e, t, n, r, i, a) {
|
|
582
|
-
return this.throwIfDisposed(), Cn(this, e, t, n, r, i, a);
|
|
583
|
-
}, C().prototype.pow = function(e) {
|
|
584
|
-
return this.throwIfDisposed(), O(this, e);
|
|
585
|
-
}, C().prototype.prelu = function(e) {
|
|
586
|
-
return this.throwIfDisposed(), Ze(this, e);
|
|
587
|
-
}, C().prototype.prod = function(e, t) {
|
|
588
|
-
return this.throwIfDisposed(), Tn(this, e, t);
|
|
589
|
-
}, C().prototype.reciprocal = function() {
|
|
590
|
-
return this.throwIfDisposed(), Dn(this);
|
|
591
|
-
}, C().prototype.relu = function() {
|
|
592
|
-
return this.throwIfDisposed(), yt(this);
|
|
593
|
-
}, C().prototype.relu6 = function() {
|
|
594
|
-
return this.throwIfDisposed(), Xe(this);
|
|
595
|
-
}, C().prototype.reshapeAs = function(e) {
|
|
596
|
-
return this.throwIfDisposed(), B(this, e.shape);
|
|
597
|
-
}, C().prototype.reshape = function(e) {
|
|
598
|
-
return this.throwIfDisposed(), B(this, e);
|
|
599
|
-
}, C().prototype.resizeBilinear = function(e, t, n) {
|
|
600
|
-
return this.throwIfDisposed(), ot(this, e, t, n);
|
|
601
|
-
}, C().prototype.resizeNearestNeighbor = function(e, t, n) {
|
|
602
|
-
return this.throwIfDisposed(), lt(this, e, t, n);
|
|
603
|
-
}, C().prototype.reverse = function(e) {
|
|
604
|
-
return this.throwIfDisposed(), R(this, e);
|
|
605
|
-
}, C().prototype.rfft = function() {
|
|
606
|
-
return this.throwIfDisposed(), In(this);
|
|
607
|
-
}, C().prototype.round = function() {
|
|
608
|
-
return this.throwIfDisposed(), $e(this);
|
|
609
|
-
}, C().prototype.rsqrt = function() {
|
|
610
|
-
return this.throwIfDisposed(), Me(this);
|
|
611
|
-
}, C().prototype.selu = function() {
|
|
612
|
-
return this.throwIfDisposed(), Ce(this);
|
|
613
|
-
}, C().prototype.separableConv2d = function(e, t, n, r, i, a) {
|
|
614
|
-
return this.throwIfDisposed(), Ee(this, e, t, n, r, i, a);
|
|
615
|
-
}, C().prototype.sigmoid = function() {
|
|
616
|
-
return this.throwIfDisposed(), W(this);
|
|
617
|
-
}, C().prototype.sign = function() {
|
|
618
|
-
return this.throwIfDisposed(), kn(this);
|
|
619
|
-
}, C().prototype.sin = function() {
|
|
620
|
-
return this.throwIfDisposed(), L(this);
|
|
621
|
-
}, C().prototype.sinh = function() {
|
|
622
|
-
return this.throwIfDisposed(), je(this);
|
|
623
|
-
}, C().prototype.slice = function(e, t) {
|
|
624
|
-
return this.throwIfDisposed(), X(this, e, t);
|
|
625
|
-
}, C().prototype.softmax = function(e) {
|
|
626
|
-
return this.throwIfDisposed(), St(this, e);
|
|
627
|
-
}, C().prototype.softplus = function() {
|
|
628
|
-
return this.throwIfDisposed(), I(this);
|
|
629
|
-
}, C().prototype.spaceToBatchND = function(e, t) {
|
|
630
|
-
return this.throwIfDisposed(), N(this, e, t);
|
|
631
|
-
}, C().prototype.split = function(e, t) {
|
|
632
|
-
return this.throwIfDisposed(), Z(this, e, t);
|
|
633
|
-
}, C().prototype.sqrt = function() {
|
|
634
|
-
return this.throwIfDisposed(), ge(this);
|
|
635
|
-
}, C().prototype.square = function() {
|
|
636
|
-
return this.throwIfDisposed(), me(this);
|
|
637
|
-
}, C().prototype.squaredDifference = function(e) {
|
|
638
|
-
return this.throwIfDisposed(), rt(this, e);
|
|
639
|
-
}, C().prototype.squeeze = function(e) {
|
|
640
|
-
return this.throwIfDisposed(), Ct(this, e);
|
|
641
|
-
}, C().prototype.stack = function(e, t) {
|
|
642
|
-
this.throwIfDisposed();
|
|
643
|
-
let n = e instanceof D ? [this, e] : [this, ...e];
|
|
644
|
-
return wt(n, t);
|
|
645
|
-
}, C().prototype.step = function(e) {
|
|
646
|
-
return this.throwIfDisposed(), Qe(this, e);
|
|
647
|
-
}, C().prototype.stridedSlice = function(e, t, n, r, i, a, o, s) {
|
|
648
|
-
return this.throwIfDisposed(), Rn(this, e, t, n, r, i, a, o, s);
|
|
649
|
-
}, C().prototype.sub = function(e) {
|
|
650
|
-
return this.throwIfDisposed(), de(this, e);
|
|
651
|
-
}, C().prototype.sum = function(e, t) {
|
|
652
|
-
return this.throwIfDisposed(), Tt(this, e, t);
|
|
653
|
-
}, C().prototype.tan = function() {
|
|
654
|
-
return this.throwIfDisposed(), Bn(this);
|
|
655
|
-
}, C().prototype.tanh = function() {
|
|
656
|
-
return this.throwIfDisposed(), be(this);
|
|
657
|
-
}, C().prototype.tile = function(e) {
|
|
658
|
-
return this.throwIfDisposed(), Et(this, e);
|
|
659
|
-
}, C().prototype.toBool = function() {
|
|
660
|
-
return this.throwIfDisposed(), l(this, "bool");
|
|
661
|
-
}, C().prototype.toFloat = function() {
|
|
662
|
-
return this.throwIfDisposed(), l(this, "float32");
|
|
663
|
-
}, C().prototype.toInt = function() {
|
|
664
|
-
return this.throwIfDisposed(), l(this, "int32");
|
|
665
|
-
}, C().prototype.topk = function(e, t) {
|
|
666
|
-
return this.throwIfDisposed(), Dt(this, e, t);
|
|
667
|
-
}, C().prototype.transpose = function(e) {
|
|
668
|
-
return this.throwIfDisposed(), ht(this, e);
|
|
669
|
-
}, C().prototype.unique = function(e) {
|
|
670
|
-
return this.throwIfDisposed(), Hn(this, e);
|
|
671
|
-
}, C().prototype.unsortedSegmentSum = function(e, t) {
|
|
672
|
-
return this.throwIfDisposed(), Ne(this, e, t);
|
|
673
|
-
}, C().prototype.unstack = function(e) {
|
|
674
|
-
return this.throwIfDisposed(), ct(this, e);
|
|
675
|
-
}, C().prototype.where = function(e, t) {
|
|
676
|
-
return this.throwIfDisposed(), H(e, this, t);
|
|
677
|
-
}, C().prototype.zerosLike = function() {
|
|
678
|
-
return this.throwIfDisposed(), g(this);
|
|
679
|
-
};
|
|
680
|
-
// lib/layers/RoPECache.ts
|
|
681
|
-
var Un = class {
|
|
682
|
-
config;
|
|
683
|
-
rotaryDim;
|
|
684
|
-
ropeBase;
|
|
685
|
-
ropeInvFreq;
|
|
686
|
-
ropeCos = null;
|
|
687
|
-
ropeSin = null;
|
|
688
|
-
ropeNegSin = null;
|
|
689
|
-
ropeCacheLen = 0;
|
|
690
|
-
constructor(e) {
|
|
691
|
-
this.config = e;
|
|
692
|
-
let t = this.config.nEmbed / this.config.nHead;
|
|
693
|
-
if (this.rotaryDim = t, this.rotaryDim % 2 != 0) throw Error("rotaryDim must be even");
|
|
694
|
-
let n = this.config.ropeTheta ?? 1e4;
|
|
695
|
-
this.ropeBase = n;
|
|
696
|
-
let r = xt(0, this.rotaryDim, 2, "float32"), i = w(r, S(this.rotaryDim, "float32")), a = O(S(this.ropeBase, "float32"), i);
|
|
697
|
-
this.ropeInvFreq = Dn(a), i.dispose(), a.dispose(), r.dispose(), (this.config.modelType === "GenAI_NanoGPT_v1" ? this.config.useRope ?? !0 : !0) === !1 ? (this.ropeCos = null, this.ropeSin = null, this.ropeNegSin = null, this.ropeCacheLen = 0) : b(() => {
|
|
698
|
-
this.ensureRopeCache(this.config.blockSize * 4);
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
|
-
ensureRopeCache(e) {
|
|
702
|
-
b(() => {
|
|
703
|
-
if (e <= this.ropeCacheLen) return;
|
|
704
|
-
this.ropeCos && this.ropeCos.dispose(), this.ropeSin && this.ropeSin.dispose();
|
|
705
|
-
let t = Math.max(e, this.ropeCacheLen + this.config.blockSize * 4), n = xt(0, t, 1, "float32").expandDims(1).mul(this.ropeInvFreq.expandDims(0));
|
|
706
|
-
this.ropeCos = y(M(n).expandDims(-1)), this.ropeSin = y(L(n).expandDims(-1)), this.ropeNegSin = y(this.ropeSin.neg()), this.ropeCacheLen = t;
|
|
707
|
-
});
|
|
708
|
-
}
|
|
709
|
-
getCos() {
|
|
710
|
-
return this.ropeCos;
|
|
711
|
-
}
|
|
712
|
-
getSin() {
|
|
713
|
-
return this.ropeSin;
|
|
714
|
-
}
|
|
715
|
-
getNegSin() {
|
|
716
|
-
return this.ropeNegSin;
|
|
717
|
-
}
|
|
718
|
-
dispose() {
|
|
719
|
-
this.ropeCos && this.ropeCos.dispose(), this.ropeSin && this.ropeSin.dispose(), this.ropeInvFreq.dispose();
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
export { Un as t };
|