@genai-fi/nanogpt 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +352 -14
- package/dist/Generator.js +69 -78
- package/dist/{RealDiv-D4EzDsC0.js → RealDiv-DgA3z9oO.js} +32 -206
- package/dist/Reshape-CF6odzV4.js +16 -0
- package/dist/Reshape-_kILl6tK.js +81 -0
- package/dist/TeachableLLM.js +28 -22
- package/dist/Trainer.d.ts +2 -0
- package/dist/Trainer.js +3 -2
- package/dist/{axis_util-TbGYJ208.js → axis_util-BvHEw88j.js} +7 -23
- package/dist/backend.d.ts +2 -1
- package/dist/backend.js +10 -4
- package/dist/backend_util-D-rUb2ty.js +474 -0
- package/dist/backend_webgpu-B0u2ndUn.js +547 -0
- package/dist/binary_op_util-pKXltfxI.js +192 -0
- package/dist/broadcast_to-CwF7XIeu.js +30 -0
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +3 -3
- package/dist/checks/check.d.ts +1 -1
- package/dist/checks/check.js +8 -8
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/index.d.ts +2 -0
- package/dist/checks/index.js +7 -5
- package/dist/checks/matMulGelu.js +6 -6
- package/dist/checks/normRMS.js +7 -7
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.d.ts +1 -0
- package/dist/checks/packUnpack.js +18 -0
- package/dist/checks/qkv.js +12 -27
- package/dist/checks/rope.js +2 -2
- package/dist/checks/weights.js +18 -16
- package/dist/complex-CSlYz-2T.js +13 -0
- package/dist/complex_util-Yc1A_gV1.js +55 -0
- package/dist/concat-BHlIJeyT.js +19 -0
- package/dist/concat_util-DcJk7YHS.js +22 -0
- package/dist/data/docx.js +1 -1
- package/dist/data/parquet.js +2 -2
- package/dist/data/pdf.js +1 -1
- package/dist/data/textLoader.js +1 -1
- package/dist/{dataset-DlZtKmBq.js → dataset-0xP8GjwI.js} +136 -236
- package/dist/dropout-C1pM3f11.js +99 -0
- package/dist/expand_dims-BPG4fwBP.js +13 -0
- package/dist/exports_initializers-xuidcwI4.js +7 -0
- package/dist/gather-DykLGqmW.js +10 -0
- package/dist/{gelu-Bp_-935b.js → gelu-CNLFZWea.js} +11 -10
- package/dist/{gpgpu_math-CDaYiyE_.js → gpgpu_math-DDVJCn6-.js} +90 -265
- package/dist/{index-C4L8Cm77.js → index-CieiGp4Y.js} +14 -14
- package/dist/index-CjOj7j-u.js +7308 -0
- package/dist/{index-Tf7vU29b.js → index-Cp39cXWe.js} +3 -10
- package/dist/{index-Dwqa6Zy2.js → index-DvYrXKkX.js} +2 -2
- package/dist/index-ZyQhjEPo.js +2157 -0
- package/dist/{jszip.min-CjP2V1VV.js → jszip.min-Bz5-11Bk.js} +56 -57
- package/dist/kernel_funcs_utils-Dg_-E44D.js +308 -0
- package/dist/layers/BaseLayer.d.ts +1 -0
- package/dist/layers/BaseLayer.js +7 -6
- package/dist/layers/CausalSelfAttention.d.ts +0 -1
- package/dist/layers/CausalSelfAttention.js +56 -55
- package/dist/layers/MLP.js +15 -16
- package/dist/layers/PositionEmbedding.js +5 -14
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.d.ts +2 -0
- package/dist/layers/RoPECache.js +22 -17
- package/dist/layers/TiedEmbedding.js +22 -17
- package/dist/layers/TransformerBlock.js +21 -20
- package/dist/loader/load.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +39 -33
- package/dist/loader/save.js +1 -1
- package/dist/log_sum_exp-DWI-76TI.js +41 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.js +63 -52
- package/dist/matMul16--R5hOwDG.js +77 -0
- package/dist/mat_mul-DeAh4uTH.js +12 -0
- package/dist/mod-Gt1rMB4n.js +12 -0
- package/dist/models/NanoGPTV1.js +40 -31
- package/dist/models/model.d.ts +2 -0
- package/dist/models/model.js +37 -29
- package/dist/{mulmat_packed_gpu-BT60jmzP.js → mulmat_packed_gpu-BMFhLwta.js} +1 -17
- package/dist/{non_max_suppression_impl-CsEgBuMA.js → non_max_suppression_impl-B2W7YjZB.js} +0 -32
- package/dist/ones-CAMiP4I2.js +15 -0
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.d.ts +1 -1
- package/dist/ops/adamMoments.js +4 -4
- package/dist/ops/add16.d.ts +2 -0
- package/dist/ops/add16.js +9 -0
- package/dist/ops/appendCache.js +16 -9
- package/dist/ops/attentionMask.js +4 -4
- package/dist/ops/concat16.d.ts +2 -0
- package/dist/ops/concat16.js +9 -0
- package/dist/ops/cpu/adamAdjust.js +14 -13
- package/dist/ops/cpu/adamMoments.js +10 -9
- package/dist/ops/cpu/appendCache.js +9 -8
- package/dist/ops/cpu/attentionMask.js +15 -14
- package/dist/ops/cpu/fusedSoftmax.js +13 -12
- package/dist/ops/cpu/gatherSub.js +9 -24
- package/dist/ops/cpu/gelu.js +13 -12
- package/dist/ops/cpu/matMul16.d.ts +1 -0
- package/dist/ops/cpu/matMul16.js +16 -0
- package/dist/ops/cpu/matMulGelu.js +18 -16
- package/dist/ops/cpu/matMulMul.js +8 -7
- package/dist/ops/cpu/mulDropout.js +4 -3
- package/dist/ops/cpu/normRMS.js +11 -10
- package/dist/ops/cpu/qkv.js +17 -13
- package/dist/ops/cpu/rope.js +23 -22
- package/dist/ops/cpu/scatterSub.js +16 -30
- package/dist/ops/dot16.d.ts +2 -0
- package/dist/ops/dot16.js +42 -0
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/add16.d.ts +1 -0
- package/dist/ops/grads/add16.js +27 -0
- package/dist/ops/grads/attentionMask.js +12 -19
- package/dist/ops/grads/gelu.js +4 -3
- package/dist/ops/grads/matMul16.d.ts +2 -0
- package/dist/ops/grads/matMul16.js +9 -0
- package/dist/ops/grads/matMulGelu.js +8 -7
- package/dist/ops/grads/normRMS.js +8 -7
- package/dist/ops/grads/{fusedSoftmax.d.ts → pack16.d.ts} +1 -1
- package/dist/ops/grads/pack16.js +7 -0
- package/dist/ops/grads/qkv.d.ts +3 -1
- package/dist/ops/grads/qkv.js +28 -22
- package/dist/ops/grads/rope.d.ts +2 -1
- package/dist/ops/grads/rope.js +6 -13
- package/dist/ops/grads/softmax16.d.ts +2 -0
- package/dist/ops/grads/softmax16.js +26 -0
- package/dist/ops/grads/unpack16.d.ts +2 -0
- package/dist/ops/grads/unpack16.js +6 -0
- package/dist/ops/grads/utils.d.ts +3 -0
- package/dist/ops/grads/utils.js +10 -0
- package/dist/ops/matMul16.d.ts +15 -0
- package/dist/ops/matMul16.js +13 -0
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mul16.d.ts +2 -0
- package/dist/ops/mul16.js +8 -0
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/pack16.d.ts +2 -0
- package/dist/ops/pack16.js +6 -0
- package/dist/ops/qkv.d.ts +1 -1
- package/dist/ops/qkv.js +8 -4
- package/dist/ops/reshape16.d.ts +2 -0
- package/dist/ops/reshape16.js +43 -0
- package/dist/ops/rope.d.ts +1 -1
- package/dist/ops/rope.js +8 -10
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/slice16.d.ts +2 -0
- package/dist/ops/slice16.js +9 -0
- package/dist/ops/softmax16.d.ts +2 -0
- package/dist/ops/softmax16.js +12 -0
- package/dist/ops/sub16.d.ts +2 -0
- package/dist/ops/sub16.js +8 -0
- package/dist/ops/sum16.d.ts +2 -0
- package/dist/ops/sum16.js +13 -0
- package/dist/ops/transpose16.d.ts +3 -0
- package/dist/ops/transpose16.js +41 -0
- package/dist/ops/unpack16.d.ts +2 -0
- package/dist/ops/unpack16.js +6 -0
- package/dist/ops/webgl/adamAdjust.js +3 -2
- package/dist/ops/webgl/adamMoments.js +2 -1
- package/dist/ops/webgl/appendCache.js +2 -1
- package/dist/ops/webgl/attentionMask.js +5 -4
- package/dist/ops/webgl/fusedSoftmax.js +6 -4
- package/dist/ops/webgl/gatherSub.js +7 -6
- package/dist/ops/webgl/gelu.js +3 -2
- package/dist/ops/webgl/log.js +12 -27
- package/dist/ops/webgl/matMul16.d.ts +1 -0
- package/dist/ops/webgl/matMul16.js +37 -0
- package/dist/ops/webgl/matMulGelu.js +17 -15
- package/dist/ops/webgl/matMulMul.js +13 -12
- package/dist/ops/webgl/mulDropout.js +9 -8
- package/dist/ops/webgl/normRMS.js +8 -7
- package/dist/ops/webgl/qkv.js +6 -5
- package/dist/ops/webgl/rope.js +11 -10
- package/dist/ops/webgl/scatterSub.js +6 -5
- package/dist/ops/webgpu/adamAdjust.js +12 -10
- package/dist/ops/webgpu/adamMoments.js +27 -22
- package/dist/ops/webgpu/add16.d.ts +1 -0
- package/dist/ops/webgpu/add16.js +14 -0
- package/dist/ops/webgpu/appendCache.js +64 -17
- package/dist/ops/webgpu/attentionMask.js +19 -62
- package/dist/ops/webgpu/attentionMask32_program.d.ts +19 -0
- package/dist/ops/webgpu/attentionMask32_program.js +54 -0
- package/dist/ops/webgpu/concat16.d.ts +19 -0
- package/dist/ops/webgpu/concat16.js +128 -0
- package/dist/ops/webgpu/gatherSub.js +9 -7
- package/dist/ops/webgpu/gelu.js +78 -31
- package/dist/ops/webgpu/index.js +12 -0
- package/dist/ops/webgpu/matMul16.d.ts +1 -0
- package/dist/ops/webgpu/matMul16.js +58 -0
- package/dist/ops/webgpu/matMul16_program.d.ts +42 -0
- package/dist/ops/webgpu/matMul16_program.js +336 -0
- package/dist/ops/webgpu/mul16.d.ts +1 -0
- package/dist/ops/webgpu/mul16.js +14 -0
- package/dist/ops/webgpu/normRMS.js +21 -40
- package/dist/ops/webgpu/normRMS16_program.d.ts +9 -0
- package/dist/ops/webgpu/normRMS16_program.js +24 -0
- package/dist/ops/webgpu/normRMS32_program.d.ts +9 -0
- package/dist/ops/webgpu/normRMS32_program.js +24 -0
- package/dist/ops/webgpu/normRMSGrad.js +113 -64
- package/dist/ops/webgpu/pack16.d.ts +1 -0
- package/dist/ops/webgpu/pack16.js +19 -0
- package/dist/ops/webgpu/pack16_program.d.ts +19 -0
- package/dist/ops/webgpu/pack16_program.js +92 -0
- package/dist/ops/webgpu/qkv.js +20 -55
- package/dist/ops/webgpu/rope.js +77 -22
- package/dist/ops/webgpu/scatterSub.js +9 -7
- package/dist/ops/webgpu/slice16.d.ts +7 -0
- package/dist/ops/webgpu/slice16.js +71 -0
- package/dist/{variable-Bm2OFwGI.js → ops/webgpu/softmax16.d.ts} +2 -8
- package/dist/ops/webgpu/softmax16.js +23 -0
- package/dist/ops/webgpu/softmax16_program.d.ts +13 -0
- package/dist/ops/webgpu/softmax16_program.js +73 -0
- package/dist/ops/webgpu/softmax16_subgroup_program.d.ts +17 -0
- package/dist/ops/webgpu/softmax16_subgroup_program.js +75 -0
- package/dist/ops/webgpu/softmax16grad.d.ts +1 -0
- package/dist/ops/webgpu/softmax16grad.js +38 -0
- package/dist/ops/webgpu/sub16.d.ts +1 -0
- package/dist/ops/webgpu/sub16.js +14 -0
- package/dist/ops/webgpu/sum16.d.ts +1 -0
- package/dist/ops/webgpu/sum16.js +40 -0
- package/dist/ops/webgpu/transpose16.d.ts +1 -0
- package/dist/ops/webgpu/transpose16.js +35 -0
- package/dist/ops/webgpu/transpose16_program.d.ts +16 -0
- package/dist/ops/webgpu/transpose16_program.js +50 -0
- package/dist/ops/webgpu/transpose16_shared_program.d.ts +15 -0
- package/dist/ops/webgpu/transpose16_shared_program.js +71 -0
- package/dist/ops/webgpu/unpack16.d.ts +1 -0
- package/dist/ops/webgpu/unpack16.js +49 -0
- package/dist/ops/webgpu/utils/binary_op.d.ts +19 -0
- package/dist/ops/webgpu/utils/binary_op.js +79 -0
- package/dist/ops/webgpu/utils/deviceInfo.d.ts +7 -0
- package/dist/ops/webgpu/utils/deviceInfo.js +11 -0
- package/dist/ops/webgpu/utils/reductions.d.ts +32 -4
- package/dist/ops/webgpu/utils/reductions.js +236 -45
- package/dist/ops-CNI3TwqM.js +645 -0
- package/dist/pack16-CFUqumar.js +41 -0
- package/dist/{papaparse.min-C8l2Kvo1.js → papaparse.min-C0cScC2i.js} +2 -8
- package/dist/{parquet-C0Tlmv9c.js → parquet-BE8MU_ge.js} +201 -278
- package/dist/patches/PackedTensor.d.ts +12 -0
- package/dist/patches/PackedTensor.js +11 -0
- package/dist/patches/engine.d.ts +261 -0
- package/dist/patches/engine.js +10 -0
- package/dist/patches/tape.d.ts +12 -0
- package/dist/patches/tape.js +5 -0
- package/dist/patches/webgpu_backend.d.ts +18 -0
- package/dist/patches/webgpu_backend.js +57 -0
- package/dist/{tensor-CZr4dh61.js → patches/webgpu_base.d.ts} +5 -8
- package/dist/patches/webgpu_base.js +34 -0
- package/dist/patches/webgpu_program.d.ts +36 -0
- package/dist/patches/webgpu_program.js +401 -0
- package/dist/{pdf-kJD-f258.js → pdf-NIhmP3sq.js} +424 -428
- package/dist/random_width-DY6Kk2Dl.js +10051 -0
- package/dist/range-BMS52eQi.js +11 -0
- package/dist/reciprocal-CTmshQ9J.js +10 -0
- package/dist/{register_all_kernels-DIGpEwcf.js → register_all_kernels-Bwu1PTuU.js} +719 -9766
- package/dist/relu-yZ2-7WxU.js +10 -0
- package/dist/reshape-DevtBWtf.js +10 -0
- package/dist/rope-B5UUMsPi.js +32 -0
- package/dist/{scatter_nd_util-BQdz--Gn.js → scatter_nd_util-5EL-8VAQ.js} +1 -1
- package/dist/selu_util-D1w6yyTO.js +303 -0
- package/dist/{shared-DuP7ue-R.js → shared-BRksrJb3.js} +1 -17
- package/dist/shared-BuAXb4CI.js +2145 -0
- package/dist/sin-BGfy2HZo.js +16 -0
- package/dist/slice-D_gkkqZK.js +13 -0
- package/dist/slice_util-DtEldBfK.js +261 -0
- package/dist/softmax-ZHVebtR1.js +13 -0
- package/dist/split-DrfihRpZ.js +10 -0
- package/dist/squeeze-DZEpeblb.js +11 -0
- package/dist/stack-yOIAalTq.js +13 -0
- package/dist/sum-_fzj5ZTB.js +12 -0
- package/dist/tensor-DdQUJZlz.js +909 -0
- package/dist/tensor-f35l8Odg.js +8 -0
- package/dist/tensor1d-CeZuc-Rv.js +12 -0
- package/dist/tensor2d-G4Ys2GxX.js +15 -0
- package/dist/tensor4d-B8roDgtc.js +15 -0
- package/dist/tensor_util-DV-FP5Q3.js +523 -0
- package/dist/tfjs_backend-kNyO5L2d.js +653 -0
- package/dist/tile-BzyEiF-F.js +13 -0
- package/dist/tokeniser/CharTokeniser.js +1 -1
- package/dist/tokeniser/bpe.js +1 -1
- package/dist/training/Adam.d.ts +2 -1
- package/dist/training/Adam.js +12 -28
- package/dist/training/AdamExt.d.ts +1 -0
- package/dist/training/AdamExt.js +2 -2
- package/dist/training/DatasetBuilder.js +3 -20
- package/dist/training/FullTrainer.js +55 -48
- package/dist/training/Trainer.d.ts +11 -6
- package/dist/training/Trainer.js +51 -39
- package/dist/training/sparseCrossEntropy.js +3 -3
- package/dist/transpose-DKELTqhe.js +38 -0
- package/dist/utilities/arrayClose.js +7 -7
- package/dist/utilities/dummy.js +35 -27
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/packed.d.ts +7 -0
- package/dist/utilities/packed.js +716 -0
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/sentences.d.ts +5 -0
- package/dist/utilities/sentences.js +41 -0
- package/dist/utilities/weights.js +2 -2
- package/dist/variable-Bhn5bHYv.js +7 -0
- package/dist/{webgpu_program-DkQJOJSd.js → webgpu_program-Cigz-7RF.js} +15 -44
- package/dist/webgpu_util-BBCnKm2X.js +65 -0
- package/dist/zeros-2gldETuK.js +14 -0
- package/package.json +4 -3
- package/dist/Reshape-Bowtk9BP.js +0 -127
- package/dist/Reshape-DUqYftGC.js +0 -30
- package/dist/backend_util-CJIiDoV1.js +0 -749
- package/dist/broadcast_to-DzlNweb8.js +0 -44
- package/dist/concat-B912vBbo.js +0 -33
- package/dist/dropout-C-csYCLj.js +0 -193
- package/dist/exports_initializers-B8iZMgQ0.js +0 -16
- package/dist/gather-Dnpgw-YQ.js +0 -25
- package/dist/index-BzFyqcy-.js +0 -4457
- package/dist/index-C1rx_Ajs.js +0 -12076
- package/dist/kernel_funcs_utils-DKLK0Mg3.js +0 -466
- package/dist/log_sum_exp-DO6z8tSE.js +0 -103
- package/dist/mat_mul-DzjTFx-u.js +0 -27
- package/dist/mod-Dobti4j4.js +0 -27
- package/dist/ones-tIJeHlq-.js +0 -29
- package/dist/ops/fusedSoftmax.d.ts +0 -2
- package/dist/ops/fusedSoftmax.js +0 -10
- package/dist/ops/grads/fusedSoftmax.js +0 -22
- package/dist/ops-LuCMAnmM.js +0 -1525
- package/dist/random_width-CXVRloNK.js +0 -13670
- package/dist/range-CWcz7xFA.js +0 -26
- package/dist/reciprocal-C4rNcM-S.js +0 -25
- package/dist/relu-BjCh_SYb.js +0 -25
- package/dist/reshape-CnIwVG1c.js +0 -25
- package/dist/selu_util-OtRzVwW5.js +0 -719
- package/dist/shared-DmRsFyaJ.js +0 -3134
- package/dist/sin-gpDNRxE0.js +0 -47
- package/dist/slice-d0Vo9XTN.js +0 -28
- package/dist/softmax-D7Jj3p_P.js +0 -28
- package/dist/split-DK2k5eHf.js +0 -25
- package/dist/stack-DFatutCx.js +0 -27
- package/dist/sum-CJ0ULhmt.js +0 -27
- package/dist/tensor1d-vML0r3q6.js +0 -27
- package/dist/tensor2d-D76QGjF3.js +0 -30
- package/dist/tensor4d-Df1WlVDY.js +0 -30
- package/dist/webgpu_util-pLEV9tks.js +0 -80
- package/dist/zeros-Bj5rMYA7.js +0 -52
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { E as h, F as f, M as p, J as g, G as u, X as b } from "./index-BzFyqcy-.js";
|
|
2
|
-
import { r as T } from "./reshape-CnIwVG1c.js";
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
* =============================================================================
|
|
18
|
-
*/
|
|
19
|
-
function m(e, r) {
|
|
20
|
-
let n = f(e, "broadcastTo", "x");
|
|
21
|
-
const a = n.shape;
|
|
22
|
-
if (p(r), r.length < n.rank)
|
|
23
|
-
throw new Error(`broadcastTo(): shape.length=${r.length} < input.rank=${n.rank}.`);
|
|
24
|
-
if (r.length > n.rank) {
|
|
25
|
-
const t = n.shape.slice();
|
|
26
|
-
for (; t.length < r.length; )
|
|
27
|
-
t.unshift(1);
|
|
28
|
-
n = T(n, t);
|
|
29
|
-
}
|
|
30
|
-
const s = n.shape, o = Array.from(r);
|
|
31
|
-
for (let t = r.length - 1; t >= 0; t--)
|
|
32
|
-
if (s[t] === r[t])
|
|
33
|
-
o[t] = 1;
|
|
34
|
-
else if (n.shape[t] !== 1)
|
|
35
|
-
throw new Error(`broadcastTo(): [${a}] cannot be broadcast to [${r}].`);
|
|
36
|
-
if (o.map((t, l) => t > 1 ? l : -1).filter((t) => t >= 0).length === 0)
|
|
37
|
-
return g(n);
|
|
38
|
-
const i = { x: n }, c = { reps: o };
|
|
39
|
-
return u.runKernel(b, i, c);
|
|
40
|
-
}
|
|
41
|
-
const E = /* @__PURE__ */ h({ broadcastTo_: m });
|
|
42
|
-
export {
|
|
43
|
-
E as b
|
|
44
|
-
};
|
package/dist/concat-B912vBbo.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { E as s, n as a, I as p, J as i, G as l, K as f } from "./index-BzFyqcy-.js";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
* =============================================================================
|
|
17
|
-
*/
|
|
18
|
-
function h(n, e = 0) {
|
|
19
|
-
a(n.length >= 1, () => "Pass at least one tensor to concat");
|
|
20
|
-
const t = p(n, "tensors", "concat", "string_or_numeric");
|
|
21
|
-
if (t[0].dtype === "complex64" && t.forEach((o) => {
|
|
22
|
-
if (o.dtype !== "complex64")
|
|
23
|
-
throw new Error(`Cannot concatenate complex64 tensors with a tensor
|
|
24
|
-
with dtype ${o.dtype}. `);
|
|
25
|
-
}), t.length === 1)
|
|
26
|
-
return i(t[0]);
|
|
27
|
-
const r = t, c = { axis: e };
|
|
28
|
-
return l.runKernel(f, r, c);
|
|
29
|
-
}
|
|
30
|
-
const u = /* @__PURE__ */ s({ concat_: h });
|
|
31
|
-
export {
|
|
32
|
-
u as c
|
|
33
|
-
};
|
package/dist/dropout-C-csYCLj.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { E as l, F as h, G as m, ao as p, M as c, ap as f, af as g, n as u, T as V, o as v, q as N, a as w } from "./index-BzFyqcy-.js";
|
|
2
|
-
import { s as d } from "./index-C4L8Cm77.js";
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
* =============================================================================
|
|
18
|
-
*/
|
|
19
|
-
function x(r) {
|
|
20
|
-
const e = { x: h(r, "x", "floor", "float32") };
|
|
21
|
-
return m.runKernel(p, e);
|
|
22
|
-
}
|
|
23
|
-
const b = /* @__PURE__ */ l({ floor_: x });
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
27
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
28
|
-
* you may not use this file except in compliance with the License.
|
|
29
|
-
* You may obtain a copy of the License at
|
|
30
|
-
*
|
|
31
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
32
|
-
*
|
|
33
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
34
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
35
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36
|
-
* See the License for the specific language governing permissions and
|
|
37
|
-
* limitations under the License.
|
|
38
|
-
* =============================================================================
|
|
39
|
-
*/
|
|
40
|
-
class T {
|
|
41
|
-
constructor(t, e, s, n, o) {
|
|
42
|
-
this.mean = t, this.stdDev = e, this.dtype = s, this.nextVal = NaN, this.truncated = n, this.truncated && (this.upper = this.mean + this.stdDev * 2, this.lower = this.mean - this.stdDev * 2);
|
|
43
|
-
const a = o || Math.random();
|
|
44
|
-
this.random = d.alea(a.toString());
|
|
45
|
-
}
|
|
46
|
-
/** Returns next sample from a Gaussian distribution. */
|
|
47
|
-
nextValue() {
|
|
48
|
-
if (!isNaN(this.nextVal)) {
|
|
49
|
-
const n = this.nextVal;
|
|
50
|
-
return this.nextVal = NaN, n;
|
|
51
|
-
}
|
|
52
|
-
let t, e, s = !1;
|
|
53
|
-
for (; !s; ) {
|
|
54
|
-
let n, o, a;
|
|
55
|
-
do
|
|
56
|
-
n = 2 * this.random() - 1, o = 2 * this.random() - 1, a = n * n + o * o;
|
|
57
|
-
while (a >= 1 || a === 0);
|
|
58
|
-
const i = Math.sqrt(-2 * Math.log(a) / a);
|
|
59
|
-
t = this.mean + this.stdDev * n * i, e = this.mean + this.stdDev * o * i, (!this.truncated || this.isValidTruncated(t)) && (s = !0);
|
|
60
|
-
}
|
|
61
|
-
return (!this.truncated || this.isValidTruncated(e)) && (this.nextVal = this.convertValue(e)), this.convertValue(t);
|
|
62
|
-
}
|
|
63
|
-
/** Handles proper rounding for non-floating-point numbers. */
|
|
64
|
-
convertValue(t) {
|
|
65
|
-
return this.dtype == null || this.dtype === "float32" ? t : Math.round(t);
|
|
66
|
-
}
|
|
67
|
-
/** Returns true if less than 2-standard-deviations from the mean. */
|
|
68
|
-
isValidTruncated(t) {
|
|
69
|
-
return t <= this.upper && t >= this.lower;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
class M {
|
|
73
|
-
constructor(t = 0, e = 1, s, n) {
|
|
74
|
-
if (this.canReturnFloat = () => this.dtype == null || this.dtype === "float32", this.min = t, this.range = e - t, this.dtype = s, n == null && (n = Math.random()), typeof n == "number" && (n = n.toString()), !this.canReturnFloat() && this.range <= 1)
|
|
75
|
-
throw new Error(`The difference between ${t} - ${e} <= 1 and dtype is not float`);
|
|
76
|
-
this.random = d.alea(n);
|
|
77
|
-
}
|
|
78
|
-
convertValue(t) {
|
|
79
|
-
return this.canReturnFloat() ? t : Math.round(t);
|
|
80
|
-
}
|
|
81
|
-
nextValue() {
|
|
82
|
-
return this.convertValue(this.min + this.range * this.random());
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @license
|
|
87
|
-
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
88
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
89
|
-
* you may not use this file except in compliance with the License.
|
|
90
|
-
* You may obtain a copy of the License at
|
|
91
|
-
*
|
|
92
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
93
|
-
*
|
|
94
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
95
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
96
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
97
|
-
* See the License for the specific language governing permissions and
|
|
98
|
-
* limitations under the License.
|
|
99
|
-
* =============================================================================
|
|
100
|
-
*/
|
|
101
|
-
function $(r, t = 0, e = 1, s, n) {
|
|
102
|
-
if (c(r), s != null && s === "bool")
|
|
103
|
-
throw new Error(`Unsupported data type ${s}`);
|
|
104
|
-
const o = new T(t, e, s, !1, n), a = f(r, s);
|
|
105
|
-
for (let i = 0; i < a.values.length; i++)
|
|
106
|
-
a.values[i] = o.nextValue();
|
|
107
|
-
return a.toTensor();
|
|
108
|
-
}
|
|
109
|
-
const U = /* @__PURE__ */ l({ randomNormal_: $ });
|
|
110
|
-
/**
|
|
111
|
-
* @license
|
|
112
|
-
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
113
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
114
|
-
* you may not use this file except in compliance with the License.
|
|
115
|
-
* You may obtain a copy of the License at
|
|
116
|
-
*
|
|
117
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
118
|
-
*
|
|
119
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
120
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
121
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
122
|
-
* See the License for the specific language governing permissions and
|
|
123
|
-
* limitations under the License.
|
|
124
|
-
* =============================================================================
|
|
125
|
-
*/
|
|
126
|
-
function y(r, t = 0, e = 1, s = "float32", n) {
|
|
127
|
-
c(r);
|
|
128
|
-
const o = f(r, s), a = new M(t, e, null, n);
|
|
129
|
-
for (let i = 0; i < o.values.length; i++)
|
|
130
|
-
o.values[i] = a.nextValue();
|
|
131
|
-
return o.toTensor();
|
|
132
|
-
}
|
|
133
|
-
const D = /* @__PURE__ */ l({ randomUniform_: y });
|
|
134
|
-
/**
|
|
135
|
-
* @license
|
|
136
|
-
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
137
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
138
|
-
* you may not use this file except in compliance with the License.
|
|
139
|
-
* You may obtain a copy of the License at
|
|
140
|
-
*
|
|
141
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
142
|
-
*
|
|
143
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
144
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
145
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
146
|
-
* See the License for the specific language governing permissions and
|
|
147
|
-
* limitations under the License.
|
|
148
|
-
* =============================================================================
|
|
149
|
-
*/
|
|
150
|
-
function E(r, t) {
|
|
151
|
-
if (t == null)
|
|
152
|
-
return r.shape.slice();
|
|
153
|
-
if (g(r.shape, t))
|
|
154
|
-
return t;
|
|
155
|
-
if (r.shape.length === t.length) {
|
|
156
|
-
const e = [];
|
|
157
|
-
for (let s = 0; s < r.shape.length; s++)
|
|
158
|
-
t[s] == null && r.shape[s] != null ? e.push(r.shape[s]) : e.push(t[s]);
|
|
159
|
-
return e;
|
|
160
|
-
}
|
|
161
|
-
return t;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @license
|
|
165
|
-
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
166
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
167
|
-
* you may not use this file except in compliance with the License.
|
|
168
|
-
* You may obtain a copy of the License at
|
|
169
|
-
*
|
|
170
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
171
|
-
*
|
|
172
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
173
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
174
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
175
|
-
* See the License for the specific language governing permissions and
|
|
176
|
-
* limitations under the License.
|
|
177
|
-
* =============================================================================
|
|
178
|
-
*/
|
|
179
|
-
function F(r, t, e, s) {
|
|
180
|
-
const n = h(r, "x", "dropout");
|
|
181
|
-
if (u(n.dtype === "float32", () => `x has to be a floating point tensor since it's going to be scaled, but got a ${n.dtype} tensor instead.`), u(t >= 0 && t < 1, () => `rate must be a float in the range [0, 1), but got ${t}.`), t === 0)
|
|
182
|
-
return r instanceof V ? n.clone() : n;
|
|
183
|
-
const o = E(n, e), a = 1 - t, i = v(b(N(D(o, 0, 1, "float32", s), a)), a);
|
|
184
|
-
return w(n, i);
|
|
185
|
-
}
|
|
186
|
-
const _ = /* @__PURE__ */ l({ dropout_: F });
|
|
187
|
-
export {
|
|
188
|
-
T as M,
|
|
189
|
-
D as a,
|
|
190
|
-
_ as d,
|
|
191
|
-
b as f,
|
|
192
|
-
U as r
|
|
193
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { R as o } from "./random_width-CXVRloNK.js";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2018 Google LLC
|
|
5
|
-
*
|
|
6
|
-
* Use of this source code is governed by an MIT-style
|
|
7
|
-
* license that can be found in the LICENSE file or at
|
|
8
|
-
* https://opensource.org/licenses/MIT.
|
|
9
|
-
* =============================================================================
|
|
10
|
-
*/
|
|
11
|
-
function m(r) {
|
|
12
|
-
return new o(r);
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
m as r
|
|
16
|
-
};
|
package/dist/gather-Dnpgw-YQ.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { E as g, F as t, G as h, H as p } from "./index-BzFyqcy-.js";
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
* =============================================================================
|
|
17
|
-
*/
|
|
18
|
-
function u(n, s, r = 0, e = 0) {
|
|
19
|
-
const o = t(n, "x", "gather"), a = t(s, "indices", "gather", "int32"), c = { x: o, indices: a }, i = { axis: r, batchDims: e };
|
|
20
|
-
return h.runKernel(p, c, i);
|
|
21
|
-
}
|
|
22
|
-
const d = /* @__PURE__ */ g({ gather_: u });
|
|
23
|
-
export {
|
|
24
|
-
d as g
|
|
25
|
-
};
|