@genai-fi/nanogpt 1.6.0 → 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-BcR_14Cj.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
|
@@ -0,0 +1,1081 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-CwxnZyOB.js";
|
|
2
|
+
import { Ai as t, At as n, Ct as r, Di as i, I as a, Ji as o, Jn as s, Kr as c, M as l, Mi as u, Mr as d, N as f, Ni as p, Nr as m, Oi as h, Sr as g, St as _, V as v, Vi as y, Yi as b, _t as x, a as S, at as C, c as w, dt as T, i as ee, j as E, jr as D, jt as O, li as k, n as A, o as te, ot as j, r as ne, s as re, t as ie, ta as M, tn as ae } from "./dist-JOPw9zTN.js";
|
|
3
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/complex.js
|
|
4
|
+
function oe(e, n) {
|
|
5
|
+
let r = j(e, "real", "complex"), i = j(n, "imag", "complex");
|
|
6
|
+
t(r.shape, i.shape, `real and imag shapes, ${r.shape} and ${i.shape}, must match in call to tf.complex().`);
|
|
7
|
+
let a = {
|
|
8
|
+
real: r,
|
|
9
|
+
imag: i
|
|
10
|
+
};
|
|
11
|
+
return T.runKernel(ae, a);
|
|
12
|
+
}
|
|
13
|
+
var N = /* @__PURE__ */ C({ complex_: oe });
|
|
14
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/conv_util.js
|
|
15
|
+
function P(e, t, n, r, i = "NHWC", a) {
|
|
16
|
+
let o = e[3];
|
|
17
|
+
return F(e, [...t, o], n, a, r, null, null, G(i));
|
|
18
|
+
}
|
|
19
|
+
function se(e, t, n, r, i, a, o = "channelsLast") {
|
|
20
|
+
let [s, c] = R(t), l;
|
|
21
|
+
if (o === "channelsLast") l = [
|
|
22
|
+
s,
|
|
23
|
+
c,
|
|
24
|
+
e[3],
|
|
25
|
+
e[3]
|
|
26
|
+
];
|
|
27
|
+
else if (o === "channelsFirst") l = [
|
|
28
|
+
s,
|
|
29
|
+
c,
|
|
30
|
+
e[1],
|
|
31
|
+
e[1]
|
|
32
|
+
];
|
|
33
|
+
else throw Error(`Unknown dataFormat ${o}`);
|
|
34
|
+
return F(e, l, n, r, i, a, !1, o);
|
|
35
|
+
}
|
|
36
|
+
function ce(e, t, n, r, i, a, o = "NDHWC") {
|
|
37
|
+
let [s, c, l] = z(t), u, d;
|
|
38
|
+
if (o === "NDHWC") d = "channelsLast", u = [
|
|
39
|
+
s,
|
|
40
|
+
c,
|
|
41
|
+
l,
|
|
42
|
+
e[4],
|
|
43
|
+
e[4]
|
|
44
|
+
];
|
|
45
|
+
else if (o === "NCDHW") d = "channelsFirst", u = [
|
|
46
|
+
s,
|
|
47
|
+
c,
|
|
48
|
+
l,
|
|
49
|
+
e[1],
|
|
50
|
+
e[1]
|
|
51
|
+
];
|
|
52
|
+
else throw Error(`Unknown dataFormat ${o}`);
|
|
53
|
+
return I(e, u, n, r, i, !1, d, a);
|
|
54
|
+
}
|
|
55
|
+
function F(e, t, n, r, i, a, o = !1, s = "channelsLast") {
|
|
56
|
+
let [c, l, u, d] = [
|
|
57
|
+
-1,
|
|
58
|
+
-1,
|
|
59
|
+
-1,
|
|
60
|
+
-1
|
|
61
|
+
];
|
|
62
|
+
if (s === "channelsLast") [c, l, u, d] = e;
|
|
63
|
+
else if (s === "channelsFirst") [c, d, l, u] = e;
|
|
64
|
+
else throw Error(`Unknown dataFormat ${s}`);
|
|
65
|
+
let [f, p, , m] = t, [h, g] = R(n), [_, v] = R(r), y = B(f, _), b = B(p, v), { padInfo: x, outHeight: S, outWidth: C } = de(i, l, u, h, g, y, b, a, s), w = o ? m * d : m, T;
|
|
66
|
+
return s === "channelsFirst" ? T = [
|
|
67
|
+
c,
|
|
68
|
+
w,
|
|
69
|
+
S,
|
|
70
|
+
C
|
|
71
|
+
] : s === "channelsLast" && (T = [
|
|
72
|
+
c,
|
|
73
|
+
S,
|
|
74
|
+
C,
|
|
75
|
+
w
|
|
76
|
+
]), {
|
|
77
|
+
batchSize: c,
|
|
78
|
+
dataFormat: s,
|
|
79
|
+
inHeight: l,
|
|
80
|
+
inWidth: u,
|
|
81
|
+
inChannels: d,
|
|
82
|
+
outHeight: S,
|
|
83
|
+
outWidth: C,
|
|
84
|
+
outChannels: w,
|
|
85
|
+
padInfo: x,
|
|
86
|
+
strideHeight: h,
|
|
87
|
+
strideWidth: g,
|
|
88
|
+
filterHeight: f,
|
|
89
|
+
filterWidth: p,
|
|
90
|
+
effectiveFilterHeight: y,
|
|
91
|
+
effectiveFilterWidth: b,
|
|
92
|
+
dilationHeight: _,
|
|
93
|
+
dilationWidth: v,
|
|
94
|
+
inShape: e,
|
|
95
|
+
outShape: T,
|
|
96
|
+
filterShape: t
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function I(e, t, n, r, i, a = !1, o = "channelsLast", s) {
|
|
100
|
+
let [c, l, u, d, f] = [
|
|
101
|
+
-1,
|
|
102
|
+
-1,
|
|
103
|
+
-1,
|
|
104
|
+
-1,
|
|
105
|
+
-1
|
|
106
|
+
];
|
|
107
|
+
if (o === "channelsLast") [c, l, u, d, f] = e;
|
|
108
|
+
else if (o === "channelsFirst") [c, f, l, u, d] = e;
|
|
109
|
+
else throw Error(`Unknown dataFormat ${o}`);
|
|
110
|
+
let [p, m, h, , g] = t, [_, v, y] = z(n), [b, x, S] = z(r), C = B(p, b), w = B(m, x), T = B(h, S), { padInfo: ee, outDepth: E, outHeight: D, outWidth: O } = fe(i, l, u, d, _, v, y, C, w, T, s), k = a ? g * f : g, A;
|
|
111
|
+
return o === "channelsFirst" ? A = [
|
|
112
|
+
c,
|
|
113
|
+
k,
|
|
114
|
+
E,
|
|
115
|
+
D,
|
|
116
|
+
O
|
|
117
|
+
] : o === "channelsLast" && (A = [
|
|
118
|
+
c,
|
|
119
|
+
E,
|
|
120
|
+
D,
|
|
121
|
+
O,
|
|
122
|
+
k
|
|
123
|
+
]), {
|
|
124
|
+
batchSize: c,
|
|
125
|
+
dataFormat: o,
|
|
126
|
+
inDepth: l,
|
|
127
|
+
inHeight: u,
|
|
128
|
+
inWidth: d,
|
|
129
|
+
inChannels: f,
|
|
130
|
+
outDepth: E,
|
|
131
|
+
outHeight: D,
|
|
132
|
+
outWidth: O,
|
|
133
|
+
outChannels: k,
|
|
134
|
+
padInfo: ee,
|
|
135
|
+
strideDepth: _,
|
|
136
|
+
strideHeight: v,
|
|
137
|
+
strideWidth: y,
|
|
138
|
+
filterDepth: p,
|
|
139
|
+
filterHeight: m,
|
|
140
|
+
filterWidth: h,
|
|
141
|
+
effectiveFilterDepth: C,
|
|
142
|
+
effectiveFilterHeight: w,
|
|
143
|
+
effectiveFilterWidth: T,
|
|
144
|
+
dilationDepth: b,
|
|
145
|
+
dilationHeight: x,
|
|
146
|
+
dilationWidth: S,
|
|
147
|
+
inShape: e,
|
|
148
|
+
outShape: A,
|
|
149
|
+
filterShape: t
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function le(e, t, n, r, i) {
|
|
153
|
+
r ??= L(e, t, n);
|
|
154
|
+
let a = e[0], o = e[1];
|
|
155
|
+
return [V((a - t + 2 * r) / n + 1, i), V((o - t + 2 * r) / n + 1, i)];
|
|
156
|
+
}
|
|
157
|
+
function ue(e, t, n, r, i, a) {
|
|
158
|
+
i ??= L(e, t[0], r[0]);
|
|
159
|
+
let o = [
|
|
160
|
+
0,
|
|
161
|
+
0,
|
|
162
|
+
0,
|
|
163
|
+
n
|
|
164
|
+
];
|
|
165
|
+
for (let n = 0; n < 3; n++) e[n] + 2 * i >= t[n] && (o[n] = V((e[n] - t[n] + 2 * i) / r[n] + 1, a));
|
|
166
|
+
return o;
|
|
167
|
+
}
|
|
168
|
+
function L(e, t, n, r = 1) {
|
|
169
|
+
let i = B(t, r);
|
|
170
|
+
return Math.floor((e[0] * (n - 1) - n + i) / 2);
|
|
171
|
+
}
|
|
172
|
+
function R(e) {
|
|
173
|
+
return typeof e == "number" ? [
|
|
174
|
+
e,
|
|
175
|
+
e,
|
|
176
|
+
e
|
|
177
|
+
] : e.length === 2 ? [
|
|
178
|
+
e[0],
|
|
179
|
+
e[1],
|
|
180
|
+
1
|
|
181
|
+
] : e;
|
|
182
|
+
}
|
|
183
|
+
function z(e) {
|
|
184
|
+
return typeof e == "number" ? [
|
|
185
|
+
e,
|
|
186
|
+
e,
|
|
187
|
+
e
|
|
188
|
+
] : e;
|
|
189
|
+
}
|
|
190
|
+
function B(e, t) {
|
|
191
|
+
return t <= 1 ? e : e + (e - 1) * (t - 1);
|
|
192
|
+
}
|
|
193
|
+
function de(e, t, n, r, i, a, o, s, c) {
|
|
194
|
+
let l, u, d;
|
|
195
|
+
if (typeof e == "number") {
|
|
196
|
+
l = {
|
|
197
|
+
top: e,
|
|
198
|
+
bottom: e,
|
|
199
|
+
left: e,
|
|
200
|
+
right: e,
|
|
201
|
+
type: e === 0 ? "VALID" : "NUMBER"
|
|
202
|
+
};
|
|
203
|
+
let i = le([t, n], a, r, e, s);
|
|
204
|
+
u = i[0], d = i[1];
|
|
205
|
+
} else if (e === "same") {
|
|
206
|
+
u = Math.ceil(t / r), d = Math.ceil(n / i);
|
|
207
|
+
let e = Math.max(0, (u - 1) * r + a - t), s = Math.max(0, (d - 1) * i + o - n), c = Math.floor(e / 2), f = e - c, p = Math.floor(s / 2);
|
|
208
|
+
l = {
|
|
209
|
+
top: c,
|
|
210
|
+
bottom: f,
|
|
211
|
+
left: p,
|
|
212
|
+
right: s - p,
|
|
213
|
+
type: "SAME"
|
|
214
|
+
};
|
|
215
|
+
} else if (e === "valid") l = {
|
|
216
|
+
top: 0,
|
|
217
|
+
bottom: 0,
|
|
218
|
+
left: 0,
|
|
219
|
+
right: 0,
|
|
220
|
+
type: "VALID"
|
|
221
|
+
}, u = Math.ceil((t - a + 1) / r), d = Math.ceil((n - o + 1) / i);
|
|
222
|
+
else if (typeof e == "object") {
|
|
223
|
+
let f = c === "channelsLast" ? e[1][0] : e[2][0], p = c === "channelsLast" ? e[1][1] : e[2][1], m = c === "channelsLast" ? e[2][0] : e[3][0], h = c === "channelsLast" ? e[2][1] : e[3][1];
|
|
224
|
+
l = {
|
|
225
|
+
top: f,
|
|
226
|
+
bottom: p,
|
|
227
|
+
left: m,
|
|
228
|
+
right: h,
|
|
229
|
+
type: f === 0 && p === 0 && m === 0 && h === 0 ? "VALID" : "EXPLICIT"
|
|
230
|
+
}, u = V((t - a + f + p) / r + 1, s), d = V((n - o + m + h) / i + 1, s);
|
|
231
|
+
} else throw Error(`Unknown padding parameter: ${e}`);
|
|
232
|
+
return {
|
|
233
|
+
padInfo: l,
|
|
234
|
+
outHeight: u,
|
|
235
|
+
outWidth: d
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function fe(e, t, n, r, i, a, o, s, c, l, u) {
|
|
239
|
+
let d, f, p, m;
|
|
240
|
+
if (e === "valid" && (e = 0), typeof e == "number") {
|
|
241
|
+
d = {
|
|
242
|
+
top: e,
|
|
243
|
+
bottom: e,
|
|
244
|
+
left: e,
|
|
245
|
+
right: e,
|
|
246
|
+
front: e,
|
|
247
|
+
back: e,
|
|
248
|
+
type: e === 0 ? "VALID" : "NUMBER"
|
|
249
|
+
};
|
|
250
|
+
let h = ue([
|
|
251
|
+
t,
|
|
252
|
+
n,
|
|
253
|
+
r,
|
|
254
|
+
1
|
|
255
|
+
], [
|
|
256
|
+
s,
|
|
257
|
+
c,
|
|
258
|
+
l
|
|
259
|
+
], 1, [
|
|
260
|
+
i,
|
|
261
|
+
a,
|
|
262
|
+
o
|
|
263
|
+
], e, u);
|
|
264
|
+
f = h[0], p = h[1], m = h[2];
|
|
265
|
+
} else if (e === "same") {
|
|
266
|
+
f = Math.ceil(t / i), p = Math.ceil(n / a), m = Math.ceil(r / o);
|
|
267
|
+
let e = (f - 1) * i + s - t, u = (p - 1) * a + c - n, h = (m - 1) * o + l - r, g = Math.floor(e / 2), _ = e - g, v = Math.floor(u / 2), y = u - v, b = Math.floor(h / 2);
|
|
268
|
+
d = {
|
|
269
|
+
top: v,
|
|
270
|
+
bottom: y,
|
|
271
|
+
left: b,
|
|
272
|
+
right: h - b,
|
|
273
|
+
front: g,
|
|
274
|
+
back: _,
|
|
275
|
+
type: "SAME"
|
|
276
|
+
};
|
|
277
|
+
} else throw Error(`Unknown padding parameter: ${e}`);
|
|
278
|
+
return {
|
|
279
|
+
padInfo: d,
|
|
280
|
+
outDepth: f,
|
|
281
|
+
outHeight: p,
|
|
282
|
+
outWidth: m
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function V(e, t) {
|
|
286
|
+
if (!t) return Math.trunc(e);
|
|
287
|
+
switch (t) {
|
|
288
|
+
case "round": return Math.round(e);
|
|
289
|
+
case "ceil": return Math.ceil(e);
|
|
290
|
+
case "floor": return Math.floor(e);
|
|
291
|
+
default: throw Error(`Unknown roundingMode ${t}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function H(e) {
|
|
295
|
+
let [t, n, r] = R(e);
|
|
296
|
+
return t === 1 && n === 1 && r === 1;
|
|
297
|
+
}
|
|
298
|
+
function U(e, t) {
|
|
299
|
+
return H(e) || H(t);
|
|
300
|
+
}
|
|
301
|
+
function W(e) {
|
|
302
|
+
return R(e).every((e) => e > 0);
|
|
303
|
+
}
|
|
304
|
+
function G(e) {
|
|
305
|
+
if (e === "NHWC") return "channelsLast";
|
|
306
|
+
if (e === "NCHW") return "channelsFirst";
|
|
307
|
+
throw Error(`Unknown dataFormat ${e}`);
|
|
308
|
+
}
|
|
309
|
+
function K(e, t, n) {
|
|
310
|
+
if (n != null) {
|
|
311
|
+
if (typeof t == "string") throw Error(`Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);
|
|
312
|
+
if (typeof t == "number") i(y(t), () => `Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);
|
|
313
|
+
else if (typeof t == "object") t.forEach((t) => {
|
|
314
|
+
t.forEach((t) => {
|
|
315
|
+
i(y(t), () => `Error in ${e}: pad must be an integer when using dimRoundingMode ${n} but got pad ${t}.`);
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
else throw Error(`Error in ${e}: Unknown padding parameter: ${t}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/reshape.js
|
|
322
|
+
function pe(e, t) {
|
|
323
|
+
let n = { x: j(e, "x", "reshape", "string_or_numeric") }, r = { shape: t };
|
|
324
|
+
return T.runKernel(m, n, r);
|
|
325
|
+
}
|
|
326
|
+
var q = /* @__PURE__ */ C({ reshape_: pe });
|
|
327
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/sigmoid.js
|
|
328
|
+
function me(e) {
|
|
329
|
+
let t = { x: j(e, "x", "sigmoid", "float32") };
|
|
330
|
+
return T.runKernel(c, t);
|
|
331
|
+
}
|
|
332
|
+
var he = /* @__PURE__ */ C({ sigmoid_: me });
|
|
333
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/elu.js
|
|
334
|
+
function ge(e) {
|
|
335
|
+
let t = { x: j(e, "x", "elu", "float32") };
|
|
336
|
+
return T.runKernel("Elu", t);
|
|
337
|
+
}
|
|
338
|
+
var _e = /* @__PURE__ */ C({ elu_: ge });
|
|
339
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/axis_util.js
|
|
340
|
+
function J(e, t) {
|
|
341
|
+
for (let n = 0; n < e.length; ++n) if (e[e.length - n - 1] !== t - 1 - n) return !1;
|
|
342
|
+
return !0;
|
|
343
|
+
}
|
|
344
|
+
function ve(e, t, n) {
|
|
345
|
+
let r = e.length + t.length, i = [], a = 0, o = 0;
|
|
346
|
+
for (let s = 0; s < r; s++) n.indexOf(s) === -1 ? i.push(e[a++]) : i.push(t[o++]);
|
|
347
|
+
return i;
|
|
348
|
+
}
|
|
349
|
+
function ye(e, t) {
|
|
350
|
+
let n = [], r = e.length;
|
|
351
|
+
for (let i = 0; i < r; i++) t.indexOf(i) === -1 && n.push(e[i]);
|
|
352
|
+
return [n, t.map((t) => e[t])];
|
|
353
|
+
}
|
|
354
|
+
function be(e, t) {
|
|
355
|
+
return ve(e, t.map((e) => 1), t);
|
|
356
|
+
}
|
|
357
|
+
function xe(e, t, n) {
|
|
358
|
+
i(J(t, n), () => `${e} supports only inner-most axes for now. Got axes ${t} and rank-${n} input.`);
|
|
359
|
+
}
|
|
360
|
+
function Se(e, t) {
|
|
361
|
+
if (J(e, t)) return null;
|
|
362
|
+
let n = [];
|
|
363
|
+
for (let r = 0; r < t; ++r) e.indexOf(r) === -1 && n.push(r);
|
|
364
|
+
return e.forEach((e) => n.push(e)), n;
|
|
365
|
+
}
|
|
366
|
+
function Ce(e) {
|
|
367
|
+
return e.map((e, t) => [t, e]).sort((e, t) => e[1] - t[1]).map((e) => e[0]);
|
|
368
|
+
}
|
|
369
|
+
function we(e, t) {
|
|
370
|
+
let n = [];
|
|
371
|
+
for (let r = t - e; r < t; ++r) n.push(r);
|
|
372
|
+
return n;
|
|
373
|
+
}
|
|
374
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/sum.js
|
|
375
|
+
function Te(e, t = null, n = !1) {
|
|
376
|
+
let r = j(e, "x", "sum");
|
|
377
|
+
r.dtype === "bool" && (r = v(r, "int32"));
|
|
378
|
+
let i = { x: r }, a = {
|
|
379
|
+
axis: t,
|
|
380
|
+
keepDims: n
|
|
381
|
+
};
|
|
382
|
+
return T.runKernel("Sum", i, a);
|
|
383
|
+
}
|
|
384
|
+
var Ee = /* @__PURE__ */ C({ sum_: Te });
|
|
385
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/leaky_relu.js
|
|
386
|
+
function De(e, t = .2) {
|
|
387
|
+
let n = { x: j(e, "x", "leakyRelu") }, r = { alpha: t };
|
|
388
|
+
return T.runKernel(s, n, r);
|
|
389
|
+
}
|
|
390
|
+
var Oe = /* @__PURE__ */ C({ leakyRelu_: De });
|
|
391
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/zeros.js
|
|
392
|
+
function Y(e, t = "float32") {
|
|
393
|
+
if (h(e), t === "complex64") return N(Y(e, "float32"), Y(e, "float32"));
|
|
394
|
+
let n = o(M(e), t);
|
|
395
|
+
return T.makeTensor(n, e, t);
|
|
396
|
+
}
|
|
397
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/prelu.js
|
|
398
|
+
function ke(e, t) {
|
|
399
|
+
let n = {
|
|
400
|
+
x: j(e, "x", "prelu"),
|
|
401
|
+
alpha: j(t, "alpha", "prelu")
|
|
402
|
+
};
|
|
403
|
+
return T.runKernel(g, n);
|
|
404
|
+
}
|
|
405
|
+
var Ae = /* @__PURE__ */ C({ prelu_: ke });
|
|
406
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/relu.js
|
|
407
|
+
function je(e) {
|
|
408
|
+
let t = { x: j(e, "x", "relu") };
|
|
409
|
+
return T.runKernel(D, t);
|
|
410
|
+
}
|
|
411
|
+
var Me = /* @__PURE__ */ C({ relu_: je });
|
|
412
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/relu6.js
|
|
413
|
+
function Ne(e) {
|
|
414
|
+
let t = { x: j(e, "x", "relu6") };
|
|
415
|
+
return T.runKernel(d, t);
|
|
416
|
+
}
|
|
417
|
+
var Pe = /* @__PURE__ */ C({ relu6_: Ne });
|
|
418
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/step.js
|
|
419
|
+
function Fe(e, t = 0) {
|
|
420
|
+
let n = { x: j(e, "x", "step") }, r = { alpha: t };
|
|
421
|
+
return T.runKernel(k, n, r);
|
|
422
|
+
}
|
|
423
|
+
var Ie = /* @__PURE__ */ C({ step_: Fe });
|
|
424
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/scatter_nd_util.js
|
|
425
|
+
function Le(e, t, n) {
|
|
426
|
+
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}.`;
|
|
427
|
+
if (n.rank < i) throw Error(a + ` update.rank < ${i}. `);
|
|
428
|
+
if (e.length < r + (n.rank - i)) throw Error(a + ` Output shape length < ${r + (n.rank - i)}`);
|
|
429
|
+
if (n.rank !== i + e.length - r) throw Error(a + ` update.rank != ${i + e.length - r}`);
|
|
430
|
+
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]}).`);
|
|
431
|
+
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]})`);
|
|
432
|
+
}
|
|
433
|
+
function Re(e, t, n) {
|
|
434
|
+
if (t.rank < 1) throw Error(`tf.scatterND() expects the indices to be rank 1 or higher, but the rank was ${t.rank}.`);
|
|
435
|
+
if (e.rank < 1) throw Error(`tf.scatterND() expects the updates to be rank 1 or higher, but the rank was ${e.rank}.`);
|
|
436
|
+
if (t.dtype !== "int32") throw Error(`The dtype of 'indices' should be int32, but got dtype: ${t.dtype}`);
|
|
437
|
+
if (n.length < 1) throw Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);
|
|
438
|
+
if (n.length === 0) {
|
|
439
|
+
if (t.size === 0) throw Error(`Indices specified for empty output. indices shape: ${t.shape}`);
|
|
440
|
+
if (e.size === 0) throw Error(`Updates specified for empty output. updates shape: ${e.shape}`);
|
|
441
|
+
}
|
|
442
|
+
Le(n, t, e);
|
|
443
|
+
}
|
|
444
|
+
function ze(e, t, n) {
|
|
445
|
+
let r = t.shape.length, i = r > 1 ? t.shape[r - 1] : 1, a = n.length, o = 1;
|
|
446
|
+
for (let e = i; e < a; ++e) o *= n[e];
|
|
447
|
+
let s = i < 1 ? 1 : i, c = M(t.shape) / s, l = [...p(n.slice(0, i)), 1], u = M(n);
|
|
448
|
+
return {
|
|
449
|
+
sliceRank: i,
|
|
450
|
+
numUpdates: c,
|
|
451
|
+
sliceSize: o,
|
|
452
|
+
strides: l,
|
|
453
|
+
outputSize: u
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/fused_util.js
|
|
457
|
+
function Be(e, t, n) {
|
|
458
|
+
if (n == null || n === "linear") return e;
|
|
459
|
+
if (n === "relu") return a(e, Ie(t));
|
|
460
|
+
throw Error(`Cannot compute gradient for fused activation ${n}.`);
|
|
461
|
+
}
|
|
462
|
+
function Ve(e, t) {
|
|
463
|
+
let n = t, r = f(e.shape, t.shape);
|
|
464
|
+
return r.length > 0 && (n = Ee(n, r)), q(n, e.shape);
|
|
465
|
+
}
|
|
466
|
+
function X(e, t, n, r) {
|
|
467
|
+
if (t === "linear") return e;
|
|
468
|
+
if (t === "relu") return Me(e);
|
|
469
|
+
if (t === "elu") return _e(e);
|
|
470
|
+
if (t === "relu6") return Pe(e);
|
|
471
|
+
if (t === "prelu") return Ae(e, n);
|
|
472
|
+
if (t === "leakyrelu") return Oe(e, r);
|
|
473
|
+
if (t === "sigmoid") return he(e);
|
|
474
|
+
throw Error(`Unknown fused activation ${t}.`);
|
|
475
|
+
}
|
|
476
|
+
var He = (e, t) => !(e > 0) || t === "linear";
|
|
477
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/gather_nd_util.js
|
|
478
|
+
function Ue(e, t) {
|
|
479
|
+
let n = e.shape.length, r = t.shape.length;
|
|
480
|
+
if (n < 1) throw Error(`tf.gatherND() expects the input to be rank 1 or higher, but the rank was ${n}.`);
|
|
481
|
+
if (r < 1) throw Error(`tf.gatherND() expects the indices to be rank 1 or higher, but the rank was ${r}.`);
|
|
482
|
+
if (t.dtype !== "int32") throw Error(`tf.gatherND() expects the indices to be int32 type, but the dtype was ${t.dtype}.`);
|
|
483
|
+
if (t.shape[r - 1] > n) throw Error(`index innermost dimension length must be <= tensor rank; saw: ${t.shape[r - 1]} vs. ${n}`);
|
|
484
|
+
if (M(e.shape) === 0) throw Error(`Requested more than 0 entries, but input is empty. Input shape: ${e.shape}.`);
|
|
485
|
+
let i = t.shape, a = i[i.length - 1], o = 1;
|
|
486
|
+
for (let e = 0; e < i.length - 1; ++e) o *= i[e];
|
|
487
|
+
let s = e.shape, c = i.slice();
|
|
488
|
+
c.pop();
|
|
489
|
+
let l = 1;
|
|
490
|
+
for (let e = a; e < n; ++e) l *= s[e], c.push(s[e]);
|
|
491
|
+
let u = [...p(e.shape).map((e) => e / l), 1].slice(0, a);
|
|
492
|
+
return [
|
|
493
|
+
c,
|
|
494
|
+
o,
|
|
495
|
+
l,
|
|
496
|
+
u
|
|
497
|
+
];
|
|
498
|
+
}
|
|
499
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/slice_util.js
|
|
500
|
+
var We = /* @__PURE__ */ e({
|
|
501
|
+
assertParamsValid: () => Ke,
|
|
502
|
+
computeFlatOffset: () => at,
|
|
503
|
+
computeOutShape: () => Je,
|
|
504
|
+
getNormalizedAxes: () => Qe,
|
|
505
|
+
isSliceContinous: () => it,
|
|
506
|
+
maskToAxes: () => qe,
|
|
507
|
+
parseSliceParams: () => ot,
|
|
508
|
+
sliceInfo: () => st,
|
|
509
|
+
startForAxis: () => nt,
|
|
510
|
+
startIndicesWithElidedDims: () => $e,
|
|
511
|
+
stopForAxis: () => rt,
|
|
512
|
+
stopIndicesWithElidedDims: () => et,
|
|
513
|
+
stridesForAxis: () => tt,
|
|
514
|
+
stridesWithElidedDims: () => Ye
|
|
515
|
+
}), Z = -2, Ge = -1;
|
|
516
|
+
function Ke(e, t, n) {
|
|
517
|
+
let r = e.shape.length;
|
|
518
|
+
i(r === t.length, () => `Error in slice${r}D: Length of begin ${t} must match the rank of the array (${r}).`), i(r === n.length, () => `Error in slice${r}D: Length of size ${n} must match the rank of the array (${r}).`);
|
|
519
|
+
for (let a = 0; a < r; ++a) i(t[a] + n[a] <= e.shape[a], () => `Error in slice${r}D: begin[${a}] + size[${a}] (${t[a] + n[a]}) would overflow input.shape[${a}] (${e.shape[a]})`);
|
|
520
|
+
}
|
|
521
|
+
function qe(e) {
|
|
522
|
+
let t = [], n = 0;
|
|
523
|
+
for (; e > 0;) e & 1 && t.push(n), e /= 2, n++;
|
|
524
|
+
return t;
|
|
525
|
+
}
|
|
526
|
+
function Je(e, t, n) {
|
|
527
|
+
let r = [];
|
|
528
|
+
for (let i = 0; i < e.length; i++) r[i] = Math.ceil((t[i] - e[i]) / n[i]);
|
|
529
|
+
return r;
|
|
530
|
+
}
|
|
531
|
+
function Ye(e, t, n, r) {
|
|
532
|
+
let i = [...e];
|
|
533
|
+
for (let e = i.length; e < r.length; e++) i.push(1);
|
|
534
|
+
for (let e = 0; e < n; e++) e === 0 ? i[t] = 1 : (i.splice(t, 0, 1), i.pop());
|
|
535
|
+
return i;
|
|
536
|
+
}
|
|
537
|
+
function Xe(e, t, n) {
|
|
538
|
+
return n <= e ? n : n - (t - 1);
|
|
539
|
+
}
|
|
540
|
+
function Ze(e, t) {
|
|
541
|
+
let n = [];
|
|
542
|
+
for (let r = 0; r < e; r++) n.push(t + r);
|
|
543
|
+
return n;
|
|
544
|
+
}
|
|
545
|
+
function Qe(e, t, n, r, i, a, o, s, c) {
|
|
546
|
+
let l = e.length, u = Array(l), d = Array(l), f = Array(l);
|
|
547
|
+
if (t.length && n > 0) {
|
|
548
|
+
let c = t[0], l = n + 1;
|
|
549
|
+
u = $e(o, c, l, r, e), d = et(s, c, l, i, e), f = Ye(a, c, l, e);
|
|
550
|
+
} else for (let t = 0; t < l; t++) u[t] = nt(o, r, a, e, t, c), d[t] = rt(s, i, a, e, t, c), f[t] = tt(a, t, c);
|
|
551
|
+
return {
|
|
552
|
+
begin: u,
|
|
553
|
+
end: d,
|
|
554
|
+
strides: f
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
function $e(e, t, n, r, i) {
|
|
558
|
+
let a = [...i], o = Ze(n, t);
|
|
559
|
+
for (let i = 0; i < a.length; i++) if (o.indexOf(i) > -1) a[i] = 0;
|
|
560
|
+
else {
|
|
561
|
+
let o = Xe(t, n, i), s = r[o];
|
|
562
|
+
e & 1 << o && (s = 0), a[i] = s;
|
|
563
|
+
}
|
|
564
|
+
return a;
|
|
565
|
+
}
|
|
566
|
+
function et(e, t, n, r, i) {
|
|
567
|
+
let a = [...i], o = Ze(n, t);
|
|
568
|
+
for (let i = 0; i < a.length; i++) if (o.indexOf(i) > -1) a[i] = 2 ** 53 - 1;
|
|
569
|
+
else {
|
|
570
|
+
let o = Xe(t, n, i), s = r[o];
|
|
571
|
+
e & 1 << o && (s = 2 ** 53 - 1), a[i] = s;
|
|
572
|
+
}
|
|
573
|
+
for (let e = 0; e < a.length; e++) {
|
|
574
|
+
let t = i[e];
|
|
575
|
+
a[e] < 0 && (a[e] += t), a[e] = u(0, a[e], i[e]);
|
|
576
|
+
}
|
|
577
|
+
return a;
|
|
578
|
+
}
|
|
579
|
+
function tt(e, t, n) {
|
|
580
|
+
let r = e[t];
|
|
581
|
+
return (n & 1 << t || r == null) && (r = 1), r;
|
|
582
|
+
}
|
|
583
|
+
function nt(e, t, n, r, i, a) {
|
|
584
|
+
let o = t[i], s = n[i] || 1;
|
|
585
|
+
(e & 1 << i || a & 1 << i || o == null) && (o = s > 0 ? -(2 ** 53 - 1) : 2 ** 53 - 1);
|
|
586
|
+
let c = r[i];
|
|
587
|
+
return o < 0 && (o += c), o = u(0, o, c - 1), o;
|
|
588
|
+
}
|
|
589
|
+
function rt(e, t, n, r, i, a) {
|
|
590
|
+
let o = t[i], s = n[i] || 1;
|
|
591
|
+
(e & 1 << i || a & 1 << i || o == null) && (o = s > 0 ? 2 ** 53 - 1 : -(2 ** 53 - 1));
|
|
592
|
+
let c = r[i];
|
|
593
|
+
return o < 0 && (o += c), o = s > 0 ? u(0, o, c) : u(-1, o, c - 1), o;
|
|
594
|
+
}
|
|
595
|
+
function it(e, t, n) {
|
|
596
|
+
let r = n.length;
|
|
597
|
+
for (let e = 0; e < n.length; e++) if (n[e] > 1) {
|
|
598
|
+
r = e;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
for (let i = r + 1; i < n.length; i++) if (t[i] > 0 || n[i] !== e[i]) return !1;
|
|
602
|
+
return !0;
|
|
603
|
+
}
|
|
604
|
+
function at(e, t) {
|
|
605
|
+
let n = e.length > 0 ? e[e.length - 1] : 1;
|
|
606
|
+
for (let r = 0; r < e.length - 1; r++) n += e[r] * t[r];
|
|
607
|
+
return n;
|
|
608
|
+
}
|
|
609
|
+
function ot(e, t, n) {
|
|
610
|
+
let r, a = e.shape.length;
|
|
611
|
+
r = typeof t == "number" ? [t, ...Array(a - 1).fill(0)] : t.length < a ? t.concat(Array(a - t.length).fill(0)) : t.slice(), r.forEach((e) => {
|
|
612
|
+
i(e !== -1, () => "slice() does not support negative begin indexing.");
|
|
613
|
+
});
|
|
614
|
+
let o;
|
|
615
|
+
return o = n == null ? Array(a).fill(-1) : typeof n == "number" ? [n, ...Array(a - 1).fill(-1)] : n.length < a ? n.concat(Array(a - n.length).fill(-1)) : n, o = o.map((t, n) => t >= 0 ? t : (i(t === -1, () => `Negative size values should be exactly -1 but got ${t} for the slice() size at index ${n}.`), e.shape[n] - r[n])), [r, o];
|
|
616
|
+
}
|
|
617
|
+
function st(e, t, n, r, i, a, o, s, c) {
|
|
618
|
+
let l;
|
|
619
|
+
if (r == null ? (l = Array(t.length), l.fill(1)) : l = r, o != null && o & o - 1) throw Error("Multiple ellipses in slice is not allowed.");
|
|
620
|
+
let u = !1, d = {
|
|
621
|
+
dims: l.length,
|
|
622
|
+
numAddAxisAfterEllipsis: 0,
|
|
623
|
+
begin: t.slice(),
|
|
624
|
+
end: n.slice(),
|
|
625
|
+
strides: l.slice(),
|
|
626
|
+
beginMask: i,
|
|
627
|
+
endMask: a,
|
|
628
|
+
ellipsisMask: o,
|
|
629
|
+
newAxisMask: s,
|
|
630
|
+
shrinkAxisMask: c
|
|
631
|
+
};
|
|
632
|
+
for (let e = 0; e < d.dims; e++) u && 1 << e & s && d.numAddAxisAfterEllipsis++, 1 << e & o && (u = !0);
|
|
633
|
+
u || (d.ellipsisMask |= 1 << d.dims, d.dims++);
|
|
634
|
+
let f = {
|
|
635
|
+
dims: e.length,
|
|
636
|
+
beginMask: 0,
|
|
637
|
+
endMask: 0,
|
|
638
|
+
beginValid: !1,
|
|
639
|
+
endValid: !1
|
|
640
|
+
};
|
|
641
|
+
ct(d, f);
|
|
642
|
+
let p = !0, m = !0, h = !0, g = [], _ = [];
|
|
643
|
+
for (let t = 0; t < e.length; ++t) {
|
|
644
|
+
if (f.strides[t] === 0) throw Error(`strides[${t}] must be non-zero`);
|
|
645
|
+
let n = !!(f.shrinkAxisMask & 1 << t), r = e[t];
|
|
646
|
+
if (r === -1) {
|
|
647
|
+
g.push(n ? 1 : -1);
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
let i = [f.beginMask & 1 << t, f.endMask & 1 << t], a = [f.strides[t] > 0 ? 0 : -1, f.strides[t] > 0 ? r : r - 1];
|
|
651
|
+
if (n && f.strides[t] <= 0) throw Error("only stride 1 allowed on non-range indexing.");
|
|
652
|
+
h &&= f.strides[t] === 1;
|
|
653
|
+
let o = !!(f.beginMask & 1 << t && f.endMask & 1 << t);
|
|
654
|
+
if (f.beginValid && f.endValid) {
|
|
655
|
+
if (n) {
|
|
656
|
+
let e = f.begin[t] < 0 ? r + f.begin[t] : f.begin[t];
|
|
657
|
+
if (f.begin[t] = e, f.end[t] = f.begin[t] + 1, e < 0 || e >= r) throw Error(`slice index ${f.begin[t]} of dimension ${t} out of bounds.`);
|
|
658
|
+
} else f.begin[t] = lt(f.begin[t], 0, f.strides[t], r, i, a), f.end[t] = lt(f.end[t], 1, f.strides[t], r, i, a);
|
|
659
|
+
let e = f.strides[t] === 1 && f.begin[t] === 0 && f.end[t] === r;
|
|
660
|
+
p &&= e, m &&= t === 0 && f.strides[t] === 1 || e;
|
|
661
|
+
} else p = p && f.strides[t] === 1 && o, m &&= t === 0 && f.strides[t] === 1 || o;
|
|
662
|
+
let s, c = !1;
|
|
663
|
+
if (f.beginValid && f.endValid ? (s = f.end[t] - f.begin[t], c = !0) : n ? (s = 1, c = !0) : o && r >= 0 && (s = f.strides[t] < 0 ? -r : r, c = !0), c) {
|
|
664
|
+
let e;
|
|
665
|
+
e = s === 0 || s < 0 != f.strides[t] < 0 ? 0 : Math.trunc(s / f.strides[t]) + (s % f.strides[t] === 0 ? 0 : 1), g.push(e);
|
|
666
|
+
} else g.push(-1);
|
|
667
|
+
}
|
|
668
|
+
for (let e = 0; e < f.finalShapeGatherIndices.length; ++e) {
|
|
669
|
+
let t = f.finalShapeGatherIndices[e];
|
|
670
|
+
t >= 0 ? _.push(g[t]) : t === Z && _.push(1);
|
|
671
|
+
}
|
|
672
|
+
return {
|
|
673
|
+
finalShapeSparse: _.filter((e, t) => f.finalShapeGatherIndices[t] !== Z),
|
|
674
|
+
finalShape: _,
|
|
675
|
+
isIdentity: p,
|
|
676
|
+
sliceDim0: m,
|
|
677
|
+
isSimpleSlice: h,
|
|
678
|
+
begin: f.begin,
|
|
679
|
+
end: f.end,
|
|
680
|
+
strides: f.strides
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
function ct(e, t) {
|
|
684
|
+
t.beginMask = 0, t.endMask = 0, t.shrinkAxisMask = 0;
|
|
685
|
+
let n = 0;
|
|
686
|
+
t.beginValid = e.begin != null, t.endValid = e.end != null, t.begin = Array(t.dims), t.end = Array(t.dims), t.strides = Array(t.dims), t.finalShapeGatherIndices = [], t.finalShapeGatherIndicesSparse = [], t.inputShapeGatherIndicesSparse = Array(t.dims);
|
|
687
|
+
for (let r = 0; r < e.dims; r++) if (1 << r & e.ellipsisMask) {
|
|
688
|
+
let i = Math.min(t.dims - (e.dims - r) + 1 + e.numAddAxisAfterEllipsis, t.dims);
|
|
689
|
+
for (; n < i; n++) t.begin[n] = 0, t.end[n] = 0, t.strides[n] = 1, t.beginMask |= 1 << n, t.endMask |= 1 << n, t.finalShapeGatherIndices.push(n), t.finalShapeGatherIndicesSparse.push(-1), t.inputShapeGatherIndicesSparse[n] = r;
|
|
690
|
+
} else if (1 << r & e.newAxisMask) t.finalShapeGatherIndices.push(Z), t.finalShapeGatherIndicesSparse.push(-1);
|
|
691
|
+
else {
|
|
692
|
+
if (n === t.begin.length) throw Error(`Index out of range using input dim ${n}; input has only ${t.dims} dims, ${t.begin.length}.`);
|
|
693
|
+
e.begin != null && (t.begin[n] = e.begin[r]), e.end != null && (t.end[n] = e.end[r]), t.strides[n] = e.strides[r], e.beginMask & 1 << r && (t.beginMask |= 1 << n), e.endMask & 1 << r && (t.endMask |= 1 << n), e.shrinkAxisMask & 1 << r ? (t.finalShapeGatherIndices.push(Ge), t.finalShapeGatherIndicesSparse.push(-1), t.shrinkAxisMask |= 1 << n) : (t.finalShapeGatherIndices.push(n), t.finalShapeGatherIndicesSparse.push(r)), t.inputShapeGatherIndicesSparse[n] = r, n++;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
function lt(e, t, n, r, i, a) {
|
|
697
|
+
if (i[t]) return n > 0 ? a[t] : a[t + 1 & 1];
|
|
698
|
+
{
|
|
699
|
+
let t = e < 0 ? r + e : e;
|
|
700
|
+
return t < a[0] ? a[0] : t > a[1] ? a[1] : t;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/concat_util.js
|
|
704
|
+
function ut(e, t) {
|
|
705
|
+
let n = e[0].length;
|
|
706
|
+
e.forEach((e, t) => {
|
|
707
|
+
i(e.length === n, () => `Error in concat${n}D: rank of tensors[${t}] must be the same as the rank of the rest (${n})`);
|
|
708
|
+
}), i(t >= 0 && t < n, () => `Error in concat${n}D: axis must be between 0 and ${n - 1}.`);
|
|
709
|
+
let r = e[0];
|
|
710
|
+
e.forEach((e, a) => {
|
|
711
|
+
for (let o = 0; o < n; o++) i(o === t || e[o] === r[o], () => `Error in concat${n}D: Shape of tensors[${a}] (${e}) does not match the shape of the rest (${r}) along the non-concatenated axis ${a}.`);
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
function dt(e, t) {
|
|
715
|
+
let n = e[0].slice();
|
|
716
|
+
for (let r = 1; r < e.length; r++) n[t] += e[r][t];
|
|
717
|
+
return n;
|
|
718
|
+
}
|
|
719
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/ragged_to_dense_util.js
|
|
720
|
+
var Q;
|
|
721
|
+
(function(e) {
|
|
722
|
+
e[e.FIRST_DIM_SIZE = 0] = "FIRST_DIM_SIZE", e[e.VALUE_ROWIDS = 1] = "VALUE_ROWIDS", e[e.ROW_LENGTHS = 2] = "ROW_LENGTHS", e[e.ROW_SPLITS = 3] = "ROW_SPLITS", e[e.ROW_LIMITS = 4] = "ROW_LIMITS", e[e.ROW_STARTS = 5] = "ROW_STARTS";
|
|
723
|
+
})(Q ||= {});
|
|
724
|
+
function ft(e, t, n) {
|
|
725
|
+
let r = [];
|
|
726
|
+
if (n == null && t == null) return r;
|
|
727
|
+
if (t == null) for (; r.length < e + n.length;) r.push(-1);
|
|
728
|
+
else r = t.slice();
|
|
729
|
+
if (n == null) return r;
|
|
730
|
+
if (e + n.length !== r.length) throw Error(`rt input.shape and shape=${t} are incompatible: rt input.rank = ${e + n.length}, but shape.rank = ${r.length}`);
|
|
731
|
+
for (let i = 1; i < n.length; ++i) {
|
|
732
|
+
let a = n[i], o = r[r.length - n.length + i], s = r[o];
|
|
733
|
+
if (a >= 0) {
|
|
734
|
+
if (s >= 0) {
|
|
735
|
+
if (s !== a) throw Error(`rt input.shape and shape=${t} are incompatible: rt input.shape[${i + e}] = ${a} but shape[${i + e}] = ${s}`);
|
|
736
|
+
} else r[o] = a;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return r;
|
|
740
|
+
}
|
|
741
|
+
function pt(e) {
|
|
742
|
+
let t = {
|
|
743
|
+
FIRST_DIM_SIZE: Q.FIRST_DIM_SIZE,
|
|
744
|
+
VALUE_ROWIDS: Q.VALUE_ROWIDS,
|
|
745
|
+
ROW_LENGTHS: Q.ROW_LENGTHS,
|
|
746
|
+
ROW_SPLITS: Q.ROW_SPLITS,
|
|
747
|
+
ROW_LIMITS: Q.ROW_LIMITS,
|
|
748
|
+
ROW_STARTS: Q.ROW_STARTS
|
|
749
|
+
}, n = [];
|
|
750
|
+
for (let r of e) if (r in t) n.push(t[r]);
|
|
751
|
+
else break;
|
|
752
|
+
return n;
|
|
753
|
+
}
|
|
754
|
+
function mt(e) {
|
|
755
|
+
return e.length === 0 ? 0 : e[0] === Q.FIRST_DIM_SIZE ? e.length - 1 : e.length;
|
|
756
|
+
}
|
|
757
|
+
function ht(e, t) {
|
|
758
|
+
if (e == null || t == null) return;
|
|
759
|
+
let n = e.length, r = t.length;
|
|
760
|
+
if (n >= r) throw Error(`defaultValue.shape=${e} and ragged tensor flatValues.shape=${t}, are incompatible: defaultValue.rank = ${n} must be less than ragged tensor input flatValues.rank = ${r})`);
|
|
761
|
+
for (let i = 0; i < Math.min(n, r - 1); ++i) {
|
|
762
|
+
let n = e[i], r = t[i + 1];
|
|
763
|
+
if (n >= 0 && r >= 0 && n !== 1 && n !== r) throw Error(`defaultValue.shape=${e}, and ragged tensor input flatValues.shape=${t} are incompatible: defaultValue.shape[${i - e.length}] = ${n} but ragged tensor input.flatValues.shape[${i - e.length}] = ${r}`);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function gt(e) {
|
|
767
|
+
return e <= 30 ? e : b(e, Math.floor(Math.sqrt(e)));
|
|
768
|
+
}
|
|
769
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/rotate_util.js
|
|
770
|
+
function _t(e, t, n) {
|
|
771
|
+
return [n * (typeof e == "number" ? e : e[0]), t * (typeof e == "number" ? e : e[1])];
|
|
772
|
+
}
|
|
773
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/array_ops_util.js
|
|
774
|
+
function vt(e, t, n, r = !0) {
|
|
775
|
+
let i = [];
|
|
776
|
+
if (r) i = i.concat(t.slice(0)), i.push(e[0] / n), i = i.concat(e.slice(1));
|
|
777
|
+
else {
|
|
778
|
+
i = i.concat(e[0]);
|
|
779
|
+
let n = t.length;
|
|
780
|
+
for (let r = 0; r < n; ++r) i = i.concat([e[r + 1] / t[r], t[r]]);
|
|
781
|
+
i = i.concat(e.slice(n + 1));
|
|
782
|
+
}
|
|
783
|
+
return i;
|
|
784
|
+
}
|
|
785
|
+
function yt(e, t, n = !0) {
|
|
786
|
+
let r = [];
|
|
787
|
+
if (n) {
|
|
788
|
+
r.push(t);
|
|
789
|
+
for (let n = t + 1; n < e; ++n) n <= 2 * t ? (r.push(n), r.push(n - (t + 1))) : r.push(n);
|
|
790
|
+
} else {
|
|
791
|
+
let n = [], i = [];
|
|
792
|
+
for (let r = 1; r < e; ++r) r >= t * 2 + 1 || r % 2 == 1 ? i.push(r) : n.push(r);
|
|
793
|
+
r.push(...n), r.push(0), r.push(...i);
|
|
794
|
+
}
|
|
795
|
+
return r;
|
|
796
|
+
}
|
|
797
|
+
function bt(e, t, n, r = !0) {
|
|
798
|
+
let i = [];
|
|
799
|
+
r ? i.push(e[0] / n) : i.push(e[0] * n);
|
|
800
|
+
for (let n = 1; n < e.length; ++n) n <= t.length ? r ? i.push(t[n - 1] * e[n]) : i.push(e[n] / t[n - 1]) : i.push(e[n]);
|
|
801
|
+
return i;
|
|
802
|
+
}
|
|
803
|
+
function xt(e, t) {
|
|
804
|
+
let n = [0];
|
|
805
|
+
for (let r = 0; r < t; ++r) n.push(e[r][0]);
|
|
806
|
+
return n;
|
|
807
|
+
}
|
|
808
|
+
function St(e, t, n) {
|
|
809
|
+
let r = e.slice(0, 1);
|
|
810
|
+
for (let i = 0; i < n; ++i) r.push(e[i + 1] - t[i][0] - t[i][1]);
|
|
811
|
+
return r;
|
|
812
|
+
}
|
|
813
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/selu_util.js
|
|
814
|
+
var Ct = 1.7580993408473768, wt = 1.0507009873554805, Tt = .3275911, Et = .254829592, Dt = -.284496736, Ot = 1.421413741, kt = -1.453152027, At = 1.061405429, jt = "->", Mt = /->/g, Nt = ",", Pt = "...";
|
|
815
|
+
function Ft(e, t) {
|
|
816
|
+
e = e.replace(/\s/g, "");
|
|
817
|
+
let n = (e.length - e.replace(Mt, "").length) / 2;
|
|
818
|
+
if (n < 1) throw Error("Equations without an arrow are not supported.");
|
|
819
|
+
if (n > 1) throw Error(`Equation must contain exactly one arrow ("${jt}").`);
|
|
820
|
+
let [r, a] = e.split(jt);
|
|
821
|
+
i(r.indexOf(Pt) === -1, () => `The ellipsis notation ("${Pt}") is not supported yet.`);
|
|
822
|
+
let o = r.split(Nt), s = o.length;
|
|
823
|
+
if (t !== s) throw Error(`Expected ${s} input tensors, received ${t}`);
|
|
824
|
+
if (s > 2) throw Error("Support for more than 2 input tensors is not implemented yet.");
|
|
825
|
+
let c = [];
|
|
826
|
+
for (let e = 0; e < a.length; ++e) {
|
|
827
|
+
let t = a[e];
|
|
828
|
+
if (!o.some((e) => e.indexOf(t) !== -1)) throw Error(`Output subscripts contain the label ${t} not present in the input subscripts.`);
|
|
829
|
+
c.indexOf(t) === -1 && c.push(t);
|
|
830
|
+
}
|
|
831
|
+
for (let e = 0; e < r.length; ++e) {
|
|
832
|
+
let t = r[e];
|
|
833
|
+
c.indexOf(t) === -1 && t !== Nt && c.push(t);
|
|
834
|
+
}
|
|
835
|
+
let l = Array(o.length);
|
|
836
|
+
for (let e = 0; e < s; ++e) {
|
|
837
|
+
if (new Set(o[e].split("")).size !== o[e].length) throw Error(`Found duplicate axes in input component ${o[e]}. Support for duplicate axes in input is not implemented yet.`);
|
|
838
|
+
l[e] = [];
|
|
839
|
+
for (let t = 0; t < o[e].length; ++t) l[e].push(c.indexOf(o[e][t]));
|
|
840
|
+
}
|
|
841
|
+
let u = c.length, d = a.length, f = [];
|
|
842
|
+
for (let e = d; e < u; ++e) f.push(e);
|
|
843
|
+
return {
|
|
844
|
+
allDims: c,
|
|
845
|
+
summedDims: f,
|
|
846
|
+
idDims: l
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function It(e, t) {
|
|
850
|
+
let n = Array(e);
|
|
851
|
+
n.fill(-1);
|
|
852
|
+
for (let e = 0; e < t.length; ++e) n[t[e]] = e;
|
|
853
|
+
let r = [];
|
|
854
|
+
for (let t = 0; t < e; ++t) n[t] === -1 && r.push(t);
|
|
855
|
+
return n = n.filter((e) => e !== -1), {
|
|
856
|
+
permutationIndices: n,
|
|
857
|
+
expandDims: r
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
function Lt(e, t, n) {
|
|
861
|
+
let r = Array(e);
|
|
862
|
+
for (let e = 0; e < n.length; ++e) {
|
|
863
|
+
let a = n[e].shape;
|
|
864
|
+
for (let n = 0; n < t[e].length; ++n) r[t[e][n]] === void 0 ? r[t[e][n]] = a[n] : i(r[t[e][n]] === a[n], () => `Expected dimension ${r[t[e][n]]} at axis ${n} of input shaped ${JSON.stringify(a)}, but got dimension ${a[n]}`);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
function Rt(e, t) {
|
|
868
|
+
let n = e, r = [], i = 0;
|
|
869
|
+
e.length === 0 && n.push(-1), i = e.length + 1;
|
|
870
|
+
for (let e = 0; e < i; ++e) r.push([]);
|
|
871
|
+
let a = [];
|
|
872
|
+
for (let e = 0; e < n.length; ++e) {
|
|
873
|
+
let i = n[e], o = Bt(t, i);
|
|
874
|
+
for (let t of o) a.indexOf(t) === -1 && (r[e].push(t), a.push(t));
|
|
875
|
+
}
|
|
876
|
+
return {
|
|
877
|
+
path: n,
|
|
878
|
+
steps: r
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function zt(e) {
|
|
882
|
+
return e.every((e, t) => e === t);
|
|
883
|
+
}
|
|
884
|
+
function Bt(e, t) {
|
|
885
|
+
let n = [];
|
|
886
|
+
for (let r = 0; r < e.length; ++r) (e[r].length === 0 || e[r].indexOf(t) !== -1 || t === -1) && n.push(r);
|
|
887
|
+
return n;
|
|
888
|
+
}
|
|
889
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/split_util.js
|
|
890
|
+
function Vt(e, t, n = 0) {
|
|
891
|
+
let r = [];
|
|
892
|
+
if (typeof t == "number") i(e.shape[n] % t === 0, () => "Number of splits must evenly divide the axis."), r = Array(t).fill(e.shape[n] / t);
|
|
893
|
+
else {
|
|
894
|
+
let a = t.reduce((e, t) => (t === -1 && (e += 1), e), 0);
|
|
895
|
+
i(a <= 1, () => "There should be only one negative value in split array.");
|
|
896
|
+
let o = t.indexOf(-1);
|
|
897
|
+
if (o !== -1) {
|
|
898
|
+
let r = t.reduce((e, t) => t > 0 ? e + t : e);
|
|
899
|
+
t[o] = e.shape[n] - r;
|
|
900
|
+
}
|
|
901
|
+
i(e.shape[n] === t.reduce((e, t) => e + t), () => "The sum of sizes must match the size of the axis dimension."), r = t;
|
|
902
|
+
}
|
|
903
|
+
return r;
|
|
904
|
+
}
|
|
905
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/sparse/sparse_fill_empty_rows_util.js
|
|
906
|
+
function Ht(e) {
|
|
907
|
+
return `Received SparseTensor with denseShape[0] = 0 but
|
|
908
|
+
indices.shape[0] = ${e}`;
|
|
909
|
+
}
|
|
910
|
+
function Ut(e, t) {
|
|
911
|
+
return `indices(${e}, 0) is invalid: ${t} < 0`;
|
|
912
|
+
}
|
|
913
|
+
function Wt(e, t, n) {
|
|
914
|
+
return `indices(${e}, 0) is invalid: ${t} >= ${n}`;
|
|
915
|
+
}
|
|
916
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/sparse/sparse_reshape_util.js
|
|
917
|
+
function Gt(e, t) {
|
|
918
|
+
return `only one output dimension may be -1, not both ${e} and ${t}`;
|
|
919
|
+
}
|
|
920
|
+
function Kt(e, t) {
|
|
921
|
+
return `size ${e} must be non-negative, not ${t}`;
|
|
922
|
+
}
|
|
923
|
+
function qt() {
|
|
924
|
+
return "reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero";
|
|
925
|
+
}
|
|
926
|
+
function Jt(e, t) {
|
|
927
|
+
return `Input to reshape is a SparseTensor with ${M(e)}
|
|
928
|
+
dense values, but the requested shape requires a multiple of ${M(t)}. inputShape=${e} outputShape= ${t}`;
|
|
929
|
+
}
|
|
930
|
+
function Yt(e, t) {
|
|
931
|
+
return `Input to reshape is a tensor with ${M(e)} dense values, but the requested shape has ${M(t)}. inputShape=${e} outputShape=${t}`;
|
|
932
|
+
}
|
|
933
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/sparse/sparse_segment_reduction_util.js
|
|
934
|
+
function Xt() {
|
|
935
|
+
return "segment ids must be >= 0";
|
|
936
|
+
}
|
|
937
|
+
function Zt() {
|
|
938
|
+
return "segment ids are not increasing";
|
|
939
|
+
}
|
|
940
|
+
function Qt(e, t) {
|
|
941
|
+
return `Segment id ${e} out of range [0, ${t}), possibly because segmentIds input is not sorted.`;
|
|
942
|
+
}
|
|
943
|
+
function $t(e, t, n) {
|
|
944
|
+
return `Bad: indices[${e}] == ${t} out of range [0, ${n})`;
|
|
945
|
+
}
|
|
946
|
+
// node_modules/@tensorflow/tfjs-core/dist/ops/segment_util.js
|
|
947
|
+
var en = /* @__PURE__ */ e({
|
|
948
|
+
collectGatherOpShapeInfo: () => rn,
|
|
949
|
+
computeOutShape: () => nn,
|
|
950
|
+
segOpComputeOptimalWindowSize: () => tn
|
|
951
|
+
});
|
|
952
|
+
function tn(e, t) {
|
|
953
|
+
let n = !1, r;
|
|
954
|
+
for (e <= 30 ? (r = e, n = !0) : r = b(e, Math.floor(Math.sqrt(e))); !n;) r > t || r === e ? n = !0 : r = b(e, r + 1);
|
|
955
|
+
return r;
|
|
956
|
+
}
|
|
957
|
+
function nn(e, t, n) {
|
|
958
|
+
let r = [], i = e.length;
|
|
959
|
+
for (let a = 0; a < i; a++) a === t ? r.push(n) : r.push(e[a]);
|
|
960
|
+
return r;
|
|
961
|
+
}
|
|
962
|
+
function rn(e, t, n, r) {
|
|
963
|
+
let i = t.shape.length, a = e.shape.length;
|
|
964
|
+
if (r !== 0 && (r < -i || r > i)) throw Error(`Expect batchDims in the range of [-${i}, ${i}], but got ${r}`);
|
|
965
|
+
if (r < 0 && (r += i), r > a) throw Error(`batchDims (${r}) must be less than rank(x) (
|
|
966
|
+
${a}).`);
|
|
967
|
+
if (n < r) throw Error(`batchDims (${r}) must be less than or equal to axis (${n}).`);
|
|
968
|
+
for (let n = 0; n < r; ++n) if (e.shape[n] !== t.shape[n]) throw Error(`x.shape[${n}]: ${e.shape[n]} should be equal to indices.shape[${n}]: ${t.shape[n]}.`);
|
|
969
|
+
let o = e.shape[n], s = [], c = 1, l = 1, u = 1;
|
|
970
|
+
for (let t = 0; t < r; ++t) s.push(e.shape[t]), c *= e.shape[t];
|
|
971
|
+
for (let t = r; t < n; t++) s.push(e.shape[t]), l *= e.shape[t];
|
|
972
|
+
for (let e = r; e < i; e++) s.push(t.shape[e]);
|
|
973
|
+
for (let t = n + 1; t < a; t++) s.push(e.shape[t]), u *= e.shape[t];
|
|
974
|
+
return {
|
|
975
|
+
batchSize: c,
|
|
976
|
+
sliceSize: u,
|
|
977
|
+
outerSize: l,
|
|
978
|
+
dimSize: o,
|
|
979
|
+
outputShape: s
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
// node_modules/@tensorflow/tfjs-core/dist/backends/backend_util.js
|
|
983
|
+
var an = /* @__PURE__ */ e({
|
|
984
|
+
ERF_A1: () => Et,
|
|
985
|
+
ERF_A2: () => Dt,
|
|
986
|
+
ERF_A3: () => Ot,
|
|
987
|
+
ERF_A4: () => kt,
|
|
988
|
+
ERF_A5: () => At,
|
|
989
|
+
ERF_P: () => Tt,
|
|
990
|
+
PARALLELIZE_THRESHOLD: () => 30,
|
|
991
|
+
RowPartitionType: () => Q,
|
|
992
|
+
SELU_SCALE: () => wt,
|
|
993
|
+
SELU_SCALEALPHA: () => Ct,
|
|
994
|
+
applyActivation: () => X,
|
|
995
|
+
assertAndGetBroadcastShape: () => E,
|
|
996
|
+
assertAxesAreInnerMostDims: () => xe,
|
|
997
|
+
assertParamsConsistent: () => ut,
|
|
998
|
+
assignToTypedArray: () => ie,
|
|
999
|
+
axesAreInnerMostDims: () => J,
|
|
1000
|
+
calculateShapes: () => ze,
|
|
1001
|
+
checkEinsumDimSizes: () => Lt,
|
|
1002
|
+
checkPadOnDimRoundingMode: () => K,
|
|
1003
|
+
combineLocations: () => ve,
|
|
1004
|
+
combineRaggedTensorToTensorShapes: () => ft,
|
|
1005
|
+
complexWithEvenIndex: () => A,
|
|
1006
|
+
complexWithOddIndex: () => ne,
|
|
1007
|
+
computeConv2DInfo: () => F,
|
|
1008
|
+
computeConv3DInfo: () => I,
|
|
1009
|
+
computeDefaultPad: () => L,
|
|
1010
|
+
computeDilation2DInfo: () => P,
|
|
1011
|
+
computeOptimalWindowSize: () => gt,
|
|
1012
|
+
computeOutAndReduceShapes: () => ye,
|
|
1013
|
+
computeOutShape: () => dt,
|
|
1014
|
+
computePool2DInfo: () => se,
|
|
1015
|
+
computePool3DInfo: () => ce,
|
|
1016
|
+
convertConv2DDataFormat: () => G,
|
|
1017
|
+
decodeEinsumEquation: () => Ft,
|
|
1018
|
+
eitherStridesOrDilationsAreOne: () => U,
|
|
1019
|
+
expandShapeToKeepDim: () => be,
|
|
1020
|
+
exponent: () => ee,
|
|
1021
|
+
exponents: () => S,
|
|
1022
|
+
fromStringArrayToUint8: () => $,
|
|
1023
|
+
fromUint8ToStringArray: () => on,
|
|
1024
|
+
getAxesPermutation: () => Se,
|
|
1025
|
+
getBroadcastDims: () => l,
|
|
1026
|
+
getComplexWithIndex: () => te,
|
|
1027
|
+
getEinsumComputePath: () => Rt,
|
|
1028
|
+
getEinsumPermutation: () => It,
|
|
1029
|
+
getFusedBiasGradient: () => Ve,
|
|
1030
|
+
getFusedDyActivation: () => Be,
|
|
1031
|
+
getImageCenter: () => _t,
|
|
1032
|
+
getInnerMostAxes: () => we,
|
|
1033
|
+
getPermuted: () => yt,
|
|
1034
|
+
getRaggedRank: () => mt,
|
|
1035
|
+
getReductionAxes: () => f,
|
|
1036
|
+
getReshaped: () => vt,
|
|
1037
|
+
getReshapedPermuted: () => bt,
|
|
1038
|
+
getRowPartitionTypesHelper: () => pt,
|
|
1039
|
+
getSliceBeginCoords: () => xt,
|
|
1040
|
+
getSliceSize: () => St,
|
|
1041
|
+
getSparseFillEmptyRowsIndicesDenseShapeMismatch: () => Ht,
|
|
1042
|
+
getSparseFillEmptyRowsNegativeIndexErrorMessage: () => Ut,
|
|
1043
|
+
getSparseFillEmptyRowsOutOfRangeIndexErrorMessage: () => Wt,
|
|
1044
|
+
getSparseReshapeEmptyTensorZeroOutputDimErrorMessage: () => qt,
|
|
1045
|
+
getSparseReshapeInputOutputMismatchErrorMessage: () => Yt,
|
|
1046
|
+
getSparseReshapeInputOutputMultipleErrorMessage: () => Jt,
|
|
1047
|
+
getSparseReshapeMultipleNegativeOneOutputDimErrorMessage: () => Gt,
|
|
1048
|
+
getSparseReshapeNegativeOutputDimErrorMessage: () => Kt,
|
|
1049
|
+
getSparseSegmentReductionIndicesOutOfRangeErrorMessage: () => $t,
|
|
1050
|
+
getSparseSegmentReductionNegativeSegmentIdsErrorMessage: () => Xt,
|
|
1051
|
+
getSparseSegmentReductionNonIncreasingSegmentIdsErrorMessage: () => Zt,
|
|
1052
|
+
getSparseSegmentReductionSegmentIdOutOfRangeErrorMessage: () => Qt,
|
|
1053
|
+
getUndoAxesPermutation: () => Ce,
|
|
1054
|
+
isIdentityPermutation: () => zt,
|
|
1055
|
+
log: () => n,
|
|
1056
|
+
mergeRealAndImagArrays: () => re,
|
|
1057
|
+
prepareAndValidate: () => Ue,
|
|
1058
|
+
prepareSplitSize: () => Vt,
|
|
1059
|
+
segment_util: () => en,
|
|
1060
|
+
shouldFuse: () => He,
|
|
1061
|
+
slice_util: () => We,
|
|
1062
|
+
splitRealAndImagArrays: () => w,
|
|
1063
|
+
stridesOrDilationsArePositive: () => W,
|
|
1064
|
+
tupleValuesAreOne: () => H,
|
|
1065
|
+
upcastType: () => x,
|
|
1066
|
+
validateDefaultValueShape: () => ht,
|
|
1067
|
+
validateInput: () => Re,
|
|
1068
|
+
validateUpdateShape: () => Le,
|
|
1069
|
+
warn: () => O
|
|
1070
|
+
});
|
|
1071
|
+
function on(e) {
|
|
1072
|
+
try {
|
|
1073
|
+
return e.map((e) => _(e));
|
|
1074
|
+
} catch (e) {
|
|
1075
|
+
throw Error(`Failed to decode encoded string bytes into utf-8, error: ${e}`);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function $(e) {
|
|
1079
|
+
return e.map((e) => r(e));
|
|
1080
|
+
}
|
|
1081
|
+
export { Ue as $, Tt as A, W as At, Q as B, It as C, F as Ct, Ot as D, ce as Dt, Dt as E, se as Et, bt as F, ut as G, mt as H, xt as I, at as J, dt as K, St as L, Ct as M, N as Mt, yt as N, kt as O, G as Ot, vt as P, st as Q, _t as R, Rt as S, K as St, Et as T, P as Tt, pt as U, ft as V, ht as W, it as X, Je as Y, ot as Z, Ut as _, we as _t, nn as a, Re as at, Lt as b, he as bt, Xt as c, Me as ct, qt as d, Oe as dt, X as et, Yt as f, Ee as ft, Ht as g, Se as gt, Kt as h, be as ht, rn as i, ze as it, wt as j, H as jt, At as k, U as kt, Zt as l, Ae as lt, Gt as m, ye as mt, $ as n, Be as nt, tn as o, Ie as ot, Jt as p, xe as pt, Ke as q, on as r, He as rt, $t as s, Pe as st, an as t, Ve as tt, Qt as u, Y as ut, Wt as v, Ce as vt, zt as w, I as wt, Ft as x, q as xt, Vt as y, _e as yt, gt as z };
|